@microbit/microbit-connection 0.9.0-apps.alpha.9 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -27
- package/build/cjs/async-util.d.ts +3 -1
- package/build/cjs/async-util.js +5 -1
- package/build/cjs/async-util.js.map +1 -1
- package/build/cjs/availability.js.map +1 -1
- package/build/cjs/bluetooth/ble-error.d.ts +10 -0
- package/build/cjs/bluetooth/ble-error.js +47 -0
- package/build/cjs/bluetooth/ble-error.js.map +1 -0
- package/build/cjs/bluetooth/connection.d.ts +378 -0
- package/build/cjs/bluetooth/connection.js +623 -0
- package/build/cjs/bluetooth/connection.js.map +1 -0
- package/build/cjs/bluetooth/device-bond-state.d.ts +14 -0
- package/build/cjs/bluetooth/device-bond-state.js +26 -0
- package/build/cjs/bluetooth/device-bond-state.js.map +1 -0
- package/build/cjs/{bluetooth-device-wrapper.d.ts → bluetooth/device-wrapper.d.ts} +36 -21
- package/build/cjs/{bluetooth-device-wrapper.js → bluetooth/device-wrapper.js} +174 -147
- package/build/cjs/bluetooth/device-wrapper.js.map +1 -0
- package/build/{esm → cjs/bluetooth}/flashing/flashing-full.d.ts +2 -2
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-full.js +6 -5
- package/build/cjs/bluetooth/flashing/flashing-full.js.map +1 -0
- package/build/cjs/bluetooth/flashing/flashing-makecode.d.ts +10 -0
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-makecode.js +5 -2
- package/build/cjs/bluetooth/flashing/flashing-makecode.js.map +1 -0
- package/build/cjs/bluetooth/flashing/flashing-partial.d.ts +10 -0
- package/build/cjs/bluetooth/flashing/flashing-partial.js +145 -0
- package/build/cjs/bluetooth/flashing/flashing-partial.js.map +1 -0
- package/build/cjs/bluetooth/flashing/flashing-v1.js.map +1 -0
- package/build/cjs/{flashing → bluetooth/flashing}/nordic-dfu.d.ts +2 -2
- package/build/cjs/{flashing → bluetooth/flashing}/nordic-dfu.js +41 -15
- package/build/cjs/bluetooth/flashing/nordic-dfu.js.map +1 -0
- package/build/cjs/bluetooth/flashing/zip.js.map +1 -0
- package/build/cjs/bluetooth/index.d.ts +5 -0
- package/build/cjs/bluetooth/index.js +9 -0
- package/build/cjs/bluetooth/index.js.map +1 -0
- package/build/cjs/{bluetooth-profile.d.ts → bluetooth/profile.d.ts} +8 -0
- package/build/cjs/{bluetooth-profile.js → bluetooth/profile.js} +7 -1
- package/build/cjs/bluetooth/profile.js.map +1 -0
- package/build/cjs/{accelerometer-service.d.ts → bluetooth/services/accelerometer-service.d.ts} +2 -3
- package/build/cjs/{accelerometer-service.js → bluetooth/services/accelerometer-service.js} +17 -12
- package/build/cjs/bluetooth/services/accelerometer-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/button-service.d.ts +2 -3
- package/build/cjs/{button-service.js → bluetooth/services/button-service.js} +24 -14
- package/build/cjs/bluetooth/services/button-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/device-information-service.d.ts +1 -1
- package/build/cjs/bluetooth/services/device-information-service.js +29 -0
- package/build/cjs/bluetooth/services/device-information-service.js.map +1 -0
- package/build/cjs/{dfu-service.js → bluetooth/services/dfu-service.js} +2 -2
- package/build/cjs/bluetooth/services/dfu-service.js.map +1 -0
- package/build/cjs/bluetooth/services/event-service.d.ts +48 -0
- package/build/cjs/bluetooth/services/event-service.js +273 -0
- package/build/cjs/bluetooth/services/event-service.js.map +1 -0
- package/build/cjs/bluetooth/services/io-pin-service.d.ts +65 -0
- package/build/cjs/bluetooth/services/io-pin-service.js +173 -0
- package/build/cjs/bluetooth/services/io-pin-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/led-service.d.ts +2 -3
- package/build/cjs/{led-service.js → bluetooth/services/led-service.js} +10 -7
- package/build/cjs/bluetooth/services/led-service.js.map +1 -0
- package/build/cjs/{magnetometer-service.d.ts → bluetooth/services/magnetometer-service.d.ts} +2 -3
- package/build/cjs/{magnetometer-service.js → bluetooth/services/magnetometer-service.js} +19 -14
- package/build/cjs/bluetooth/services/magnetometer-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/partial-flashing-service.d.ts +1 -1
- package/build/cjs/{partial-flashing-service.js → bluetooth/services/partial-flashing-service.js} +8 -8
- package/build/cjs/bluetooth/services/partial-flashing-service.js.map +1 -0
- package/build/cjs/bluetooth/services/temperature-service.d.ts +14 -0
- package/build/cjs/bluetooth/services/temperature-service.js +80 -0
- package/build/cjs/bluetooth/services/temperature-service.js.map +1 -0
- package/build/cjs/{uart-service.d.ts → bluetooth/services/uart-service.d.ts} +2 -2
- package/build/cjs/{uart-service.js → bluetooth/services/uart-service.js} +21 -9
- package/build/cjs/bluetooth/services/uart-service.js.map +1 -0
- package/build/cjs/board-id.d.ts +1 -1
- package/build/cjs/board-id.js.map +1 -1
- package/build/cjs/device.d.ts +191 -101
- package/build/cjs/device.js +47 -110
- package/build/cjs/device.js.map +1 -1
- package/build/cjs/events.d.ts +8 -108
- package/build/cjs/events.js +27 -88
- package/build/cjs/events.js.map +1 -1
- package/build/cjs/hex-util.d.ts +1 -0
- package/build/cjs/hex-util.js +15 -0
- package/build/cjs/hex-util.js.map +1 -0
- package/build/cjs/index.d.ts +8 -16
- package/build/cjs/index.js +9 -28
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/logging.js.map +1 -1
- package/build/cjs/microbit-events.d.ts +67 -0
- package/build/cjs/microbit-events.js +55 -0
- package/build/cjs/microbit-events.js.map +1 -0
- package/build/cjs/radio-bridge/connection.d.ts +52 -0
- package/build/cjs/{usb-radio-bridge.js → radio-bridge/connection.js} +84 -96
- package/build/cjs/radio-bridge/connection.js.map +1 -0
- package/build/cjs/radio-bridge/index.d.ts +4 -0
- package/build/cjs/radio-bridge/index.js +9 -0
- package/build/cjs/radio-bridge/index.js.map +1 -0
- package/build/cjs/{usb-serial-protocol.js → radio-bridge/serial-protocol.js} +1 -1
- package/build/cjs/radio-bridge/serial-protocol.js.map +1 -0
- package/build/cjs/service-events.d.ts +92 -15
- package/build/cjs/service-events.js +6 -36
- package/build/cjs/service-events.js.map +1 -1
- package/build/{esm/hex-flash-data-source.d.ts → cjs/universal-hex/flash-data-source.d.ts} +1 -1
- package/build/cjs/{hex-flash-data-source.js → universal-hex/flash-data-source.js} +6 -3
- package/build/cjs/universal-hex/flash-data-source.js.map +1 -0
- package/build/cjs/universal-hex/index.d.ts +4 -0
- package/build/cjs/universal-hex/index.js +9 -0
- package/build/cjs/universal-hex/index.js.map +1 -0
- package/build/cjs/usb/arm-debug.d.ts +137 -0
- package/build/cjs/usb/arm-debug.js +414 -0
- package/build/cjs/usb/arm-debug.js.map +1 -0
- package/build/{esm → cjs/usb}/board-serial-info.d.ts +2 -1
- package/build/cjs/{board-serial-info.js → usb/board-serial-info.js} +10 -7
- package/build/cjs/usb/board-serial-info.js.map +1 -0
- package/build/cjs/usb/cdc-saturation.d.ts +36 -0
- package/build/cjs/usb/cdc-saturation.js +151 -0
- package/build/cjs/usb/cdc-saturation.js.map +1 -0
- package/build/cjs/usb/cmsis-dap.d.ts +113 -0
- package/build/cjs/usb/cmsis-dap.js +349 -0
- package/build/cjs/usb/cmsis-dap.js.map +1 -0
- package/build/cjs/usb/connection.d.ts +96 -0
- package/build/cjs/{usb.js → usb/connection.js} +257 -173
- package/build/cjs/usb/connection.js.map +1 -0
- package/build/cjs/usb/cortex-m.d.ts +72 -0
- package/build/cjs/usb/cortex-m.js +165 -0
- package/build/cjs/usb/cortex-m.js.map +1 -0
- package/build/cjs/usb/daplink.d.ts +69 -0
- package/build/cjs/usb/daplink.js +238 -0
- package/build/cjs/usb/daplink.js.map +1 -0
- package/build/cjs/usb/device-wrapper.d.ts +34 -0
- package/build/cjs/usb/device-wrapper.js +102 -0
- package/build/cjs/usb/device-wrapper.js.map +1 -0
- package/build/cjs/usb/index.d.ts +5 -0
- package/build/cjs/usb/index.js +10 -0
- package/build/cjs/usb/index.js.map +1 -0
- package/build/{esm/usb-partial-flashing-utils.d.ts → cjs/usb/partial-flashing-utils.d.ts} +6 -9
- package/build/cjs/{usb-partial-flashing-utils.js → usb/partial-flashing-utils.js} +6 -49
- package/build/cjs/usb/partial-flashing-utils.js.map +1 -0
- package/build/{esm/usb-partial-flashing.d.ts → cjs/usb/partial-flashing.d.ts} +37 -11
- package/build/cjs/{usb-partial-flashing.js → usb/partial-flashing.js} +170 -134
- package/build/cjs/usb/partial-flashing.js.map +1 -0
- package/build/cjs/usb/promise-queue.js.map +1 -0
- package/build/cjs/usb/serial-events.d.ts +16 -0
- package/build/cjs/{led.js → usb/serial-events.js} +1 -1
- package/build/cjs/usb/serial-events.js.map +1 -0
- package/build/cjs/usb/transport.d.ts +42 -0
- package/build/cjs/usb/transport.js +155 -0
- package/build/cjs/usb/transport.js.map +1 -0
- package/build/esm/async-util.d.ts +3 -1
- package/build/esm/async-util.js +5 -1
- package/build/esm/async-util.js.map +1 -1
- package/build/esm/availability.js.map +1 -1
- package/build/esm/bluetooth/ble-error.d.ts +10 -0
- package/build/esm/bluetooth/ble-error.js +42 -0
- package/build/esm/bluetooth/ble-error.js.map +1 -0
- package/build/esm/bluetooth/connection.d.ts +378 -0
- package/build/esm/bluetooth/connection.js +593 -0
- package/build/esm/bluetooth/connection.js.map +1 -0
- package/build/esm/bluetooth/device-bond-state.d.ts +14 -0
- package/build/esm/bluetooth/device-bond-state.js +22 -0
- package/build/esm/bluetooth/device-bond-state.js.map +1 -0
- package/build/esm/{bluetooth-device-wrapper.d.ts → bluetooth/device-wrapper.d.ts} +36 -21
- package/build/esm/{bluetooth-device-wrapper.js → bluetooth/device-wrapper.js} +172 -146
- package/build/esm/bluetooth/device-wrapper.js.map +1 -0
- package/build/{cjs → esm/bluetooth}/flashing/flashing-full.d.ts +2 -2
- package/build/esm/{flashing → bluetooth/flashing}/flashing-full.js +6 -5
- package/build/esm/bluetooth/flashing/flashing-full.js.map +1 -0
- package/build/esm/bluetooth/flashing/flashing-makecode.d.ts +10 -0
- package/build/esm/{flashing → bluetooth/flashing}/flashing-makecode.js +5 -2
- package/build/esm/bluetooth/flashing/flashing-makecode.js.map +1 -0
- package/build/esm/bluetooth/flashing/flashing-partial.d.ts +10 -0
- package/build/esm/bluetooth/flashing/flashing-partial.js +142 -0
- package/build/esm/bluetooth/flashing/flashing-partial.js.map +1 -0
- package/build/esm/bluetooth/flashing/flashing-v1.js.map +1 -0
- package/build/esm/{flashing → bluetooth/flashing}/nordic-dfu.d.ts +2 -2
- package/build/esm/{flashing → bluetooth/flashing}/nordic-dfu.js +41 -15
- package/build/esm/bluetooth/flashing/nordic-dfu.js.map +1 -0
- package/build/esm/bluetooth/flashing/zip.js.map +1 -0
- package/build/esm/bluetooth/index.d.ts +5 -0
- package/build/esm/bluetooth/index.js +5 -0
- package/build/esm/bluetooth/index.js.map +1 -0
- package/build/esm/{bluetooth-profile.d.ts → bluetooth/profile.d.ts} +8 -0
- package/build/esm/{bluetooth-profile.js → bluetooth/profile.js} +7 -1
- package/build/{cjs/bluetooth-profile.js.map → esm/bluetooth/profile.js.map} +1 -1
- package/build/esm/{accelerometer-service.d.ts → bluetooth/services/accelerometer-service.d.ts} +2 -3
- package/build/esm/{accelerometer-service.js → bluetooth/services/accelerometer-service.js} +11 -6
- package/build/esm/bluetooth/services/accelerometer-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/button-service.d.ts +2 -3
- package/build/esm/{button-service.js → bluetooth/services/button-service.js} +20 -10
- package/build/esm/bluetooth/services/button-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/device-information-service.d.ts +1 -1
- package/build/esm/bluetooth/services/device-information-service.js +25 -0
- package/build/esm/bluetooth/services/device-information-service.js.map +1 -0
- package/build/esm/{dfu-service.js → bluetooth/services/dfu-service.js} +1 -1
- package/build/esm/bluetooth/services/dfu-service.js.map +1 -0
- package/build/esm/bluetooth/services/event-service.d.ts +48 -0
- package/build/esm/bluetooth/services/event-service.js +269 -0
- package/build/esm/bluetooth/services/event-service.js.map +1 -0
- package/build/esm/bluetooth/services/io-pin-service.d.ts +65 -0
- package/build/esm/bluetooth/services/io-pin-service.js +169 -0
- package/build/esm/bluetooth/services/io-pin-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/led-service.d.ts +2 -3
- package/build/esm/{led-service.js → bluetooth/services/led-service.js} +4 -1
- package/build/esm/bluetooth/services/led-service.js.map +1 -0
- package/build/esm/{magnetometer-service.d.ts → bluetooth/services/magnetometer-service.d.ts} +2 -3
- package/build/esm/{magnetometer-service.js → bluetooth/services/magnetometer-service.js} +11 -6
- package/build/esm/bluetooth/services/magnetometer-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/partial-flashing-service.d.ts +1 -1
- package/build/esm/{partial-flashing-service.js → bluetooth/services/partial-flashing-service.js} +4 -4
- package/build/esm/bluetooth/services/partial-flashing-service.js.map +1 -0
- package/build/esm/bluetooth/services/temperature-service.d.ts +14 -0
- package/build/esm/bluetooth/services/temperature-service.js +76 -0
- package/build/esm/bluetooth/services/temperature-service.js.map +1 -0
- package/build/esm/{uart-service.d.ts → bluetooth/services/uart-service.d.ts} +2 -2
- package/build/esm/{uart-service.js → bluetooth/services/uart-service.js} +18 -6
- package/build/esm/bluetooth/services/uart-service.js.map +1 -0
- package/build/esm/board-id.d.ts +1 -1
- package/build/esm/board-id.js.map +1 -1
- package/build/esm/device.d.ts +191 -101
- package/build/esm/device.js +45 -104
- package/build/esm/device.js.map +1 -1
- package/build/esm/events.d.ts +8 -108
- package/build/esm/events.js +26 -86
- package/build/esm/events.js.map +1 -1
- package/build/esm/hex-util.d.ts +1 -0
- package/build/esm/hex-util.js +11 -0
- package/build/esm/hex-util.js.map +1 -0
- package/build/esm/index.d.ts +8 -16
- package/build/esm/index.js +7 -11
- package/build/esm/index.js.map +1 -1
- package/build/esm/logging.js.map +1 -1
- package/build/esm/microbit-events.d.ts +67 -0
- package/build/esm/microbit-events.js +52 -0
- package/build/esm/microbit-events.js.map +1 -0
- package/build/esm/radio-bridge/connection.d.ts +52 -0
- package/build/esm/{usb-radio-bridge.js → radio-bridge/connection.js} +84 -96
- package/build/esm/radio-bridge/connection.js.map +1 -0
- package/build/esm/radio-bridge/index.d.ts +4 -0
- package/build/esm/radio-bridge/index.js +5 -0
- package/build/esm/radio-bridge/index.js.map +1 -0
- package/build/esm/{usb-serial-protocol.js → radio-bridge/serial-protocol.js} +1 -1
- package/build/esm/radio-bridge/serial-protocol.js.map +1 -0
- package/build/esm/service-events.d.ts +92 -15
- package/build/esm/service-events.js +5 -34
- package/build/esm/service-events.js.map +1 -1
- package/build/{cjs/hex-flash-data-source.d.ts → esm/universal-hex/flash-data-source.d.ts} +1 -1
- package/build/esm/{hex-flash-data-source.js → universal-hex/flash-data-source.js} +6 -3
- package/build/esm/universal-hex/flash-data-source.js.map +1 -0
- package/build/esm/universal-hex/index.d.ts +4 -0
- package/build/esm/universal-hex/index.js +5 -0
- package/build/esm/universal-hex/index.js.map +1 -0
- package/build/esm/usb/arm-debug.d.ts +137 -0
- package/build/esm/usb/arm-debug.js +409 -0
- package/build/esm/usb/arm-debug.js.map +1 -0
- package/build/{cjs → esm/usb}/board-serial-info.d.ts +2 -1
- package/build/esm/{board-serial-info.js → usb/board-serial-info.js} +10 -7
- package/build/esm/usb/board-serial-info.js.map +1 -0
- package/build/esm/usb/cdc-saturation.d.ts +36 -0
- package/build/esm/usb/cdc-saturation.js +148 -0
- package/build/esm/usb/cdc-saturation.js.map +1 -0
- package/build/esm/usb/cmsis-dap.d.ts +113 -0
- package/build/esm/usb/cmsis-dap.js +342 -0
- package/build/esm/usb/cmsis-dap.js.map +1 -0
- package/build/esm/usb/connection.d.ts +96 -0
- package/build/esm/{usb.js → usb/connection.js} +253 -168
- package/build/esm/usb/connection.js.map +1 -0
- package/build/esm/usb/cortex-m.d.ts +72 -0
- package/build/esm/usb/cortex-m.js +161 -0
- package/build/esm/usb/cortex-m.js.map +1 -0
- package/build/esm/usb/daplink.d.ts +69 -0
- package/build/esm/usb/daplink.js +231 -0
- package/build/esm/usb/daplink.js.map +1 -0
- package/build/esm/usb/device-wrapper.d.ts +34 -0
- package/build/esm/usb/device-wrapper.js +98 -0
- package/build/esm/usb/device-wrapper.js.map +1 -0
- package/build/esm/usb/index.d.ts +5 -0
- package/build/esm/usb/index.js +5 -0
- package/build/esm/usb/index.js.map +1 -0
- package/build/{cjs/usb-partial-flashing-utils.d.ts → esm/usb/partial-flashing-utils.d.ts} +6 -9
- package/build/esm/{usb-partial-flashing-utils.js → usb/partial-flashing-utils.js} +4 -44
- package/build/esm/usb/partial-flashing-utils.js.map +1 -0
- package/build/{cjs/usb-partial-flashing.d.ts → esm/usb/partial-flashing.d.ts} +37 -11
- package/build/esm/{usb-partial-flashing.js → usb/partial-flashing.js} +169 -110
- package/build/esm/usb/partial-flashing.js.map +1 -0
- package/build/esm/usb/promise-queue.js.map +1 -0
- package/build/esm/usb/serial-events.d.ts +16 -0
- package/build/esm/usb/serial-events.js +2 -0
- package/build/esm/usb/serial-events.js.map +1 -0
- package/build/esm/usb/transport.d.ts +42 -0
- package/build/esm/usb/transport.js +151 -0
- package/build/esm/usb/transport.js.map +1 -0
- package/package.json +61 -14
- package/build/cjs/accelerometer-service.js.map +0 -1
- package/build/cjs/accelerometer.d.ts +0 -9
- package/build/cjs/accelerometer.js +0 -16
- package/build/cjs/accelerometer.js.map +0 -1
- package/build/cjs/bluetooth-device-wrapper.js.map +0 -1
- package/build/cjs/bluetooth.d.ts +0 -112
- package/build/cjs/bluetooth.js +0 -457
- package/build/cjs/bluetooth.js.map +0 -1
- package/build/cjs/board-serial-info.js.map +0 -1
- package/build/cjs/button-service.js.map +0 -1
- package/build/cjs/buttons.d.ts +0 -10
- package/build/cjs/buttons.js +0 -22
- package/build/cjs/buttons.js.map +0 -1
- package/build/cjs/constants.d.ts +0 -48
- package/build/cjs/constants.js +0 -73
- package/build/cjs/constants.js.map +0 -1
- package/build/cjs/device-information-service.js +0 -34
- package/build/cjs/device-information-service.js.map +0 -1
- package/build/cjs/dfu-service.js.map +0 -1
- package/build/cjs/flashing/flashing-full.js.map +0 -1
- package/build/cjs/flashing/flashing-makecode.d.ts +0 -6
- package/build/cjs/flashing/flashing-makecode.js.map +0 -1
- package/build/cjs/flashing/flashing-partial.d.ts +0 -9
- package/build/cjs/flashing/flashing-partial.js +0 -98
- package/build/cjs/flashing/flashing-partial.js.map +0 -1
- package/build/cjs/flashing/flashing-v1.js.map +0 -1
- package/build/cjs/flashing/nordic-dfu.js.map +0 -1
- package/build/cjs/flashing/zip.js.map +0 -1
- package/build/cjs/hex-flash-data-source.js.map +0 -1
- package/build/cjs/led-service.js.map +0 -1
- package/build/cjs/led.d.ts +0 -6
- package/build/cjs/led.js.map +0 -1
- package/build/cjs/magnetometer-service.js.map +0 -1
- package/build/cjs/magnetometer.d.ts +0 -9
- package/build/cjs/magnetometer.js +0 -16
- package/build/cjs/magnetometer.js.map +0 -1
- package/build/cjs/partial-flashing-service.js.map +0 -1
- package/build/cjs/promise-queue.js.map +0 -1
- package/build/cjs/serial-events.d.ts +0 -20
- package/build/cjs/serial-events.js +0 -69
- package/build/cjs/serial-events.js.map +0 -1
- package/build/cjs/setupTests.d.ts +0 -6
- package/build/cjs/setupTests.js.map +0 -1
- package/build/cjs/uart-service.js.map +0 -1
- package/build/cjs/uart.d.ts +0 -4
- package/build/cjs/uart.js +0 -16
- package/build/cjs/uart.js.map +0 -1
- package/build/cjs/usb-device-wrapper.d.ts +0 -47
- package/build/cjs/usb-device-wrapper.js +0 -437
- package/build/cjs/usb-device-wrapper.js.map +0 -1
- package/build/cjs/usb-partial-flashing-utils.js.map +0 -1
- package/build/cjs/usb-partial-flashing.js.map +0 -1
- package/build/cjs/usb-radio-bridge.d.ts +0 -24
- package/build/cjs/usb-radio-bridge.js.map +0 -1
- package/build/cjs/usb-serial-protocol.js.map +0 -1
- package/build/cjs/usb.d.ts +0 -66
- package/build/cjs/usb.js.map +0 -1
- package/build/esm/accelerometer-service.js.map +0 -1
- package/build/esm/accelerometer.d.ts +0 -9
- package/build/esm/accelerometer.js +0 -12
- package/build/esm/accelerometer.js.map +0 -1
- package/build/esm/bluetooth-device-wrapper.js.map +0 -1
- package/build/esm/bluetooth-profile.js.map +0 -1
- package/build/esm/bluetooth.d.ts +0 -112
- package/build/esm/bluetooth.js +0 -427
- package/build/esm/bluetooth.js.map +0 -1
- package/build/esm/board-serial-info.js.map +0 -1
- package/build/esm/button-service.js.map +0 -1
- package/build/esm/buttons.d.ts +0 -10
- package/build/esm/buttons.js +0 -18
- package/build/esm/buttons.js.map +0 -1
- package/build/esm/constants.d.ts +0 -48
- package/build/esm/constants.js +0 -70
- package/build/esm/constants.js.map +0 -1
- package/build/esm/device-information-service.js +0 -30
- package/build/esm/device-information-service.js.map +0 -1
- package/build/esm/dfu-service.js.map +0 -1
- package/build/esm/flashing/flashing-full.js.map +0 -1
- package/build/esm/flashing/flashing-makecode.d.ts +0 -6
- package/build/esm/flashing/flashing-makecode.js.map +0 -1
- package/build/esm/flashing/flashing-partial.d.ts +0 -9
- package/build/esm/flashing/flashing-partial.js +0 -95
- package/build/esm/flashing/flashing-partial.js.map +0 -1
- package/build/esm/flashing/flashing-v1.js.map +0 -1
- package/build/esm/flashing/nordic-dfu.js.map +0 -1
- package/build/esm/flashing/zip.js.map +0 -1
- package/build/esm/hex-flash-data-source.js.map +0 -1
- package/build/esm/led-service.js.map +0 -1
- package/build/esm/led.d.ts +0 -6
- package/build/esm/led.js +0 -2
- package/build/esm/led.js.map +0 -1
- package/build/esm/magnetometer-service.js.map +0 -1
- package/build/esm/magnetometer.d.ts +0 -9
- package/build/esm/magnetometer.js +0 -12
- package/build/esm/magnetometer.js.map +0 -1
- package/build/esm/partial-flashing-service.js.map +0 -1
- package/build/esm/promise-queue.js.map +0 -1
- package/build/esm/serial-events.d.ts +0 -20
- package/build/esm/serial-events.js +0 -61
- package/build/esm/serial-events.js.map +0 -1
- package/build/esm/setupTests.d.ts +0 -6
- package/build/esm/setupTests.js.map +0 -1
- package/build/esm/uart-service.js.map +0 -1
- package/build/esm/uart.d.ts +0 -4
- package/build/esm/uart.js +0 -12
- package/build/esm/uart.js.map +0 -1
- package/build/esm/usb-device-wrapper.d.ts +0 -47
- package/build/esm/usb-device-wrapper.js +0 -410
- package/build/esm/usb-device-wrapper.js.map +0 -1
- package/build/esm/usb-partial-flashing-utils.js.map +0 -1
- package/build/esm/usb-partial-flashing.js.map +0 -1
- package/build/esm/usb-radio-bridge.d.ts +0 -24
- package/build/esm/usb-radio-bridge.js.map +0 -1
- package/build/esm/usb-serial-protocol.js.map +0 -1
- package/build/esm/usb.d.ts +0 -66
- package/build/esm/usb.js.map +0 -1
- package/typedoc.json +0 -14
- /package/build/cjs/{flashing → bluetooth/flashing}/flashing-v1.d.ts +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/flashing-v1.js +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/zip.d.ts +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/zip.js +0 -0
- /package/build/cjs/{dfu-service.d.ts → bluetooth/services/dfu-service.d.ts} +0 -0
- /package/build/cjs/{usb-serial-protocol.d.ts → radio-bridge/serial-protocol.d.ts} +0 -0
- /package/build/cjs/{promise-queue.d.ts → usb/promise-queue.d.ts} +0 -0
- /package/build/cjs/{promise-queue.js → usb/promise-queue.js} +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/flashing-v1.d.ts +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/flashing-v1.js +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/zip.d.ts +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/zip.js +0 -0
- /package/build/esm/{dfu-service.d.ts → bluetooth/services/dfu-service.d.ts} +0 -0
- /package/build/esm/{usb-serial-protocol.d.ts → radio-bridge/serial-protocol.d.ts} +0 -0
- /package/build/esm/{promise-queue.d.ts → usb/promise-queue.d.ts} +0 -0
- /package/build/esm/{promise-queue.js → usb/promise-queue.js} +0 -0
package/build/esm/events.d.ts
CHANGED
|
@@ -1,110 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* A function that can be passed to the `listener` parameter of {@link TypedEventTarget.addEventListener} and {@link TypedEventTarget.removeEventListener}.
|
|
10
|
-
*
|
|
11
|
-
* @template M A map of event types to their respective event classes.
|
|
12
|
-
* @template T The type of event to listen for (has to be keyof `M`).
|
|
13
|
-
*/
|
|
14
|
-
export type TypedEventListener<M, T extends keyof M> = (evt: M[T]) => void | Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* An object that can be passed to the `listener` parameter of {@link TypedEventTarget.addEventListener} and {@link TypedEventTarget.removeEventListener}.
|
|
17
|
-
*
|
|
18
|
-
* @template M A map of event types to their respective event classes.
|
|
19
|
-
* @template T The type of event to listen for (has to be keyof `M`).
|
|
20
|
-
*/
|
|
21
|
-
export interface TypedEventListenerObject<M, T extends keyof M> {
|
|
22
|
-
handleEvent: (evt: M[T]) => void | Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Type of parameter `listener` in {@link TypedEventTarget.addEventListener} and {@link TypedEventTarget.removeEventListener}.
|
|
26
|
-
*
|
|
27
|
-
* The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs.
|
|
28
|
-
*
|
|
29
|
-
* Can be either an object with a handleEvent() method, or a JavaScript function.
|
|
30
|
-
*
|
|
31
|
-
* @template M A map of event types to their respective event classes.
|
|
32
|
-
* @template T The type of event to listen for (has to be keyof `M`).
|
|
33
|
-
*/
|
|
34
|
-
export type TypedEventListenerOrEventListenerObject<M, T extends keyof M> = TypedEventListener<M, T> | TypedEventListenerObject<M, T>;
|
|
35
|
-
export type ValueIsEvent<T> = {
|
|
36
|
-
[key in keyof T]: Event;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Typescript friendly version of {@link EventTarget}
|
|
40
|
-
*
|
|
41
|
-
* @template M A map of event types to their respective event classes.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```typescript
|
|
45
|
-
* interface MyEventMap {
|
|
46
|
-
* hello: Event;
|
|
47
|
-
* time: CustomEvent<number>;
|
|
48
|
-
* }
|
|
49
|
-
*
|
|
50
|
-
* const eventTarget = new TypedEventTarget<MyEventMap>();
|
|
51
|
-
*
|
|
52
|
-
* eventTarget.addEventListener('time', (event) => {
|
|
53
|
-
* // event is of type CustomEvent<number>
|
|
54
|
-
* });
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
export interface TypedEventTarget<M extends ValueIsEvent<M>> {
|
|
58
|
-
/** Appends an event listener for events whose type attribute value is type.
|
|
59
|
-
* The callback argument sets the callback that will be invoked when the event
|
|
60
|
-
* is dispatched.
|
|
61
|
-
*
|
|
62
|
-
* The options argument sets listener-specific options. For compatibility this
|
|
63
|
-
* can be a boolean, in which case the method behaves exactly as if the value
|
|
64
|
-
* was specified as options's capture.
|
|
65
|
-
*
|
|
66
|
-
* When set to true, options's capture prevents callback from being invoked
|
|
67
|
-
* when the event's eventPhase attribute value is BUBBLING_PHASE. When false
|
|
68
|
-
* (or not present), callback will not be invoked when event's eventPhase
|
|
69
|
-
* attribute value is CAPTURING_PHASE. Either way, callback will be invoked if
|
|
70
|
-
* event's eventPhase attribute value is AT_TARGET.
|
|
71
|
-
*
|
|
72
|
-
* When set to true, options's passive indicates that the callback will not
|
|
73
|
-
* cancel the event by invoking preventDefault(). This is used to enable
|
|
74
|
-
* performance optimizations described in § 2.8 Observing event listeners.
|
|
75
|
-
*
|
|
76
|
-
* When set to true, options's once indicates that the callback will only be
|
|
77
|
-
* invoked once after which the event listener will be removed.
|
|
78
|
-
*
|
|
79
|
-
* The event listener is appended to target's event listener list and is not
|
|
80
|
-
* appended if it has the same type, callback, and capture. */
|
|
81
|
-
addEventListener: <T extends keyof M & string>(type: T, listener: TypedEventListenerOrEventListenerObject<M, T> | null, options?: boolean | AddEventListenerOptions) => void;
|
|
82
|
-
/** Removes the event listener in target's event listener list with the same
|
|
83
|
-
* type, callback, and options. */
|
|
84
|
-
removeEventListener: <T extends keyof M & string>(type: T, callback: TypedEventListenerOrEventListenerObject<M, T> | null, options?: EventListenerOptions | boolean) => void;
|
|
85
|
-
/**
|
|
86
|
-
* Dispatches a synthetic event event to target and returns true if either
|
|
87
|
-
* event's cancelable attribute value is false or its preventDefault() method
|
|
88
|
-
* was not invoked, and false otherwise.
|
|
89
|
-
* @deprecated To ensure type safety use `dispatchTypedEvent` instead.
|
|
90
|
-
*/
|
|
91
|
-
dispatchEvent: (event: Event) => boolean;
|
|
92
|
-
}
|
|
93
|
-
export declare class TrackingEventTarget extends EventTarget {
|
|
94
|
-
private activeEventTracking;
|
|
95
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
|
|
96
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
|
|
97
|
-
dispatchEvent(event: Event): boolean;
|
|
98
|
-
private filterRegistrations;
|
|
99
|
-
protected eventActivated(type: string): void;
|
|
100
|
-
protected eventDeactivated(type: string): void;
|
|
1
|
+
export type Listener<T> = (data: T) => void;
|
|
2
|
+
export declare class TypedEventTarget<M> {
|
|
3
|
+
private listeners;
|
|
4
|
+
addEventListener<K extends keyof M & string>(type: K, listener: Listener<M[K]>): void;
|
|
5
|
+
removeEventListener<K extends keyof M & string>(type: K, listener: Listener<M[K]>): void;
|
|
6
|
+
protected dispatchEvent<K extends keyof M & string>(type: K, ...[data]: M[K] extends void ? [] : [data: M[K]]): void;
|
|
7
|
+
protected eventActivated(_type: string): void;
|
|
8
|
+
protected eventDeactivated(_type: string): void;
|
|
101
9
|
protected getActiveEvents(): string[];
|
|
102
10
|
}
|
|
103
|
-
export declare class TypedEventTarget<M extends ValueIsEvent<M>> extends TrackingEventTarget {
|
|
104
|
-
/**
|
|
105
|
-
* Dispatches a synthetic event event to target and returns true if either
|
|
106
|
-
* event's cancelable attribute value is false or its preventDefault() method
|
|
107
|
-
* was not invoked, and false otherwise.
|
|
108
|
-
*/
|
|
109
|
-
dispatchTypedEvent<T extends keyof M>(_type: T, event: M[T]): boolean;
|
|
110
|
-
}
|
package/build/esm/events.js
CHANGED
|
@@ -1,104 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2022 Jonas "DerZade" Schade
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: MIT
|
|
5
|
-
*
|
|
6
|
-
* https://github.com/DerZade/typescript-event-target/blob/master/src/TypedEventTarget.ts
|
|
7
|
-
*/
|
|
8
|
-
// We've added this in to keep track of what events are active.
|
|
9
|
-
// Having done this it's questionable whether it's worth the reimplementation
|
|
10
|
-
// just to use an EventTarget API.
|
|
11
|
-
export class TrackingEventTarget extends EventTarget {
|
|
1
|
+
export class TypedEventTarget {
|
|
12
2
|
constructor() {
|
|
13
|
-
|
|
14
|
-
Object.defineProperty(this, "activeEventTracking", {
|
|
3
|
+
Object.defineProperty(this, "listeners", {
|
|
15
4
|
enumerable: true,
|
|
16
5
|
configurable: true,
|
|
17
6
|
writable: true,
|
|
18
7
|
value: new Map()
|
|
19
8
|
});
|
|
20
9
|
}
|
|
21
|
-
addEventListener(type,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
registrations.push(registration);
|
|
28
|
-
this.activeEventTracking.set(type, registrations);
|
|
29
|
-
if (wasEmpty) {
|
|
30
|
-
this.eventActivated(type);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
10
|
+
addEventListener(type, listener) {
|
|
11
|
+
let set = this.listeners.get(type);
|
|
12
|
+
const wasEmpty = !set || set.size === 0;
|
|
13
|
+
if (!set) {
|
|
14
|
+
set = new Set();
|
|
15
|
+
this.listeners.set(type, set);
|
|
33
16
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const registration = new Registration(callback, options ?? false);
|
|
39
|
-
this.filterRegistrations(type, (r) => !r.eq(registration));
|
|
17
|
+
if (!set.has(listener)) {
|
|
18
|
+
set.add(listener);
|
|
19
|
+
if (wasEmpty)
|
|
20
|
+
this.eventActivated(type);
|
|
40
21
|
}
|
|
41
|
-
super.removeEventListener(type, callback, options);
|
|
42
|
-
}
|
|
43
|
-
dispatchEvent(event) {
|
|
44
|
-
const result = super.dispatchEvent(event);
|
|
45
|
-
this.filterRegistrations(event.type, (r) => !r.isOnce());
|
|
46
|
-
return result;
|
|
47
22
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.activeEventTracking.delete(type);
|
|
23
|
+
removeEventListener(type, listener) {
|
|
24
|
+
const set = this.listeners.get(type);
|
|
25
|
+
if (set?.delete(listener) && set.size === 0) {
|
|
26
|
+
this.listeners.delete(type);
|
|
53
27
|
this.eventDeactivated(type);
|
|
54
28
|
}
|
|
55
|
-
|
|
56
|
-
|
|
29
|
+
}
|
|
30
|
+
dispatchEvent(type, ...[data]) {
|
|
31
|
+
const set = this.listeners.get(type);
|
|
32
|
+
if (set) {
|
|
33
|
+
for (const listener of set) {
|
|
34
|
+
listener(data);
|
|
35
|
+
}
|
|
57
36
|
}
|
|
58
37
|
}
|
|
59
|
-
eventActivated(
|
|
60
|
-
eventDeactivated(
|
|
38
|
+
eventActivated(_type) { }
|
|
39
|
+
eventDeactivated(_type) { }
|
|
61
40
|
getActiveEvents() {
|
|
62
|
-
return [...this.
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
66
|
-
export class TypedEventTarget extends TrackingEventTarget {
|
|
67
|
-
/**
|
|
68
|
-
* Dispatches a synthetic event event to target and returns true if either
|
|
69
|
-
* event's cancelable attribute value is false or its preventDefault() method
|
|
70
|
-
* was not invoked, and false otherwise.
|
|
71
|
-
*/
|
|
72
|
-
dispatchTypedEvent(_type, event) {
|
|
73
|
-
return super.dispatchEvent(event);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
class Registration {
|
|
77
|
-
constructor(callback, options) {
|
|
78
|
-
Object.defineProperty(this, "callback", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
configurable: true,
|
|
81
|
-
writable: true,
|
|
82
|
-
value: callback
|
|
83
|
-
});
|
|
84
|
-
Object.defineProperty(this, "options", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
configurable: true,
|
|
87
|
-
writable: true,
|
|
88
|
-
value: options
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
isOnce() {
|
|
92
|
-
return typeof this.options === "object" && this.options.once === true;
|
|
93
|
-
}
|
|
94
|
-
eq(other) {
|
|
95
|
-
return (other.callback === this.callback &&
|
|
96
|
-
eqUseCapture(this.options, other.options));
|
|
41
|
+
return [...this.listeners.keys()];
|
|
97
42
|
}
|
|
98
43
|
}
|
|
99
|
-
const eqUseCapture = (left, right) => {
|
|
100
|
-
const leftValue = typeof left === "boolean" ? left : left.capture ?? false;
|
|
101
|
-
const rightValue = typeof right === "boolean" ? right : right.capture ?? false;
|
|
102
|
-
return leftValue === rightValue;
|
|
103
|
-
};
|
|
104
44
|
//# sourceMappingURL=events.js.map
|
package/build/esm/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,gBAAgB;IAA7B;QACU;;;;mBAAY,IAAI,GAAG,EAA8B;WAAC;IA8C5D,CAAC;IA5CC,gBAAgB,CACd,IAAO,EACP,QAAwB;QAExB,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC;QACxC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvB,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAClB,IAAI,QAAQ;gBAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,mBAAmB,CACjB,IAAO,EACP,QAAwB;QAExB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAES,aAAa,CACrB,IAAO,EACP,GAAG,CAAC,IAAI,CAAwC;QAEhD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,GAAG,EAAE,CAAC;YACR,KAAK,MAAM,QAAQ,IAAI,GAAG,EAAE,CAAC;gBAC3B,QAAQ,CAAC,IAAY,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAES,cAAc,CAAC,KAAa,IAAS,CAAC;IACtC,gBAAgB,CAAC,KAAa,IAAS,CAAC;IACxC,eAAe;QACvB,OAAO,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAa,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const truncateHexAfterEof: (hex: string) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// MakeCode hex files may contain embedded source in custom record types
|
|
2
|
+
// (type 0x0E) after the EOF record, and older files may have trailing blank
|
|
3
|
+
// lines. The nrf-intel-hex parser rejects any data after EOF, so we truncate.
|
|
4
|
+
export const truncateHexAfterEof = (hex) => {
|
|
5
|
+
// The EOF record is :00000001FF (case-insensitive per the Intel HEX spec).
|
|
6
|
+
const eofIdx = hex.search(/:00000001FF/i);
|
|
7
|
+
if (eofIdx < 0)
|
|
8
|
+
return hex;
|
|
9
|
+
return hex.slice(0, eofIdx + ":00000001FF".length) + "\n";
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=hex-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex-util.js","sourceRoot":"","sources":["../../src/hex-util.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,4EAA4E;AAC5E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAW,EAAU,EAAE;IACzD,2EAA2E;IAC3E,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAC1C,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAC3B,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAC5D,CAAC,CAAC"}
|
package/build/esm/index.d.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import { AfterRequestDevice, BackgroundErrorEvent, BeforeRequestDevice, BoardVersion, ConnectOptions, ConnectionAvailabilityStatus, ConnectionStatus, ConnectionStatusEvent, DeviceConnection, DeviceConnectionEventMap, DeviceError, DeviceErrorCode, FlashDataError, FlashDataSource, FlashOptions, ProgressCallback, ProgressStage } from "./device.js";
|
|
6
|
-
import { TypedEventTarget } from "./events.js";
|
|
7
|
-
import { createUniversalHexFlashDataSource } from "./hex-flash-data-source.js";
|
|
8
|
-
import { LedMatrix } from "./led.js";
|
|
1
|
+
/**
|
|
2
|
+
* @module @microbit/microbit-connection
|
|
3
|
+
*/
|
|
4
|
+
import { BackgroundErrorData, BoardVersion, BondMode, ConnectOptions, ConnectionAvailabilityStatus, ConnectionStatus, ConnectionStatusChange, DeviceConnection, DeviceError, DeviceErrorCode, FlashDataError, FlashDataSource, FlashOptions, ProgressCallback, ProgressStage, assertConnected } from "./device.js";
|
|
9
5
|
import { Logging, LoggingEvent } from "./logging.js";
|
|
10
|
-
import { MagnetometerData,
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { createRadioBridgeConnection, MicrobitRadioBridgeConnection, MicrobitRadioBridgeConnectionOptions } from "./usb-radio-bridge.js";
|
|
15
|
-
import { createWebUSBConnection, DeviceSelectionMode, MicrobitWebUSBConnection, MicrobitWebUSBConnectionOptions } from "./usb.js";
|
|
16
|
-
export { AfterRequestDevice, BackgroundErrorEvent, BeforeRequestDevice, BoardId, ConnectionStatus, ConnectionStatusEvent, createRadioBridgeConnection, createUniversalHexFlashDataSource, createWebBluetoothConnection, createWebUSBConnection, DeviceConnectionEventMap, DeviceSelectionMode, DeviceError, FlashDataError, FlashEvent, ProgressStage, SerialConnectionEventMap, SerialDataEvent, SerialErrorEvent, SerialResetEvent, ServiceConnectionEventMap, TypedEventTarget, UARTDataEvent, };
|
|
17
|
-
export type { AccelerometerData, AccelerometerDataEvent, BoardVersion, ConnectionAvailabilityStatus, ButtonEvent, ButtonEventType, ButtonState, ConnectOptions, DeviceConnection, DeviceErrorCode, FlashDataSource, FlashOptions, LedMatrix, Logging, LoggingEvent, MagnetometerData, MagnetometerDataEvent, MicrobitRadioBridgeConnection, MicrobitRadioBridgeConnectionOptions, MicrobitWebBluetoothConnection, MicrobitWebBluetoothConnectionOptions, MicrobitWebUSBConnection, MicrobitWebUSBConnectionOptions, ProgressCallback, };
|
|
6
|
+
import { AccelerometerData, ButtonActionData, ButtonData, ButtonActionType, ButtonState, GestureData, MicrobitEventData, PinValue, PinData, LedMatrix, MagnetometerData, TemperatureData, UartData } from "./service-events.js";
|
|
7
|
+
import { ButtonAction, GestureEvent } from "./microbit-events.js";
|
|
8
|
+
export { ButtonAction, ButtonState, ConnectionStatus, DeviceError, FlashDataError, GestureEvent, assertConnected, ProgressStage, };
|
|
9
|
+
export type { AccelerometerData, BackgroundErrorData, BoardVersion, BondMode, ButtonActionData, ButtonData, ButtonActionType, ConnectOptions, ConnectionAvailabilityStatus, ConnectionStatusChange, DeviceConnection, DeviceErrorCode, FlashDataSource, FlashOptions, GestureData, MicrobitEventData, PinValue, PinData, LedMatrix, Logging, LoggingEvent, MagnetometerData, ProgressCallback, TemperatureData, UartData, };
|
package/build/esm/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { UARTDataEvent } from "./uart.js";
|
|
9
|
-
import { createRadioBridgeConnection, } from "./usb-radio-bridge.js";
|
|
10
|
-
import { createWebUSBConnection, DeviceSelectionMode, } from "./usb.js";
|
|
11
|
-
export { AfterRequestDevice, BackgroundErrorEvent, BeforeRequestDevice, BoardId, ConnectionStatus, ConnectionStatusEvent, createRadioBridgeConnection, createUniversalHexFlashDataSource, createWebBluetoothConnection, createWebUSBConnection, DeviceConnectionEventMap, DeviceSelectionMode, DeviceError, FlashDataError, FlashEvent, ProgressStage, SerialConnectionEventMap, SerialDataEvent, SerialErrorEvent, SerialResetEvent, ServiceConnectionEventMap, TypedEventTarget, UARTDataEvent, };
|
|
1
|
+
/**
|
|
2
|
+
* @module @microbit/microbit-connection
|
|
3
|
+
*/
|
|
4
|
+
import { ConnectionStatus, DeviceError, FlashDataError, ProgressStage, assertConnected, } from "./device.js";
|
|
5
|
+
import { ButtonState, } from "./service-events.js";
|
|
6
|
+
import { ButtonAction, GestureEvent } from "./microbit-events.js";
|
|
7
|
+
export { ButtonAction, ButtonState, ConnectionStatus, DeviceError, FlashDataError, GestureEvent, assertConnected, ProgressStage, };
|
|
12
8
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAML,gBAAgB,EAGhB,WAAW,EAEX,cAAc,EAId,aAAa,EACb,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EAKL,WAAW,GASZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,GACd,CAAC"}
|
package/build/esm/logging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":"AAkBA,MAAM,OAAO,cAAc;IACzB,KAAK,CAAC,MAAoB;QACxB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IACD,KAAK,CAAC,EAAU,EAAE,EAAW;QAC3B,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACxB,CAAC;IACD,GAAG,CAAC,EAAO;QACT,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Well-known micro:bit message bus event source IDs and values.
|
|
3
|
+
*
|
|
4
|
+
* Source IDs differ between V1 (DAL) and V2 (CODAL). Event values are
|
|
5
|
+
* identical across versions (V2 adds TwoG to gesture values).
|
|
6
|
+
*
|
|
7
|
+
* @see https://lancaster-university.github.io/microbit-docs/
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Event source IDs for micro:bit V1 (DAL).
|
|
11
|
+
*/
|
|
12
|
+
export declare const V1Source: {
|
|
13
|
+
readonly ButtonA: 1;
|
|
14
|
+
readonly ButtonB: 2;
|
|
15
|
+
readonly ButtonAB: 26;
|
|
16
|
+
readonly Gesture: 27;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Event source IDs for micro:bit V2 (CODAL).
|
|
20
|
+
*/
|
|
21
|
+
export declare const V2Source: {
|
|
22
|
+
readonly ButtonA: 1;
|
|
23
|
+
readonly ButtonB: 2;
|
|
24
|
+
readonly ButtonAB: 3;
|
|
25
|
+
readonly Gesture: 13;
|
|
26
|
+
readonly Logo: 121;
|
|
27
|
+
};
|
|
28
|
+
export declare const EventSource: {
|
|
29
|
+
readonly v1: {
|
|
30
|
+
readonly ButtonA: 1;
|
|
31
|
+
readonly ButtonB: 2;
|
|
32
|
+
readonly ButtonAB: 26;
|
|
33
|
+
readonly Gesture: 27;
|
|
34
|
+
};
|
|
35
|
+
readonly v2: {
|
|
36
|
+
readonly ButtonA: 1;
|
|
37
|
+
readonly ButtonB: 2;
|
|
38
|
+
readonly ButtonAB: 3;
|
|
39
|
+
readonly Gesture: 13;
|
|
40
|
+
readonly Logo: 121;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare const GestureEvent: {
|
|
44
|
+
readonly TiltUp: 1;
|
|
45
|
+
readonly TiltDown: 2;
|
|
46
|
+
readonly TiltLeft: 3;
|
|
47
|
+
readonly TiltRight: 4;
|
|
48
|
+
readonly FaceUp: 5;
|
|
49
|
+
readonly FaceDown: 6;
|
|
50
|
+
readonly Freefall: 7;
|
|
51
|
+
readonly Acceleration3g: 8;
|
|
52
|
+
readonly Acceleration6g: 9;
|
|
53
|
+
readonly Acceleration8g: 10;
|
|
54
|
+
readonly Shake: 11;
|
|
55
|
+
/** V2 only. */
|
|
56
|
+
readonly Acceleration2g: 12;
|
|
57
|
+
};
|
|
58
|
+
export type GestureEvent = (typeof GestureEvent)[keyof typeof GestureEvent];
|
|
59
|
+
export declare const ButtonAction: {
|
|
60
|
+
readonly Down: 1;
|
|
61
|
+
readonly Up: 2;
|
|
62
|
+
readonly Click: 3;
|
|
63
|
+
readonly LongClick: 4;
|
|
64
|
+
readonly Hold: 5;
|
|
65
|
+
readonly DoubleClick: 6;
|
|
66
|
+
};
|
|
67
|
+
export type ButtonAction = (typeof ButtonAction)[keyof typeof ButtonAction];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Well-known micro:bit message bus event source IDs and values.
|
|
3
|
+
*
|
|
4
|
+
* Source IDs differ between V1 (DAL) and V2 (CODAL). Event values are
|
|
5
|
+
* identical across versions (V2 adds TwoG to gesture values).
|
|
6
|
+
*
|
|
7
|
+
* @see https://lancaster-university.github.io/microbit-docs/
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Event source IDs for micro:bit V1 (DAL).
|
|
11
|
+
*/
|
|
12
|
+
export const V1Source = {
|
|
13
|
+
ButtonA: 1,
|
|
14
|
+
ButtonB: 2,
|
|
15
|
+
ButtonAB: 26,
|
|
16
|
+
Gesture: 27,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Event source IDs for micro:bit V2 (CODAL).
|
|
20
|
+
*/
|
|
21
|
+
export const V2Source = {
|
|
22
|
+
ButtonA: 1,
|
|
23
|
+
ButtonB: 2,
|
|
24
|
+
ButtonAB: 3,
|
|
25
|
+
Gesture: 13,
|
|
26
|
+
Logo: 121,
|
|
27
|
+
};
|
|
28
|
+
export const EventSource = { v1: V1Source, v2: V2Source };
|
|
29
|
+
export const GestureEvent = {
|
|
30
|
+
TiltUp: 1,
|
|
31
|
+
TiltDown: 2,
|
|
32
|
+
TiltLeft: 3,
|
|
33
|
+
TiltRight: 4,
|
|
34
|
+
FaceUp: 5,
|
|
35
|
+
FaceDown: 6,
|
|
36
|
+
Freefall: 7,
|
|
37
|
+
Acceleration3g: 8,
|
|
38
|
+
Acceleration6g: 9,
|
|
39
|
+
Acceleration8g: 10,
|
|
40
|
+
Shake: 11,
|
|
41
|
+
/** V2 only. */
|
|
42
|
+
Acceleration2g: 12,
|
|
43
|
+
};
|
|
44
|
+
export const ButtonAction = {
|
|
45
|
+
Down: 1,
|
|
46
|
+
Up: 2,
|
|
47
|
+
Click: 3,
|
|
48
|
+
LongClick: 4,
|
|
49
|
+
Hold: 5,
|
|
50
|
+
DoubleClick: 6,
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=microbit-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microbit-events.js","sourceRoot":"","sources":["../../src/microbit-events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,EAAE;CACH,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,GAAG;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAW,CAAC;AAEnE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;IACZ,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,EAAE;IAClB,KAAK,EAAE,EAAE;IACT,eAAe;IACf,cAAc,EAAE,EAAE;CACV,CAAC;AAGX,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,CAAC;IACP,EAAE,EAAE,CAAC;IACL,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,CAAC;IACP,WAAW,EAAE,CAAC;CACN,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { BackgroundErrorData, ConnectionStatusChange, DeviceConnection } from "../device.js";
|
|
7
|
+
import { Logging } from "../logging.js";
|
|
8
|
+
import { AccelerometerData, ButtonData } from "../service-events.js";
|
|
9
|
+
import { MicrobitUSBConnection } from "../usb/connection.js";
|
|
10
|
+
export interface MicrobitRadioBridgeConnectionOptions {
|
|
11
|
+
logging?: Logging;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A connection to a remote micro:bit via a USB-connected micro:bit running
|
|
15
|
+
* radio bridge firmware. Sensor data is relayed over a serial protocol.
|
|
16
|
+
*
|
|
17
|
+
* @experimental This connection type has limited service support compared to
|
|
18
|
+
* direct Bluetooth connections:
|
|
19
|
+
*
|
|
20
|
+
* - `accelerometerdatachanged`, `buttonachanged`, `buttonbchanged` events
|
|
21
|
+
* are supported.
|
|
22
|
+
* - `flash` is not supported.
|
|
23
|
+
*/
|
|
24
|
+
export interface MicrobitRadioBridgeConnection extends DeviceConnection {
|
|
25
|
+
readonly type: "radio-bridge";
|
|
26
|
+
addEventListener(type: "status", listener: (data: ConnectionStatusChange) => void): void;
|
|
27
|
+
addEventListener(type: "backgrounderror", listener: (data: BackgroundErrorData) => void): void;
|
|
28
|
+
addEventListener(type: "beforerequestdevice", listener: () => void): void;
|
|
29
|
+
addEventListener(type: "afterrequestdevice", listener: () => void): void;
|
|
30
|
+
addEventListener(type: "flash", listener: () => void): void;
|
|
31
|
+
addEventListener(type: "accelerometerdatachanged", listener: (data: AccelerometerData) => void): void;
|
|
32
|
+
addEventListener(type: "buttonachanged" | "buttonbchanged", listener: (data: ButtonData) => void): void;
|
|
33
|
+
removeEventListener(type: "status", listener: (data: ConnectionStatusChange) => void): void;
|
|
34
|
+
removeEventListener(type: "backgrounderror", listener: (data: BackgroundErrorData) => void): void;
|
|
35
|
+
removeEventListener(type: "beforerequestdevice", listener: () => void): void;
|
|
36
|
+
removeEventListener(type: "afterrequestdevice", listener: () => void): void;
|
|
37
|
+
removeEventListener(type: "flash", listener: () => void): void;
|
|
38
|
+
removeEventListener(type: "accelerometerdatachanged", listener: (data: AccelerometerData) => void): void;
|
|
39
|
+
removeEventListener(type: "buttonachanged" | "buttonbchanged", listener: (data: ButtonData) => void): void;
|
|
40
|
+
/**
|
|
41
|
+
* Sets remote device.
|
|
42
|
+
*
|
|
43
|
+
* @param deviceId The device id of remote micro:bit.
|
|
44
|
+
*/
|
|
45
|
+
setRemoteDeviceId(deviceId: number): void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A radio bridge connection factory.
|
|
49
|
+
*
|
|
50
|
+
* @experimental See {@link MicrobitRadioBridgeConnection} for limitations.
|
|
51
|
+
*/
|
|
52
|
+
export declare const createRadioBridgeConnection: (delegate: MicrobitUSBConnection, options?: MicrobitRadioBridgeConnectionOptions) => MicrobitRadioBridgeConnection;
|