@badge.team/badge-webusb
v1.2.2
Published
Web API for the Badge.team MCH2022 badge
Downloads
5
Readme
MCH2022 WebUSB API library
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
- WebUSB implementation in the MCH2022 badge firmware
- MDN WebUSB API spec