@microbit/microbit-connection 0.0.0-tab.change.177 → 0.9.0-apps.alpha.0
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/LICENSE.md +21 -0
- package/README.md +94 -5
- package/build/cjs/accelerometer-service.d.ts +18 -0
- package/build/cjs/accelerometer-service.js +105 -0
- package/build/cjs/accelerometer-service.js.map +1 -0
- package/build/cjs/accelerometer.js +16 -0
- package/build/cjs/accelerometer.js.map +1 -0
- package/build/{async-util.d.ts → cjs/async-util.d.ts} +9 -0
- package/build/cjs/async-util.js +47 -0
- package/build/cjs/async-util.js.map +1 -0
- package/build/cjs/bluetooth-device-wrapper.d.ts +97 -0
- package/build/cjs/bluetooth-device-wrapper.js +486 -0
- package/build/cjs/bluetooth-device-wrapper.js.map +1 -0
- package/build/{bluetooth-profile.d.ts → cjs/bluetooth-profile.d.ts} +43 -35
- package/build/cjs/bluetooth-profile.js +92 -0
- package/build/cjs/bluetooth-profile.js.map +1 -0
- package/build/cjs/bluetooth.d.ts +112 -0
- package/build/cjs/bluetooth.js +458 -0
- package/build/cjs/bluetooth.js.map +1 -0
- package/build/cjs/board-id.js +81 -0
- package/build/cjs/board-id.js.map +1 -0
- package/build/cjs/board-serial-info.js +51 -0
- package/build/cjs/board-serial-info.js.map +1 -0
- package/build/cjs/button-service.d.ts +13 -0
- package/build/cjs/button-service.js +66 -0
- package/build/cjs/button-service.js.map +1 -0
- package/build/cjs/buttons.js +22 -0
- package/build/cjs/buttons.js.map +1 -0
- package/build/cjs/constants.js +73 -0
- package/build/cjs/constants.js.map +1 -0
- package/build/cjs/device-information-service.d.ts +6 -0
- package/build/cjs/device-information-service.js +34 -0
- package/build/cjs/device-information-service.js.map +1 -0
- package/build/{device.d.ts → cjs/device.d.ts} +71 -39
- package/build/cjs/device.js +147 -0
- package/build/cjs/device.js.map +1 -0
- package/build/cjs/dfu-service.d.ts +9 -0
- package/build/cjs/dfu-service.js +26 -0
- package/build/cjs/dfu-service.js.map +1 -0
- package/build/{events.d.ts → cjs/events.d.ts} +1 -2
- package/build/cjs/events.js +109 -0
- package/build/cjs/events.js.map +1 -0
- package/build/cjs/flashing/flashing-full.d.ts +14 -0
- package/build/cjs/flashing/flashing-full.js +87 -0
- package/build/cjs/flashing/flashing-full.js.map +1 -0
- package/build/cjs/flashing/flashing-makecode.d.ts +6 -0
- package/build/cjs/flashing/flashing-makecode.js +48 -0
- package/build/cjs/flashing/flashing-makecode.js.map +1 -0
- package/build/cjs/flashing/flashing-partial.d.ts +9 -0
- package/build/cjs/flashing/flashing-partial.js +98 -0
- package/build/cjs/flashing/flashing-partial.js.map +1 -0
- package/build/cjs/flashing/flashing-v1.d.ts +11 -0
- package/build/cjs/flashing/flashing-v1.js +24 -0
- package/build/cjs/flashing/flashing-v1.js.map +1 -0
- package/build/cjs/flashing/nordic-dfu.d.ts +3 -0
- package/build/cjs/flashing/nordic-dfu.js +214 -0
- package/build/cjs/flashing/nordic-dfu.js.map +1 -0
- package/build/cjs/flashing/zip.d.ts +12 -0
- package/build/cjs/flashing/zip.js +177 -0
- package/build/cjs/flashing/zip.js.map +1 -0
- package/build/cjs/hex-flash-data-source.js +26 -0
- package/build/cjs/hex-flash-data-source.js.map +1 -0
- package/build/cjs/index.d.ts +17 -0
- package/build/cjs/index.js +37 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/led-service.d.ts +18 -0
- package/build/cjs/led-service.js +89 -0
- package/build/cjs/led-service.js.map +1 -0
- package/build/cjs/led.js +3 -0
- package/build/cjs/led.js.map +1 -0
- package/build/{logging.d.ts → cjs/logging.d.ts} +4 -4
- package/build/cjs/logging.js +16 -0
- package/build/cjs/logging.js.map +1 -0
- package/build/cjs/magnetometer-service.d.ts +18 -0
- package/build/cjs/magnetometer-service.js +94 -0
- package/build/cjs/magnetometer-service.js.map +1 -0
- package/build/cjs/magnetometer.d.ts +9 -0
- package/build/cjs/magnetometer.js +16 -0
- package/build/cjs/magnetometer.js.map +1 -0
- package/build/cjs/package.json +1 -0
- package/build/cjs/partial-flashing-service.d.ts +45 -0
- package/build/cjs/partial-flashing-service.js +110 -0
- package/build/cjs/partial-flashing-service.js.map +1 -0
- package/build/cjs/promise-queue.js +78 -0
- package/build/cjs/promise-queue.js.map +1 -0
- package/build/cjs/serial-events.d.ts +20 -0
- package/build/cjs/serial-events.js +69 -0
- package/build/cjs/serial-events.js.map +1 -0
- package/build/{service-events.d.ts → cjs/service-events.d.ts} +4 -0
- package/build/cjs/service-events.js +39 -0
- package/build/cjs/service-events.js.map +1 -0
- package/build/cjs/setupTests.js.map +1 -0
- package/build/cjs/uart-service.d.ts +12 -0
- package/build/cjs/uart-service.js +55 -0
- package/build/cjs/uart-service.js.map +1 -0
- package/build/cjs/uart.d.ts +4 -0
- package/build/cjs/uart.js +16 -0
- package/build/cjs/uart.js.map +1 -0
- package/build/{usb-device-wrapper.d.ts → cjs/usb-device-wrapper.d.ts} +1 -6
- package/build/cjs/usb-device-wrapper.js +437 -0
- package/build/cjs/usb-device-wrapper.js.map +1 -0
- package/build/cjs/usb-partial-flashing-utils.js +133 -0
- package/build/cjs/usb-partial-flashing-utils.js.map +1 -0
- package/build/{usb-partial-flashing.d.ts → cjs/usb-partial-flashing.d.ts} +3 -5
- package/build/cjs/usb-partial-flashing.js +342 -0
- package/build/cjs/usb-partial-flashing.js.map +1 -0
- package/build/cjs/usb-radio-bridge.d.ts +24 -0
- package/build/cjs/usb-radio-bridge.js +515 -0
- package/build/cjs/usb-radio-bridge.js.map +1 -0
- package/build/cjs/usb-serial-protocol.js +183 -0
- package/build/cjs/usb-serial-protocol.js.map +1 -0
- package/build/cjs/usb.d.ts +66 -0
- package/build/cjs/usb.js +662 -0
- package/build/cjs/usb.js.map +1 -0
- package/build/esm/accelerometer-service.d.ts +18 -0
- package/build/esm/accelerometer-service.js +101 -0
- package/build/esm/accelerometer-service.js.map +1 -0
- package/build/esm/accelerometer.d.ts +9 -0
- package/build/esm/accelerometer.js.map +1 -0
- package/build/esm/async-util.d.ts +22 -0
- package/build/esm/async-util.js +38 -0
- package/build/esm/async-util.js.map +1 -0
- package/build/esm/bluetooth-device-wrapper.d.ts +97 -0
- package/build/esm/bluetooth-device-wrapper.js +481 -0
- package/build/esm/bluetooth-device-wrapper.js.map +1 -0
- package/build/esm/bluetooth-profile.d.ts +147 -0
- package/build/{bluetooth-profile.js → esm/bluetooth-profile.js} +35 -29
- package/build/esm/bluetooth-profile.js.map +1 -0
- package/build/esm/bluetooth.d.ts +112 -0
- package/build/esm/bluetooth.js +428 -0
- package/build/esm/bluetooth.js.map +1 -0
- package/build/esm/board-id.d.ts +36 -0
- package/build/esm/board-id.js.map +1 -0
- package/build/esm/board-serial-info.d.ts +14 -0
- package/build/esm/board-serial-info.js.map +1 -0
- package/build/esm/button-service.d.ts +13 -0
- package/build/esm/button-service.js +62 -0
- package/build/esm/button-service.js.map +1 -0
- package/build/esm/buttons.d.ts +10 -0
- package/build/esm/buttons.js.map +1 -0
- package/build/esm/constants.d.ts +48 -0
- package/build/esm/constants.js.map +1 -0
- package/build/esm/device-information-service.d.ts +6 -0
- package/build/esm/device-information-service.js +30 -0
- package/build/esm/device-information-service.js.map +1 -0
- package/build/esm/device.d.ts +238 -0
- package/build/{device.js → esm/device.js} +16 -58
- package/build/esm/device.js.map +1 -0
- package/build/esm/dfu-service.d.ts +9 -0
- package/build/esm/dfu-service.js +22 -0
- package/build/esm/dfu-service.js.map +1 -0
- package/build/esm/events.d.ts +110 -0
- package/build/esm/events.js.map +1 -0
- package/build/esm/flashing/flashing-full.d.ts +14 -0
- package/build/esm/flashing/flashing-full.js +84 -0
- package/build/esm/flashing/flashing-full.js.map +1 -0
- package/build/esm/flashing/flashing-makecode.d.ts +6 -0
- package/build/esm/flashing/flashing-makecode.js +44 -0
- package/build/esm/flashing/flashing-makecode.js.map +1 -0
- package/build/esm/flashing/flashing-partial.d.ts +9 -0
- package/build/esm/flashing/flashing-partial.js +95 -0
- package/build/esm/flashing/flashing-partial.js.map +1 -0
- package/build/esm/flashing/flashing-v1.d.ts +11 -0
- package/build/esm/flashing/flashing-v1.js +20 -0
- package/build/esm/flashing/flashing-v1.js.map +1 -0
- package/build/esm/flashing/nordic-dfu.d.ts +3 -0
- package/build/esm/flashing/nordic-dfu.js +211 -0
- package/build/esm/flashing/nordic-dfu.js.map +1 -0
- package/build/esm/flashing/zip.d.ts +12 -0
- package/build/esm/flashing/zip.js +174 -0
- package/build/esm/flashing/zip.js.map +1 -0
- package/build/esm/hex-flash-data-source.d.ts +7 -0
- package/build/esm/hex-flash-data-source.js.map +1 -0
- package/build/esm/index.d.ts +17 -0
- package/build/esm/index.js +12 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/led-service.d.ts +18 -0
- package/build/esm/led-service.js +85 -0
- package/build/esm/led-service.js.map +1 -0
- package/build/esm/led.d.ts +6 -0
- package/build/esm/led.js.map +1 -0
- package/build/esm/logging.d.ts +21 -0
- package/build/{logging.js → esm/logging.js} +1 -1
- package/build/esm/logging.js.map +1 -0
- package/build/esm/magnetometer-service.d.ts +18 -0
- package/build/esm/magnetometer-service.js +90 -0
- package/build/esm/magnetometer-service.js.map +1 -0
- package/build/esm/magnetometer.d.ts +9 -0
- package/build/esm/magnetometer.js +12 -0
- package/build/esm/magnetometer.js.map +1 -0
- package/build/esm/package.json +1 -0
- package/build/esm/partial-flashing-service.d.ts +45 -0
- package/build/esm/partial-flashing-service.js +106 -0
- package/build/esm/partial-flashing-service.js.map +1 -0
- package/build/esm/promise-queue.d.ts +27 -0
- package/build/esm/promise-queue.js.map +1 -0
- package/build/esm/serial-events.d.ts +20 -0
- package/build/esm/serial-events.js +61 -0
- package/build/esm/serial-events.js.map +1 -0
- package/build/esm/service-events.d.ts +17 -0
- package/build/{service-events.js → esm/service-events.js} +12 -0
- package/build/esm/service-events.js.map +1 -0
- package/build/esm/setupTests.d.ts +6 -0
- package/build/{setupTests.js.map → esm/setupTests.js.map} +1 -1
- package/build/esm/uart-service.d.ts +12 -0
- package/build/esm/uart-service.js +51 -0
- package/build/esm/uart-service.js.map +1 -0
- package/build/esm/uart.d.ts +4 -0
- package/build/esm/uart.js +12 -0
- package/build/esm/uart.js.map +1 -0
- package/build/esm/usb-device-wrapper.d.ts +47 -0
- package/build/{usb-device-wrapper.js → esm/usb-device-wrapper.js} +43 -17
- package/build/esm/usb-device-wrapper.js.map +1 -0
- package/build/esm/usb-partial-flashing-utils.d.ts +17 -0
- package/build/esm/usb-partial-flashing-utils.js.map +1 -0
- package/build/esm/usb-partial-flashing.d.ts +67 -0
- package/build/{usb-partial-flashing.js → esm/usb-partial-flashing.js} +12 -13
- package/build/esm/usb-partial-flashing.js.map +1 -0
- package/build/esm/usb-radio-bridge.d.ts +24 -0
- package/build/{usb-radio-bridge.js → esm/usb-radio-bridge.js} +13 -7
- package/build/esm/usb-radio-bridge.js.map +1 -0
- package/build/esm/usb-serial-protocol.d.ts +66 -0
- package/build/esm/usb-serial-protocol.js.map +1 -0
- package/build/esm/usb.d.ts +66 -0
- package/build/{usb.js → esm/usb.js} +257 -49
- package/build/esm/usb.js.map +1 -0
- package/package.json +25 -8
- package/typedoc.json +14 -0
- package/build/accelerometer-service.d.ts +0 -18
- package/build/accelerometer-service.js +0 -102
- package/build/accelerometer-service.js.map +0 -1
- package/build/accelerometer.js.map +0 -1
- package/build/async-util.js +0 -22
- package/build/async-util.js.map +0 -1
- package/build/bluetooth-device-wrapper.d.ts +0 -57
- package/build/bluetooth-device-wrapper.js +0 -433
- package/build/bluetooth-device-wrapper.js.map +0 -1
- package/build/bluetooth-profile.js.map +0 -1
- package/build/bluetooth.d.ts +0 -54
- package/build/bluetooth.js +0 -243
- package/build/bluetooth.js.map +0 -1
- package/build/board-id.js.map +0 -1
- package/build/board-serial-info.js.map +0 -1
- package/build/button-service.d.ts +0 -13
- package/build/button-service.js +0 -76
- package/build/button-service.js.map +0 -1
- package/build/buttons.js.map +0 -1
- package/build/constants.js.map +0 -1
- package/build/device.js.map +0 -1
- package/build/events.js.map +0 -1
- package/build/hex-flash-data-source.js.map +0 -1
- package/build/index.d.ts +0 -10
- package/build/index.js +0 -8
- package/build/index.js.map +0 -1
- package/build/led-service.d.ts +0 -20
- package/build/led-service.js +0 -116
- package/build/led-service.js.map +0 -1
- package/build/led.js.map +0 -1
- package/build/logging.js.map +0 -1
- package/build/promise-queue.js.map +0 -1
- package/build/service-events.js.map +0 -1
- package/build/usb-device-wrapper.js.map +0 -1
- package/build/usb-partial-flashing-utils.js.map +0 -1
- package/build/usb-partial-flashing.js.map +0 -1
- package/build/usb-radio-bridge.d.ts +0 -41
- package/build/usb-radio-bridge.js.map +0 -1
- package/build/usb-serial-protocol.js.map +0 -1
- package/build/usb.d.ts +0 -54
- package/build/usb.js.map +0 -1
- package/vite.config.ts +0 -34
- /package/build/{accelerometer.d.ts → cjs/accelerometer.d.ts} +0 -0
- /package/build/{board-id.d.ts → cjs/board-id.d.ts} +0 -0
- /package/build/{board-serial-info.d.ts → cjs/board-serial-info.d.ts} +0 -0
- /package/build/{buttons.d.ts → cjs/buttons.d.ts} +0 -0
- /package/build/{constants.d.ts → cjs/constants.d.ts} +0 -0
- /package/build/{hex-flash-data-source.d.ts → cjs/hex-flash-data-source.d.ts} +0 -0
- /package/build/{led.d.ts → cjs/led.d.ts} +0 -0
- /package/build/{promise-queue.d.ts → cjs/promise-queue.d.ts} +0 -0
- /package/build/{setupTests.d.ts → cjs/setupTests.d.ts} +0 -0
- /package/build/{usb-partial-flashing-utils.d.ts → cjs/usb-partial-flashing-utils.d.ts} +0 -0
- /package/build/{usb-serial-protocol.d.ts → cjs/usb-serial-protocol.d.ts} +0 -0
- /package/build/{accelerometer.js → esm/accelerometer.js} +0 -0
- /package/build/{board-id.js → esm/board-id.js} +0 -0
- /package/build/{board-serial-info.js → esm/board-serial-info.js} +0 -0
- /package/build/{buttons.js → esm/buttons.js} +0 -0
- /package/build/{constants.js → esm/constants.js} +0 -0
- /package/build/{events.js → esm/events.js} +0 -0
- /package/build/{hex-flash-data-source.js → esm/hex-flash-data-source.js} +0 -0
- /package/build/{led.js → esm/led.js} +0 -0
- /package/build/{promise-queue.js → esm/promise-queue.js} +0 -0
- /package/build/{usb-partial-flashing-utils.js → esm/usb-partial-flashing-utils.js} +0 -0
- /package/build/{usb-serial-protocol.js → esm/usb-serial-protocol.js} +0 -0
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
// Very incomplete BT profile
|
|
2
1
|
export const profile = {
|
|
3
|
-
|
|
4
|
-
id: "6e400001-b5a3-f393-e0a9-e50e24dcca9e",
|
|
5
|
-
characteristics: {
|
|
6
|
-
tx: { id: "6e400002-b5a3-f393-e0a9-e50e24dcca9e" },
|
|
7
|
-
rx: { id: "6e400003-b5a3-f393-e0a9-e50e24dcca9e" },
|
|
8
|
-
},
|
|
9
|
-
},
|
|
2
|
+
// Alphabetised
|
|
10
3
|
accelerometer: {
|
|
11
4
|
id: "e95d0753-251d-470a-a062-fa1922dfa9a8",
|
|
12
5
|
characteristics: {
|
|
@@ -14,14 +7,21 @@ export const profile = {
|
|
|
14
7
|
period: { id: "e95dfb24-251d-470a-a062-fa1922dfa9a8" },
|
|
15
8
|
},
|
|
16
9
|
},
|
|
10
|
+
button: {
|
|
11
|
+
id: "e95d9882-251d-470a-a062-fa1922dfa9a8",
|
|
12
|
+
characteristics: {
|
|
13
|
+
a: { id: "e95dda90-251d-470a-a062-fa1922dfa9a8" },
|
|
14
|
+
b: { id: "e95dda91-251d-470a-a062-fa1922dfa9a8" },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
17
|
deviceInformation: {
|
|
18
18
|
id: "0000180a-0000-1000-8000-00805f9b34fb",
|
|
19
19
|
characteristics: {
|
|
20
|
-
modelNumber: { id: "00002a24-0000-1000-8000-00805f9b34fb" },
|
|
21
|
-
serialNumber: { id: "00002a25-0000-1000-8000-00805f9b34fb" },
|
|
22
20
|
firmwareRevision: { id: "00002a26-0000-1000-8000-00805f9b34fb" },
|
|
23
21
|
hardwareRevision: { id: "00002a27-0000-1000-8000-00805f9b34fb" },
|
|
24
22
|
manufacturer: { id: "00002a29-0000-1000-8000-00805f9b34fb" },
|
|
23
|
+
modelNumber: { id: "00002a24-0000-1000-8000-00805f9b34fb" },
|
|
24
|
+
serialNumber: { id: "00002a25-0000-1000-8000-00805f9b34fb" },
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
dfuControl: {
|
|
@@ -30,37 +30,30 @@ export const profile = {
|
|
|
30
30
|
control: { id: "e95d93b1-251d-470a-a062-fa1922dfa9a8" },
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
|
-
|
|
34
|
-
id: "
|
|
33
|
+
event: {
|
|
34
|
+
id: "e95d93af-251d-470a-a062-fa1922dfa9a8",
|
|
35
35
|
characteristics: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
clientEvent: { id: "e95d5404-251d-470a-a062-fa1922dfa9a8" },
|
|
37
|
+
clientRequirements: { id: "e95d23c4-251d-470a-a062-fa1922dfa9a8" },
|
|
38
|
+
microBitEvent: { id: "e95d9775-251d-470a-a062-fa1922dfa9a8" },
|
|
39
|
+
microBitRequirements: { id: "e95db84c-251d-470a-a062-fa1922dfa9a8" },
|
|
39
40
|
},
|
|
40
41
|
},
|
|
41
42
|
ioPin: {
|
|
42
43
|
id: "e95d127b-251d-470a-a062-fa1922dfa9a8",
|
|
43
44
|
characteristics: {
|
|
44
|
-
pinData: { id: "e95d8d00-251d-470a-a062-fa1922dfa9a8" },
|
|
45
45
|
pinAdConfiguration: { id: "e95d5899-251d-470a-a062-fa1922dfa9a8" },
|
|
46
|
+
pinData: { id: "e95d8d00-251d-470a-a062-fa1922dfa9a8" },
|
|
46
47
|
pinIoConfiguration: { id: "e95db9fe-251d-470a-a062-fa1922dfa9a8" },
|
|
47
48
|
pwmControl: { id: "e95dd822-251d-470a-a062-fa1922dfa9a8" },
|
|
48
49
|
},
|
|
49
50
|
},
|
|
50
|
-
|
|
51
|
-
id: "
|
|
52
|
-
characteristics: {
|
|
53
|
-
a: { id: "e95dda90-251d-470a-a062-fa1922dfa9a8" },
|
|
54
|
-
b: { id: "e95dda91-251d-470a-a062-fa1922dfa9a8" },
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
event: {
|
|
58
|
-
id: "e95d93af-251d-470a-a062-fa1922dfa9a8",
|
|
51
|
+
led: {
|
|
52
|
+
id: "e95dd91d-251d-470a-a062-fa1922dfa9a8",
|
|
59
53
|
characteristics: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
clientEvent: { id: "e95d5404-251d-470a-a062-fa1922dfa9a8" },
|
|
54
|
+
matrixState: { id: "e95d7b77-251d-470a-a062-fa1922dfa9a8" },
|
|
55
|
+
scrollingDelay: { id: "e95d0d2d-251d-470a-a062-fa1922dfa9a8" },
|
|
56
|
+
text: { id: "e95d93ee-251d-470a-a062-fa1922dfa9a8" },
|
|
64
57
|
},
|
|
65
58
|
},
|
|
66
59
|
magnetometer: {
|
|
@@ -72,6 +65,12 @@ export const profile = {
|
|
|
72
65
|
calibration: { id: "e95db358-251d-470a-a062-fa1922dfa9a8" },
|
|
73
66
|
},
|
|
74
67
|
},
|
|
68
|
+
partialFlashing: {
|
|
69
|
+
id: "e97dd91d-251d-470a-a062-fa1922dfa9a8",
|
|
70
|
+
characteristics: {
|
|
71
|
+
partialFlash: { id: "e97d3b10-251d-470a-a062-fa1922dfa9a8" },
|
|
72
|
+
},
|
|
73
|
+
},
|
|
75
74
|
temperature: {
|
|
76
75
|
id: "e95d6100-251d-470a-a062-fa1922dfa9a8",
|
|
77
76
|
characteristics: {
|
|
@@ -79,5 +78,12 @@ export const profile = {
|
|
|
79
78
|
period: { id: "e95d1b25-251d-470a-a062-fa1922dfa9a8" },
|
|
80
79
|
},
|
|
81
80
|
},
|
|
81
|
+
uart: {
|
|
82
|
+
id: "6e400001-b5a3-f393-e0a9-e50e24dcca9e",
|
|
83
|
+
characteristics: {
|
|
84
|
+
rx: { id: "6e400003-b5a3-f393-e0a9-e50e24dcca9e" },
|
|
85
|
+
tx: { id: "6e400002-b5a3-f393-e0a9-e50e24dcca9e" },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
82
88
|
};
|
|
83
89
|
//# sourceMappingURL=bluetooth-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bluetooth-profile.js","sourceRoot":"","sources":["../../lib/bluetooth-profile.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,eAAe;IACf,aAAa,EAAE;QACb,EAAE,EAAE,sCAAsC;QAC1C,eAAe,EAAE;YACf,IAAI,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;YACpD,MAAM,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;SACvD;KACF;IACD,MAAM,EAAE;QACN,EAAE,EAAE,sCAAsC;QAC1C,eAAe,EAAE;YACf,CAAC,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;YACjD,CAAC,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;SAClD;KACF;IAED,iBAAiB,EAAE;QACjB,EAAE,EAAE,sCAAsC;QAC1C,eAAe,EAAE;YACf,gBAAgB,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;YAChE,gBAAgB,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;YAChE,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;YAC5D,WAAW,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;YAC3D,YAAY,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;SAC7D;KACF;IACD,UAAU,EAAE;QACV,EAAE,EAAE,sCAAsC;QAC1C,eAAe,EAAE;YACf,OAAO,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;SACxD;KACF;IACD,KAAK,EAAE;QACL,EAAE,EAAE,sCAAsC;QAC1C,eAAe,EAAE;YACf,WAAW,EAAE,EAAE,EAAE,EAAE,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,sCAAsC,EAAE;SACvD;KACF;IACD,IAAI,EAAE;QACJ,EAAE,EAAE,sCAAsC;QAC1C,eAAe,EAAE;YACf,EAAE,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;YAClD,EAAE,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;SACnD;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { AccelerometerData } from "./accelerometer.js";
|
|
2
|
+
import { DeviceConnection, FlashDataSource, FlashOptions } from "./device.js";
|
|
3
|
+
import { LedMatrix } from "./led.js";
|
|
4
|
+
import { Logging } from "./logging.js";
|
|
5
|
+
import { MagnetometerData } from "./magnetometer.js";
|
|
6
|
+
import { ServiceConnectionEventMap } from "./service-events.js";
|
|
7
|
+
export interface MicrobitWebBluetoothConnectionOptions {
|
|
8
|
+
logging?: Logging;
|
|
9
|
+
}
|
|
10
|
+
export interface MicrobitWebBluetoothConnection extends DeviceConnection<ServiceConnectionEventMap> {
|
|
11
|
+
/**
|
|
12
|
+
* Sets micro:bit name filter for device requesting.
|
|
13
|
+
*
|
|
14
|
+
* @param name The name of the micro:bit.
|
|
15
|
+
*/
|
|
16
|
+
setNameFilter(name: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Gets micro:bit accelerometer data.
|
|
19
|
+
*
|
|
20
|
+
* @returns accelerometer data or undefined if there is no connection.
|
|
21
|
+
*/
|
|
22
|
+
getAccelerometerData(): Promise<AccelerometerData | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets micro:bit accelerometer period.
|
|
25
|
+
*
|
|
26
|
+
* @returns accelerometer period or undefined if there is no connection.
|
|
27
|
+
*/
|
|
28
|
+
getAccelerometerPeriod(): Promise<number | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Sets micro:bit accelerometer period.
|
|
31
|
+
*
|
|
32
|
+
* @param value The accelerometer period.
|
|
33
|
+
*/
|
|
34
|
+
setAccelerometerPeriod(value: number): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Sets micro:bit LED text.
|
|
37
|
+
*
|
|
38
|
+
* @param text The text displayed on micro:bit LED.
|
|
39
|
+
*/
|
|
40
|
+
setLedText(text: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets micro:bit LED scrolling delay.
|
|
43
|
+
*
|
|
44
|
+
* @returns LED scrolling delay in milliseconds.
|
|
45
|
+
*/
|
|
46
|
+
getLedScrollingDelay(): Promise<number | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* Sets micro:bit LED scrolling delay.
|
|
49
|
+
*
|
|
50
|
+
* @param delayInMillis LED scrolling delay in milliseconds.
|
|
51
|
+
*/
|
|
52
|
+
setLedScrollingDelay(delayInMillis: number): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Gets micro:bit LED matrix.
|
|
55
|
+
*
|
|
56
|
+
* @returns a boolean matrix representing the micro:bit LED display.
|
|
57
|
+
*/
|
|
58
|
+
getLedMatrix(): Promise<LedMatrix | undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* Sets micro:bit LED matrix.
|
|
61
|
+
*
|
|
62
|
+
* @param matrix an boolean matrix representing the micro:bit LED display.
|
|
63
|
+
*/
|
|
64
|
+
setLedMatrix(matrix: LedMatrix): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Gets micro:bit magnetometer data.
|
|
67
|
+
*
|
|
68
|
+
* @returns magnetometer data.
|
|
69
|
+
*/
|
|
70
|
+
getMagnetometerData(): Promise<MagnetometerData | undefined>;
|
|
71
|
+
/**
|
|
72
|
+
* Gets micro:bit magnetometer bearing.
|
|
73
|
+
*
|
|
74
|
+
* @returns magnetometer bearing.
|
|
75
|
+
*/
|
|
76
|
+
getMagnetometerBearing(): Promise<number | undefined>;
|
|
77
|
+
/**
|
|
78
|
+
* Gets micro:bit magnetometer period.
|
|
79
|
+
*
|
|
80
|
+
* @returns magnetometer period.
|
|
81
|
+
*/
|
|
82
|
+
getMagnetometerPeriod(): Promise<number | undefined>;
|
|
83
|
+
/**
|
|
84
|
+
* Sets micro:bit magnetometer period.
|
|
85
|
+
*
|
|
86
|
+
* @param value magnetometer period.
|
|
87
|
+
*/
|
|
88
|
+
setMagnetometerPeriod(value: number): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Triggers micro:bit magnetometer calibration.
|
|
91
|
+
*/
|
|
92
|
+
triggerMagnetometerCalibration(): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Write UART messages.
|
|
95
|
+
*
|
|
96
|
+
* @param data UART message.
|
|
97
|
+
*/
|
|
98
|
+
uartWrite(data: Uint8Array): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Flash the micro:bit.
|
|
101
|
+
*
|
|
102
|
+
* @param dataSource The data to use.
|
|
103
|
+
* @param options Flash options and progress callback.
|
|
104
|
+
* @throws {DeviceError} On flash failure. The error.code property indicates the failure type.
|
|
105
|
+
* @throws {FlashDataError} If data preparation fails.
|
|
106
|
+
*/
|
|
107
|
+
flash(dataSource: FlashDataSource, options: FlashOptions): Promise<void>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A Bluetooth connection factory.
|
|
111
|
+
*/
|
|
112
|
+
export declare const createWebBluetoothConnection: (options?: MicrobitWebBluetoothConnectionOptions) => MicrobitWebBluetoothConnection;
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) 2021, Micro:bit Educational Foundation and contributors
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { BleClient } from "@capacitor-community/bluetooth-le";
|
|
7
|
+
import { Capacitor } from "@capacitor/core";
|
|
8
|
+
import MemoryMap from "nrf-intel-hex";
|
|
9
|
+
import { BluetoothDeviceWrapper, isAndroid, scanningTimeoutInMs, } from "./bluetooth-device-wrapper.js";
|
|
10
|
+
import { profile } from "./bluetooth-profile.js";
|
|
11
|
+
import { AfterRequestDevice, BeforeRequestDevice, ConnectionStatus, ConnectionStatusEvent, DeviceError, FlashDataError, ProgressStage, } from "./device.js";
|
|
12
|
+
import { TypedEventTarget } from "./events.js";
|
|
13
|
+
import { ConsoleLogging } from "./logging.js";
|
|
14
|
+
import { fullFlash } from "./flashing/flashing-full.js";
|
|
15
|
+
import partialFlash, { PartialFlashResult, } from "./flashing/flashing-partial.js";
|
|
16
|
+
let bleClientInitialized = false;
|
|
17
|
+
/**
|
|
18
|
+
* A Bluetooth connection factory.
|
|
19
|
+
*/
|
|
20
|
+
export const createWebBluetoothConnection = (options) => new MicrobitWebBluetoothConnectionImpl(options);
|
|
21
|
+
/**
|
|
22
|
+
* A Bluetooth connection to a micro:bit device.
|
|
23
|
+
*/
|
|
24
|
+
class MicrobitWebBluetoothConnectionImpl extends TypedEventTarget {
|
|
25
|
+
constructor(options = {}) {
|
|
26
|
+
super();
|
|
27
|
+
Object.defineProperty(this, "status", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: ConnectionStatus.SUPPORT_NOT_KNOWN
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* The USB device we last connected to.
|
|
35
|
+
* Cleared if it is disconnected.
|
|
36
|
+
*/
|
|
37
|
+
Object.defineProperty(this, "device", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(this, "logging", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: void 0
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(this, "connection", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: void 0
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(this, "availabilityListener", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: (e) => {
|
|
60
|
+
// TODO: is this called? is `value` correct?
|
|
61
|
+
const value = e.value;
|
|
62
|
+
this.availability = value;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(this, "availability", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
configurable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
value: void 0
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(this, "nameFilter", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
configurable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
value: void 0
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(this, "deferStatusUpdates", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: false
|
|
82
|
+
});
|
|
83
|
+
this.logging = options.logging || new ConsoleLogging();
|
|
84
|
+
}
|
|
85
|
+
eventActivated(type) {
|
|
86
|
+
this.connection?.startNotifications(type);
|
|
87
|
+
}
|
|
88
|
+
eventDeactivated(type) {
|
|
89
|
+
this.connection?.stopNotifications(type);
|
|
90
|
+
}
|
|
91
|
+
log(v) {
|
|
92
|
+
this.logging.log(v);
|
|
93
|
+
}
|
|
94
|
+
error(message, e) {
|
|
95
|
+
this.logging.error(message, e);
|
|
96
|
+
}
|
|
97
|
+
async initialize() {
|
|
98
|
+
navigator.bluetooth?.addEventListener("availabilitychanged", this.availabilityListener);
|
|
99
|
+
this.availability = await navigator.bluetooth?.getAvailability();
|
|
100
|
+
this.setStatus(this.availability
|
|
101
|
+
? ConnectionStatus.NO_AUTHORIZED_DEVICE
|
|
102
|
+
: ConnectionStatus.NOT_SUPPORTED);
|
|
103
|
+
}
|
|
104
|
+
dispose() {
|
|
105
|
+
navigator.bluetooth?.removeEventListener("availabilitychanged", this.availabilityListener);
|
|
106
|
+
}
|
|
107
|
+
getBoardVersion() {
|
|
108
|
+
return this.connection?.boardVersion;
|
|
109
|
+
}
|
|
110
|
+
async connect(options) {
|
|
111
|
+
const progress = options?.progress ?? (() => { });
|
|
112
|
+
progress(ProgressStage.Initializing);
|
|
113
|
+
await this.preConnectInitialization();
|
|
114
|
+
if (!this.connection) {
|
|
115
|
+
progress(ProgressStage.FindingDevice);
|
|
116
|
+
const device = await this.requestDevice();
|
|
117
|
+
this.connection = new BluetoothDeviceWrapper(device, this.logging, this.dispatchTypedEvent.bind(this), () => this.getActiveEvents(), {
|
|
118
|
+
onConnecting: () => this.setStatus(ConnectionStatus.CONNECTING),
|
|
119
|
+
onReconnecting: () => this.setStatus(ConnectionStatus.RECONNECTING),
|
|
120
|
+
onSuccess: () => this.setStatus(ConnectionStatus.CONNECTED),
|
|
121
|
+
onFail: () => {
|
|
122
|
+
this.setStatus(ConnectionStatus.DISCONNECTED);
|
|
123
|
+
this.connection = undefined;
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
progress(ProgressStage.Connecting);
|
|
128
|
+
await this.connection.connect();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Initializes BLE.
|
|
132
|
+
*
|
|
133
|
+
* This must happen before requesting a device or connecting.
|
|
134
|
+
*
|
|
135
|
+
* We do this just before use not at connection initialize because on Android/iOS
|
|
136
|
+
* that's the appropriate time to ask for permissions.
|
|
137
|
+
*/
|
|
138
|
+
async preConnectInitialization() {
|
|
139
|
+
try {
|
|
140
|
+
if (isAndroid()) {
|
|
141
|
+
const isLocationEnabled = await BleClient.isLocationEnabled();
|
|
142
|
+
if (!isLocationEnabled) {
|
|
143
|
+
throw new DeviceError({
|
|
144
|
+
code: "bluetooth-missing-permissions",
|
|
145
|
+
message: "Location services is disabled",
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (!bleClientInitialized) {
|
|
150
|
+
await BleClient.initialize({ androidNeverForLocation: true });
|
|
151
|
+
bleClientInitialized = true;
|
|
152
|
+
}
|
|
153
|
+
const isBluetoothEnabled = await BleClient.isEnabled();
|
|
154
|
+
if (!isBluetoothEnabled) {
|
|
155
|
+
throw new DeviceError({
|
|
156
|
+
code: "bluetooth-disabled",
|
|
157
|
+
message: "Bluetooth is disabled",
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
this.error("Error initializing Bluetooth", e);
|
|
163
|
+
const error = e;
|
|
164
|
+
if (error.message === "BLE permission denied") {
|
|
165
|
+
// Error thrown for iOS platform.
|
|
166
|
+
throw new DeviceError({
|
|
167
|
+
code: "bluetooth-disabled",
|
|
168
|
+
message: "Bluetooth is disabled",
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
throw new DeviceError({
|
|
172
|
+
code: "bluetooth-missing-permissions",
|
|
173
|
+
message: "Missing permissions",
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async disconnect() {
|
|
178
|
+
try {
|
|
179
|
+
if (this.connection) {
|
|
180
|
+
await this.connection.disconnect();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
this.logging.event({
|
|
185
|
+
type: "Bluetooth-error",
|
|
186
|
+
message: "error-disconnecting",
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
finally {
|
|
190
|
+
this.connection = undefined;
|
|
191
|
+
this.setStatus(ConnectionStatus.DISCONNECTED);
|
|
192
|
+
this.logging.event({
|
|
193
|
+
type: "Bluetooth-info",
|
|
194
|
+
message: "disconnected",
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
setStatus(newStatus) {
|
|
199
|
+
this.status = newStatus;
|
|
200
|
+
this.log("Bluetooth connection status " + newStatus);
|
|
201
|
+
if (!this.deferStatusUpdates) {
|
|
202
|
+
this.dispatchTypedEvent("status", new ConnectionStatusEvent(newStatus));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
serialWrite(data) {
|
|
206
|
+
if (this.connection) {
|
|
207
|
+
// TODO
|
|
208
|
+
}
|
|
209
|
+
return Promise.resolve();
|
|
210
|
+
}
|
|
211
|
+
async clearDevice() {
|
|
212
|
+
await this.disconnect();
|
|
213
|
+
this.device = undefined;
|
|
214
|
+
this.setStatus(ConnectionStatus.NO_AUTHORIZED_DEVICE);
|
|
215
|
+
}
|
|
216
|
+
setNameFilter(name) {
|
|
217
|
+
this.nameFilter = name;
|
|
218
|
+
}
|
|
219
|
+
async requestDevice() {
|
|
220
|
+
if (this.device) {
|
|
221
|
+
return this.device;
|
|
222
|
+
}
|
|
223
|
+
this.dispatchTypedEvent("beforerequestdevice", new BeforeRequestDevice());
|
|
224
|
+
try {
|
|
225
|
+
const namePrefix = this.nameFilter
|
|
226
|
+
? `BBC micro:bit [${this.nameFilter}]`
|
|
227
|
+
: "BBC micro:bit";
|
|
228
|
+
if (Capacitor.isNativePlatform()) {
|
|
229
|
+
this.device = await this.requestDeviceNative(namePrefix);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
this.device = await this.requestDeviceWeb(namePrefix);
|
|
233
|
+
}
|
|
234
|
+
if (!this.device) {
|
|
235
|
+
this.setStatus(ConnectionStatus.NO_AUTHORIZED_DEVICE);
|
|
236
|
+
throw new DeviceError({
|
|
237
|
+
code: "timeout-error",
|
|
238
|
+
message: "Timeout scanning for device",
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return this.device;
|
|
242
|
+
}
|
|
243
|
+
finally {
|
|
244
|
+
this.dispatchTypedEvent("afterrequestdevice", new AfterRequestDevice());
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
async getAccelerometerData() {
|
|
248
|
+
return this.connection?.accelerometer.getData();
|
|
249
|
+
}
|
|
250
|
+
async getAccelerometerPeriod() {
|
|
251
|
+
return this.connection?.accelerometer.getPeriod();
|
|
252
|
+
}
|
|
253
|
+
async setAccelerometerPeriod(value) {
|
|
254
|
+
return this.connection?.accelerometer.setPeriod(value);
|
|
255
|
+
}
|
|
256
|
+
async setLedText(text) {
|
|
257
|
+
return this.connection?.led.setText(text);
|
|
258
|
+
}
|
|
259
|
+
async getLedScrollingDelay() {
|
|
260
|
+
return this.connection?.led.getScrollingDelay();
|
|
261
|
+
}
|
|
262
|
+
async setLedScrollingDelay(delayInMillis) {
|
|
263
|
+
await this.connection?.led.setScrollingDelay(delayInMillis);
|
|
264
|
+
}
|
|
265
|
+
async getLedMatrix() {
|
|
266
|
+
return await this.connection?.led.getLedMatrix();
|
|
267
|
+
}
|
|
268
|
+
async setLedMatrix(matrix) {
|
|
269
|
+
await this.connection?.led.setLedMatrix(matrix);
|
|
270
|
+
}
|
|
271
|
+
async getMagnetometerData() {
|
|
272
|
+
return this.connection?.magnetometer.getData();
|
|
273
|
+
}
|
|
274
|
+
async getMagnetometerPeriod() {
|
|
275
|
+
return this.connection?.magnetometer.getPeriod();
|
|
276
|
+
}
|
|
277
|
+
async setMagnetometerPeriod(value) {
|
|
278
|
+
return this.connection?.magnetometer.setPeriod(value);
|
|
279
|
+
}
|
|
280
|
+
async getMagnetometerBearing() {
|
|
281
|
+
return this.connection?.magnetometer.getBearing();
|
|
282
|
+
}
|
|
283
|
+
async triggerMagnetometerCalibration() {
|
|
284
|
+
await this.connection?.magnetometer.triggerCalibration();
|
|
285
|
+
}
|
|
286
|
+
async uartWrite(data) {
|
|
287
|
+
await this.connection?.uart.writeData(data);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Flash the micro:bit.
|
|
291
|
+
*
|
|
292
|
+
* Note that this will always leave the connection disconnected.
|
|
293
|
+
*
|
|
294
|
+
* @param dataSource The data to use.
|
|
295
|
+
* @param options Flash options and progress callback.
|
|
296
|
+
*/
|
|
297
|
+
async flash(dataSource, options = {}) {
|
|
298
|
+
const progress = options.progress ?? (() => { });
|
|
299
|
+
try {
|
|
300
|
+
// We'll disconnect/reconnect multiple times due to device resets, but reporting this is unhelpful.
|
|
301
|
+
this.deferStatusUpdates = true;
|
|
302
|
+
if (this.status !== ConnectionStatus.CONNECTED) {
|
|
303
|
+
await this.connect({ progress });
|
|
304
|
+
}
|
|
305
|
+
const connection = this.connection;
|
|
306
|
+
try {
|
|
307
|
+
const boardVersion = connection.boardVersion;
|
|
308
|
+
if (!boardVersion) {
|
|
309
|
+
throw new DeviceError({
|
|
310
|
+
code: "device-disconnected",
|
|
311
|
+
message: "No board version found",
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
const memoryMap = convertDataToMemoryMap(await dataSource(boardVersion));
|
|
315
|
+
if (!memoryMap) {
|
|
316
|
+
throw new FlashDataError("Could not convert hex to memory map");
|
|
317
|
+
}
|
|
318
|
+
if (!this.device) {
|
|
319
|
+
throw new DeviceError({
|
|
320
|
+
code: "device-disconnected",
|
|
321
|
+
message: "No device",
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
this.log(`Got board version ${boardVersion}`);
|
|
325
|
+
const partialFlashResult = await partialFlash(connection, memoryMap, progress);
|
|
326
|
+
if (partialFlashResult === PartialFlashResult.AttemptFullFlash) {
|
|
327
|
+
await fullFlash(connection, boardVersion, memoryMap, progress);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
catch (e) {
|
|
331
|
+
this.error("Failed to flash", e);
|
|
332
|
+
throw e;
|
|
333
|
+
}
|
|
334
|
+
finally {
|
|
335
|
+
await this.disconnect();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
finally {
|
|
339
|
+
this.deferStatusUpdates = false;
|
|
340
|
+
this.dispatchTypedEvent("status", new ConnectionStatusEvent(this.status));
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
async requestDeviceWeb(namePrefix) {
|
|
344
|
+
return await BleClient.requestDevice({
|
|
345
|
+
namePrefix: this.nameFilter
|
|
346
|
+
? `BBC micro:bit [${namePrefix}]`
|
|
347
|
+
: "BBC micro:bit",
|
|
348
|
+
// TODO: is this possible to reinstate?
|
|
349
|
+
// See https://github.com/bsiever/microbit-pxt-blehid/issues/31
|
|
350
|
+
//namePrefix: this.nameFilter
|
|
351
|
+
// ? `uBit [${this.nameFilter}]`
|
|
352
|
+
// : "uBit",
|
|
353
|
+
optionalServices: [
|
|
354
|
+
profile.accelerometer.id,
|
|
355
|
+
profile.button.id,
|
|
356
|
+
profile.deviceInformation.id,
|
|
357
|
+
profile.dfuControl.id,
|
|
358
|
+
profile.event.id,
|
|
359
|
+
profile.ioPin.id,
|
|
360
|
+
profile.led.id,
|
|
361
|
+
profile.magnetometer.id,
|
|
362
|
+
profile.temperature.id,
|
|
363
|
+
profile.uart.id,
|
|
364
|
+
],
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Finds device with specified name prefix.
|
|
369
|
+
*
|
|
370
|
+
* @returns device or undefined if none can be found.
|
|
371
|
+
*/
|
|
372
|
+
async requestDeviceNative(namePrefix) {
|
|
373
|
+
// Check for existing bonded devices.
|
|
374
|
+
const bonded = await this.checkBondedDevices((device) => {
|
|
375
|
+
const name = device.name;
|
|
376
|
+
return !!name && name.startsWith(namePrefix);
|
|
377
|
+
});
|
|
378
|
+
if (bonded) {
|
|
379
|
+
return bonded;
|
|
380
|
+
}
|
|
381
|
+
this.log(`Scanning for device - ${namePrefix}`);
|
|
382
|
+
let found = false;
|
|
383
|
+
const scanPromise = new Promise((resolve) =>
|
|
384
|
+
// This only resolves when we stop the scan.
|
|
385
|
+
void BleClient.requestLEScan({}, async (result) => {
|
|
386
|
+
// For a V1 in the Nordic bootloader, we see a name of "DfuTarg" that
|
|
387
|
+
// isn't matched by the name filter but the advertising name is in the
|
|
388
|
+
// localName on the device. So we filter here instead. This happens on
|
|
389
|
+
// iOS if DFU fails / is interrupted.
|
|
390
|
+
if (result.device.name?.startsWith(namePrefix) ||
|
|
391
|
+
result.localName?.startsWith(namePrefix)) {
|
|
392
|
+
found = true;
|
|
393
|
+
await BleClient.stopLEScan();
|
|
394
|
+
resolve(result.device);
|
|
395
|
+
}
|
|
396
|
+
}));
|
|
397
|
+
const scanTimeoutPromise = new Promise((resolve) => setTimeout(async () => {
|
|
398
|
+
if (!found) {
|
|
399
|
+
await BleClient.stopLEScan();
|
|
400
|
+
this.log("Timeout scanning for device");
|
|
401
|
+
resolve(undefined);
|
|
402
|
+
}
|
|
403
|
+
}, scanningTimeoutInMs));
|
|
404
|
+
return await Promise.race([scanPromise, scanTimeoutPromise]);
|
|
405
|
+
}
|
|
406
|
+
async checkBondedDevices(predicate) {
|
|
407
|
+
if (!isAndroid()) {
|
|
408
|
+
// Not supported.
|
|
409
|
+
return undefined;
|
|
410
|
+
}
|
|
411
|
+
const bondedDevices = await BleClient.getBondedDevices();
|
|
412
|
+
const result = bondedDevices.find(predicate);
|
|
413
|
+
this.log(result === undefined
|
|
414
|
+
? "No matching bonded device"
|
|
415
|
+
: "Found matching bonded device");
|
|
416
|
+
return result;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
const convertDataToMemoryMap = (data) => {
|
|
420
|
+
if (data instanceof MemoryMap) {
|
|
421
|
+
return data;
|
|
422
|
+
}
|
|
423
|
+
if (data instanceof Uint8Array) {
|
|
424
|
+
return MemoryMap.fromPaddedUint8Array(data);
|
|
425
|
+
}
|
|
426
|
+
return MemoryMap.fromHex(data);
|
|
427
|
+
};
|
|
428
|
+
//# sourceMappingURL=bluetooth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bluetooth.js","sourceRoot":"","sources":["../../lib/bluetooth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAa,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,SAAS,MAAM,eAAe,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,SAAS,EACT,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACj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