badgeteam / mch2022-webusb-lib

Client library on top of WebUSB to communicate with the MCH2022 badge

Home Page:https://npmjs.com/package/@badge.team/badge-webusb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Client library on top of WebUSB to communicate with the MCH2022 badge

https://npmjs.com/package/@badge.team/badge-webusb

License:MIT License


Languages

Language:TypeScript 100.0%