@hangtime/grip-connect 0.6.1 → 0.7.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 +3 -3
- package/deno.json +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/interfaces/command.interface.d.ts +6 -0
- package/dist/interfaces/device/climbro.interface.d.ts +1 -1
- package/dist/interfaces/device/entralpi.interface.d.ts +1 -1
- package/dist/interfaces/device/forceboard.interface.d.ts +30 -4
- package/dist/interfaces/device/kilterboard.interface.d.ts +1 -1
- package/dist/interfaces/device/motherboard.interface.d.ts +1 -1
- package/dist/interfaces/device/mysmartboard.interface.d.ts +1 -1
- package/dist/interfaces/device/progressor.interface.d.ts +1 -1
- package/dist/interfaces/device/wh-c06.interface.d.ts +1 -1
- package/dist/interfaces/device.interface.d.ts +3 -3
- package/dist/interfaces/index.d.ts +8 -8
- package/dist/models/base.model.d.ts +1 -1
- package/dist/models/device/climbro.model.d.ts +2 -2
- package/dist/models/device/climbro.model.js +1 -1
- package/dist/models/device/entralpi.model.d.ts +2 -2
- package/dist/models/device/entralpi.model.js +1 -1
- package/dist/models/device/forceboard.model.d.ts +29 -5
- package/dist/models/device/forceboard.model.js +95 -52
- package/dist/models/device/kilterboard.model.d.ts +3 -3
- package/dist/models/device/kilterboard.model.js +2 -2
- package/dist/models/device/motherboard.model.d.ts +2 -2
- package/dist/models/device/motherboard.model.js +1 -1
- package/dist/models/device/mysmartboard.model.d.ts +2 -2
- package/dist/models/device/mysmartboard.model.js +1 -1
- package/dist/models/device/progressor.model.d.ts +2 -2
- package/dist/models/device/progressor.model.js +1 -1
- package/dist/models/device/wh-c06.model.d.ts +2 -2
- package/dist/models/device/wh-c06.model.js +1 -1
- package/dist/models/device.model.d.ts +13 -23
- package/dist/models/device.model.js +51 -64
- package/dist/models/index.d.ts +8 -8
- package/dist/models/index.js +8 -8
- package/package.json +3 -3
- package/src/index.ts +2 -2
- package/src/interfaces/command.interface.ts +9 -0
- package/src/interfaces/device/climbro.interface.ts +1 -1
- package/src/interfaces/device/entralpi.interface.ts +1 -1
- package/src/interfaces/device/forceboard.interface.ts +34 -4
- package/src/interfaces/device/kilterboard.interface.ts +1 -1
- package/src/interfaces/device/motherboard.interface.ts +1 -1
- package/src/interfaces/device/mysmartboard.interface.ts +1 -1
- package/src/interfaces/device/progressor.interface.ts +1 -1
- package/src/interfaces/device/wh-c06.interface.ts +1 -1
- package/src/interfaces/device.interface.ts +3 -3
- package/src/interfaces/index.ts +8 -8
- package/src/models/base.model.ts +1 -1
- package/src/models/device/climbro.model.ts +2 -2
- package/src/models/device/entralpi.model.ts +2 -2
- package/src/models/device/forceboard.model.ts +104 -53
- package/src/models/device/kilterboard.model.ts +3 -3
- package/src/models/device/motherboard.model.ts +3 -3
- package/src/models/device/mysmartboard.model.ts +2 -2
- package/src/models/device/progressor.model.ts +2 -2
- package/src/models/device/wh-c06.model.ts +2 -2
- package/src/models/device.model.ts +60 -77
- package/src/models/index.ts +8 -8
package/README.md
CHANGED
|
@@ -35,9 +35,8 @@ Learn more: [Documentation](https://stevie-ray.github.io/hangtime-grip-connect/)
|
|
|
35
35
|
|
|
36
36
|
## Install
|
|
37
37
|
|
|
38
|
-
This package
|
|
39
|
-
[NPM](https://www.npmjs.com/package/@hangtime/grip-connect) and [JSR](https://jsr.io/@hangtime/grip-connect)
|
|
40
|
-
registries.
|
|
38
|
+
This package works with Node.js, Bun, Deno, and the web, and is available on both
|
|
39
|
+
[NPM](https://www.npmjs.com/package/@hangtime/grip-connect) and [JSR](https://jsr.io/@hangtime/grip-connect).
|
|
41
40
|
|
|
42
41
|
```sh [npm]
|
|
43
42
|
$ npm install @hangtime/grip-connect
|
|
@@ -156,6 +155,7 @@ A special thank you to:
|
|
|
156
155
|
- [@ecstrema](https://github.com/ecstrema) for providing [examples](https://github.com/ecstrema/entralpi-games) on how
|
|
157
156
|
to play games with the Entralpi.
|
|
158
157
|
- [Tindeq](https://tindeq.com/) for providing an open [Progressor API](https://tindeq.com/progressor_api/).
|
|
158
|
+
- [PitchSix](https://pitchsix.com/) for the [Force Board Portable Public API](https://pitchsix.com/pages/downloads).
|
|
159
159
|
- [@StuartLittlefair](https://github.com/StuartLittlefair) for his
|
|
160
160
|
[PyTindeq](https://github.com/StuartLittlefair/PyTindeq) implementation.
|
|
161
161
|
- [@Phil9l](https://github.com/phil9l) for his research and providing a [blog](https://bazun.me/blog/kiterboard/) on how
|
package/deno.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { IClimbro, IEntralpi, IForceBoard, IKilterBoard, IMotherboard, ImySmartBoard, IProgressor, IWHC06, } from "./interfaces/index
|
|
2
|
-
export { Climbro, Entralpi, ForceBoard, KilterBoard, Motherboard, mySmartBoard, Progressor, WHC06, } from "./models/index
|
|
1
|
+
export type { IClimbro, IEntralpi, IForceBoard, IKilterBoard, IMotherboard, ImySmartBoard, IProgressor, IWHC06, } from "./interfaces/index";
|
|
2
|
+
export { Climbro, Entralpi, ForceBoard, KilterBoard, Motherboard, mySmartBoard, Progressor, WHC06, } from "./models/index";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Climbro, Entralpi, ForceBoard, KilterBoard, Motherboard, mySmartBoard, Progressor, WHC06, } from "./models/index
|
|
1
|
+
export { Climbro, Entralpi, ForceBoard, KilterBoard, Motherboard, mySmartBoard, Progressor, WHC06, } from "./models/index";
|
|
@@ -37,6 +37,12 @@ export interface Commands {
|
|
|
37
37
|
* Used to ensure accurate measurements by applying calibration points.
|
|
38
38
|
*/
|
|
39
39
|
GET_CALIBRATION?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the Force Board into Quick Start mode.
|
|
42
|
+
* In this mode, data transmission starts when force exceeds the threshold
|
|
43
|
+
* and stops when force drops below the threshold.
|
|
44
|
+
*/
|
|
45
|
+
START_QUICK_MEAS?: string;
|
|
40
46
|
/**
|
|
41
47
|
* Tares the scale, zeroing the current weight measurement.
|
|
42
48
|
* Used to reset the baseline for weight data.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IDevice } from "../device.interface
|
|
1
|
+
import type { IDevice } from "../device.interface";
|
|
2
2
|
/**
|
|
3
3
|
* Interface representing the PitchSix ForceBoard device, extending the base Device interface.
|
|
4
4
|
*/
|
|
@@ -19,19 +19,45 @@ export interface IForceBoard extends IDevice {
|
|
|
19
19
|
*/
|
|
20
20
|
manufacturer(): Promise<string | undefined>;
|
|
21
21
|
/**
|
|
22
|
-
* Stops the data stream on the specified device.
|
|
22
|
+
* Stops the data stream on the specified device by setting it to Idle mode.
|
|
23
|
+
* Writes 0x07 to the Device Mode characteristic.
|
|
23
24
|
* @returns {Promise<void>} A promise that resolves when the stream is stopped.
|
|
24
25
|
*/
|
|
25
26
|
stop(): Promise<void>;
|
|
26
27
|
/**
|
|
27
|
-
* Starts streaming data from the specified device.
|
|
28
|
+
* Starts streaming data from the specified device in Streaming Data Mode.
|
|
29
|
+
* Writes 0x04 to the Device Mode characteristic.
|
|
28
30
|
* @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely.
|
|
29
31
|
* @returns {Promise<void>} A promise that resolves when the streaming operation is completed.
|
|
30
32
|
*/
|
|
31
33
|
stream(duration?: number): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Tares the Force Board device using a characteristic to zero out the current load value.
|
|
36
|
+
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
37
|
+
*/
|
|
38
|
+
tareByCharacteristic(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Tares the Force Board device using the Device Mode characteristic.
|
|
41
|
+
* Writes 0x05 to the Device Mode characteristic to zero out the current load value.
|
|
42
|
+
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
43
|
+
*/
|
|
44
|
+
tareByMode(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the threshold for the Quick Start mode.
|
|
47
|
+
* @param {number} thresholdLbs - The threshold value in pounds.
|
|
48
|
+
* @returns {Promise<void>} A promise that resolves when the threshold is set.
|
|
49
|
+
*/
|
|
50
|
+
threshold(thresholdLbs: number): Promise<void>;
|
|
32
51
|
/**
|
|
33
52
|
* Retrieves temperature information from the device.
|
|
34
|
-
* @returns {Promise<string | undefined>} A Promise that resolves with the
|
|
53
|
+
* @returns {Promise<string | undefined>} A Promise that resolves with the temperature information.
|
|
35
54
|
*/
|
|
36
55
|
temperature(): Promise<string | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* Starts the Force Board in Quick Start mode.
|
|
58
|
+
* Writes 0x06 to the Device Mode characteristic.
|
|
59
|
+
* @param {number} [duration=0] - The duration in milliseconds. If set to 0, mode will continue indefinitely.
|
|
60
|
+
* @returns {Promise<void>} A promise that resolves when the operation is completed.
|
|
61
|
+
*/
|
|
62
|
+
quick(duration?: number): Promise<void>;
|
|
37
63
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IBase } from "./base.interface
|
|
2
|
-
import type { massObject } from "./callback.interface
|
|
3
|
-
import type { Commands } from "./command.interface
|
|
1
|
+
import type { IBase } from "./base.interface";
|
|
2
|
+
import type { massObject } from "./callback.interface";
|
|
3
|
+
import type { Commands } from "./command.interface";
|
|
4
4
|
/**
|
|
5
5
|
* Represents a characteristic of a Bluetooth service.
|
|
6
6
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { IClimbro } from "./device/climbro.interface
|
|
2
|
-
export type { IEntralpi } from "./device/entralpi.interface
|
|
3
|
-
export type { IForceBoard } from "./device/forceboard.interface
|
|
4
|
-
export type { IKilterBoard } from "./device/kilterboard.interface
|
|
5
|
-
export type { IMotherboard } from "./device/motherboard.interface
|
|
6
|
-
export type { ImySmartBoard } from "./device/mysmartboard.interface
|
|
7
|
-
export type { IProgressor } from "./device/progressor.interface
|
|
8
|
-
export type { IWHC06 } from "./device/wh-c06.interface
|
|
1
|
+
export type { IClimbro } from "./device/climbro.interface";
|
|
2
|
+
export type { IEntralpi } from "./device/entralpi.interface";
|
|
3
|
+
export type { IForceBoard } from "./device/forceboard.interface";
|
|
4
|
+
export type { IKilterBoard } from "./device/kilterboard.interface";
|
|
5
|
+
export type { IMotherboard } from "./device/motherboard.interface";
|
|
6
|
+
export type { ImySmartBoard } from "./device/mysmartboard.interface";
|
|
7
|
+
export type { IProgressor } from "./device/progressor.interface";
|
|
8
|
+
export type { IWHC06 } from "./device/wh-c06.interface";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
2
|
-
import type { IClimbro } from "../../interfaces/device/climbro.interface
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { IClimbro } from "../../interfaces/device/climbro.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a Climbro device.
|
|
5
5
|
* TODO: Add services, do you own a Climbro? Help us!
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
2
|
-
import type { IEntralpi } from "../../interfaces/device/entralpi.interface
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { IEntralpi } from "../../interfaces/device/entralpi.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a Entralpi device.
|
|
5
5
|
* {@link https://entralpi.com}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
2
|
-
import type { IForceBoard } from "../../interfaces/device/forceboard.interface
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { IForceBoard } from "../../interfaces/device/forceboard.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a PitchSix Force Board device.
|
|
5
5
|
* {@link https://pitchsix.com}
|
|
@@ -30,19 +30,43 @@ export declare class ForceBoard extends Device implements IForceBoard {
|
|
|
30
30
|
*/
|
|
31
31
|
manufacturer: () => Promise<string | undefined>;
|
|
32
32
|
/**
|
|
33
|
-
* Stops the data stream on the specified device.
|
|
33
|
+
* Stops the data stream on the specified device by setting it to Idle mode.
|
|
34
34
|
* @returns {Promise<void>} A promise that resolves when the stream is stopped.
|
|
35
35
|
*/
|
|
36
36
|
stop: () => Promise<void>;
|
|
37
37
|
/**
|
|
38
|
-
* Starts streaming data from the specified device.
|
|
38
|
+
* Starts streaming data from the specified device in Streaming Data Mode.
|
|
39
39
|
* @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely.
|
|
40
40
|
* @returns {Promise<void>} A promise that resolves when the streaming operation is completed.
|
|
41
41
|
*/
|
|
42
42
|
stream: (duration?: number) => Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Sets the threshold in Lbs for the Quick Start mode.
|
|
45
|
+
* @param {number} thresholdLbs - The threshold value in pounds.
|
|
46
|
+
* @returns {Promise<void>} A promise that resolves when the threshold is set.
|
|
47
|
+
*/
|
|
48
|
+
threshold: (thresholdLbs: number) => Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Tares the Force Board device using a characteristic to zero out the current load value.
|
|
51
|
+
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
52
|
+
*/
|
|
53
|
+
tareByCharacteristic: () => Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Initiates a tare routine via the Device Mode characteristic.
|
|
56
|
+
* Writes 0x05 to the Device Mode characteristic to zero out the current load value.
|
|
57
|
+
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
58
|
+
*/
|
|
59
|
+
tareByMode: () => Promise<void>;
|
|
43
60
|
/**
|
|
44
61
|
* Retrieves temperature information from the device.
|
|
45
|
-
* @returns {Promise<string>} A Promise that resolves with the
|
|
62
|
+
* @returns {Promise<string>} A Promise that resolves with the temperature information,
|
|
46
63
|
*/
|
|
47
64
|
temperature: () => Promise<string | undefined>;
|
|
65
|
+
/**
|
|
66
|
+
* Starts the Force Board in Quick Start mode.
|
|
67
|
+
* Writes 0x06 to the Device Mode characteristic.
|
|
68
|
+
* @param {number} [duration=0] - The duration in milliseconds. If set to 0, mode will continue indefinitely.
|
|
69
|
+
* @returns {Promise<void>} A promise that resolves when the operation is completed.
|
|
70
|
+
*/
|
|
71
|
+
quick: (duration?: number) => Promise<void>;
|
|
48
72
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
2
|
/**
|
|
3
3
|
* Represents a PitchSix Force Board device.
|
|
4
4
|
* {@link https://pitchsix.com}
|
|
@@ -106,13 +106,13 @@ export class ForceBoard extends Device {
|
|
|
106
106
|
uuid: "9a88d681-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
|
-
name: "
|
|
109
|
+
name: "Force Data",
|
|
110
110
|
id: "rx",
|
|
111
111
|
uuid: "9a88d682-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
|
-
name: "
|
|
115
|
-
id: "",
|
|
114
|
+
name: "Tare",
|
|
115
|
+
id: "tare",
|
|
116
116
|
uuid: "9a88d683-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
117
117
|
},
|
|
118
118
|
{
|
|
@@ -121,8 +121,8 @@ export class ForceBoard extends Device {
|
|
|
121
121
|
uuid: "9a88d685-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
|
-
name: "
|
|
125
|
-
id: "",
|
|
124
|
+
name: "Threshold",
|
|
125
|
+
id: "threshold",
|
|
126
126
|
uuid: "9a88d686-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
127
127
|
},
|
|
128
128
|
{
|
|
@@ -143,12 +143,12 @@ export class ForceBoard extends Device {
|
|
|
143
143
|
],
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
|
-
name: "Weight
|
|
146
|
+
name: "Weight Service",
|
|
147
147
|
id: "weight",
|
|
148
148
|
uuid: "467a8516-6e39-11eb-9439-0242ac130002",
|
|
149
149
|
characteristics: [
|
|
150
150
|
{
|
|
151
|
-
name: "
|
|
151
|
+
name: "Device Mode",
|
|
152
152
|
id: "tx",
|
|
153
153
|
uuid: "467a8517-6e39-11eb-9439-0242ac130002",
|
|
154
154
|
},
|
|
@@ -161,7 +161,10 @@ export class ForceBoard extends Device {
|
|
|
161
161
|
},
|
|
162
162
|
],
|
|
163
163
|
commands: {
|
|
164
|
-
|
|
164
|
+
START_WEIGHT_MEAS: String.fromCharCode(0x04), // Streaming Data Mode: continuously streams force data.
|
|
165
|
+
TARE_SCALE: String.fromCharCode(0x05), // Tare function: zeroes out the current load value
|
|
166
|
+
START_QUICK_MEAS: String.fromCharCode(0x06), // Quick Start Mode: Starts data transmission when a force value exceeds the Threshold and stops data transmission when the force data drops below the Threshold.
|
|
167
|
+
STOP_WEIGHT_MEAS: String.fromCharCode(0x07), // Idle Mode: Force Board is idle.
|
|
165
168
|
},
|
|
166
169
|
});
|
|
167
170
|
}
|
|
@@ -187,38 +190,43 @@ export class ForceBoard extends Device {
|
|
|
187
190
|
if (value.buffer) {
|
|
188
191
|
const receivedTime = Date.now();
|
|
189
192
|
const dataArray = new Uint8Array(value.buffer);
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
//
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
193
|
+
// First two bytes contain the number of samples in the packet
|
|
194
|
+
const numSamples = (dataArray[0] << 8) | dataArray[1];
|
|
195
|
+
// Process each sample (3 bytes per sample)
|
|
196
|
+
for (let i = 0; i < numSamples; i++) {
|
|
197
|
+
const offset = 2 + i * 3; // Skip the first 2 bytes which indicate number of samples
|
|
198
|
+
if (offset + 2 < dataArray.length) {
|
|
199
|
+
// Sample = byte1*32768 + byte2*256 + byte3
|
|
200
|
+
const receivedData = dataArray[offset] * 32768 + dataArray[offset + 1] * 256 + dataArray[offset + 2];
|
|
201
|
+
// Convert from LBS to KG
|
|
202
|
+
const convertedReceivedData = receivedData * 0.453592;
|
|
203
|
+
// Tare correction
|
|
204
|
+
const numericData = convertedReceivedData - this.applyTare(convertedReceivedData);
|
|
205
|
+
// Add data to downloadable Array
|
|
206
|
+
this.downloadPackets.push({
|
|
207
|
+
received: receivedTime,
|
|
208
|
+
sampleNum: this.dataPointCount,
|
|
209
|
+
battRaw: 0,
|
|
210
|
+
samples: [convertedReceivedData],
|
|
211
|
+
masses: [numericData],
|
|
212
|
+
});
|
|
213
|
+
// Update massMax
|
|
214
|
+
this.massMax = Math.max(Number(this.massMax), numericData).toFixed(1);
|
|
215
|
+
// Update running sum and count
|
|
216
|
+
const currentMassTotal = Math.max(-1000, numericData);
|
|
217
|
+
this.massTotalSum += currentMassTotal;
|
|
218
|
+
this.dataPointCount++;
|
|
219
|
+
// Calculate the average dynamically
|
|
220
|
+
this.massAverage = (this.massTotalSum / this.dataPointCount).toFixed(1);
|
|
221
|
+
// Check if device is being used
|
|
222
|
+
this.activityCheck(numericData);
|
|
223
|
+
// Notify with weight data
|
|
224
|
+
this.notifyCallback({
|
|
225
|
+
massMax: this.massMax,
|
|
226
|
+
massAverage: this.massAverage,
|
|
227
|
+
massTotal: Math.max(-1000, numericData).toFixed(1),
|
|
228
|
+
});
|
|
229
|
+
}
|
|
222
230
|
}
|
|
223
231
|
}
|
|
224
232
|
}
|
|
@@ -238,32 +246,67 @@ export class ForceBoard extends Device {
|
|
|
238
246
|
return await this.read("device", "manufacturer", 250);
|
|
239
247
|
};
|
|
240
248
|
/**
|
|
241
|
-
* Stops the data stream on the specified device.
|
|
249
|
+
* Stops the data stream on the specified device by setting it to Idle mode.
|
|
242
250
|
* @returns {Promise<void>} A promise that resolves when the stream is stopped.
|
|
243
251
|
*/
|
|
244
252
|
stop = async () => {
|
|
245
253
|
await this.write("weight", "tx", this.commands.STOP_WEIGHT_MEAS, 0);
|
|
246
254
|
};
|
|
247
255
|
/**
|
|
248
|
-
* Starts streaming data from the specified device.
|
|
256
|
+
* Starts streaming data from the specified device in Streaming Data Mode.
|
|
249
257
|
* @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely.
|
|
250
258
|
* @returns {Promise<void>} A promise that resolves when the streaming operation is completed.
|
|
251
259
|
*/
|
|
252
260
|
stream = async (duration = 0) => {
|
|
253
|
-
//
|
|
254
|
-
this.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
// Start streaming data - Streaming Data Mode
|
|
262
|
+
await this.write("weight", "tx", this.commands.START_WEIGHT_MEAS, duration);
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Sets the threshold in Lbs for the Quick Start mode.
|
|
266
|
+
* @param {number} thresholdLbs - The threshold value in pounds.
|
|
267
|
+
* @returns {Promise<void>} A promise that resolves when the threshold is set.
|
|
268
|
+
*/
|
|
269
|
+
threshold = async (thresholdLbs) => {
|
|
270
|
+
const thresholdHex = thresholdLbs.toString(16).padStart(6, "0");
|
|
271
|
+
// 3-byte array from the hex string
|
|
272
|
+
const bytes = new Uint8Array(3);
|
|
273
|
+
bytes[0] = parseInt(thresholdHex.substring(0, 2), 16);
|
|
274
|
+
bytes[1] = parseInt(thresholdHex.substring(2, 4), 16);
|
|
275
|
+
bytes[2] = parseInt(thresholdHex.substring(4, 6), 16);
|
|
276
|
+
await this.write("forceboard", "threshold", String.fromCharCode(...bytes), 0);
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Tares the Force Board device using a characteristic to zero out the current load value.
|
|
280
|
+
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
281
|
+
*/
|
|
282
|
+
tareByCharacteristic = async () => {
|
|
283
|
+
// Send tare command (0x01) to the tare characteristic
|
|
284
|
+
const tareValue = String.fromCharCode(0x01);
|
|
285
|
+
await this.write("forceboard", "tare", tareValue, 0);
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Initiates a tare routine via the Device Mode characteristic.
|
|
289
|
+
* Writes 0x05 to the Device Mode characteristic to zero out the current load value.
|
|
290
|
+
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
291
|
+
*/
|
|
292
|
+
tareByMode = async () => {
|
|
293
|
+
await this.write("weight", "tx", this.commands.TARE_SCALE, 0);
|
|
261
294
|
};
|
|
262
295
|
/**
|
|
263
296
|
* Retrieves temperature information from the device.
|
|
264
|
-
* @returns {Promise<string>} A Promise that resolves with the
|
|
297
|
+
* @returns {Promise<string>} A Promise that resolves with the temperature information,
|
|
265
298
|
*/
|
|
266
299
|
temperature = async () => {
|
|
267
300
|
return await this.read("temperature", "level", 250);
|
|
268
301
|
};
|
|
302
|
+
/**
|
|
303
|
+
* Starts the Force Board in Quick Start mode.
|
|
304
|
+
* Writes 0x06 to the Device Mode characteristic.
|
|
305
|
+
* @param {number} [duration=0] - The duration in milliseconds. If set to 0, mode will continue indefinitely.
|
|
306
|
+
* @returns {Promise<void>} A promise that resolves when the operation is completed.
|
|
307
|
+
*/
|
|
308
|
+
quick = async (duration = 0) => {
|
|
309
|
+
// Start in Quick Start mode
|
|
310
|
+
await this.write("weight", "tx", this.commands.START_QUICK_MEAS, duration);
|
|
311
|
+
};
|
|
269
312
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
2
|
-
import type { IKilterBoard } from "../../interfaces/device/kilterboard.interface
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { IKilterBoard } from "../../interfaces/device/kilterboard.interface";
|
|
3
3
|
/**
|
|
4
4
|
* For API level 2 and API level 3.
|
|
5
5
|
* The first byte in the data is dependent on where the packet is in the message as a whole.
|
|
@@ -113,7 +113,7 @@ export declare class KilterBoard extends Device implements IKilterBoard {
|
|
|
113
113
|
private prepBytesV3;
|
|
114
114
|
/**
|
|
115
115
|
* Splits a collection into slices of the specified length.
|
|
116
|
-
* https://github.com/ramda/ramda/blob/master/source/splitEvery
|
|
116
|
+
* https://github.com/ramda/ramda/blob/master/source/splitEvery
|
|
117
117
|
* @param {Number} n
|
|
118
118
|
* @param {Array} list
|
|
119
119
|
* @return {Array<number[]>}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
2
|
/**
|
|
3
3
|
* For API level 2 and API level 3.
|
|
4
4
|
* The first byte in the data is dependent on where the packet is in the message as a whole.
|
|
@@ -234,7 +234,7 @@ export class KilterBoard extends Device {
|
|
|
234
234
|
}
|
|
235
235
|
/**
|
|
236
236
|
* Splits a collection into slices of the specified length.
|
|
237
|
-
* https://github.com/ramda/ramda/blob/master/source/splitEvery
|
|
237
|
+
* https://github.com/ramda/ramda/blob/master/source/splitEvery
|
|
238
238
|
* @param {Number} n
|
|
239
239
|
* @param {Array} list
|
|
240
240
|
* @return {Array<number[]>}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
2
|
-
import type { IMotherboard } from "../../interfaces/device/motherboard.interface
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { IMotherboard } from "../../interfaces/device/motherboard.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a Griptonite Motherboard device.
|
|
5
5
|
* {@link https://griptonite.io}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
2
|
-
import type { ImySmartBoard } from "../../interfaces/device/mysmartboard.interface
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { ImySmartBoard } from "../../interfaces/device/mysmartboard.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a Smartboard Climbing mySmartBoard device.
|
|
5
5
|
* TODO: Add services, do you own a mySmartBoard? Help us!
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
2
|
-
import type { IProgressor } from "../../interfaces/device/progressor.interface
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { IProgressor } from "../../interfaces/device/progressor.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a Tindeq Progressor device.
|
|
5
5
|
* {@link https://tindeq.com}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Device } from "../device.model
|
|
2
|
-
import type { IWHC06 } from "../../interfaces/device/wh-c06.interface
|
|
1
|
+
import { Device } from "../device.model";
|
|
2
|
+
import type { IWHC06 } from "../../interfaces/device/wh-c06.interface";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a Weiheng - WH-C06 (or MAT Muscle Meter) device.
|
|
5
5
|
* To use this device enable: `chrome://flags/#enable-experimental-web-platform-features`.
|