@hangtime/grip-connect 0.5.0 → 0.5.2

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.
Files changed (65) hide show
  1. package/README.md +17 -38
  2. package/dist/{is-device.d.ts → helpers/is-device.d.ts} +1 -1
  3. package/dist/{is-device.js → helpers/is-device.js} +1 -1
  4. package/dist/index.d.ts +1 -3
  5. package/dist/index.js +2 -4
  6. package/dist/interfaces/base.interface.d.ts +12 -0
  7. package/dist/interfaces/device/climbro.interface.d.ts +3 -0
  8. package/dist/interfaces/device/entralpi.interface.d.ts +49 -0
  9. package/dist/interfaces/device/forceboard.interface.d.ts +18 -0
  10. package/dist/interfaces/device/kilterboard.interface.d.ts +73 -0
  11. package/dist/interfaces/device/motherboard.interface.d.ts +53 -3
  12. package/dist/interfaces/device/mysmartboard.interface.d.ts +3 -0
  13. package/dist/interfaces/device/progressor.interface.d.ts +24 -0
  14. package/dist/interfaces/device/wh-c06.interface.d.ts +3 -0
  15. package/dist/interfaces/device.interface.d.ts +73 -17
  16. package/dist/models/device/entralpi.model.d.ts +22 -6
  17. package/dist/models/device/entralpi.model.js +54 -16
  18. package/dist/models/device/forceboard.model.js +3 -4
  19. package/dist/models/device/kilterboard.model.d.ts +1 -1
  20. package/dist/models/device/kilterboard.model.js +1 -2
  21. package/dist/models/device/motherboard.model.d.ts +5 -0
  22. package/dist/models/device/motherboard.model.js +24 -19
  23. package/dist/models/device/progressor.model.d.ts +5 -0
  24. package/dist/models/device/progressor.model.js +23 -16
  25. package/dist/models/device/wh-c06.model.js +3 -4
  26. package/dist/models/device.model.d.ts +78 -17
  27. package/dist/models/device.model.js +181 -51
  28. package/package.json +1 -1
  29. package/src/{is-device.ts → helpers/is-device.ts} +2 -2
  30. package/src/index.ts +2 -6
  31. package/src/interfaces/base.interface.ts +14 -0
  32. package/src/interfaces/device/climbro.interface.ts +3 -1
  33. package/src/interfaces/device/entralpi.interface.ts +59 -2
  34. package/src/interfaces/device/forceboard.interface.ts +22 -2
  35. package/src/interfaces/device/kilterboard.interface.ts +83 -2
  36. package/src/interfaces/device/motherboard.interface.ts +62 -3
  37. package/src/interfaces/device/mysmartboard.interface.ts +3 -1
  38. package/src/interfaces/device/progressor.interface.ts +29 -2
  39. package/src/interfaces/device/wh-c06.interface.ts +3 -1
  40. package/src/interfaces/device.interface.ts +85 -17
  41. package/src/models/device/entralpi.model.ts +57 -16
  42. package/src/models/device/forceboard.model.ts +3 -4
  43. package/src/models/device/kilterboard.model.ts +2 -3
  44. package/src/models/device/motherboard.model.ts +25 -19
  45. package/src/models/device/progressor.model.ts +24 -16
  46. package/src/models/device/wh-c06.model.ts +4 -4
  47. package/src/models/device.model.ts +201 -55
  48. package/dist/characteristic.d.ts +0 -9
  49. package/dist/characteristic.js +0 -21
  50. package/dist/notify.d.ts +0 -16
  51. package/dist/notify.js +0 -14
  52. package/dist/read.d.ts +0 -10
  53. package/dist/read.js +0 -43
  54. package/dist/stop.d.ts +0 -7
  55. package/dist/stop.js +0 -20
  56. package/dist/write.d.ts +0 -34
  57. package/dist/write.js +0 -58
  58. package/src/characteristic.ts +0 -29
  59. package/src/notify.ts +0 -18
  60. package/src/read.ts +0 -45
  61. package/src/stop.ts +0 -22
  62. package/src/write.ts +0 -74
  63. /package/dist/{struct/index.d.ts → helpers/struct.d.ts} +0 -0
  64. /package/dist/{struct/index.js → helpers/struct.js} +0 -0
  65. /package/src/{struct/index.ts → helpers/struct.ts} +0 -0
@@ -11,13 +11,71 @@ export class Device extends BaseModel {
11
11
  this.bluetooth = device.bluetooth;
12
12
  }
13
13
  /**
14
- * Handles the 'disconnected' event.
15
- * @param {Event} event - The 'disconnected' event.
14
+ * Connects to a Bluetooth device.
15
+ * @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
16
+ * @param {Function} [onError] - Optional callback function to execute on error. Default logs the error.
16
17
  */
17
- onDisconnected = (event) => {
18
- this.bluetooth = undefined;
19
- const device = event.target;
20
- throw new Error(`Device ${device.name} is disconnected.`);
18
+ connect = async (onSuccess = () => console.log("Connected successfully"), onError = (error) => console.error(error)) => {
19
+ try {
20
+ // Request device and set up connection
21
+ const deviceServices = this.getAllServiceUUIDs();
22
+ this.bluetooth = await navigator.bluetooth.requestDevice({
23
+ filters: this.filters,
24
+ optionalServices: deviceServices,
25
+ });
26
+ if (!this.bluetooth.gatt) {
27
+ throw new Error("GATT is not available on this device");
28
+ }
29
+ this.bluetooth.addEventListener("gattserverdisconnected", (event) => {
30
+ this.onDisconnected(event);
31
+ });
32
+ server = await this.bluetooth.gatt.connect();
33
+ if (server.connected) {
34
+ await this.onConnected(onSuccess);
35
+ }
36
+ }
37
+ catch (error) {
38
+ onError(error);
39
+ }
40
+ };
41
+ /**
42
+ * Disconnects the device if it is currently connected.
43
+ * - Checks if the device is connected via it's GATT server.
44
+ * - If the device is connected, it attempts to gracefully disconnect.
45
+ */
46
+ disconnect = () => {
47
+ // Verify that the device is connected using the provided helper function
48
+ if (this.isConnected()) {
49
+ // Safely attempt to disconnect the device's GATT server, if available
50
+ this.bluetooth?.gatt?.disconnect();
51
+ }
52
+ };
53
+ /**
54
+ * Returns UUIDs of all services associated with the device.
55
+ * @returns {string[]} Array of service UUIDs.
56
+ */
57
+ getAllServiceUUIDs = () => {
58
+ return this.services.map((service) => service.uuid);
59
+ };
60
+ /**
61
+ * Retrieves the characteristic from the device's service.
62
+ * @param {string} serviceId - The UUID of the service.
63
+ * @param {string} characteristicId - The UUID of the characteristic.
64
+ * @returns {BluetoothRemoteGATTCharacteristic | undefined} The characteristic, if found.
65
+ */
66
+ getCharacteristic = (serviceId, characteristicId) => {
67
+ // Find the service with the specified serviceId
68
+ const boardService = this.services.find((service) => service.id === serviceId);
69
+ if (boardService) {
70
+ // If the service is found, find the characteristic with the specified characteristicId
71
+ const boardCharacteristic = boardService.characteristics.find((characteristic) => characteristic.id === characteristicId);
72
+ if (boardCharacteristic) {
73
+ // If the characteristic is found, return it
74
+ return boardCharacteristic.characteristic;
75
+ }
76
+ }
77
+ // Return undefined if the service or characteristic is not found
78
+ return undefined;
21
79
  };
22
80
  /**
23
81
  * Handles notifications received from a characteristic.
@@ -38,6 +96,32 @@ export class Device extends BaseModel {
38
96
  }
39
97
  }
40
98
  };
99
+ /**
100
+ * Checks if a Bluetooth device is connected.
101
+ * @returns {boolean} A boolean indicating whether the device is connected.
102
+ */
103
+ isConnected = () => {
104
+ // Check if the device is defined and available
105
+ if (!this?.bluetooth) {
106
+ return false;
107
+ }
108
+ // Check if the device is connected
109
+ return !!this.bluetooth.gatt?.connected;
110
+ };
111
+ /**
112
+ * Sets the callback function to be called when notifications are received.
113
+ * @param {NotifyCallback} callback - The callback function to be set.
114
+ * @returns {void}
115
+ */
116
+ notify = (callback) => {
117
+ this.notifyCallback = callback;
118
+ };
119
+ /**
120
+ * Defines the type for the callback function.
121
+ * @callback NotifyCallback
122
+ * @param {massObject} data - The data passed to the callback.
123
+ */
124
+ notifyCallback = (data) => console.log(data);
41
125
  /**
42
126
  * Handles the 'connected' event.
43
127
  * @param {Function} onSuccess - Callback function to execute on successful connection.
@@ -79,62 +163,108 @@ export class Device extends BaseModel {
79
163
  onSuccess();
80
164
  };
81
165
  /**
82
- * Returns UUIDs of all services associated with the device.
83
- * @returns {string[]} Array of service UUIDs.
166
+ * Handles the 'disconnected' event.
167
+ * @param {Event} event - The 'disconnected' event.
84
168
  */
85
- getAllServiceUUIDs = () => {
86
- return this.services.map((service) => service.uuid);
169
+ onDisconnected = (event) => {
170
+ this.bluetooth = undefined;
171
+ const device = event.target;
172
+ throw new Error(`Device ${device.name} is disconnected.`);
87
173
  };
88
174
  /**
89
- * Connects to a Bluetooth device.
90
- * @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
91
- * @param {Function} [onError] - Optional callback function to execute on error. Default logs the error.
175
+ * Reads the value of the specified characteristic from the device.
176
+ * @param {string} serviceId - The service ID where the characteristic belongs.
177
+ * @param {string} characteristicId - The characteristic ID to read from.
178
+ * @param {number} [duration=0] - The duration to wait before resolving the promise, in milliseconds.
179
+ * @returns {Promise<string>} A promise that resolves when the read operation is completed.
92
180
  */
93
- connect = async (onSuccess = () => console.log("Connected successfully"), onError = (error) => console.error(error)) => {
94
- try {
95
- // Request device and set up connection
96
- const deviceServices = this.getAllServiceUUIDs();
97
- this.bluetooth = await navigator.bluetooth.requestDevice({
98
- filters: this.filters,
99
- optionalServices: deviceServices,
100
- });
101
- if (!this.bluetooth.gatt) {
102
- throw new Error("GATT is not available on this device");
103
- }
104
- this.bluetooth.addEventListener("gattserverdisconnected", (event) => {
105
- this.onDisconnected(event);
106
- });
107
- server = await this.bluetooth.gatt.connect();
108
- if (server.connected) {
109
- await this.onConnected(onSuccess);
181
+ read = (serviceId, characteristicId, duration = 0) => {
182
+ return new Promise((resolve, reject) => {
183
+ if (this.isConnected()) {
184
+ const characteristic = this.getCharacteristic(serviceId, characteristicId);
185
+ if (characteristic) {
186
+ characteristic
187
+ .readValue()
188
+ .then((value) => {
189
+ let decodedValue;
190
+ const decoder = new TextDecoder("utf-8");
191
+ switch (characteristicId) {
192
+ case "level":
193
+ // TODO: This is battery specific.
194
+ decodedValue = value.getUint8(0).toString();
195
+ break;
196
+ default:
197
+ decodedValue = decoder.decode(value);
198
+ break;
199
+ }
200
+ // Resolve after specified duration
201
+ setTimeout(() => {
202
+ return resolve(decodedValue);
203
+ }, duration);
204
+ })
205
+ .catch((error) => {
206
+ reject(error);
207
+ });
208
+ }
209
+ else {
210
+ reject(new Error("Characteristic is undefined"));
211
+ }
110
212
  }
111
- }
112
- catch (error) {
113
- onError(error);
114
- }
213
+ });
115
214
  };
116
215
  /**
117
- * Checks if a Bluetooth device is connected.
118
- * @returns {boolean} A boolean indicating whether the device is connected.
216
+ * Writes a message to the specified characteristic of a Bluetooth device and optionally provides a callback to handle responses.
217
+ * @param {string} serviceId - The service UUID of the Bluetooth device containing the target characteristic.
218
+ * @param {string} characteristicId - The characteristic UUID where the message will be written.
219
+ * @param {string | Uint8Array | undefined} message - The message to be written to the characteristic. It can be a string or a Uint8Array.
220
+ * @param {number} [duration=0] - Optional. The time in milliseconds to wait before resolving the promise. Defaults to 0 for immediate resolution.
221
+ * @param {WriteCallback} [callback=writeCallback] - Optional. A custom callback to handle the response after the write operation is successful.
222
+ *
223
+ * @returns {Promise<void>} A promise that resolves once the write operation is complete.
224
+ *
225
+ * @throws {Error} Throws an error if the characteristic is undefined.
226
+ *
227
+ * @example
228
+ * // Example usage of the write function with a custom callback
229
+ * await Progressor.write("progressor", "tx", ProgressorCommands.GET_BATT_VLTG, 250, (data) => {
230
+ * console.log(`Battery voltage: ${data}`);
231
+ * });
119
232
  */
120
- isConnected = () => {
121
- // Check if the device is defined and available
122
- if (!this?.bluetooth) {
123
- return false;
233
+ write = async (serviceId, characteristicId, message, duration = 0, callback = this.writeCallback) => {
234
+ if (this.isConnected()) {
235
+ // Check if message is provided
236
+ if (message === undefined) {
237
+ // If not provided, return without performing write operation
238
+ return;
239
+ }
240
+ // Get the characteristic from the device using serviceId and characteristicId
241
+ const characteristic = this.getCharacteristic(serviceId, characteristicId);
242
+ if (!characteristic) {
243
+ throw new Error("Characteristic is undefined");
244
+ }
245
+ // Convert the message to Uint8Array if it's a string
246
+ const valueToWrite = typeof message === "string" ? new TextEncoder().encode(message) : message;
247
+ // Write the value to the characteristic
248
+ await characteristic.writeValue(valueToWrite);
249
+ // Update the last written message
250
+ this.writeLast = message;
251
+ // Assign the provided callback to `writeCallback`
252
+ this.writeCallback = callback;
253
+ // If a duration is specified, resolve the promise after the duration
254
+ if (duration > 0) {
255
+ await new Promise((resolve) => setTimeout(resolve, duration));
256
+ }
124
257
  }
125
- // Check if the device is connected
126
- return !!this.bluetooth.gatt?.connected;
127
258
  };
128
259
  /**
129
- * Disconnects the device if it is currently connected.
130
- * - Checks if the device is connected via it's GATT server.
131
- * - If the device is connected, it attempts to gracefully disconnect.
260
+ * A default write callback that logs the response
132
261
  */
133
- disconnect = () => {
134
- // Verify that the device is connected using the provided helper function
135
- if (this.isConnected()) {
136
- // Safely attempt to disconnect the device's GATT server, if available
137
- this.bluetooth?.gatt?.disconnect();
138
- }
262
+ writeCallback = (data) => {
263
+ console.log(data);
139
264
  };
265
+ /**
266
+ * The last message written to the device.
267
+ * @type {string | Uint8Array | null}
268
+ */
269
+ writeLast = null;
140
270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hangtime/grip-connect",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Griptonite Motherboard, Tindeq Progressor, PitchSix Force Board, WHC-06, Entralpi, Climbro, mySmartBoard: Web Bluetooth API Force-Sensing strength analysis for climbers",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
- import type { Device } from "./models/device.model"
2
- import { AuroraUUID } from "./models/device/kilterboard.model"
1
+ import type { Device } from "./../models/device.model"
2
+ import { AuroraUUID } from "./../models/device/kilterboard.model"
3
3
 
4
4
  /**
5
5
  * Checks if the given device is an Entralpi device.
package/src/index.ts CHANGED
@@ -10,15 +10,11 @@ export {
10
10
  } from "./models/index"
11
11
 
12
12
  // helpers
13
- export { isEntralpi, isKilterboard, isMotherboard, isWHC06, isProgressor } from "./is-device"
13
+ export { isEntralpi, isKilterboard, isMotherboard, isWHC06, isProgressor } from "./helpers/is-device"
14
14
 
15
- // functions
15
+ // TODO: Make functions device specific
16
16
  export { download } from "./download"
17
17
 
18
18
  export { active, isActive } from "./is-active"
19
19
 
20
- export { notify } from "./notify"
21
-
22
- export { stop } from "./stop"
23
-
24
20
  export { tare } from "./tare"
@@ -1,5 +1,19 @@
1
+ /**
2
+ * Represents the base properties for an entity.
3
+ */
1
4
  export interface IBase {
5
+ /**
6
+ * Unique identifier for the entity (optional).
7
+ */
2
8
  id?: string
9
+
10
+ /**
11
+ * The date and time when the entity was created (optional).
12
+ */
3
13
  createdAt?: Date
14
+
15
+ /**
16
+ * The date and time when the entity was last updated (optional).
17
+ */
4
18
  updatedAt?: Date
5
19
  }
@@ -1,4 +1,6 @@
1
1
  import type { IDevice } from "../device.interface"
2
-
2
+ /**
3
+ * Interface representing the Climbro device, extending the base Device interface.
4
+ */
3
5
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
4
6
  export interface IClimbro extends IDevice {}
@@ -1,4 +1,61 @@
1
1
  import type { IDevice } from "../device.interface"
2
2
 
3
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
4
- export interface IEntralpi extends IDevice {}
3
+ /**
4
+ * Interface representing the Entralpi device, extending the base Device interface.
5
+ */
6
+ export interface IEntralpi extends IDevice {
7
+ /**
8
+ * Retrieves battery or voltage information from the device.
9
+ * @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
10
+ */
11
+ battery(): Promise<string | undefined>
12
+
13
+ /**
14
+ * Retrieves IEEE 11073-20601 Regulatory Certification from the device.
15
+ * @returns {Promise<string | undefined>} A Promise that resolves with the firmware version.
16
+ */
17
+ certification(): Promise<string | undefined>
18
+
19
+ /**
20
+ * Retrieves firmware version from the device.
21
+ * @returns {Promise<string | undefined>} A Promise that resolves with the firmware version.
22
+ */
23
+ firmware(): Promise<string | undefined>
24
+
25
+ /**
26
+ * Retrieves hardware version from the device.
27
+ * @returns {Promise<string | undefined>} A Promise that resolves with the hardware version.
28
+ */
29
+ hardware(): Promise<string | undefined>
30
+
31
+ /**
32
+ * Retrieves manufacturer information from the device.
33
+ * @returns {Promise<string | undefined>} A Promise that resolves with the manufacturer information.
34
+ */
35
+ manufacturer(): Promise<string | undefined>
36
+
37
+ /**
38
+ * Retrieves model number from the device.
39
+ * @returns {Promise<string | undefined>} A Promise that resolves with the model number.
40
+ */
41
+ model(): Promise<string | undefined>
42
+
43
+ /**
44
+ * Retrieves PnP ID from the device, a set of values that used to create a device ID value that is unique for this device.
45
+ * Included in the characteristic is a Vendor ID Source field, a Vendor ID field, a Product ID field and a Product Version field
46
+ * @returns {Promise<string | undefined>} A Promise that resolves with the PnP ID.
47
+ */
48
+ pnp(): Promise<string | undefined>
49
+
50
+ /**
51
+ * Retrieves software version from the device.
52
+ * @returns {Promise<string | undefined>} A Promise that resolves with the software version.
53
+ */
54
+ software(): Promise<string | undefined>
55
+
56
+ /**
57
+ * Retrieves system id from the device.
58
+ * @returns {Promise<string | undefined>} A Promise that resolves with the system id.
59
+ */
60
+ system(): Promise<string | undefined>
61
+ }
@@ -1,4 +1,24 @@
1
1
  import type { IDevice } from "../device.interface"
2
2
 
3
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
4
- export interface IForceBoard extends IDevice {}
3
+ /**
4
+ * Interface representing the PitchSix ForceBoard device, extending the base Device interface.
5
+ */
6
+ export interface IForceBoard extends IDevice {
7
+ /**
8
+ * Retrieves battery or voltage information from the device.
9
+ * @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
10
+ */
11
+ battery(): Promise<string | undefined>
12
+
13
+ /**
14
+ * Retrieves humidity level from the device.
15
+ * @returns {Promise<string | undefined>} A Promise that resolves with the humidity level.
16
+ */
17
+ humidity(): Promise<string | undefined>
18
+
19
+ /**
20
+ * Retrieves manufacturer information from the device.
21
+ * @returns {Promise<string | undefined>} A Promise that resolves with the manufacturer information.
22
+ */
23
+ manufacturer(): Promise<string | undefined>
24
+ }
@@ -1,4 +1,85 @@
1
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
2
21
 
3
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
4
- export interface IKilterBoard extends IDevice {}
22
+ /**
23
+ * Wraps a byte array with header and footer bytes for transmission.
24
+ * @param data - The array of bytes to wrap.
25
+ * @returns The wrapped byte array.
26
+ */
27
+ wrapBytes(data: number[]): number[]
28
+
29
+ /**
30
+ * Encodes a position into a byte array.
31
+ * @param position - The position to encode.
32
+ * @returns The encoded byte array representing the position.
33
+ */
34
+ encodePosition(position: number): number[]
35
+
36
+ /**
37
+ * Encodes a color string into a numeric representation.
38
+ * @param color - The color string in hexadecimal format.
39
+ * @returns The encoded/compressed color value.
40
+ */
41
+ encodeColor(color: string): number
42
+
43
+ /**
44
+ * Encodes a placement into a byte array.
45
+ * @param position - The position to encode.
46
+ * @param ledColor - The color of the LED in hexadecimal format.
47
+ * @returns The encoded byte array representing the placement.
48
+ */
49
+ encodePlacement(position: number, ledColor: string): number[]
50
+
51
+ /**
52
+ * Prepares byte arrays for transmission based on a list of climb placements.
53
+ * @param climbPlacementList - The list of climb placements.
54
+ * @returns The final byte array ready for transmission.
55
+ */
56
+ prepBytesV3(climbPlacementList: ClimbPlacement[]): number[]
57
+
58
+ /**
59
+ * Splits a collection into slices of the specified length.
60
+ * @param n - Number of elements per slice.
61
+ * @param list - Array to be sliced.
62
+ * @returns The sliced array.
63
+ */
64
+ splitEvery(n: number, list: number[]): number[][]
65
+
66
+ /**
67
+ * Splits a message into 20-byte chunks for Bluetooth transmission.
68
+ * @param buffer - The message to split.
69
+ * @returns The array of Uint8Arrays.
70
+ */
71
+ splitMessages(buffer: number[]): Uint8Array[]
72
+
73
+ /**
74
+ * Sends a series of messages to the device.
75
+ * @param messages - Array of Uint8Arrays to send.
76
+ */
77
+ writeMessageSeries(messages: Uint8Array[]): Promise<void>
78
+
79
+ /**
80
+ * Configures the LEDs based on an array of climb placements.
81
+ * @param config - Optional color or array of climb placements.
82
+ * @returns The prepared payload or undefined.
83
+ */
84
+ led(config?: ClimbPlacement[]): Promise<number[] | undefined>
85
+ }
@@ -1,11 +1,70 @@
1
1
  import type { IDevice } from "../device.interface"
2
2
 
3
+ /**
4
+ * Interface representing the Griptonite Motherboard device.
5
+ */
3
6
  export interface IMotherboard extends IDevice {
4
7
  /**
5
8
  * Applies calibration to a sample value.
6
- * @param sample - The sample value to calibrate.
7
- * @param calibration - The calibration data.
8
- * @returns The calibrated sample value.
9
+ * @param {number} sample - The sample value to calibrate.
10
+ * @param {number[][]} calibration - The calibration data.
11
+ * @returns {number} The calibrated sample value.
9
12
  */
10
13
  applyCalibration(sample: number, calibration: number[][]): number
14
+
15
+ /**
16
+ * Retrieves battery or voltage information from the device.
17
+ * @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
18
+ */
19
+ battery(): Promise<string | undefined>
20
+
21
+ /**
22
+ * Writes a command to get calibration data from the device.
23
+ * @returns {Promise<void>} A Promise that resolves when the command is successfully sent.
24
+ */
25
+ calibration(): Promise<void>
26
+
27
+ /**
28
+ * Retrieves firmware version from the device.
29
+ * @returns {Promise<string | undefined>} A Promise that resolves with the firmware version.
30
+ */
31
+ firmware(): Promise<string | undefined>
32
+
33
+ /**
34
+ * Retrieves hardware version from the device.
35
+ * @returns {Promise<string | undefined>} A Promise that resolves with the hardware version.
36
+ */
37
+ hardware(): Promise<string | undefined>
38
+
39
+ /**
40
+ * Sets the LED color based on a single color option.
41
+ * @param {"green" | "red" | "orange"} [config] - Optional color for the LEDs.
42
+ * @returns {Promise<number[] | undefined>} A promise that resolves with the payload array for the Kilter Board if LED settings were applied.
43
+ */
44
+ led(config?: "green" | "red" | "orange"): Promise<number[] | undefined>
45
+
46
+ /**
47
+ * Retrieves manufacturer information from the device.
48
+ * @returns {Promise<string | undefined>} A Promise that resolves with the manufacturer information.
49
+ */
50
+ manufacturer(): Promise<string | undefined>
51
+
52
+ /**
53
+ * Retrieves serial number from the device.
54
+ * @returns {Promise<string | undefined>} A Promise that resolves with the serial number.
55
+ */
56
+ serial(): Promise<string | undefined>
57
+
58
+ /**
59
+ * Stops the data stream on the specified device.
60
+ * @returns {Promise<void>} A promise that resolves when the stream is stopped.
61
+ */
62
+ stop(): Promise<void>
63
+
64
+ /**
65
+ * Starts streaming data from the specified device.
66
+ * @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely.
67
+ * @returns {Promise<void>} A promise that resolves when the streaming operation is completed.
68
+ */
69
+ stream(duration?: number): Promise<void>
11
70
  }
@@ -1,4 +1,6 @@
1
1
  import type { IDevice } from "../device.interface"
2
-
2
+ /**
3
+ * Interface representing the mySmartBoard device, extending the base Device interface.
4
+ */
3
5
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
4
6
  export interface ImySmartBoard extends IDevice {}
@@ -1,4 +1,31 @@
1
1
  import type { IDevice } from "../device.interface"
2
2
 
3
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type
4
- export interface IProgressor extends IDevice {}
3
+ /**
4
+ * Interface representing the Tindeq Progressor device.
5
+ */
6
+ export interface IProgressor extends IDevice {
7
+ /**
8
+ * Retrieves battery or voltage information from the device.
9
+ * @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
10
+ */
11
+ battery(): Promise<string | undefined>
12
+
13
+ /**
14
+ * Retrieves firmware version from the device.
15
+ * @returns {Promise<string>} A Promise that resolves with the firmware version.
16
+ */
17
+ firmware(): Promise<string | undefined>
18
+
19
+ /**
20
+ * Stops the data stream on the specified device.
21
+ * @returns {Promise<void>} A promise that resolves when the stream is stopped.
22
+ */
23
+ stop(): Promise<void>
24
+
25
+ /**
26
+ * Starts streaming data from the specified device.
27
+ * @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely.
28
+ * @returns {Promise<void>} A promise that resolves when the streaming operation is completed.
29
+ */
30
+ stream(duration?: number): Promise<void>
31
+ }
@@ -1,4 +1,6 @@
1
1
  import type { IDevice } from "../device.interface"
2
-
2
+ /**
3
+ * Interface representing the Weiheng WH-C06 device.
4
+ */
3
5
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
4
6
  export interface IWHC06 extends IDevice {}