@microbit/microbit-connection 0.9.0-apps.alpha.2 → 0.9.0-apps.alpha.20
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/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/async-util.test.d.ts +1 -0
- package/build/cjs/async-util.test.js +20 -0
- package/build/cjs/async-util.test.js.map +1 -0
- package/build/cjs/availability.d.ts +14 -0
- package/build/cjs/availability.js +44 -0
- package/build/cjs/availability.js.map +1 -0
- 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/connection.test.d.ts +1 -0
- package/build/cjs/bluetooth/connection.test.js +88 -0
- package/build/cjs/bluetooth/connection.test.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} +35 -19
- package/build/cjs/{bluetooth-device-wrapper.js → bluetooth/device-wrapper.js} +169 -101
- 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-makecode.test.d.ts +1 -0
- package/build/cjs/bluetooth/flashing/flashing-makecode.test.js +253 -0
- package/build/cjs/bluetooth/flashing/flashing-makecode.test.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 +40 -14
- 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/flashing/zip.test.d.ts +1 -0
- package/build/cjs/bluetooth/flashing/zip.test.js +96 -0
- package/build/cjs/bluetooth/flashing/zip.test.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/{esm → cjs/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/event-service.test.d.ts +1 -0
- package/build/cjs/bluetooth/services/event-service.test.js +252 -0
- package/build/cjs/bluetooth/services/event-service.test.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/cjs/{led-service.d.ts → 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 +214 -97
- package/build/cjs/device.js +57 -114
- 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/events.test.d.ts +1 -0
- package/build/cjs/events.test.js +115 -0
- package/build/cjs/events.test.js.map +1 -0
- 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} +108 -97
- 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/cjs/setupTests.js +8 -0
- package/build/cjs/setupTests.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/cjs/usb/arm-debug.test.d.ts +1 -0
- package/build/cjs/usb/arm-debug.test.js +333 -0
- package/build/cjs/usb/arm-debug.test.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/board-serial-info.test.d.ts +1 -0
- package/build/cjs/usb/board-serial-info.test.js +46 -0
- package/build/cjs/usb/board-serial-info.test.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/cmsis-dap.test.d.ts +1 -0
- package/build/cjs/usb/cmsis-dap.test.js +350 -0
- package/build/cjs/usb/cmsis-dap.test.js.map +1 -0
- package/build/cjs/usb/connection.d.ts +96 -0
- package/build/cjs/{usb.js → usb/connection.js} +274 -193
- package/build/cjs/usb/connection.js.map +1 -0
- package/build/cjs/usb/connection.test.d.ts +1 -0
- package/build/cjs/usb/connection.test.js +266 -0
- package/build/cjs/usb/connection.test.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/cortex-m.test.d.ts +1 -0
- package/build/cjs/usb/cortex-m.test.js +217 -0
- package/build/cjs/usb/cortex-m.test.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/daplink.test.d.ts +1 -0
- package/build/cjs/usb/daplink.test.js +290 -0
- package/build/cjs/usb/daplink.test.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/cjs/{usb-partial-flashing-utils.d.ts → 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/cjs/{usb-partial-flashing.d.ts → 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/promise-queue.test.d.ts +1 -0
- package/build/cjs/usb/promise-queue.test.js +68 -0
- package/build/cjs/usb/promise-queue.test.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/async-util.test.d.ts +1 -0
- package/build/esm/async-util.test.js +18 -0
- package/build/esm/async-util.test.js.map +1 -0
- package/build/esm/availability.d.ts +14 -0
- package/build/esm/availability.js +40 -0
- package/build/esm/availability.js.map +1 -0
- 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/connection.test.d.ts +1 -0
- package/build/esm/bluetooth/connection.test.js +86 -0
- package/build/esm/bluetooth/connection.test.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} +35 -19
- package/build/esm/{bluetooth-device-wrapper.js → bluetooth/device-wrapper.js} +167 -100
- 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-makecode.test.d.ts +1 -0
- package/build/esm/bluetooth/flashing/flashing-makecode.test.js +248 -0
- package/build/esm/bluetooth/flashing/flashing-makecode.test.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 +40 -14
- 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/flashing/zip.test.d.ts +1 -0
- package/build/esm/bluetooth/flashing/zip.test.js +94 -0
- package/build/esm/bluetooth/flashing/zip.test.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/{cjs → esm/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/event-service.test.d.ts +1 -0
- package/build/esm/bluetooth/services/event-service.test.js +250 -0
- package/build/esm/bluetooth/services/event-service.test.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/esm/{led-service.d.ts → 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 +214 -97
- package/build/esm/device.js +55 -108
- 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/events.test.d.ts +1 -0
- package/build/esm/events.test.js +113 -0
- package/build/esm/events.test.js.map +1 -0
- 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} +108 -97
- 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/esm/setupTests.js +7 -0
- package/build/esm/setupTests.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/esm/usb/arm-debug.test.d.ts +1 -0
- package/build/esm/usb/arm-debug.test.js +331 -0
- package/build/esm/usb/arm-debug.test.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/board-serial-info.test.d.ts +1 -0
- package/build/esm/usb/board-serial-info.test.js +44 -0
- package/build/esm/usb/board-serial-info.test.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/cmsis-dap.test.d.ts +1 -0
- package/build/esm/usb/cmsis-dap.test.js +348 -0
- package/build/esm/usb/cmsis-dap.test.js.map +1 -0
- package/build/esm/usb/connection.d.ts +96 -0
- package/build/esm/{usb.js → usb/connection.js} +270 -188
- package/build/esm/usb/connection.js.map +1 -0
- package/build/esm/usb/connection.test.d.ts +1 -0
- package/build/esm/usb/connection.test.js +264 -0
- package/build/esm/usb/connection.test.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/cortex-m.test.d.ts +1 -0
- package/build/esm/usb/cortex-m.test.js +215 -0
- package/build/esm/usb/cortex-m.test.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/daplink.test.d.ts +1 -0
- package/build/esm/usb/daplink.test.js +288 -0
- package/build/esm/usb/daplink.test.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/esm/{usb-partial-flashing-utils.d.ts → 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/esm/{usb-partial-flashing.d.ts → 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/promise-queue.test.d.ts +1 -0
- package/build/esm/usb/promise-queue.test.js +66 -0
- package/build/esm/usb/promise-queue.test.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 +55 -15
- package/LICENSE.md +0 -21
- package/README.md +0 -125
- 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 -458
- 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/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 -428
- 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/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
|
@@ -3,51 +3,49 @@
|
|
|
3
3
|
*
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { withTimeout } from "../async-util.js";
|
|
7
|
+
import { throwIfUnavailable } from "../availability.js";
|
|
8
|
+
import { ConnectionStatus, DeviceError, FlashDataError, ProgressStage, assertConnected, } from "../device.js";
|
|
9
|
+
import { TypedEventTarget } from "../events.js";
|
|
10
|
+
import { ConsoleLogging } from "../logging.js";
|
|
10
11
|
import { PromiseQueue } from "./promise-queue.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
// Temporary workaround for ChromeOS 105 bug.
|
|
15
|
-
// See https://bugs.chromium.org/p/chromium/issues/detail?id=1363712&q=usb&can=2
|
|
16
|
-
export const isChromeOS105 = () => {
|
|
17
|
-
const userAgent = navigator.userAgent;
|
|
18
|
-
return /CrOS/.test(userAgent) && /Chrome\/105\b/.test(userAgent);
|
|
19
|
-
};
|
|
12
|
+
import { USBDeviceWrapper, } from "./device-wrapper.js";
|
|
13
|
+
import { PartialFlashing } from "./partial-flashing.js";
|
|
14
|
+
import { saturateCdcPipeline } from "./cdc-saturation.js";
|
|
20
15
|
const defaultFilters = [{ vendorId: 0x0d28, productId: 0x0204 }];
|
|
21
|
-
export
|
|
22
|
-
(function (DeviceSelectionMode) {
|
|
16
|
+
export const DeviceSelectionMode = {
|
|
23
17
|
/**
|
|
24
18
|
* Attempts to connect to known device, otherwise asks which device to
|
|
25
19
|
* connect to.
|
|
26
20
|
*/
|
|
27
|
-
|
|
21
|
+
AlwaysAsk: "AlwaysAsk",
|
|
28
22
|
/**
|
|
29
23
|
* Attempts to connect to known device, otherwise attempts to connect to any
|
|
30
24
|
* allowed devices. If that fails, asks which device to connect to.
|
|
31
25
|
*/
|
|
32
|
-
|
|
33
|
-
}
|
|
26
|
+
UseAnyAllowed: "UseAnyAllowed",
|
|
27
|
+
};
|
|
34
28
|
/**
|
|
35
29
|
* A WebUSB connection factory.
|
|
36
30
|
*/
|
|
37
|
-
export const
|
|
31
|
+
export const createUSBConnection = (options) => new MicrobitUSBConnectionImpl(options);
|
|
38
32
|
/**
|
|
39
33
|
* A WebUSB connection to a micro:bit device.
|
|
40
34
|
*/
|
|
41
|
-
class
|
|
35
|
+
class MicrobitUSBConnectionImpl extends TypedEventTarget {
|
|
42
36
|
constructor(options = {}) {
|
|
43
37
|
super();
|
|
38
|
+
Object.defineProperty(this, "type", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: "usb"
|
|
43
|
+
});
|
|
44
44
|
Object.defineProperty(this, "status", {
|
|
45
45
|
enumerable: true,
|
|
46
46
|
configurable: true,
|
|
47
47
|
writable: true,
|
|
48
|
-
value:
|
|
49
|
-
? ConnectionStatus.NO_AUTHORIZED_DEVICE
|
|
50
|
-
: ConnectionStatus.NOT_SUPPORTED
|
|
48
|
+
value: ConnectionStatus.NoAuthorizedDevice
|
|
51
49
|
});
|
|
52
50
|
Object.defineProperty(this, "exclusionFilters", {
|
|
53
51
|
enumerable: true,
|
|
@@ -56,9 +54,18 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
56
54
|
value: void 0
|
|
57
55
|
});
|
|
58
56
|
/**
|
|
59
|
-
* The USB device we last connected to.
|
|
57
|
+
* The raw USB device we last connected to.
|
|
60
58
|
* Cleared if it is disconnected.
|
|
61
59
|
*/
|
|
60
|
+
Object.defineProperty(this, "usbDevice", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
configurable: true,
|
|
63
|
+
writable: true,
|
|
64
|
+
value: void 0
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* Device-specific state. Created on connect, cleared on disconnect.
|
|
68
|
+
*/
|
|
62
69
|
Object.defineProperty(this, "device", {
|
|
63
70
|
enumerable: true,
|
|
64
71
|
configurable: true,
|
|
@@ -66,14 +73,37 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
66
73
|
value: void 0
|
|
67
74
|
});
|
|
68
75
|
/**
|
|
69
|
-
*
|
|
76
|
+
* Cached device properties that persist across reconnections until clearDevice.
|
|
70
77
|
*/
|
|
71
|
-
Object.defineProperty(this, "
|
|
78
|
+
Object.defineProperty(this, "cachedConnectionInfo", {
|
|
72
79
|
enumerable: true,
|
|
73
80
|
configurable: true,
|
|
74
81
|
writable: true,
|
|
75
82
|
value: void 0
|
|
76
83
|
});
|
|
84
|
+
Object.defineProperty(this, "loggedBoardSerialInfo", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
configurable: true,
|
|
87
|
+
writable: true,
|
|
88
|
+
value: void 0
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* Whether CDC pipeline saturation has been performed for this physical
|
|
92
|
+
* USB connection. Once saturated, the buffers stay full until the device
|
|
93
|
+
* is physically disconnected.
|
|
94
|
+
*/
|
|
95
|
+
Object.defineProperty(this, "cdcSaturated", {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
configurable: true,
|
|
98
|
+
writable: true,
|
|
99
|
+
value: false
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* Whether the serial read loop is running.
|
|
103
|
+
*
|
|
104
|
+
* This is false even if we have serial listeners when we're disconnected or flashing.
|
|
105
|
+
* The serial reads interfere with the flash process.
|
|
106
|
+
*/
|
|
77
107
|
Object.defineProperty(this, "serialState", {
|
|
78
108
|
enumerable: true,
|
|
79
109
|
configurable: true,
|
|
@@ -91,7 +121,7 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
91
121
|
configurable: true,
|
|
92
122
|
writable: true,
|
|
93
123
|
value: (data) => {
|
|
94
|
-
this.
|
|
124
|
+
this.dispatchEvent("serialdata", { data });
|
|
95
125
|
}
|
|
96
126
|
});
|
|
97
127
|
Object.defineProperty(this, "flashing", {
|
|
@@ -100,13 +130,7 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
100
130
|
writable: true,
|
|
101
131
|
value: false
|
|
102
132
|
});
|
|
103
|
-
Object.defineProperty(this, "
|
|
104
|
-
enumerable: true,
|
|
105
|
-
configurable: true,
|
|
106
|
-
writable: true,
|
|
107
|
-
value: false
|
|
108
|
-
});
|
|
109
|
-
Object.defineProperty(this, "visibilityReconnect", {
|
|
133
|
+
Object.defineProperty(this, "pauseAfterFlash", {
|
|
110
134
|
enumerable: true,
|
|
111
135
|
configurable: true,
|
|
112
136
|
writable: true,
|
|
@@ -118,27 +142,26 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
118
142
|
writable: true,
|
|
119
143
|
value: () => {
|
|
120
144
|
if (document.visibilityState === "visible") {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.visibilityReconnect = false;
|
|
145
|
+
// We may not have actually paused when we became hidden due to an in-progress flash.
|
|
146
|
+
this.pauseAfterFlash = false;
|
|
147
|
+
if (this.status === ConnectionStatus.Paused) {
|
|
125
148
|
if (!this.flashing) {
|
|
126
149
|
this.log("Reconnecting visible tab");
|
|
127
|
-
|
|
150
|
+
// withEnrichedErrors already disconnects and logs on failure.
|
|
151
|
+
this.connect().catch(() => { });
|
|
128
152
|
}
|
|
129
153
|
}
|
|
130
154
|
}
|
|
131
155
|
else {
|
|
132
|
-
if (!this.unloading && this.status === ConnectionStatus.
|
|
156
|
+
if (!this.unloading && this.status === ConnectionStatus.Connected) {
|
|
133
157
|
if (!this.flashing) {
|
|
134
|
-
this.log("
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
158
|
+
this.log("Pausing connection for hidden tab");
|
|
159
|
+
// Transition to PAUSED not DISCONNECTED
|
|
160
|
+
this.disconnect(false, ConnectionStatus.Paused);
|
|
138
161
|
}
|
|
139
162
|
else {
|
|
140
163
|
this.log("Scheduling disconnect of hidden tab for after flash");
|
|
141
|
-
this.
|
|
164
|
+
this.pauseAfterFlash = true;
|
|
142
165
|
}
|
|
143
166
|
}
|
|
144
167
|
}
|
|
@@ -165,9 +188,9 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
165
188
|
window.addEventListener("focus", () => {
|
|
166
189
|
const assumePageIsStayingOpenDelay = 1000;
|
|
167
190
|
setTimeout(() => {
|
|
168
|
-
if (this.status === ConnectionStatus.
|
|
191
|
+
if (this.status === ConnectionStatus.Connected) {
|
|
169
192
|
this.unloading = false;
|
|
170
|
-
if (this.
|
|
193
|
+
if (this.hasSerialEventListeners()) {
|
|
171
194
|
this.startSerialInternal();
|
|
172
195
|
}
|
|
173
196
|
}
|
|
@@ -187,29 +210,29 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
187
210
|
writable: true,
|
|
188
211
|
value: void 0
|
|
189
212
|
});
|
|
190
|
-
Object.defineProperty(this, "
|
|
213
|
+
Object.defineProperty(this, "pauseOnHidden", {
|
|
191
214
|
enumerable: true,
|
|
192
215
|
configurable: true,
|
|
193
216
|
writable: true,
|
|
194
|
-
value:
|
|
195
|
-
serialdata: 0,
|
|
196
|
-
}
|
|
217
|
+
value: void 0
|
|
197
218
|
});
|
|
198
219
|
Object.defineProperty(this, "handleDisconnect", {
|
|
199
220
|
enumerable: true,
|
|
200
221
|
configurable: true,
|
|
201
222
|
writable: true,
|
|
202
223
|
value: (event) => {
|
|
203
|
-
if (event.device === this.
|
|
204
|
-
this.
|
|
224
|
+
if (event.device === this.usbDevice) {
|
|
225
|
+
this.cdcSaturated = false;
|
|
205
226
|
this.device = undefined;
|
|
206
|
-
this.
|
|
227
|
+
this.usbDevice = undefined;
|
|
228
|
+
this.setStatus(ConnectionStatus.NoAuthorizedDevice);
|
|
207
229
|
}
|
|
208
230
|
}
|
|
209
231
|
});
|
|
210
232
|
this.logging = options.logging || new ConsoleLogging();
|
|
211
233
|
this.deviceSelectionMode =
|
|
212
234
|
options.deviceSelectionMode || DeviceSelectionMode.AlwaysAsk;
|
|
235
|
+
this.pauseOnHidden = options.pauseOnHidden ?? true;
|
|
213
236
|
}
|
|
214
237
|
log(v) {
|
|
215
238
|
this.logging.log(v);
|
|
@@ -220,18 +243,24 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
220
243
|
}
|
|
221
244
|
if (typeof window !== "undefined") {
|
|
222
245
|
window.addEventListener("beforeunload", this.beforeUnloadListener);
|
|
223
|
-
if (window.document) {
|
|
246
|
+
if (this.pauseOnHidden && window.document) {
|
|
224
247
|
window.document.addEventListener("visibilitychange", this.visibilityChangeListener);
|
|
225
248
|
}
|
|
226
249
|
}
|
|
227
250
|
}
|
|
251
|
+
async checkAvailability() {
|
|
252
|
+
if (!navigator.usb) {
|
|
253
|
+
return "unsupported";
|
|
254
|
+
}
|
|
255
|
+
return "available";
|
|
256
|
+
}
|
|
228
257
|
dispose() {
|
|
229
258
|
if (navigator.usb) {
|
|
230
259
|
navigator.usb.removeEventListener("disconnect", this.handleDisconnect);
|
|
231
260
|
}
|
|
232
261
|
if (typeof window !== "undefined") {
|
|
233
262
|
window.removeEventListener("beforeunload", this.beforeUnloadListener);
|
|
234
|
-
if (window.document) {
|
|
263
|
+
if (this.pauseOnHidden && window.document) {
|
|
235
264
|
window.document.removeEventListener("visibilitychange", this.visibilityChangeListener);
|
|
236
265
|
}
|
|
237
266
|
}
|
|
@@ -246,20 +275,22 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
246
275
|
});
|
|
247
276
|
}
|
|
248
277
|
getDeviceId() {
|
|
249
|
-
|
|
278
|
+
assertConnected(this.cachedConnectionInfo);
|
|
279
|
+
return this.cachedConnectionInfo.deviceId;
|
|
250
280
|
}
|
|
251
281
|
getDevice() {
|
|
252
|
-
return this.
|
|
282
|
+
return this.usbDevice;
|
|
253
283
|
}
|
|
254
284
|
getBoardVersion() {
|
|
255
|
-
|
|
285
|
+
assertConnected(this.cachedConnectionInfo);
|
|
286
|
+
return this.cachedConnectionInfo.boardSerialInfo.id.toBoardVersion();
|
|
256
287
|
}
|
|
257
288
|
async flash(dataSource, options) {
|
|
258
289
|
this.flashing = true;
|
|
259
290
|
try {
|
|
260
291
|
const startTime = new Date().getTime();
|
|
261
292
|
await this.withEnrichedErrors(() => this.flashInternal(dataSource, options));
|
|
262
|
-
this.
|
|
293
|
+
this.dispatchEvent("flash");
|
|
263
294
|
const flashTime = new Date().getTime() - startTime;
|
|
264
295
|
this.logging.event({
|
|
265
296
|
type: "WebUSB-time",
|
|
@@ -280,17 +311,41 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
280
311
|
await this.stopSerialInternal();
|
|
281
312
|
this.log("Reconnecting before flash");
|
|
282
313
|
await this.connectInternal(progress);
|
|
283
|
-
if (!this.
|
|
314
|
+
if (!this.device) {
|
|
284
315
|
throw new DeviceError({
|
|
285
|
-
code: "
|
|
316
|
+
code: "connection-error",
|
|
286
317
|
message: "Must be connected now",
|
|
287
318
|
});
|
|
288
319
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
320
|
+
// Saturate DAPLink's CDC buffers on the first flash after physical
|
|
321
|
+
// connection, but only if someone is listening for serial data.
|
|
322
|
+
// Once saturated, the buffers stay full until physical disconnect.
|
|
323
|
+
if (!this.cdcSaturated && this.hasSerialEventListeners()) {
|
|
324
|
+
// Ensure DAPLink's UART is at 115200 before saturation.
|
|
325
|
+
// V1 DAPLink defaults to 9600 on fresh connection.
|
|
326
|
+
// setBaudrate may reset the target, so reinit SWD afterwards.
|
|
327
|
+
const currentBaud = await this.device.serial.getBaudrate();
|
|
328
|
+
if (currentBaud !== 115200) {
|
|
329
|
+
this.log(`Setting DAPLink baud from ${currentBaud} to 115200`);
|
|
330
|
+
await this.device.serial.setBaudrate(115200);
|
|
331
|
+
await this.device.adi.reinit();
|
|
332
|
+
}
|
|
333
|
+
this.log("Halting target");
|
|
334
|
+
await this.device.cortexM.halt();
|
|
335
|
+
const boardVersion = this.cachedConnectionInfo.boardSerialInfo.id.toBoardVersion();
|
|
336
|
+
await saturateCdcPipeline(this.device, boardVersion, this.logging);
|
|
337
|
+
this.cdcSaturated = true;
|
|
338
|
+
await this.device.serial.drain();
|
|
339
|
+
}
|
|
340
|
+
// Halt unconditionally — flash needs the target stopped.
|
|
341
|
+
if (!(await this.device.cortexM.isHalted())) {
|
|
342
|
+
this.log("Halting target");
|
|
343
|
+
await this.device.cortexM.halt();
|
|
344
|
+
}
|
|
345
|
+
const { boardSerialInfo, pageSize, numPages } = this.cachedConnectionInfo;
|
|
346
|
+
const boardVersion = boardSerialInfo.id.toBoardVersion();
|
|
292
347
|
const data = await dataSource(boardVersion);
|
|
293
|
-
const flashing = new PartialFlashing(this.
|
|
348
|
+
const flashing = new PartialFlashing(this.device, this.logging, boardVersion, pageSize, numPages);
|
|
294
349
|
let wasPartial = false;
|
|
295
350
|
try {
|
|
296
351
|
if (partial) {
|
|
@@ -302,18 +357,30 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
302
357
|
}
|
|
303
358
|
finally {
|
|
304
359
|
progress(wasPartial ? ProgressStage.PartialFlashing : ProgressStage.FullFlashing, undefined);
|
|
305
|
-
if (this.
|
|
360
|
+
if (this.pauseAfterFlash) {
|
|
306
361
|
this.log("Disconnecting after flash due to tab visibility");
|
|
307
|
-
this.
|
|
308
|
-
await this.disconnect();
|
|
309
|
-
this.visibilityReconnect = true;
|
|
362
|
+
this.pauseAfterFlash = false;
|
|
363
|
+
await this.disconnect(false, ConnectionStatus.Paused);
|
|
310
364
|
}
|
|
311
365
|
else {
|
|
312
|
-
|
|
366
|
+
await this.device.adi.reinit();
|
|
367
|
+
// Start serial before resetting so we capture startup output.
|
|
368
|
+
// For full flash FLASH_CLOSE already reset the target, so its
|
|
369
|
+
// early output accumulates in DAPLink's 512-byte serial ring
|
|
370
|
+
// buffer until the first read here.
|
|
371
|
+
if (this.hasSerialEventListeners()) {
|
|
313
372
|
this.log("Reinstating serial after flash");
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
373
|
+
await this.startSerialInternal();
|
|
374
|
+
}
|
|
375
|
+
if (wasPartial) {
|
|
376
|
+
// Partial flash writes pages via SWD without resetting.
|
|
377
|
+
// Full flash already resets via FLASH_CLOSE.
|
|
378
|
+
this.log("Resetting micro:bit to run new program");
|
|
379
|
+
try {
|
|
380
|
+
await this.device.cortexM.reset();
|
|
381
|
+
}
|
|
382
|
+
catch (e) {
|
|
383
|
+
// Allow errors on resetting, user can always manually reset if necessary.
|
|
317
384
|
}
|
|
318
385
|
}
|
|
319
386
|
}
|
|
@@ -321,38 +388,51 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
321
388
|
}
|
|
322
389
|
async startSerialInternal() {
|
|
323
390
|
return this.serialStateChangeQueue.add(async () => {
|
|
324
|
-
if (!this.
|
|
391
|
+
if (!this.device || this.serialState) {
|
|
325
392
|
return;
|
|
326
393
|
}
|
|
327
394
|
this.log("Starting serial");
|
|
328
395
|
this.serialState = true;
|
|
329
|
-
this.
|
|
330
|
-
|
|
396
|
+
const serial = this.device.serial;
|
|
397
|
+
const currentBaud = await serial.getBaudrate();
|
|
398
|
+
if (currentBaud !== 115200) {
|
|
399
|
+
// Changing the baud rate causes a micro:bit reset, so only do it if necessary
|
|
400
|
+
await serial.setBaudrate(115200);
|
|
401
|
+
}
|
|
402
|
+
serial
|
|
403
|
+
.startPolling(this.serialListener, 1)
|
|
331
404
|
.then(() => {
|
|
332
405
|
this.log("Finished listening for serial data");
|
|
333
406
|
})
|
|
334
407
|
.catch((e) => {
|
|
335
|
-
this.
|
|
408
|
+
this.dispatchEvent("backgrounderror", {
|
|
409
|
+
error: enrichedError(e),
|
|
410
|
+
event: "serialdata",
|
|
411
|
+
});
|
|
336
412
|
})
|
|
337
413
|
.finally(() => {
|
|
338
414
|
this.serialState = false;
|
|
415
|
+
// Don't reset when paused — the same program is still running and
|
|
416
|
+
// serial will resume when the tab becomes visible again.
|
|
417
|
+
if (this.status !== ConnectionStatus.Paused) {
|
|
418
|
+
this.dispatchEvent("serialreset");
|
|
419
|
+
}
|
|
339
420
|
});
|
|
340
421
|
});
|
|
341
422
|
}
|
|
342
423
|
async stopSerialInternal() {
|
|
343
424
|
return this.serialStateChangeQueue.add(async () => {
|
|
344
|
-
if (!this.
|
|
425
|
+
if (!this.device || !this.serialState) {
|
|
345
426
|
return;
|
|
346
427
|
}
|
|
347
|
-
this.
|
|
348
|
-
this.dispatchTypedEvent("serialreset", new SerialResetEvent());
|
|
428
|
+
this.device.serial.stopPolling();
|
|
349
429
|
});
|
|
350
430
|
}
|
|
351
|
-
async disconnect(quiet) {
|
|
431
|
+
async disconnect(quiet, finalStatus = ConnectionStatus.Disconnected) {
|
|
352
432
|
try {
|
|
353
|
-
if (this.
|
|
433
|
+
if (this.device) {
|
|
354
434
|
await this.stopSerialInternal();
|
|
355
|
-
await this.
|
|
435
|
+
await this.device.disconnect();
|
|
356
436
|
}
|
|
357
437
|
}
|
|
358
438
|
catch (e) {
|
|
@@ -365,8 +445,8 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
365
445
|
}
|
|
366
446
|
}
|
|
367
447
|
finally {
|
|
368
|
-
this.
|
|
369
|
-
this.setStatus(
|
|
448
|
+
this.device = undefined;
|
|
449
|
+
this.setStatus(finalStatus);
|
|
370
450
|
if (!quiet) {
|
|
371
451
|
this.logging.log("Disconnection complete");
|
|
372
452
|
this.logging.event({
|
|
@@ -377,10 +457,30 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
377
457
|
}
|
|
378
458
|
}
|
|
379
459
|
setStatus(newStatus) {
|
|
460
|
+
const previousStatus = this.status;
|
|
380
461
|
this.status = newStatus;
|
|
381
|
-
this.visibilityReconnect = false;
|
|
382
462
|
this.log("USB connection status " + newStatus);
|
|
383
|
-
this.
|
|
463
|
+
this.dispatchEvent("status", {
|
|
464
|
+
status: newStatus,
|
|
465
|
+
previousStatus,
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
logBoardInfo(info) {
|
|
469
|
+
this.logging.event({
|
|
470
|
+
type: "WebUSB-info",
|
|
471
|
+
message: "connected",
|
|
472
|
+
});
|
|
473
|
+
if (!this.loggedBoardSerialInfo || !this.loggedBoardSerialInfo.eq(info)) {
|
|
474
|
+
this.loggedBoardSerialInfo = info;
|
|
475
|
+
this.logging.event({
|
|
476
|
+
type: "WebUSB-info",
|
|
477
|
+
message: "board-id/" + info.id,
|
|
478
|
+
});
|
|
479
|
+
this.logging.event({
|
|
480
|
+
type: "WebUSB-info",
|
|
481
|
+
message: "board-family-hic/" + info.familyId + info.hic,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
384
484
|
}
|
|
385
485
|
async withEnrichedErrors(f) {
|
|
386
486
|
try {
|
|
@@ -414,68 +514,75 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
414
514
|
}
|
|
415
515
|
}
|
|
416
516
|
serialWrite(data) {
|
|
517
|
+
assertConnected(this.device);
|
|
518
|
+
const device = this.device;
|
|
417
519
|
return this.withEnrichedErrors(async () => {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
start = end;
|
|
428
|
-
}
|
|
520
|
+
// WebUSB packets are 64 bytes with a two byte header.
|
|
521
|
+
// https://github.com/microbit-foundation/python-editor-v3/issues/215
|
|
522
|
+
const maxSerialWrite = 62;
|
|
523
|
+
let start = 0;
|
|
524
|
+
while (start < data.length) {
|
|
525
|
+
const end = Math.min(start + maxSerialWrite, data.length);
|
|
526
|
+
const chunkData = data.slice(start, end);
|
|
527
|
+
await device.serial.write(chunkData);
|
|
528
|
+
start = end;
|
|
429
529
|
}
|
|
430
530
|
});
|
|
431
531
|
}
|
|
432
532
|
async softwareReset() {
|
|
433
|
-
|
|
533
|
+
assertConnected(this.device);
|
|
534
|
+
const device = this.device;
|
|
535
|
+
return this.serialStateChangeQueue.add(async () => await device.cortexM.softwareReset());
|
|
434
536
|
}
|
|
435
537
|
async clearDevice() {
|
|
436
538
|
await this.disconnect();
|
|
437
|
-
this.
|
|
438
|
-
this.
|
|
539
|
+
this.usbDevice = undefined;
|
|
540
|
+
this.cachedConnectionInfo = undefined;
|
|
541
|
+
this.cdcSaturated = false;
|
|
542
|
+
this.setStatus(ConnectionStatus.NoAuthorizedDevice);
|
|
439
543
|
}
|
|
440
544
|
async connectInternal(progress) {
|
|
441
545
|
const reportProgress = progress ?? (() => { });
|
|
442
|
-
|
|
546
|
+
reportProgress(ProgressStage.Initializing);
|
|
547
|
+
throwIfUnavailable(await this.checkAvailability());
|
|
548
|
+
if (!this.device && this.usbDevice) {
|
|
443
549
|
reportProgress(ProgressStage.Connecting);
|
|
444
|
-
this.
|
|
445
|
-
await withTimeout(this.
|
|
550
|
+
this.device = new USBDeviceWrapper(this.usbDevice, this.logging);
|
|
551
|
+
this.cachedConnectionInfo = await withTimeout(this.device.reconnect(), 10_000);
|
|
446
552
|
}
|
|
447
|
-
else if (!this.
|
|
553
|
+
else if (!this.device) {
|
|
448
554
|
await this.connectWithOtherDevice(reportProgress);
|
|
449
555
|
}
|
|
450
556
|
else {
|
|
451
557
|
reportProgress(ProgressStage.Connecting);
|
|
452
|
-
await withTimeout(this.
|
|
558
|
+
this.cachedConnectionInfo = await withTimeout(this.device.reconnect(), 10_000);
|
|
453
559
|
}
|
|
454
|
-
|
|
560
|
+
this.logBoardInfo(this.cachedConnectionInfo.boardSerialInfo);
|
|
561
|
+
if (this.hasSerialEventListeners() && !this.flashing) {
|
|
455
562
|
this.startSerialInternal();
|
|
456
563
|
}
|
|
457
|
-
this.setStatus(ConnectionStatus.
|
|
564
|
+
this.setStatus(ConnectionStatus.Connected);
|
|
458
565
|
}
|
|
459
566
|
async connectWithOtherDevice(progress) {
|
|
460
567
|
if (this.deviceSelectionMode === DeviceSelectionMode.UseAnyAllowed) {
|
|
461
568
|
await this.attemptConnectAllowedDevices();
|
|
462
569
|
}
|
|
463
|
-
if (!this.
|
|
570
|
+
if (!this.device) {
|
|
464
571
|
progress(ProgressStage.FindingDevice);
|
|
465
|
-
this.
|
|
572
|
+
this.usbDevice = await this.chooseDevice();
|
|
466
573
|
progress(ProgressStage.Connecting);
|
|
467
|
-
this.
|
|
468
|
-
await withTimeout(this.
|
|
574
|
+
this.device = new USBDeviceWrapper(this.usbDevice, this.logging);
|
|
575
|
+
this.cachedConnectionInfo = await withTimeout(this.device.reconnect(), 10_000);
|
|
469
576
|
}
|
|
470
577
|
}
|
|
471
578
|
// Based on: https://github.com/microsoft/pxt/blob/ab97a2422879824c730f009b15d4bf446b0e8547/pxtlib/webusb.ts#L361
|
|
472
579
|
async attemptConnectAllowedDevices() {
|
|
473
580
|
const pairedDevices = await this.getFilteredAllowedDevices();
|
|
474
|
-
for (const
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
581
|
+
for (const usbDevice of pairedDevices) {
|
|
582
|
+
const device = await this.attemptDeviceConnection(usbDevice);
|
|
583
|
+
if (device) {
|
|
584
|
+
this.usbDevice = usbDevice;
|
|
477
585
|
this.device = device;
|
|
478
|
-
this.connection = connection;
|
|
479
586
|
return;
|
|
480
587
|
}
|
|
481
588
|
}
|
|
@@ -490,34 +597,33 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
490
597
|
const filteredDevices = devices.filter((device) => applyDeviceFilters(device, defaultFilters, this.exclusionFilters ?? []));
|
|
491
598
|
return filteredDevices;
|
|
492
599
|
}
|
|
493
|
-
async attemptDeviceConnection(
|
|
494
|
-
this.log(`Attempting connection to: ${
|
|
495
|
-
this.log(`Serial number: ${
|
|
496
|
-
const
|
|
497
|
-
await withTimeout(
|
|
498
|
-
return
|
|
600
|
+
async attemptDeviceConnection(usbDevice) {
|
|
601
|
+
this.log(`Attempting connection to: ${usbDevice.manufacturerName} ${usbDevice.productName}`);
|
|
602
|
+
this.log(`Serial number: ${usbDevice.serialNumber}`);
|
|
603
|
+
const device = new USBDeviceWrapper(usbDevice, this.logging);
|
|
604
|
+
this.cachedConnectionInfo = await withTimeout(device.reconnect(), 10_000);
|
|
605
|
+
return device;
|
|
499
606
|
}
|
|
500
607
|
async chooseDevice() {
|
|
501
|
-
this.
|
|
608
|
+
this.dispatchEvent("beforerequestdevice");
|
|
502
609
|
try {
|
|
503
|
-
this.
|
|
610
|
+
this.usbDevice = await navigator.usb.requestDevice({
|
|
504
611
|
exclusionFilters: this.exclusionFilters,
|
|
505
612
|
filters: defaultFilters,
|
|
506
613
|
});
|
|
507
614
|
}
|
|
508
615
|
finally {
|
|
509
|
-
this.
|
|
616
|
+
this.dispatchEvent("afterrequestdevice");
|
|
510
617
|
}
|
|
511
|
-
return this.
|
|
618
|
+
return this.usbDevice;
|
|
512
619
|
}
|
|
513
620
|
eventActivated(type) {
|
|
514
621
|
switch (type) {
|
|
515
622
|
case "serialdata": {
|
|
516
|
-
// Prevent starting serial
|
|
517
|
-
if (!this.
|
|
623
|
+
// Prevent starting serial when flashing. We'll reinstate later.
|
|
624
|
+
if (!this.flashing) {
|
|
518
625
|
this.startSerialInternal();
|
|
519
626
|
}
|
|
520
|
-
this.addedListeners.serialdata++;
|
|
521
627
|
break;
|
|
522
628
|
}
|
|
523
629
|
}
|
|
@@ -525,14 +631,14 @@ class MicrobitWebUSBConnectionImpl extends TypedEventTarget {
|
|
|
525
631
|
async eventDeactivated(type) {
|
|
526
632
|
switch (type) {
|
|
527
633
|
case "serialdata": {
|
|
528
|
-
this.
|
|
529
|
-
if (!this.addedListeners.serialdata) {
|
|
530
|
-
this.stopSerialInternal();
|
|
531
|
-
}
|
|
634
|
+
this.stopSerialInternal();
|
|
532
635
|
break;
|
|
533
636
|
}
|
|
534
637
|
}
|
|
535
638
|
}
|
|
639
|
+
hasSerialEventListeners() {
|
|
640
|
+
return this.getActiveEvents().includes("serialdata");
|
|
641
|
+
}
|
|
536
642
|
}
|
|
537
643
|
/**
|
|
538
644
|
* Applying WebUSB device filter. Exported for testing.
|
|
@@ -577,66 +683,42 @@ const hasMatchingInterface = (device, filter) => {
|
|
|
577
683
|
});
|
|
578
684
|
});
|
|
579
685
|
};
|
|
580
|
-
const genericErrorSuggestingReconnect = (e) => new DeviceError({
|
|
581
|
-
code: "reconnect-microbit",
|
|
582
|
-
message: e.message,
|
|
583
|
-
});
|
|
584
|
-
// tslint:disable-next-line: no-any
|
|
585
686
|
const enrichedError = (err) => {
|
|
586
687
|
if (err instanceof DeviceError) {
|
|
587
688
|
return err;
|
|
588
689
|
}
|
|
589
|
-
if (err instanceof
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
err = err.reason;
|
|
600
|
-
}
|
|
601
|
-
// This is somewhat fragile but worth it for scenario specific errors.
|
|
602
|
-
// These messages changed to be prefixed in 2023 so we've relaxed the checks.
|
|
603
|
-
if (/No valid interfaces found/.test(err.message)) {
|
|
604
|
-
// This comes from DAPjs's WebUSB open.
|
|
605
|
-
return new DeviceError({
|
|
606
|
-
code: "update-req",
|
|
607
|
-
message: err.message,
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
else if (/No device selected/.test(err.message)) {
|
|
611
|
-
return new DeviceError({
|
|
612
|
-
code: "no-device-selected",
|
|
613
|
-
message: err.message,
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
else if (/Unable to claim interface/.test(err.message)) {
|
|
617
|
-
return new DeviceError({
|
|
618
|
-
code: "clear-connect",
|
|
619
|
-
message: err.message,
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
else if (err.name === "device-disconnected") {
|
|
623
|
-
return new DeviceError({
|
|
624
|
-
code: "device-disconnected",
|
|
625
|
-
message: err.message,
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
else {
|
|
629
|
-
// Unhandled error. User will need to reconnect their micro:bit
|
|
630
|
-
return genericErrorSuggestingReconnect(err);
|
|
631
|
-
}
|
|
632
|
-
case "string": {
|
|
633
|
-
// Caught a string. Example case: "Flash error" from DAPjs
|
|
634
|
-
return genericErrorSuggestingReconnect(err);
|
|
690
|
+
if (err instanceof Error) {
|
|
691
|
+
// Match Chromium WebUSB DOMException messages for user-friendly error codes.
|
|
692
|
+
// These are hardcoded English strings in Chromium (not localized).
|
|
693
|
+
// https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/renderer/modules/webusb/usb.cc
|
|
694
|
+
if (/No device selected/.test(err.message)) {
|
|
695
|
+
return new DeviceError({
|
|
696
|
+
code: "no-device-selected",
|
|
697
|
+
message: err.message,
|
|
698
|
+
cause: err,
|
|
699
|
+
});
|
|
635
700
|
}
|
|
636
|
-
|
|
637
|
-
|
|
701
|
+
// https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/renderer/modules/webusb/usb_device.cc
|
|
702
|
+
if (/Unable to claim interface/.test(err.message)) {
|
|
703
|
+
return new DeviceError({
|
|
704
|
+
code: "device-in-use",
|
|
705
|
+
message: err.message,
|
|
706
|
+
cause: err,
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
if (/The device was disconnected/.test(err.message)) {
|
|
710
|
+
return new DeviceError({
|
|
711
|
+
code: "device-disconnected",
|
|
712
|
+
message: err.message,
|
|
713
|
+
cause: err,
|
|
714
|
+
});
|
|
638
715
|
}
|
|
639
716
|
}
|
|
717
|
+
return new DeviceError({
|
|
718
|
+
code: "connection-error",
|
|
719
|
+
message: err.message,
|
|
720
|
+
cause: err,
|
|
721
|
+
});
|
|
640
722
|
};
|
|
641
723
|
const rateLimitProgress = (minimumProgressIncrement, callback) => {
|
|
642
724
|
let lastCallValue = -1;
|
|
@@ -653,4 +735,4 @@ const rateLimitProgress = (minimumProgressIncrement, callback) => {
|
|
|
653
735
|
}
|
|
654
736
|
};
|
|
655
737
|
};
|
|
656
|
-
//# sourceMappingURL=
|
|
738
|
+
//# sourceMappingURL=connection.js.map
|