Skip to content

badgeteam/mch2022-webusb-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCH2022 WebUSB API library

latest NPM release bundle size license

This library allows easy WebUSB communication with the MCH2022 badge, and possibly more badges in the future.

Endpoints

interface BadgeAPI {
    connect()
    disconnect(reset)
    syncConnection()
    assertConnected()

    set onConnectionLost
    get hasConnectedBadge

    transaction(cmd, payload, timeout)

    fileSystem: {
        state()
        list(path)
        mkdir(path)
        exists(path)
        delete(path)
        readFile(path)
        writeFile(path, bin)
        closeFile()
    }

    appFS: {
        list()
        run(name)
        read(name)
        write(name, title, version, bin)
        delete(name)
    }

    nvs: {
        list(ns)
        read(ns, key, type)
        write(ns, key, type, value)
        delete(ns, key)
    }
}

TODO: auto generated docs :)

Credits

  • Nicolai Electronics: initial WebUSB implementation (firmware + JS client)
  • Reinier van der Leer (@Pwuts): TypeScript conversion, documentation, improvements etc.

References