@hangtime/grip-connect 0.3.9 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -64
- package/dist/connect.d.ts +3 -2
- package/dist/connect.js +44 -41
- package/package.json +1 -1
- package/src/connect.ts +49 -40
package/README.md
CHANGED
|
@@ -7,8 +7,7 @@ Force-Sensing Hangboards / Dynamometers / Plates / LED system boards used by cli
|
|
|
7
7
|
the [Griptonite Motherboard](https://griptonite.io/shop/motherboard/), [Climbro](https://climbro.com/),
|
|
8
8
|
[mySmartBoard](https://www.smartboard-climbing.com/), [Entralpi](https://entralpi.com/),
|
|
9
9
|
[Tindeq Progressor](https://tindeq.com/) or
|
|
10
|
-
[Weiheng WH-C06](https://weihengmanufacturer.com/products/wh-c06-bluetooth-300kg-hanging-scale/)
|
|
11
|
-
[MAT Muscle Meter](https://www.matassessment.com/musclemeter).
|
|
10
|
+
[Weiheng WH-C06](https://weihengmanufacturer.com/products/wh-c06-bluetooth-300kg-hanging-scale/).
|
|
12
11
|
|
|
13
12
|
And LED system boards from [Aurora Climbing](https://auroraclimbing.com/) like the
|
|
14
13
|
[Kilter Board](https://settercloset.com/pages/the-kilter-board),
|
|
@@ -52,75 +51,85 @@ import { Motherboard, active, battery, connect, disconnect, info, notify, stream
|
|
|
52
51
|
const motherboardButton = document.querySelector("#motherboard")
|
|
53
52
|
|
|
54
53
|
motherboardButton.addEventListener("click", () => {
|
|
55
|
-
connect(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
54
|
+
connect(
|
|
55
|
+
Motherboard,
|
|
56
|
+
async () => {
|
|
57
|
+
// Listen for stream notifications
|
|
58
|
+
notify((data) => {
|
|
59
|
+
// { massTotal: "0", massMax: "0", massAverage: "0", massLeft: "0", massCenter: "0", massRight: "0" }
|
|
60
|
+
console.log(data)
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
// Check if device is being used
|
|
64
|
+
active((value) => {
|
|
65
|
+
console.log(value)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
// Read battery + device info
|
|
69
|
+
await battery(Motherboard)
|
|
70
|
+
await info(Motherboard)
|
|
71
|
+
|
|
72
|
+
// trigger LEDs
|
|
73
|
+
// await led(device)
|
|
74
|
+
|
|
75
|
+
// Start weight streaming (for a minute) remove parameter for a continues stream
|
|
76
|
+
await stream(Motherboard, 60000)
|
|
77
|
+
|
|
78
|
+
// Manualy tare the device when the stream is running
|
|
79
|
+
// await tare(5000)
|
|
80
|
+
|
|
81
|
+
// Manually call stop method if stream is continues
|
|
82
|
+
// await stop(Motherboard)
|
|
83
|
+
|
|
84
|
+
// Download data as CSV, JSON, or XML (default: CSV) format => timestamp, frame, battery, samples, masses
|
|
85
|
+
// download('json')
|
|
86
|
+
|
|
87
|
+
// Disconnect from device after we are done
|
|
88
|
+
disconnect(Motherboard)
|
|
89
|
+
},
|
|
90
|
+
(error) => {
|
|
91
|
+
// Optinal custom error handeling
|
|
92
|
+
console.error(error.message)
|
|
93
|
+
},
|
|
94
|
+
)
|
|
89
95
|
})
|
|
90
96
|
```
|
|
91
97
|
|
|
92
|
-
##
|
|
98
|
+
## Device support
|
|
93
99
|
|
|
94
|
-
|
|
100
|
+
- ✅ Griptonite - Motherboard
|
|
101
|
+
- ✅ Tindeq - Progressor
|
|
102
|
+
- ✅ Weiheng - WH-C06
|
|
103
|
+
- By default [watchAdvertisements](https://chromestatus.com/feature/5180688812736512) isn't supported . For Chrome,
|
|
104
|
+
enable it at `chrome://flags/#enable-experimental-web-platform-features`.
|
|
105
|
+
- ✅ Kilter Board
|
|
106
|
+
- ⏳ Entralpi (not verified)
|
|
107
|
+
- ➡️ Climbro
|
|
108
|
+
- ➡️ Smartboard Climbing - mySmartBoard
|
|
109
|
+
|
|
110
|
+
## Features
|
|
111
|
+
|
|
112
|
+
**Help wanted:** Do you own any of the missing devices? Use Google Chrome's Bluetooth Internals
|
|
95
113
|
`chrome://bluetooth-internals/#devices` and press `Start Scan` to look for your device, click on `Inspect` and share all
|
|
96
114
|
available services with us.
|
|
97
115
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
- ✅
|
|
101
|
-
- ✅
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
- ✅
|
|
112
|
-
- ✅
|
|
113
|
-
- ✅
|
|
114
|
-
- ✅
|
|
115
|
-
- ✅ Device info: firmware / serial etc.
|
|
116
|
-
- ✅ Check if device is connected
|
|
117
|
-
- ✅ Check if device is being used
|
|
118
|
-
- ✅ Peak / Average load
|
|
119
|
-
- ✅️ Tare / unladen weight
|
|
120
|
-
- ✅️ Download data (CSV, JSON, XML)
|
|
121
|
-
- ➡️ Endurance
|
|
122
|
-
- ➡️ Rate of Force Development: RFD
|
|
123
|
-
- ➡️ Critical Force
|
|
116
|
+
| | Motherboard | Progressor | WH-C06 | Entralpi | Kilter Board | Climbro | mySmartBoard |
|
|
117
|
+
| --------------------------------------------------------------------------------------- | ----------- | ---------- | ------ | -------- | ------------ | ------- | ------------ |
|
|
118
|
+
| [Battery](https://stevie-ray.github.io/hangtime-grip-connect/api/battery.html) | ✅ | ✅ | | | | | |
|
|
119
|
+
| [Calibration](https://stevie-ray.github.io/hangtime-grip-connect/api/calibration.html) | ✅ | | | | | | |
|
|
120
|
+
| [Connect](https://stevie-ray.github.io/hangtime-grip-connect/api/connect.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | |
|
|
121
|
+
| [Disconnect](https://stevie-ray.github.io/hangtime-grip-connect/api/disconnect.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | |
|
|
122
|
+
| [Download](https://stevie-ray.github.io/hangtime-grip-connect/api/download.html) | ✅ | ✅ | | | | | |
|
|
123
|
+
| [Info](https://stevie-ray.github.io/hangtime-grip-connect/api/info.html) | ✅ | ✅ | | | | | |
|
|
124
|
+
| [isActive](https://stevie-ray.github.io/hangtime-grip-connect/api/is-active.html) | ✅ | ✅ | ✅ | ✅ | | | |
|
|
125
|
+
| [isConnected](https://stevie-ray.github.io/hangtime-grip-connect/api/is-connected.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | |
|
|
126
|
+
| [Led](https://stevie-ray.github.io/hangtime-grip-connect/api/led.html) | ✅ | | | | ✅ | | |
|
|
127
|
+
| [Notify](https://stevie-ray.github.io/hangtime-grip-connect/api/notify.html) | ✅ | ✅ | ✅ | ✅ | | | |
|
|
128
|
+
| [Read](https://stevie-ray.github.io/hangtime-grip-connect/api/read.html) | ✅ | | | | | | |
|
|
129
|
+
| [Stop](https://stevie-ray.github.io/hangtime-grip-connect/api/stop.html) | ✅ | ✅ | | | | | |
|
|
130
|
+
| [Stream](https://stevie-ray.github.io/hangtime-grip-connect/api/stream.html) | ✅ | ✅ | | | | | |
|
|
131
|
+
| [Tare](https://stevie-ray.github.io/hangtime-grip-connect/api/tare.html) | ✅ | ✅ | ✅ | ✅ | | | |
|
|
132
|
+
| [Write](https://stevie-ray.github.io/hangtime-grip-connect/api/write.html) | ✅ | ✅ | | | | | |
|
|
124
133
|
|
|
125
134
|
## Development
|
|
126
135
|
|
package/dist/connect.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Device } from "./types/devices";
|
|
|
2
2
|
/**
|
|
3
3
|
* Connects to a Bluetooth device.
|
|
4
4
|
* @param {Device} board - The device to connect to.
|
|
5
|
-
* @param {Function} onSuccess -
|
|
5
|
+
* @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
|
|
6
|
+
* @param {Function} [onError] - Optional callback function to execute on error. Default logs the error.
|
|
6
7
|
*/
|
|
7
|
-
export declare const connect: (board: Device, onSuccess
|
|
8
|
+
export declare const connect: (board: Device, onSuccess?: () => void, onError?: (error: Error) => void) => Promise<void>;
|
package/dist/connect.js
CHANGED
|
@@ -9,7 +9,7 @@ const receiveBuffer = [];
|
|
|
9
9
|
const onDisconnected = (event, board) => {
|
|
10
10
|
board.device = undefined;
|
|
11
11
|
const device = event.target;
|
|
12
|
-
|
|
12
|
+
throw new Error(`Device ${device.name} is disconnected.`);
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Handles notifications received from a characteristic.
|
|
@@ -61,46 +61,40 @@ const handleNotifications = (event, board) => {
|
|
|
61
61
|
* @param {Function} onSuccess - Callback function to execute on successful connection.
|
|
62
62
|
*/
|
|
63
63
|
const onConnected = async (board, onSuccess) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
handleNotifications(event, board);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
64
|
+
// Connect to GATT server and set up characteristics
|
|
65
|
+
const services = await server.getPrimaryServices();
|
|
66
|
+
if (!services || services.length === 0) {
|
|
67
|
+
throw new Error("No services found");
|
|
68
|
+
}
|
|
69
|
+
for (const service of services) {
|
|
70
|
+
const matchingService = board.services.find((boardService) => boardService.uuid === service.uuid);
|
|
71
|
+
if (matchingService) {
|
|
72
|
+
// Android bug: Introduce a delay before getting characteristics
|
|
73
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
74
|
+
const characteristics = await service.getCharacteristics();
|
|
75
|
+
for (const characteristic of matchingService.characteristics) {
|
|
76
|
+
const matchingCharacteristic = characteristics.find((char) => char.uuid === characteristic.uuid);
|
|
77
|
+
if (matchingCharacteristic) {
|
|
78
|
+
const element = matchingService.characteristics.find((char) => char.uuid === matchingCharacteristic.uuid);
|
|
79
|
+
if (element) {
|
|
80
|
+
element.characteristic = matchingCharacteristic;
|
|
81
|
+
// notify
|
|
82
|
+
if (element.id === "rx") {
|
|
83
|
+
matchingCharacteristic.startNotifications();
|
|
84
|
+
matchingCharacteristic.addEventListener("characteristicvaluechanged", (event) => {
|
|
85
|
+
handleNotifications(event, board);
|
|
86
|
+
});
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
throw new Error(`Characteristic ${characteristic.uuid} not found in service ${service.uuid}`);
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
94
|
}
|
|
98
|
-
// Call the onSuccess callback after successful connection and setup
|
|
99
|
-
onSuccess();
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
console.error(error);
|
|
103
95
|
}
|
|
96
|
+
// Call the onSuccess callback after successful connection and setup
|
|
97
|
+
onSuccess();
|
|
104
98
|
};
|
|
105
99
|
/**
|
|
106
100
|
* Returns UUIDs of all services associated with the device.
|
|
@@ -113,9 +107,10 @@ const getAllServiceUUIDs = (device) => {
|
|
|
113
107
|
/**
|
|
114
108
|
* Connects to a Bluetooth device.
|
|
115
109
|
* @param {Device} board - The device to connect to.
|
|
116
|
-
* @param {Function} onSuccess -
|
|
110
|
+
* @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
|
|
111
|
+
* @param {Function} [onError] - Optional callback function to execute on error. Default logs the error.
|
|
117
112
|
*/
|
|
118
|
-
export const connect = async (board, onSuccess) => {
|
|
113
|
+
export const connect = async (board, onSuccess = () => console.log("Connected successfully"), onError = (error) => console.error(error)) => {
|
|
119
114
|
try {
|
|
120
115
|
// Request device and set up connection
|
|
121
116
|
const deviceServices = getAllServiceUUIDs(board);
|
|
@@ -128,8 +123,7 @@ export const connect = async (board, onSuccess) => {
|
|
|
128
123
|
});
|
|
129
124
|
board.device = device;
|
|
130
125
|
if (!board.device.gatt) {
|
|
131
|
-
|
|
132
|
-
return;
|
|
126
|
+
throw new Error("GATT is not available on this device");
|
|
133
127
|
}
|
|
134
128
|
board.device.addEventListener("gattserverdisconnected", (event) => {
|
|
135
129
|
onDisconnected(event, board);
|
|
@@ -145,8 +139,17 @@ export const connect = async (board, onSuccess) => {
|
|
|
145
139
|
handleWHC06Data(manufacturerData);
|
|
146
140
|
}
|
|
147
141
|
});
|
|
142
|
+
// When the companyIdentifier is provided we want to get manufacturerData using watchAdvertisements.
|
|
148
143
|
if (optionalManufacturerData.length) {
|
|
149
|
-
|
|
144
|
+
// Receive events when the system receives an advertisement packet from a watched device.
|
|
145
|
+
// To use this function in Chrome: chrome://flags/#enable-experimental-web-platform-features has to be enabled.
|
|
146
|
+
// More info: https://chromestatus.com/feature/5180688812736512
|
|
147
|
+
if (typeof board.device.watchAdvertisements === "function") {
|
|
148
|
+
await board.device.watchAdvertisements();
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
throw new Error("watchAdvertisements isn't supported. For Chrome, enable it at chrome://flags/#enable-experimental-web-platform-features.");
|
|
152
|
+
}
|
|
150
153
|
}
|
|
151
154
|
server = await board.device.gatt.connect();
|
|
152
155
|
if (server.connected) {
|
|
@@ -154,6 +157,6 @@ export const connect = async (board, onSuccess) => {
|
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
159
|
catch (error) {
|
|
157
|
-
|
|
160
|
+
onError(error);
|
|
158
161
|
}
|
|
159
162
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hangtime/grip-connect",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "A client that can establish connections with various Force-Sensing Hangboards/Plates used by climbers for strength measurement. Examples of such hangboards include the Griptonite Motherboard, Climbro, SmartBoard, Entralpi or Tindeq Progressor",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/src/connect.ts
CHANGED
|
@@ -12,7 +12,7 @@ const receiveBuffer: number[] = []
|
|
|
12
12
|
const onDisconnected = (event: Event, board: Device): void => {
|
|
13
13
|
board.device = undefined
|
|
14
14
|
const device = event.target as BluetoothDevice
|
|
15
|
-
|
|
15
|
+
throw new Error(`Device ${device.name} is disconnected.`)
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Handles notifications received from a characteristic.
|
|
@@ -62,52 +62,47 @@ const handleNotifications = (event: Event, board: Device): void => {
|
|
|
62
62
|
* @param {Function} onSuccess - Callback function to execute on successful connection.
|
|
63
63
|
*/
|
|
64
64
|
const onConnected = async (board: Device, onSuccess: () => void): Promise<void> => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const services: BluetoothRemoteGATTService[] = await server.getPrimaryServices()
|
|
65
|
+
// Connect to GATT server and set up characteristics
|
|
66
|
+
const services: BluetoothRemoteGATTService[] = await server.getPrimaryServices()
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
68
|
+
if (!services || services.length === 0) {
|
|
69
|
+
throw new Error("No services found")
|
|
70
|
+
}
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
for (const service of services) {
|
|
73
|
+
const matchingService = board.services.find((boardService) => boardService.uuid === service.uuid)
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
if (matchingService) {
|
|
76
|
+
// Android bug: Introduce a delay before getting characteristics
|
|
77
|
+
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
80
78
|
|
|
81
|
-
|
|
79
|
+
const characteristics = await service.getCharacteristics()
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
for (const characteristic of matchingService.characteristics) {
|
|
82
|
+
const matchingCharacteristic = characteristics.find((char) => char.uuid === characteristic.uuid)
|
|
85
83
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
if (matchingCharacteristic) {
|
|
85
|
+
const element = matchingService.characteristics.find((char) => char.uuid === matchingCharacteristic.uuid)
|
|
86
|
+
if (element) {
|
|
87
|
+
element.characteristic = matchingCharacteristic
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
89
|
+
// notify
|
|
90
|
+
if (element.id === "rx") {
|
|
91
|
+
matchingCharacteristic.startNotifications()
|
|
92
|
+
matchingCharacteristic.addEventListener("characteristicvaluechanged", (event: Event) => {
|
|
93
|
+
handleNotifications(event, board)
|
|
94
|
+
})
|
|
98
95
|
}
|
|
99
|
-
} else {
|
|
100
|
-
console.warn(`Characteristic ${characteristic.uuid} not found in service ${service.uuid}`)
|
|
101
96
|
}
|
|
97
|
+
} else {
|
|
98
|
+
throw new Error(`Characteristic ${characteristic.uuid} not found in service ${service.uuid}`)
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
|
-
|
|
106
|
-
// Call the onSuccess callback after successful connection and setup
|
|
107
|
-
onSuccess()
|
|
108
|
-
} catch (error) {
|
|
109
|
-
console.error(error)
|
|
110
102
|
}
|
|
103
|
+
|
|
104
|
+
// Call the onSuccess callback after successful connection and setup
|
|
105
|
+
onSuccess()
|
|
111
106
|
}
|
|
112
107
|
/**
|
|
113
108
|
* Returns UUIDs of all services associated with the device.
|
|
@@ -120,9 +115,14 @@ const getAllServiceUUIDs = (device: Device) => {
|
|
|
120
115
|
/**
|
|
121
116
|
* Connects to a Bluetooth device.
|
|
122
117
|
* @param {Device} board - The device to connect to.
|
|
123
|
-
* @param {Function} onSuccess -
|
|
118
|
+
* @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
|
|
119
|
+
* @param {Function} [onError] - Optional callback function to execute on error. Default logs the error.
|
|
124
120
|
*/
|
|
125
|
-
export const connect = async (
|
|
121
|
+
export const connect = async (
|
|
122
|
+
board: Device,
|
|
123
|
+
onSuccess: () => void = () => console.log("Connected successfully"),
|
|
124
|
+
onError: (error: Error) => void = (error) => console.error(error),
|
|
125
|
+
): Promise<void> => {
|
|
126
126
|
try {
|
|
127
127
|
// Request device and set up connection
|
|
128
128
|
const deviceServices = getAllServiceUUIDs(board)
|
|
@@ -141,8 +141,7 @@ export const connect = async (board: Device, onSuccess: () => void): Promise<voi
|
|
|
141
141
|
board.device = device
|
|
142
142
|
|
|
143
143
|
if (!board.device.gatt) {
|
|
144
|
-
|
|
145
|
-
return
|
|
144
|
+
throw new Error("GATT is not available on this device")
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
board.device.addEventListener("gattserverdisconnected", (event) => {
|
|
@@ -162,8 +161,18 @@ export const connect = async (board: Device, onSuccess: () => void): Promise<voi
|
|
|
162
161
|
}
|
|
163
162
|
})
|
|
164
163
|
|
|
164
|
+
// When the companyIdentifier is provided we want to get manufacturerData using watchAdvertisements.
|
|
165
165
|
if (optionalManufacturerData.length) {
|
|
166
|
-
|
|
166
|
+
// Receive events when the system receives an advertisement packet from a watched device.
|
|
167
|
+
// To use this function in Chrome: chrome://flags/#enable-experimental-web-platform-features has to be enabled.
|
|
168
|
+
// More info: https://chromestatus.com/feature/5180688812736512
|
|
169
|
+
if (typeof board.device.watchAdvertisements === "function") {
|
|
170
|
+
await board.device.watchAdvertisements()
|
|
171
|
+
} else {
|
|
172
|
+
throw new Error(
|
|
173
|
+
"watchAdvertisements isn't supported. For Chrome, enable it at chrome://flags/#enable-experimental-web-platform-features.",
|
|
174
|
+
)
|
|
175
|
+
}
|
|
167
176
|
}
|
|
168
177
|
|
|
169
178
|
server = await board.device.gatt.connect()
|
|
@@ -172,6 +181,6 @@ export const connect = async (board: Device, onSuccess: () => void): Promise<voi
|
|
|
172
181
|
await onConnected(board, onSuccess)
|
|
173
182
|
}
|
|
174
183
|
} catch (error) {
|
|
175
|
-
|
|
184
|
+
onError(error as Error)
|
|
176
185
|
}
|
|
177
186
|
}
|