@hangtime/grip-connect 0.4.2 → 0.5.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/README.md +49 -40
- package/dist/characteristic.d.ts +1 -1
- package/dist/commands/forceboard.d.ts +6 -0
- package/dist/commands/forceboard.js +5 -0
- package/dist/commands/index.d.ts +3 -2
- package/dist/commands/index.js +3 -2
- package/dist/index.d.ts +1 -13
- package/dist/index.js +3 -23
- package/dist/interfaces/base.interface.d.ts +5 -0
- package/dist/interfaces/device/climbro.interface.d.ts +3 -0
- package/dist/interfaces/device/climbro.interface.js +1 -0
- package/dist/interfaces/device/entralpi.interface.d.ts +3 -0
- package/dist/interfaces/device/entralpi.interface.js +1 -0
- package/dist/interfaces/device/forceboard.interface.d.ts +3 -0
- package/dist/interfaces/device/forceboard.interface.js +1 -0
- package/dist/interfaces/device/kilterboard.interface.d.ts +3 -0
- package/dist/interfaces/device/kilterboard.interface.js +1 -0
- package/dist/interfaces/device/motherboard.interface.d.ts +10 -0
- package/dist/interfaces/device/motherboard.interface.js +1 -0
- package/dist/interfaces/device/mysmartboard.interface.d.ts +3 -0
- package/dist/interfaces/device/mysmartboard.interface.js +1 -0
- package/dist/interfaces/device/progressor.interface.d.ts +3 -0
- package/dist/interfaces/device/progressor.interface.js +1 -0
- package/dist/interfaces/device/wh-c06.interface.d.ts +3 -0
- package/dist/interfaces/device/wh-c06.interface.js +1 -0
- package/dist/interfaces/device.interface.d.ts +76 -0
- package/dist/interfaces/device.interface.js +1 -0
- package/dist/is-device.d.ts +19 -13
- package/dist/is-device.js +19 -13
- package/dist/models/base.model.d.ts +7 -0
- package/dist/models/base.model.js +10 -0
- package/dist/models/device/climbro.model.d.ts +9 -0
- package/dist/models/device/climbro.model.js +13 -0
- package/dist/models/device/entralpi.model.d.ts +43 -0
- package/dist/models/device/entralpi.model.js +246 -0
- package/dist/models/device/forceboard.model.d.ts +23 -0
- package/dist/models/device/forceboard.model.js +201 -0
- package/dist/models/device/kilterboard.model.d.ts +85 -0
- package/dist/models/device/kilterboard.model.js +213 -0
- package/dist/models/device/motherboard.model.d.ts +76 -0
- package/dist/models/device/motherboard.model.js +391 -0
- package/dist/models/device/mysmartboard.model.d.ts +9 -0
- package/dist/models/device/mysmartboard.model.js +13 -0
- package/dist/models/device/progressor.model.d.ts +32 -0
- package/dist/models/device/progressor.model.js +177 -0
- package/dist/models/device/wh-c06.model.d.ts +15 -0
- package/dist/models/device/wh-c06.model.js +97 -0
- package/dist/models/device.model.d.ts +45 -0
- package/dist/models/device.model.js +140 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +8 -0
- package/dist/notify.js +1 -1
- package/dist/read.d.ts +1 -1
- package/dist/read.js +1 -2
- package/dist/stop.d.ts +1 -1
- package/dist/stop.js +1 -2
- package/dist/write.d.ts +1 -1
- package/dist/write.js +1 -2
- package/package.json +4 -2
- package/src/characteristic.ts +1 -1
- package/src/commands/forceboard.ts +6 -0
- package/src/commands/index.ts +4 -2
- package/src/index.ts +14 -27
- package/src/interfaces/base.interface.ts +5 -0
- package/src/interfaces/device/climbro.interface.ts +4 -0
- package/src/interfaces/device/entralpi.interface.ts +4 -0
- package/src/interfaces/device/forceboard.interface.ts +4 -0
- package/src/interfaces/device/kilterboard.interface.ts +4 -0
- package/src/interfaces/device/motherboard.interface.ts +11 -0
- package/src/interfaces/device/mysmartboard.interface.ts +4 -0
- package/src/interfaces/device/progressor.interface.ts +4 -0
- package/src/interfaces/device/wh-c06.interface.ts +4 -0
- package/src/interfaces/device.interface.ts +85 -0
- package/src/is-device.ts +23 -16
- package/src/models/base.model.ts +16 -0
- package/src/models/device/climbro.model.ts +15 -0
- package/src/models/device/entralpi.model.ts +264 -0
- package/src/models/device/forceboard.model.ts +206 -0
- package/src/models/device/kilterboard.model.ts +229 -0
- package/src/models/device/motherboard.model.ts +430 -0
- package/src/models/device/mysmartboard.model.ts +15 -0
- package/src/models/device/progressor.model.ts +184 -0
- package/src/models/device/wh-c06.model.ts +118 -0
- package/src/models/device.model.ts +159 -0
- package/src/models/index.ts +15 -0
- package/src/notify.ts +1 -1
- package/src/read.ts +2 -3
- package/src/stop.ts +2 -3
- package/src/write.ts +2 -3
- package/dist/battery.d.ts +0 -10
- package/dist/battery.js +0 -34
- package/dist/calibration.d.ts +0 -7
- package/dist/calibration.js +0 -21
- package/dist/connect.d.ts +0 -8
- package/dist/connect.js +0 -163
- package/dist/data/entralpi.d.ts +0 -5
- package/dist/data/entralpi.js +0 -33
- package/dist/data/index.d.ts +0 -4
- package/dist/data/index.js +0 -4
- package/dist/data/motherboard.d.ts +0 -10
- package/dist/data/motherboard.js +0 -141
- package/dist/data/progressor.d.ts +0 -9
- package/dist/data/progressor.js +0 -78
- package/dist/data/wh-c06.d.ts +0 -5
- package/dist/data/wh-c06.js +0 -38
- package/dist/devices/climbro.d.ts +0 -6
- package/dist/devices/climbro.js +0 -8
- package/dist/devices/entralpi.d.ts +0 -5
- package/dist/devices/entralpi.js +0 -59
- package/dist/devices/index.d.ts +0 -7
- package/dist/devices/index.js +0 -7
- package/dist/devices/kilterboard.d.ts +0 -10
- package/dist/devices/kilterboard.js +0 -34
- package/dist/devices/motherboard.d.ts +0 -5
- package/dist/devices/motherboard.js +0 -81
- package/dist/devices/mysmartboard.d.ts +0 -6
- package/dist/devices/mysmartboard.js +0 -8
- package/dist/devices/progressor.d.ts +0 -5
- package/dist/devices/progressor.js +0 -37
- package/dist/devices/wh-c06.d.ts +0 -6
- package/dist/devices/wh-c06.js +0 -17
- package/dist/disconnect.d.ts +0 -8
- package/dist/disconnect.js +0 -14
- package/dist/firmware.d.ts +0 -10
- package/dist/firmware.js +0 -34
- package/dist/hardware.d.ts +0 -9
- package/dist/hardware.js +0 -22
- package/dist/is-connected.d.ts +0 -7
- package/dist/is-connected.js +0 -13
- package/dist/led.d.ts +0 -24
- package/dist/led.js +0 -195
- package/dist/manufacturer.d.ts +0 -9
- package/dist/manufacturer.js +0 -22
- package/dist/serial.d.ts +0 -9
- package/dist/serial.js +0 -27
- package/dist/stream.d.ts +0 -8
- package/dist/stream.js +0 -41
- package/dist/text.d.ts +0 -12
- package/dist/text.js +0 -30
- package/dist/types/devices.d.ts +0 -38
- package/src/battery.ts +0 -36
- package/src/calibration.ts +0 -23
- package/src/connect.ts +0 -187
- package/src/data/entralpi.ts +0 -41
- package/src/data/index.ts +0 -7
- package/src/data/motherboard.ts +0 -163
- package/src/data/progressor.ts +0 -79
- package/src/data/wh-c06.ts +0 -47
- package/src/devices/climbro.ts +0 -10
- package/src/devices/entralpi.ts +0 -61
- package/src/devices/index.ts +0 -13
- package/src/devices/kilterboard.ts +0 -37
- package/src/devices/motherboard.ts +0 -83
- package/src/devices/mysmartboard.ts +0 -10
- package/src/devices/progressor.ts +0 -38
- package/src/devices/wh-c06.ts +0 -19
- package/src/disconnect.ts +0 -16
- package/src/firmware.ts +0 -36
- package/src/hardware.ts +0 -24
- package/src/is-connected.ts +0 -15
- package/src/led.ts +0 -210
- package/src/manufacturer.ts +0 -24
- package/src/serial.ts +0 -29
- package/src/stream.ts +0 -43
- package/src/text.ts +0 -32
- package/src/types/devices.ts +0 -39
- /package/dist/{types/devices.js → interfaces/base.interface.js} +0 -0
package/README.md
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
The objective of this project is to create a Web Bluetooth API client that can establish connections with various
|
|
6
6
|
Force-Sensing Hangboards / Dynamometers / Plates / LED system boards used by climbers. Examples of such tools include
|
|
7
|
-
the [Griptonite Motherboard](https://griptonite.io/shop/motherboard/),
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[Weiheng WH-C06](https://weihengmanufacturer.com/products/wh-c06-bluetooth-300kg-hanging-scale/)
|
|
7
|
+
the [Griptonite Motherboard](https://griptonite.io/shop/motherboard/),
|
|
8
|
+
[Tindeq Progressor](https://tindeq.com/product/progressor/),
|
|
9
|
+
[PitchSix Force Board](https://pitchsix.com/products/force-board-portable),
|
|
10
|
+
[Weiheng WH-C06](https://weihengmanufacturer.com/products/wh-c06-bluetooth-300kg-hanging-scale/),
|
|
11
|
+
[Entralpi](https://entralpi.com/), [Climbro](https://climbro.com/), or
|
|
12
|
+
[mySmartBoard](https://www.smartboard-climbing.com/)
|
|
11
13
|
|
|
12
14
|
And LED system boards from [Aurora Climbing](https://auroraclimbing.com/) like the
|
|
13
15
|
[Kilter Board](https://settercloset.com/pages/the-kilter-board),
|
|
@@ -29,6 +31,8 @@ Learn more: [Docs](https://stevie-ray.github.io/hangtime-grip-connect/) -
|
|
|
29
31
|
[Chart](https://grip-connect.vercel.app/) - [Flappy Bird](https://grip-connect-flappy-bird.vercel.app/) -
|
|
30
32
|
[Kilter Board](https://grip-connect-kilter-board.vercel.app/?route=p1083r15p1117r15p1164r12p1185r12p1233r13p1282r13p1303r13p1372r13p1392r14p1505r15)
|
|
31
33
|
|
|
34
|
+

|
|
35
|
+
|
|
32
36
|
## Install
|
|
33
37
|
|
|
34
38
|
This project can be found in the [NPM package registry](https://www.npmjs.com/package/@hangtime/grip-connect).
|
|
@@ -46,13 +50,15 @@ Simply importing the utilities you need from `@hangtime/grip-connect`.
|
|
|
46
50
|
```
|
|
47
51
|
|
|
48
52
|
```js
|
|
49
|
-
import { Motherboard, active,
|
|
53
|
+
import { Motherboard, active, connect, disconnect, notify } from "@hangtime/grip-connect"
|
|
50
54
|
|
|
51
55
|
const motherboardButton = document.querySelector("#motherboard")
|
|
52
56
|
|
|
53
57
|
motherboardButton.addEventListener("click", () => {
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
// setup device
|
|
59
|
+
const motherboard = new Motherboard()
|
|
60
|
+
// connect to device
|
|
61
|
+
motherboard.connect(
|
|
56
62
|
async () => {
|
|
57
63
|
// Listen for stream notifications
|
|
58
64
|
notify((data) => {
|
|
@@ -69,19 +75,19 @@ motherboardButton.addEventListener("click", () => {
|
|
|
69
75
|
{ threshold: 2.5, duration: 1000 },
|
|
70
76
|
)
|
|
71
77
|
|
|
72
|
-
// Read
|
|
73
|
-
const batteryLevel = await battery(
|
|
78
|
+
// Read device specific data: battery + firmware
|
|
79
|
+
const batteryLevel = await motherboard.battery()
|
|
74
80
|
console.log(batteryLevel)
|
|
75
81
|
|
|
76
|
-
const firmwareVersion = await firmware(
|
|
82
|
+
const firmwareVersion = await motherboard.firmware()
|
|
77
83
|
console.log(firmwareVersion)
|
|
78
84
|
|
|
79
85
|
// LEDs: "green", "red", "orange", or no argument to turn off
|
|
80
|
-
// await led(Motherboard, "red")
|
|
81
|
-
// await led(Motherboard)
|
|
86
|
+
// await motherboard.led(Motherboard, "red")
|
|
87
|
+
// await motherboard.led(Motherboard)
|
|
82
88
|
|
|
83
89
|
// Start weight streaming (for a minute) remove parameter for a continues stream
|
|
84
|
-
await stream(
|
|
90
|
+
await motherboard.stream(60000)
|
|
85
91
|
|
|
86
92
|
// Manualy tare the device when the stream is running
|
|
87
93
|
// await tare(5000)
|
|
@@ -91,15 +97,14 @@ motherboardButton.addEventListener("click", () => {
|
|
|
91
97
|
|
|
92
98
|
// Download data as CSV, JSON, or XML (default: CSV) format => timestamp, frame, battery, samples, masses
|
|
93
99
|
// download('json')
|
|
94
|
-
|
|
95
|
-
// Disconnect from device after we are done
|
|
96
|
-
disconnect(Motherboard)
|
|
97
100
|
},
|
|
98
101
|
(error) => {
|
|
99
102
|
// Optinal custom error handeling
|
|
100
103
|
console.error(error.message)
|
|
101
104
|
},
|
|
102
105
|
)
|
|
106
|
+
// Disconnect from device after we are done
|
|
107
|
+
motherboard.disconnect(Motherboard)
|
|
103
108
|
})
|
|
104
109
|
```
|
|
105
110
|
|
|
@@ -111,7 +116,8 @@ motherboardButton.addEventListener("click", () => {
|
|
|
111
116
|
- By default [watchAdvertisements](https://chromestatus.com/feature/5180688812736512) isn't supported . For Chrome,
|
|
112
117
|
enable it at `chrome://flags/#enable-experimental-web-platform-features`.
|
|
113
118
|
- ✅ Kilter Board
|
|
114
|
-
-
|
|
119
|
+
- ✅ Entralpi / Lefu Scale
|
|
120
|
+
- ⏳ PitchSix Force Board
|
|
115
121
|
- ➡️ Climbro
|
|
116
122
|
- ➡️ Smartboard Climbing - mySmartBoard
|
|
117
123
|
|
|
@@ -121,28 +127,31 @@ motherboardButton.addEventListener("click", () => {
|
|
|
121
127
|
`chrome://bluetooth-internals/#devices` and press `Start Scan` to look for your device, click on `Inspect` and share all
|
|
122
128
|
available services with us.
|
|
123
129
|
|
|
124
|
-
| | Motherboard | Progressor | WH-C06 | Entralpi | Kilter Board | Climbro | mySmartBoard |
|
|
125
|
-
| ---------------------------------------------------------------------------------------- | ----------- | ---------- | ------ | -------- | ------------ | ------- | ------------ |
|
|
126
|
-
| [Battery](https://stevie-ray.github.io/hangtime-grip-connect/api/battery.html) | ✅ | ✅ | |
|
|
127
|
-
| [Calibration](https://stevie-ray.github.io/hangtime-grip-connect/api/calibration.html) | ✅ | | | | | | |
|
|
128
|
-
| [Connect](https://stevie-ray.github.io/hangtime-grip-connect/api/connect.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | |
|
|
129
|
-
| [Disconnect](https://stevie-ray.github.io/hangtime-grip-connect/api/disconnect.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | |
|
|
130
|
-
| [Download](https://stevie-ray.github.io/hangtime-grip-connect/api/download.html) | ✅ | ✅ | | | | | |
|
|
131
|
-
| [Firmware](https://stevie-ray.github.io/hangtime-grip-connect/api/firmware.html) | ✅ | ✅ | |
|
|
132
|
-
| [Hardware](https://stevie-ray.github.io/hangtime-grip-connect/api/hardware.html) | ✅ | | |
|
|
133
|
-
| [
|
|
134
|
-
| [
|
|
135
|
-
| [
|
|
136
|
-
| [
|
|
137
|
-
| [
|
|
138
|
-
| [
|
|
139
|
-
| [
|
|
140
|
-
| [
|
|
141
|
-
| [
|
|
142
|
-
| [
|
|
143
|
-
| [
|
|
144
|
-
| [
|
|
145
|
-
| [
|
|
130
|
+
| | Motherboard | Progressor | WH-C06 | Entralpi | Kilter Board | Force Board | Climbro | mySmartBoard |
|
|
131
|
+
| ---------------------------------------------------------------------------------------- | ----------- | ---------- | ------ | -------- | ------------ | ----------- | ------- | ------------ |
|
|
132
|
+
| [Battery](https://stevie-ray.github.io/hangtime-grip-connect/api/battery.html) | ✅ | ✅ | | ✅ | | ✅ | | |
|
|
133
|
+
| [Calibration](https://stevie-ray.github.io/hangtime-grip-connect/api/calibration.html) | ✅ | | | | | | | |
|
|
134
|
+
| [Connect](https://stevie-ray.github.io/hangtime-grip-connect/api/connect.html) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | |
|
|
135
|
+
| [Disconnect](https://stevie-ray.github.io/hangtime-grip-connect/api/disconnect.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | | |
|
|
136
|
+
| [Download](https://stevie-ray.github.io/hangtime-grip-connect/api/download.html) | ✅ | ✅ | | | | | | |
|
|
137
|
+
| [Firmware](https://stevie-ray.github.io/hangtime-grip-connect/api/firmware.html) | ✅ | ✅ | | ✅ | | | | |
|
|
138
|
+
| [Hardware](https://stevie-ray.github.io/hangtime-grip-connect/api/hardware.html) | ✅ | | | ✅ | | | | |
|
|
139
|
+
| [Humidity](https://stevie-ray.github.io/hangtime-grip-connect/api/humidity.html) | | | | | | ✅ | | |
|
|
140
|
+
| [isActive](https://stevie-ray.github.io/hangtime-grip-connect/api/is-active.html) | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
141
|
+
| [isConnected](https://stevie-ray.github.io/hangtime-grip-connect/api/is-connected.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | | |
|
|
142
|
+
| [isDevice](https://stevie-ray.github.io/hangtime-grip-connect/api/is-device.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | | |
|
|
143
|
+
| [Led](https://stevie-ray.github.io/hangtime-grip-connect/api/led.html) | ✅ | | | | ✅ | | | |
|
|
144
|
+
| [Manufacturer](https://stevie-ray.github.io/hangtime-grip-connect/api/manufacturer.html) | ✅ | | | ✅ | | ✅ | | |
|
|
145
|
+
| [Model](#) | | | | ✅ | | | | |
|
|
146
|
+
| [Notify](https://stevie-ray.github.io/hangtime-grip-connect/api/notify.html) | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
147
|
+
| [Read](https://stevie-ray.github.io/hangtime-grip-connect/api/read.html) | ✅ | | | | | | | |
|
|
148
|
+
| [Serial](https://stevie-ray.github.io/hangtime-grip-connect/api/serial.html) | ✅ | | | | | | | |
|
|
149
|
+
| [Software](#) | | | | ✅ | | | | |
|
|
150
|
+
| [Stop](https://stevie-ray.github.io/hangtime-grip-connect/api/stop.html) | ✅ | ✅ | | | | | | |
|
|
151
|
+
| [Stream](https://stevie-ray.github.io/hangtime-grip-connect/api/stream.html) | ✅ | ✅ | | | | | | |
|
|
152
|
+
| [Tare](https://stevie-ray.github.io/hangtime-grip-connect/api/tare.html) | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
153
|
+
| [Text](https://stevie-ray.github.io/hangtime-grip-connect/api/text.html) | ✅ | | | | | | | |
|
|
154
|
+
| [Write](https://stevie-ray.github.io/hangtime-grip-connect/api/write.html) | ✅ | ✅ | | | | | | |
|
|
146
155
|
|
|
147
156
|
## Development
|
|
148
157
|
|
|
@@ -168,7 +177,7 @@ A special thank you to:
|
|
|
168
177
|
- [@1-max-1](https://github.com/1-max-1) for the docs on his Kilter Board
|
|
169
178
|
[simulator](https://github.com/1-max-1/fake_kilter_board) that I coverted to
|
|
170
179
|
[hangtime-arduino-kilterboard](https://github.com/Stevie-Ray/hangtime-arduino-kilterboard).
|
|
171
|
-
- [@sebws](https://github.com/
|
|
180
|
+
- [@sebws](https://github.com/sebws) for a [code sample](https://github.com/sebws/Crane) of the Weiheng WH-C06 App.
|
|
172
181
|
|
|
173
182
|
## Disclaimer
|
|
174
183
|
|
package/dist/characteristic.d.ts
CHANGED
package/dist/commands/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ClimbroCommands } from "./climbro";
|
|
2
2
|
export { EntralpiCommands } from "./entralpi";
|
|
3
|
+
export { ForceBoardCommands } from "./forceboard";
|
|
3
4
|
export { MotherboardCommands } from "./motherboard";
|
|
4
|
-
export { WHC06Commands } from "./wh-c06";
|
|
5
|
-
export { ProgressorCommands } from "./progressor";
|
|
6
5
|
export { mySmartBoardCommands } from "./mysmartboard";
|
|
6
|
+
export { ProgressorCommands } from "./progressor";
|
|
7
|
+
export { WHC06Commands } from "./wh-c06";
|
package/dist/commands/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ClimbroCommands } from "./climbro";
|
|
2
2
|
export { EntralpiCommands } from "./entralpi";
|
|
3
|
+
export { ForceBoardCommands } from "./forceboard";
|
|
3
4
|
export { MotherboardCommands } from "./motherboard";
|
|
4
|
-
export { WHC06Commands } from "./wh-c06";
|
|
5
|
-
export { ProgressorCommands } from "./progressor";
|
|
6
5
|
export { mySmartBoardCommands } from "./mysmartboard";
|
|
6
|
+
export { ProgressorCommands } from "./progressor";
|
|
7
|
+
export { WHC06Commands } from "./wh-c06";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
export { Climbro, Entralpi, KilterBoard, Motherboard, mySmartBoard, WHC06, Progressor } from "./
|
|
1
|
+
export { Climbro, Entralpi, ForceBoard, KilterBoard, Motherboard, mySmartBoard, WHC06, Progressor, } from "./models/index";
|
|
2
2
|
export { isEntralpi, isKilterboard, isMotherboard, isWHC06, isProgressor } from "./is-device";
|
|
3
|
-
export { calibration } from "./calibration";
|
|
4
3
|
export { download } from "./download";
|
|
5
|
-
export { connect } from "./connect";
|
|
6
|
-
export { disconnect } from "./disconnect";
|
|
7
4
|
export { active, isActive } from "./is-active";
|
|
8
|
-
export { isConnected } from "./is-connected";
|
|
9
|
-
export { battery } from "./battery";
|
|
10
|
-
export { firmware } from "./firmware";
|
|
11
|
-
export { hardware } from "./hardware";
|
|
12
|
-
export { manufacturer } from "./manufacturer";
|
|
13
|
-
export { text } from "./text";
|
|
14
|
-
export { serial } from "./serial";
|
|
15
|
-
export { led } from "./led";
|
|
16
5
|
export { notify } from "./notify";
|
|
17
6
|
export { stop } from "./stop";
|
|
18
|
-
export { stream } from "./stream";
|
|
19
7
|
export { tare } from "./tare";
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Export isDevice functions
|
|
1
|
+
export { Climbro, Entralpi, ForceBoard, KilterBoard, Motherboard, mySmartBoard, WHC06, Progressor, } from "./models/index";
|
|
2
|
+
// helpers
|
|
4
3
|
export { isEntralpi, isKilterboard, isMotherboard, isWHC06, isProgressor } from "./is-device";
|
|
5
|
-
//
|
|
6
|
-
export { calibration } from "./calibration";
|
|
7
|
-
// Export download function
|
|
4
|
+
// functions
|
|
8
5
|
export { download } from "./download";
|
|
9
|
-
// Export connection related functions
|
|
10
|
-
export { connect } from "./connect";
|
|
11
|
-
export { disconnect } from "./disconnect";
|
|
12
6
|
export { active, isActive } from "./is-active";
|
|
13
|
-
export { isConnected } from "./is-connected";
|
|
14
|
-
// Export information retrieval functions
|
|
15
|
-
export { battery } from "./battery";
|
|
16
|
-
export { firmware } from "./firmware";
|
|
17
|
-
// Export "Motherboard exclusive" functions
|
|
18
|
-
export { hardware } from "./hardware";
|
|
19
|
-
export { manufacturer } from "./manufacturer";
|
|
20
|
-
export { text } from "./text";
|
|
21
|
-
export { serial } from "./serial";
|
|
22
|
-
// Export led retrieval function
|
|
23
|
-
export { led } from "./led";
|
|
24
|
-
// Export notification related function
|
|
25
7
|
export { notify } from "./notify";
|
|
26
|
-
// Export stream related functions
|
|
27
8
|
export { stop } from "./stop";
|
|
28
|
-
export { stream } from "./stream";
|
|
29
9
|
export { tare } from "./tare";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IDevice } from "../device.interface";
|
|
2
|
+
export interface IMotherboard extends IDevice {
|
|
3
|
+
/**
|
|
4
|
+
* Applies calibration to a sample value.
|
|
5
|
+
* @param sample - The sample value to calibrate.
|
|
6
|
+
* @param calibration - The calibration data.
|
|
7
|
+
* @returns The calibrated sample value.
|
|
8
|
+
*/
|
|
9
|
+
applyCalibration(sample: number, calibration: number[][]): number;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { IBase } from "./base.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a characteristic of a Bluetooth service.
|
|
4
|
+
*/
|
|
5
|
+
interface Characteristic {
|
|
6
|
+
/** Name of the characteristic */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Identifier of the characteristic */
|
|
9
|
+
id: string;
|
|
10
|
+
/** UUID of the characteristic */
|
|
11
|
+
uuid: string;
|
|
12
|
+
/** Reference to the characteristic object */
|
|
13
|
+
characteristic?: BluetoothRemoteGATTCharacteristic;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents a Bluetooth service.
|
|
17
|
+
*/
|
|
18
|
+
export interface Service {
|
|
19
|
+
/** Name of the service */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Identifier of the service */
|
|
22
|
+
id: string;
|
|
23
|
+
/** UUID of the service */
|
|
24
|
+
uuid: string;
|
|
25
|
+
/** Array of characteristics belonging to this service */
|
|
26
|
+
characteristics: Characteristic[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Represents a Bluetooth device.
|
|
30
|
+
*/
|
|
31
|
+
export interface IDevice extends IBase {
|
|
32
|
+
/** Filters to indentify the device */
|
|
33
|
+
filters: BluetoothLEScanFilter[];
|
|
34
|
+
/** Array of services provided by the device */
|
|
35
|
+
services: Service[];
|
|
36
|
+
/** Reference to the BluetoothDevice object representing this device */
|
|
37
|
+
bluetooth?: BluetoothDevice;
|
|
38
|
+
/**
|
|
39
|
+
* Handles the 'disconnected' event.
|
|
40
|
+
* @param {Event} event - The 'disconnected' event.
|
|
41
|
+
*/
|
|
42
|
+
onDisconnected(event: Event): void;
|
|
43
|
+
/**
|
|
44
|
+
* Handles notifications received from a characteristic.
|
|
45
|
+
* @param {Event} event - The notification event.
|
|
46
|
+
*/
|
|
47
|
+
handleNotifications(event: Event): void;
|
|
48
|
+
/**
|
|
49
|
+
* Handles the 'connected' event.
|
|
50
|
+
* @param {Function} onSuccess - Callback function to execute on successful connection.
|
|
51
|
+
*/
|
|
52
|
+
onConnected(onSuccess: () => void): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns UUIDs of all services associated with the device.
|
|
55
|
+
* @returns {string[]} Array of service UUIDs.
|
|
56
|
+
*/
|
|
57
|
+
getAllServiceUUIDs(): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Connects to a Bluetooth device.
|
|
60
|
+
* @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
|
|
61
|
+
* @param {Function} [onError] - Optional callback function to execute on error. Default logs the error.
|
|
62
|
+
*/
|
|
63
|
+
connect(onSuccess?: () => void, onError?: (error: Error) => void): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Checks if a Bluetooth device is connected.
|
|
66
|
+
* @returns {boolean} A boolean indicating whether the device is connected.
|
|
67
|
+
*/
|
|
68
|
+
isConnected(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Disconnects the device if it is currently connected.
|
|
71
|
+
* - Checks if the device is connected via it's GATT server.
|
|
72
|
+
* - If the device is connected, it attempts to gracefully disconnect.
|
|
73
|
+
*/
|
|
74
|
+
disconnect(): void;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/is-device.d.ts
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
import type { Device } from "./
|
|
2
|
-
/**
|
|
3
|
-
* Checks if the given device is a Motherboard.
|
|
4
|
-
* @param {Device} [board] - The device to check.
|
|
5
|
-
* @returns {boolean} `true` if the device has a filter with the name "Motherboard", otherwise `false`.
|
|
6
|
-
*/
|
|
7
|
-
export declare const isMotherboard: (board?: Device) => boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Checks if the given device is a Progressor.
|
|
10
|
-
* @param {Device} [board] - The device to check.
|
|
11
|
-
* @returns {boolean} `true` if the device has a filter with a namePrefix of "Progressor", otherwise `false`.
|
|
12
|
-
*/
|
|
13
|
-
export declare const isProgressor: (board?: Device) => boolean;
|
|
1
|
+
import type { Device } from "./models/device.model";
|
|
14
2
|
/**
|
|
15
3
|
* Checks if the given device is an Entralpi device.
|
|
16
4
|
* @param {Device} [board] - The device to check.
|
|
17
5
|
* @returns {boolean} `true` if the device has a filter with the name "ENTRALPI", otherwise `false`.
|
|
18
6
|
*/
|
|
19
7
|
export declare const isEntralpi: (board?: Device) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if the given device is a Force Board.
|
|
10
|
+
* @param {Device} [board] - The device to check.
|
|
11
|
+
* @returns {boolean} `true` if the device has a filter with the name "Force Board", otherwise `false`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const isForceBoard: (board?: Device) => boolean;
|
|
20
14
|
/**
|
|
21
15
|
* Checks if the given device is a Kilterboard.
|
|
22
16
|
* @param {Device} [board] - The device to check.
|
|
23
17
|
* @returns {boolean} `true` if the device has a service UUID matching the Kilterboard Aurora UUID, otherwise `false`.
|
|
24
18
|
*/
|
|
25
19
|
export declare const isKilterboard: (board?: Device) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if the given device is a Motherboard.
|
|
22
|
+
* @param {Device} [board] - The device to check.
|
|
23
|
+
* @returns {boolean} `true` if the device has a filter with the name "Motherboard", otherwise `false`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isMotherboard: (board?: Device) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the given device is a Progressor.
|
|
28
|
+
* @param {Device} [board] - The device to check.
|
|
29
|
+
* @returns {boolean} `true` if the device has a filter with a namePrefix of "Progressor", otherwise `false`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const isProgressor: (board?: Device) => boolean;
|
|
26
32
|
/**
|
|
27
33
|
* Checks if the given device is a WH-C06.
|
|
28
34
|
* @param {Device} [board] - The device to check.
|
package/dist/is-device.js
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import { AuroraUUID } from "./
|
|
2
|
-
/**
|
|
3
|
-
* Checks if the given device is a Motherboard.
|
|
4
|
-
* @param {Device} [board] - The device to check.
|
|
5
|
-
* @returns {boolean} `true` if the device has a filter with the name "Motherboard", otherwise `false`.
|
|
6
|
-
*/
|
|
7
|
-
export const isMotherboard = (board) => board?.filters.some((filter) => filter.name === "Motherboard") ?? false;
|
|
8
|
-
/**
|
|
9
|
-
* Checks if the given device is a Progressor.
|
|
10
|
-
* @param {Device} [board] - The device to check.
|
|
11
|
-
* @returns {boolean} `true` if the device has a filter with a namePrefix of "Progressor", otherwise `false`.
|
|
12
|
-
*/
|
|
13
|
-
export const isProgressor = (board) => board?.filters.some((filter) => filter.namePrefix === "Progressor") ?? false;
|
|
1
|
+
import { AuroraUUID } from "./models/device/kilterboard.model";
|
|
14
2
|
/**
|
|
15
3
|
* Checks if the given device is an Entralpi device.
|
|
16
4
|
* @param {Device} [board] - The device to check.
|
|
17
5
|
* @returns {boolean} `true` if the device has a filter with the name "ENTRALPI", otherwise `false`.
|
|
18
6
|
*/
|
|
19
7
|
export const isEntralpi = (board) => board?.filters.some((filter) => filter.name === "ENTRALPI") ?? false;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if the given device is a Force Board.
|
|
10
|
+
* @param {Device} [board] - The device to check.
|
|
11
|
+
* @returns {boolean} `true` if the device has a filter with the name "Force Board", otherwise `false`.
|
|
12
|
+
*/
|
|
13
|
+
export const isForceBoard = (board) => board?.filters.some((filter) => filter.name === "Force Board") ?? false;
|
|
20
14
|
/**
|
|
21
15
|
* Checks if the given device is a Kilterboard.
|
|
22
16
|
* @param {Device} [board] - The device to check.
|
|
@@ -25,6 +19,18 @@ export const isEntralpi = (board) => board?.filters.some((filter) => filter.name
|
|
|
25
19
|
export const isKilterboard = (board) => {
|
|
26
20
|
return board?.filters.some((filter) => filter.services?.includes(AuroraUUID)) ?? false;
|
|
27
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the given device is a Motherboard.
|
|
24
|
+
* @param {Device} [board] - The device to check.
|
|
25
|
+
* @returns {boolean} `true` if the device has a filter with the name "Motherboard", otherwise `false`.
|
|
26
|
+
*/
|
|
27
|
+
export const isMotherboard = (board) => board?.filters.some((filter) => filter.name === "Motherboard") ?? false;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if the given device is a Progressor.
|
|
30
|
+
* @param {Device} [board] - The device to check.
|
|
31
|
+
* @returns {boolean} `true` if the device has a filter with a namePrefix of "Progressor", otherwise `false`.
|
|
32
|
+
*/
|
|
33
|
+
export const isProgressor = (board) => board?.filters.some((filter) => filter.namePrefix === "Progressor") ?? false;
|
|
28
34
|
/**
|
|
29
35
|
* Checks if the given device is a WH-C06.
|
|
30
36
|
* @param {Device} [board] - The device to check.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { IClimbro } from "../../interfaces/device/climbro.interface";
|
|
3
|
+
/**
|
|
4
|
+
* Represents a Climbro device
|
|
5
|
+
* TODO: Add services, do you own a Climbro? Help us!
|
|
6
|
+
*/
|
|
7
|
+
export declare class Climbro extends Device implements IClimbro {
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a Climbro device
|
|
4
|
+
* TODO: Add services, do you own a Climbro? Help us!
|
|
5
|
+
*/
|
|
6
|
+
export class Climbro extends Device {
|
|
7
|
+
constructor() {
|
|
8
|
+
super({
|
|
9
|
+
filters: [{ name: "Climbro" }],
|
|
10
|
+
services: [],
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { IEntralpi } from "../../interfaces/device/entralpi.interface";
|
|
3
|
+
export declare class Entralpi extends Device implements IEntralpi {
|
|
4
|
+
constructor();
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves battery or voltage information from the device.
|
|
7
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information,
|
|
8
|
+
*/
|
|
9
|
+
battery: () => Promise<string | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves firmware version from the device.
|
|
12
|
+
* @returns {Promise<string>} A Promise that resolves with the firmware version,
|
|
13
|
+
*/
|
|
14
|
+
firmware: () => Promise<string | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Handles data received from the Progressor device, processes weight measurements,
|
|
17
|
+
* and updates mass data including maximum and average values.
|
|
18
|
+
* It also handles command responses for retrieving device information.
|
|
19
|
+
*
|
|
20
|
+
* @param {Event} event - The notification event.
|
|
21
|
+
*/
|
|
22
|
+
handleNotifications: (event: Event) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves hardware version from the device.
|
|
25
|
+
* @returns {Promise<string>} A Promise that resolves with the hardware version,
|
|
26
|
+
*/
|
|
27
|
+
hardware: () => Promise<string | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves manufacturer information from the device.
|
|
30
|
+
* @returns {Promise<string>} A Promise that resolves with the manufacturer information,
|
|
31
|
+
*/
|
|
32
|
+
manufacturer: () => Promise<string | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves model number from the device.
|
|
35
|
+
* @returns {Promise<string>} A Promise that resolves with the model number,
|
|
36
|
+
*/
|
|
37
|
+
model: () => Promise<string | undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves software version from the device.
|
|
40
|
+
* @returns {Promise<string>} A Promise that resolves with the software version,
|
|
41
|
+
*/
|
|
42
|
+
software: () => Promise<string | undefined>;
|
|
43
|
+
}
|