@hangtime/grip-connect 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -43
- 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 -15
- package/dist/index.js +3 -25
- package/dist/interfaces/base.interface.d.ts +17 -0
- package/dist/interfaces/device/climbro.interface.d.ts +6 -0
- package/dist/interfaces/device/climbro.interface.js +1 -0
- package/dist/interfaces/device/entralpi.interface.d.ts +52 -0
- package/dist/interfaces/device/entralpi.interface.js +1 -0
- package/dist/interfaces/device/forceboard.interface.d.ts +21 -0
- package/dist/interfaces/device/forceboard.interface.js +1 -0
- package/dist/interfaces/device/kilterboard.interface.d.ts +76 -0
- package/dist/interfaces/device/kilterboard.interface.js +1 -0
- package/dist/interfaces/device/motherboard.interface.d.ts +60 -0
- package/dist/interfaces/device/motherboard.interface.js +1 -0
- package/dist/interfaces/device/mysmartboard.interface.d.ts +6 -0
- package/dist/interfaces/device/mysmartboard.interface.js +1 -0
- package/dist/interfaces/device/progressor.interface.d.ts +27 -0
- package/dist/interfaces/device/progressor.interface.js +1 -0
- package/dist/interfaces/device/wh-c06.interface.d.ts +6 -0
- package/dist/interfaces/device/wh-c06.interface.js +1 -0
- package/dist/interfaces/device.interface.d.ts +90 -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 +59 -0
- package/dist/models/device/entralpi.model.js +285 -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 +81 -0
- package/dist/models/device/motherboard.model.js +399 -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 +37 -0
- package/dist/models/device/progressor.model.js +185 -0
- package/dist/models/device/wh-c06.model.d.ts +15 -0
- package/dist/models/device/wh-c06.model.js +96 -0
- package/dist/models/device.model.d.ts +61 -0
- package/dist/models/device.model.js +154 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +8 -0
- package/dist/read.d.ts +1 -1
- package/dist/read.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 +13 -30
- package/src/interfaces/base.interface.ts +19 -0
- package/src/interfaces/device/climbro.interface.ts +6 -0
- package/src/interfaces/device/entralpi.interface.ts +61 -0
- package/src/interfaces/device/forceboard.interface.ts +24 -0
- package/src/interfaces/device/kilterboard.interface.ts +85 -0
- package/src/interfaces/device/motherboard.interface.ts +70 -0
- package/src/interfaces/device/mysmartboard.interface.ts +6 -0
- package/src/interfaces/device/progressor.interface.ts +31 -0
- package/src/interfaces/device/wh-c06.interface.ts +6 -0
- package/src/interfaces/device.interface.ts +101 -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 +306 -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 +439 -0
- package/src/models/device/mysmartboard.model.ts +15 -0
- package/src/models/device/progressor.model.ts +193 -0
- package/src/models/device/wh-c06.model.ts +118 -0
- package/src/models/device.model.ts +177 -0
- package/src/models/index.ts +15 -0
- package/src/read.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/notify.d.ts +0 -16
- package/dist/notify.js +0 -14
- package/dist/serial.d.ts +0 -9
- package/dist/serial.js +0 -27
- package/dist/stop.d.ts +0 -7
- package/dist/stop.js +0 -21
- 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/notify.ts +0 -18
- package/src/serial.ts +0 -29
- package/src/stop.ts +0 -23
- 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),
|
|
@@ -16,7 +18,7 @@ And LED system boards from [Aurora Climbing](https://auroraclimbing.com/) like t
|
|
|
16
18
|
[Decoy Board](https://decoy-holds.com/pages/decoy-board), [Touchstone Board](https://touchstoneboardapp.com/) and
|
|
17
19
|
[So iLL Board](https://apps.apple.com/us/app/so-ill-board/id1358056082).
|
|
18
20
|
|
|
19
|
-
Learn more: [
|
|
21
|
+
Learn more: [Documentation](https://stevie-ray.github.io/hangtime-grip-connect/) -
|
|
20
22
|
[Browser Support](https://caniuse.com/web-bluetooth)
|
|
21
23
|
|
|
22
24
|
> This project is provided "as-is" without any express or implied warranties. By using this software, you assume all
|
|
@@ -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,16 +50,18 @@ 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 } 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
|
-
notify((data) => {
|
|
64
|
+
motherboard.notify((data) => {
|
|
59
65
|
// { massTotal: "0", massMax: "0", massAverage: "0", massLeft: "0", massCenter: "0", massRight: "0" }
|
|
60
66
|
console.log(data)
|
|
61
67
|
})
|
|
@@ -69,37 +75,36 @@ 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)
|
|
88
94
|
|
|
89
95
|
// Manually call stop method if stream is continues
|
|
90
|
-
// await stop(
|
|
96
|
+
// await motherboard.stop()
|
|
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,38 +116,30 @@ 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
|
|
|
118
124
|
## Features
|
|
119
125
|
|
|
126
|
+
All devices provide some default features such as `connect`, `isConnected`, and `disconnect`. Additionally, each device
|
|
127
|
+
offers specific features—refer to the [documentation](https://stevie-ray.github.io/hangtime-grip-connect/devices/) for
|
|
128
|
+
more details on individual devices. There are also extra features that are not part of the device itself, like a
|
|
129
|
+
reactive `isActive` check and a `download` feature.
|
|
130
|
+
|
|
120
131
|
**Help wanted:** Do you own any of the missing devices? Use Google Chrome's Bluetooth Internals
|
|
121
132
|
`chrome://bluetooth-internals/#devices` and press `Start Scan` to look for your device, click on `Inspect` and share all
|
|
122
133
|
available services with us.
|
|
123
134
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
| [
|
|
127
|
-
| [
|
|
128
|
-
| [
|
|
129
|
-
| [
|
|
130
|
-
| [
|
|
131
|
-
| [
|
|
132
|
-
| [Hardware](https://stevie-ray.github.io/hangtime-grip-connect/api/hardware.html) | ✅ | | | | | | |
|
|
133
|
-
| [isActive](https://stevie-ray.github.io/hangtime-grip-connect/api/is-active.html) | ✅ | ✅ | ✅ | ✅ | | | |
|
|
134
|
-
| [isConnected](https://stevie-ray.github.io/hangtime-grip-connect/api/is-connected.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | |
|
|
135
|
-
| [isDevice](https://stevie-ray.github.io/hangtime-grip-connect/api/is-device.html) | ✅ | ✅ | ✅ | ✅ | ✅ | | |
|
|
136
|
-
| [Led](https://stevie-ray.github.io/hangtime-grip-connect/api/led.html) | ✅ | | | | ✅ | | |
|
|
137
|
-
| [Manufacturer](https://stevie-ray.github.io/hangtime-grip-connect/api/manufacturer.html) | ✅ | | | | | | |
|
|
138
|
-
| [Notify](https://stevie-ray.github.io/hangtime-grip-connect/api/notify.html) | ✅ | ✅ | ✅ | ✅ | | | |
|
|
139
|
-
| [Read](https://stevie-ray.github.io/hangtime-grip-connect/api/read.html) | ✅ | | | | | | |
|
|
140
|
-
| [Serial](https://stevie-ray.github.io/hangtime-grip-connect/api/serial.html) | ✅ | | | | | | |
|
|
141
|
-
| [Stop](https://stevie-ray.github.io/hangtime-grip-connect/api/stop.html) | ✅ | ✅ | | | | | |
|
|
142
|
-
| [Stream](https://stevie-ray.github.io/hangtime-grip-connect/api/stream.html) | ✅ | ✅ | | | | | |
|
|
143
|
-
| [Tare](https://stevie-ray.github.io/hangtime-grip-connect/api/tare.html) | ✅ | ✅ | ✅ | ✅ | | | |
|
|
144
|
-
| [Text](https://stevie-ray.github.io/hangtime-grip-connect/api/text.html) | ✅ | | | | | | |
|
|
145
|
-
| [Write](https://stevie-ray.github.io/hangtime-grip-connect/api/write.html) | ✅ | ✅ | | | | | |
|
|
135
|
+
| | [Motherboard](https://stevie-ray.github.io/hangtime-grip-connect/devices/motherboard.html) | [Progressor](https://stevie-ray.github.io/hangtime-grip-connect/devices/progressor.html) | [WH-C06](https://stevie-ray.github.io/hangtime-grip-connect/devices/wh-c06.html) | [Entralpi](https://stevie-ray.github.io/hangtime-grip-connect/devices/entralpi.html) | [Kilter Board](https://stevie-ray.github.io/hangtime-grip-connect/devices/kilterboard.html) | [Force Board](https://stevie-ray.github.io/hangtime-grip-connect/devices/forceboard.html) | [Climbro](https://stevie-ray.github.io/hangtime-grip-connect/devices/climbro.html) | [mySmartBoard](https://stevie-ray.github.io/hangtime-grip-connect/devices/mysmartboard.html) |
|
|
136
|
+
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
137
|
+
| [Download](https://stevie-ray.github.io/hangtime-grip-connect/api/download.html) | ✅ | ✅ | | | | | | |
|
|
138
|
+
| [isActive](https://stevie-ray.github.io/hangtime-grip-connect/api/is-active.html) | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
139
|
+
| [isDevice](https://stevie-ray.github.io/hangtime-grip-connect/api/is-device.html) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | |
|
|
140
|
+
| [Read](https://stevie-ray.github.io/hangtime-grip-connect/api/read.html) | ✅ | | | ✅ | | ✅ | | |
|
|
141
|
+
| [Tare](https://stevie-ray.github.io/hangtime-grip-connect/api/tare.html) | ✅ | ✅ | ✅ | ✅ | | | | |
|
|
142
|
+
| [Write](https://stevie-ray.github.io/hangtime-grip-connect/api/write.html) | ✅ | ✅ | | | ✅ | | | |
|
|
146
143
|
|
|
147
144
|
## Development
|
|
148
145
|
|
|
@@ -168,7 +165,7 @@ A special thank you to:
|
|
|
168
165
|
- [@1-max-1](https://github.com/1-max-1) for the docs on his Kilter Board
|
|
169
166
|
[simulator](https://github.com/1-max-1/fake_kilter_board) that I coverted to
|
|
170
167
|
[hangtime-arduino-kilterboard](https://github.com/Stevie-Ray/hangtime-arduino-kilterboard).
|
|
171
|
-
- [@sebws](https://github.com/
|
|
168
|
+
- [@sebws](https://github.com/sebws) for a [code sample](https://github.com/sebws/Crane) of the Weiheng WH-C06 App.
|
|
172
169
|
|
|
173
170
|
## Disclaimer
|
|
174
171
|
|
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,5 @@
|
|
|
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
|
-
export { notify } from "./notify";
|
|
17
|
-
export { stop } from "./stop";
|
|
18
|
-
export { stream } from "./stream";
|
|
19
5
|
export { tare } from "./tare";
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
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
|
-
export { notify } from "./notify";
|
|
26
|
-
// Export stream related functions
|
|
27
|
-
export { stop } from "./stop";
|
|
28
|
-
export { stream } from "./stream";
|
|
29
7
|
export { tare } from "./tare";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the base properties for an entity.
|
|
3
|
+
*/
|
|
4
|
+
export interface IBase {
|
|
5
|
+
/**
|
|
6
|
+
* Unique identifier for the entity (optional).
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The date and time when the entity was created (optional).
|
|
11
|
+
*/
|
|
12
|
+
createdAt?: Date;
|
|
13
|
+
/**
|
|
14
|
+
* The date and time when the entity was last updated (optional).
|
|
15
|
+
*/
|
|
16
|
+
updatedAt?: Date;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { IDevice } from "../device.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing the Entralpi device, extending the base Device interface.
|
|
4
|
+
*/
|
|
5
|
+
export interface IEntralpi extends IDevice {
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves battery or voltage information from the device.
|
|
8
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
|
|
9
|
+
*/
|
|
10
|
+
battery(): Promise<string | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves IEEE 11073-20601 Regulatory Certification from the device.
|
|
13
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the firmware version.
|
|
14
|
+
*/
|
|
15
|
+
certification(): Promise<string | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves firmware version from the device.
|
|
18
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the firmware version.
|
|
19
|
+
*/
|
|
20
|
+
firmware(): Promise<string | undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves hardware version from the device.
|
|
23
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the hardware version.
|
|
24
|
+
*/
|
|
25
|
+
hardware(): Promise<string | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves manufacturer information from the device.
|
|
28
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the manufacturer information.
|
|
29
|
+
*/
|
|
30
|
+
manufacturer(): Promise<string | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves model number from the device.
|
|
33
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the model number.
|
|
34
|
+
*/
|
|
35
|
+
model(): Promise<string | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves PnP ID from the device, a set of values that used to create a device ID value that is unique for this device.
|
|
38
|
+
* Included in the characteristic is a Vendor ID Source field, a Vendor ID field, a Product ID field and a Product Version field
|
|
39
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the PnP ID.
|
|
40
|
+
*/
|
|
41
|
+
pnp(): Promise<string | undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves software version from the device.
|
|
44
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the software version.
|
|
45
|
+
*/
|
|
46
|
+
software(): Promise<string | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves system id from the device.
|
|
49
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the system id.
|
|
50
|
+
*/
|
|
51
|
+
system(): Promise<string | undefined>;
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IDevice } from "../device.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing the PitchSix ForceBoard device, extending the base Device interface.
|
|
4
|
+
*/
|
|
5
|
+
export interface IForceBoard extends IDevice {
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves battery or voltage information from the device.
|
|
8
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
|
|
9
|
+
*/
|
|
10
|
+
battery(): Promise<string | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves humidity level from the device.
|
|
13
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the humidity level.
|
|
14
|
+
*/
|
|
15
|
+
humidity(): Promise<string | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves manufacturer information from the device.
|
|
18
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the manufacturer information.
|
|
19
|
+
*/
|
|
20
|
+
manufacturer(): Promise<string | undefined>;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { IDevice } from "../device.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a climbing placement with a position and role identifier.
|
|
4
|
+
*/
|
|
5
|
+
export interface ClimbPlacement {
|
|
6
|
+
/** The position of the hold placement. */
|
|
7
|
+
position: number;
|
|
8
|
+
/** The role ID associated with the climb placement. */
|
|
9
|
+
role_id: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface representing the KilterBoard device, extending the base Device interface.
|
|
13
|
+
*/
|
|
14
|
+
export interface IKilterBoard extends IDevice {
|
|
15
|
+
/**
|
|
16
|
+
* Calculates the checksum for a byte array.
|
|
17
|
+
* @param data - The array of bytes to calculate the checksum for.
|
|
18
|
+
* @returns The calculated checksum value.
|
|
19
|
+
*/
|
|
20
|
+
checksum(data: number[]): number;
|
|
21
|
+
/**
|
|
22
|
+
* Wraps a byte array with header and footer bytes for transmission.
|
|
23
|
+
* @param data - The array of bytes to wrap.
|
|
24
|
+
* @returns The wrapped byte array.
|
|
25
|
+
*/
|
|
26
|
+
wrapBytes(data: number[]): number[];
|
|
27
|
+
/**
|
|
28
|
+
* Encodes a position into a byte array.
|
|
29
|
+
* @param position - The position to encode.
|
|
30
|
+
* @returns The encoded byte array representing the position.
|
|
31
|
+
*/
|
|
32
|
+
encodePosition(position: number): number[];
|
|
33
|
+
/**
|
|
34
|
+
* Encodes a color string into a numeric representation.
|
|
35
|
+
* @param color - The color string in hexadecimal format.
|
|
36
|
+
* @returns The encoded/compressed color value.
|
|
37
|
+
*/
|
|
38
|
+
encodeColor(color: string): number;
|
|
39
|
+
/**
|
|
40
|
+
* Encodes a placement into a byte array.
|
|
41
|
+
* @param position - The position to encode.
|
|
42
|
+
* @param ledColor - The color of the LED in hexadecimal format.
|
|
43
|
+
* @returns The encoded byte array representing the placement.
|
|
44
|
+
*/
|
|
45
|
+
encodePlacement(position: number, ledColor: string): number[];
|
|
46
|
+
/**
|
|
47
|
+
* Prepares byte arrays for transmission based on a list of climb placements.
|
|
48
|
+
* @param climbPlacementList - The list of climb placements.
|
|
49
|
+
* @returns The final byte array ready for transmission.
|
|
50
|
+
*/
|
|
51
|
+
prepBytesV3(climbPlacementList: ClimbPlacement[]): number[];
|
|
52
|
+
/**
|
|
53
|
+
* Splits a collection into slices of the specified length.
|
|
54
|
+
* @param n - Number of elements per slice.
|
|
55
|
+
* @param list - Array to be sliced.
|
|
56
|
+
* @returns The sliced array.
|
|
57
|
+
*/
|
|
58
|
+
splitEvery(n: number, list: number[]): number[][];
|
|
59
|
+
/**
|
|
60
|
+
* Splits a message into 20-byte chunks for Bluetooth transmission.
|
|
61
|
+
* @param buffer - The message to split.
|
|
62
|
+
* @returns The array of Uint8Arrays.
|
|
63
|
+
*/
|
|
64
|
+
splitMessages(buffer: number[]): Uint8Array[];
|
|
65
|
+
/**
|
|
66
|
+
* Sends a series of messages to the device.
|
|
67
|
+
* @param messages - Array of Uint8Arrays to send.
|
|
68
|
+
*/
|
|
69
|
+
writeMessageSeries(messages: Uint8Array[]): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Configures the LEDs based on an array of climb placements.
|
|
72
|
+
* @param config - Optional color or array of climb placements.
|
|
73
|
+
* @returns The prepared payload or undefined.
|
|
74
|
+
*/
|
|
75
|
+
led(config?: ClimbPlacement[]): Promise<number[] | undefined>;
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { IDevice } from "../device.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing the Griptonite Motherboard device.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMotherboard extends IDevice {
|
|
6
|
+
/**
|
|
7
|
+
* Applies calibration to a sample value.
|
|
8
|
+
* @param {number} sample - The sample value to calibrate.
|
|
9
|
+
* @param {number[][]} calibration - The calibration data.
|
|
10
|
+
* @returns {number} The calibrated sample value.
|
|
11
|
+
*/
|
|
12
|
+
applyCalibration(sample: number, calibration: number[][]): number;
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves battery or voltage information from the device.
|
|
15
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
|
|
16
|
+
*/
|
|
17
|
+
battery(): Promise<string | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Writes a command to get calibration data from the device.
|
|
20
|
+
* @returns {Promise<void>} A Promise that resolves when the command is successfully sent.
|
|
21
|
+
*/
|
|
22
|
+
calibration(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves firmware version from the device.
|
|
25
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the firmware version.
|
|
26
|
+
*/
|
|
27
|
+
firmware(): Promise<string | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves hardware version from the device.
|
|
30
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the hardware version.
|
|
31
|
+
*/
|
|
32
|
+
hardware(): Promise<string | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the LED color based on a single color option.
|
|
35
|
+
* @param {"green" | "red" | "orange"} [config] - Optional color for the LEDs.
|
|
36
|
+
* @returns {Promise<number[] | undefined>} A promise that resolves with the payload array for the Kilter Board if LED settings were applied.
|
|
37
|
+
*/
|
|
38
|
+
led(config?: "green" | "red" | "orange"): Promise<number[] | undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves manufacturer information from the device.
|
|
41
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the manufacturer information.
|
|
42
|
+
*/
|
|
43
|
+
manufacturer(): Promise<string | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieves serial number from the device.
|
|
46
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the serial number.
|
|
47
|
+
*/
|
|
48
|
+
serial(): Promise<string | undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* Stops the data stream on the specified device.
|
|
51
|
+
* @returns {Promise<void>} A promise that resolves when the stream is stopped.
|
|
52
|
+
*/
|
|
53
|
+
stop(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Starts streaming data from the specified device.
|
|
56
|
+
* @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely.
|
|
57
|
+
* @returns {Promise<void>} A promise that resolves when the streaming operation is completed.
|
|
58
|
+
*/
|
|
59
|
+
stream(duration?: number): Promise<void>;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IDevice } from "../device.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing the Tindeq Progressor device.
|
|
4
|
+
*/
|
|
5
|
+
export interface IProgressor extends IDevice {
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves battery or voltage information from the device.
|
|
8
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
|
|
9
|
+
*/
|
|
10
|
+
battery(): Promise<string | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves firmware version from the device.
|
|
13
|
+
* @returns {Promise<string>} A Promise that resolves with the firmware version.
|
|
14
|
+
*/
|
|
15
|
+
firmware(): Promise<string | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* Stops the data stream on the specified device.
|
|
18
|
+
* @returns {Promise<void>} A promise that resolves when the stream is stopped.
|
|
19
|
+
*/
|
|
20
|
+
stop(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Starts streaming data from the specified device.
|
|
23
|
+
* @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely.
|
|
24
|
+
* @returns {Promise<void>} A promise that resolves when the streaming operation is completed.
|
|
25
|
+
*/
|
|
26
|
+
stream(duration?: number): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|