@badge.team/badge-webusb

1.2.2 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i @badge.team/badge-webusb

Weekly Downloads

0

Version

1.2.2

License

MIT

Unpacked Size

71.9 kB

Total Files

27

Last publish

Collaborators

  • pwuts