@hangtime/grip-connect 0.5.0 → 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.
Files changed (47) hide show
  1. package/README.md +17 -29
  2. package/dist/index.d.ts +0 -2
  3. package/dist/index.js +0 -2
  4. package/dist/interfaces/base.interface.d.ts +12 -0
  5. package/dist/interfaces/device/climbro.interface.d.ts +3 -0
  6. package/dist/interfaces/device/entralpi.interface.d.ts +49 -0
  7. package/dist/interfaces/device/forceboard.interface.d.ts +18 -0
  8. package/dist/interfaces/device/kilterboard.interface.d.ts +73 -0
  9. package/dist/interfaces/device/motherboard.interface.d.ts +53 -3
  10. package/dist/interfaces/device/mysmartboard.interface.d.ts +3 -0
  11. package/dist/interfaces/device/progressor.interface.d.ts +24 -0
  12. package/dist/interfaces/device/wh-c06.interface.d.ts +3 -0
  13. package/dist/interfaces/device.interface.d.ts +33 -19
  14. package/dist/models/device/entralpi.model.d.ts +22 -6
  15. package/dist/models/device/entralpi.model.js +48 -9
  16. package/dist/models/device/kilterboard.model.d.ts +1 -1
  17. package/dist/models/device/motherboard.model.d.ts +5 -0
  18. package/dist/models/device/motherboard.model.js +12 -4
  19. package/dist/models/device/progressor.model.d.ts +5 -0
  20. package/dist/models/device/progressor.model.js +12 -4
  21. package/dist/models/device/wh-c06.model.js +3 -4
  22. package/dist/models/device.model.d.ts +35 -19
  23. package/dist/models/device.model.js +76 -62
  24. package/package.json +1 -1
  25. package/src/index.ts +0 -4
  26. package/src/interfaces/base.interface.ts +14 -0
  27. package/src/interfaces/device/climbro.interface.ts +3 -1
  28. package/src/interfaces/device/entralpi.interface.ts +59 -2
  29. package/src/interfaces/device/forceboard.interface.ts +22 -2
  30. package/src/interfaces/device/kilterboard.interface.ts +83 -2
  31. package/src/interfaces/device/motherboard.interface.ts +62 -3
  32. package/src/interfaces/device/mysmartboard.interface.ts +3 -1
  33. package/src/interfaces/device/progressor.interface.ts +29 -2
  34. package/src/interfaces/device/wh-c06.interface.ts +3 -1
  35. package/src/interfaces/device.interface.ts +36 -20
  36. package/src/models/device/entralpi.model.ts +51 -9
  37. package/src/models/device/kilterboard.model.ts +1 -1
  38. package/src/models/device/motherboard.model.ts +13 -4
  39. package/src/models/device/progressor.model.ts +13 -4
  40. package/src/models/device/wh-c06.model.ts +4 -4
  41. package/src/models/device.model.ts +87 -69
  42. package/dist/notify.d.ts +0 -16
  43. package/dist/notify.js +0 -14
  44. package/dist/stop.d.ts +0 -7
  45. package/dist/stop.js +0 -20
  46. package/src/notify.ts +0 -18
  47. package/src/stop.ts +0 -22
package/README.md CHANGED
@@ -18,7 +18,7 @@ And LED system boards from [Aurora Climbing](https://auroraclimbing.com/) like t
18
18
  [Decoy Board](https://decoy-holds.com/pages/decoy-board), [Touchstone Board](https://touchstoneboardapp.com/) and
19
19
  [So iLL Board](https://apps.apple.com/us/app/so-ill-board/id1358056082).
20
20
 
21
- Learn more: [Docs](https://stevie-ray.github.io/hangtime-grip-connect/) -
21
+ Learn more: [Documentation](https://stevie-ray.github.io/hangtime-grip-connect/) -
22
22
  [Browser Support](https://caniuse.com/web-bluetooth)
23
23
 
24
24
  > This project is provided "as-is" without any express or implied warranties. By using this software, you assume all
@@ -50,7 +50,7 @@ Simply importing the utilities you need from `@hangtime/grip-connect`.
50
50
  ```
51
51
 
52
52
  ```js
53
- import { Motherboard, active, connect, disconnect, notify } from "@hangtime/grip-connect"
53
+ import { Motherboard, active } from "@hangtime/grip-connect"
54
54
 
55
55
  const motherboardButton = document.querySelector("#motherboard")
56
56
 
@@ -61,7 +61,7 @@ motherboardButton.addEventListener("click", () => {
61
61
  motherboard.connect(
62
62
  async () => {
63
63
  // Listen for stream notifications
64
- notify((data) => {
64
+ motherboard.notify((data) => {
65
65
  // { massTotal: "0", massMax: "0", massAverage: "0", massLeft: "0", massCenter: "0", massRight: "0" }
66
66
  console.log(data)
67
67
  })
@@ -93,7 +93,7 @@ motherboardButton.addEventListener("click", () => {
93
93
  // await tare(5000)
94
94
 
95
95
  // Manually call stop method if stream is continues
96
- // await stop(Motherboard)
96
+ // await motherboard.stop()
97
97
 
98
98
  // Download data as CSV, JSON, or XML (default: CSV) format => timestamp, frame, battery, samples, masses
99
99
  // download('json')
@@ -123,35 +123,23 @@ motherboardButton.addEventListener("click", () => {
123
123
 
124
124
  ## Features
125
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
+
126
131
  **Help wanted:** Do you own any of the missing devices? Use Google Chrome's Bluetooth Internals
127
132
  `chrome://bluetooth-internals/#devices` and press `Start Scan` to look for your device, click on `Inspect` and share all
128
133
  available services with us.
129
134
 
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) | ✅ | ✅ | | | | | | |
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) | ✅ | ✅ | | | | | | |
155
143
 
156
144
  ## Development
157
145
 
package/dist/index.d.ts CHANGED
@@ -2,6 +2,4 @@ export { Climbro, Entralpi, ForceBoard, KilterBoard, Motherboard, mySmartBoard,
2
2
  export { isEntralpi, isKilterboard, isMotherboard, isWHC06, isProgressor } from "./is-device";
3
3
  export { download } from "./download";
4
4
  export { active, isActive } from "./is-active";
5
- export { notify } from "./notify";
6
- export { stop } from "./stop";
7
5
  export { tare } from "./tare";
package/dist/index.js CHANGED
@@ -4,6 +4,4 @@ export { isEntralpi, isKilterboard, isMotherboard, isWHC06, isProgressor } from
4
4
  // functions
5
5
  export { download } from "./download";
6
6
  export { active, isActive } from "./is-active";
7
- export { notify } from "./notify";
8
- export { stop } from "./stop";
9
7
  export { tare } from "./tare";
@@ -1,5 +1,17 @@
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
+ * The date and time when the entity was created (optional).
11
+ */
3
12
  createdAt?: Date;
13
+ /**
14
+ * The date and time when the entity was last updated (optional).
15
+ */
4
16
  updatedAt?: Date;
5
17
  }
@@ -1,3 +1,6 @@
1
1
  import type { IDevice } from "../device.interface";
2
+ /**
3
+ * Interface representing the Climbro device, extending the base Device interface.
4
+ */
2
5
  export interface IClimbro extends IDevice {
3
6
  }
@@ -1,3 +1,52 @@
1
1
  import type { IDevice } from "../device.interface";
2
+ /**
3
+ * Interface representing the Entralpi device, extending the base Device interface.
4
+ */
2
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>;
3
52
  }
@@ -1,3 +1,21 @@
1
1
  import type { IDevice } from "../device.interface";
2
+ /**
3
+ * Interface representing the PitchSix ForceBoard device, extending the base Device interface.
4
+ */
2
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>;
3
21
  }
@@ -1,3 +1,76 @@
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
+ */
2
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>;
3
76
  }
@@ -1,10 +1,60 @@
1
1
  import type { IDevice } from "../device.interface";
2
+ /**
3
+ * Interface representing the Griptonite Motherboard device.
4
+ */
2
5
  export interface IMotherboard extends IDevice {
3
6
  /**
4
7
  * 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
+ * @param {number} sample - The sample value to calibrate.
9
+ * @param {number[][]} calibration - The calibration data.
10
+ * @returns {number} The calibrated sample value.
8
11
  */
9
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>;
10
60
  }
@@ -1,3 +1,6 @@
1
1
  import type { IDevice } from "../device.interface";
2
+ /**
3
+ * Interface representing the mySmartBoard device, extending the base Device interface.
4
+ */
2
5
  export interface ImySmartBoard extends IDevice {
3
6
  }
@@ -1,3 +1,27 @@
1
1
  import type { IDevice } from "../device.interface";
2
+ /**
3
+ * Interface representing the Tindeq Progressor device.
4
+ */
2
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>;
3
27
  }
@@ -1,3 +1,6 @@
1
1
  import type { IDevice } from "../device.interface";
2
+ /**
3
+ * Interface representing the Weiheng WH-C06 device.
4
+ */
2
5
  export interface IWHC06 extends IDevice {
3
6
  }
@@ -1,4 +1,6 @@
1
1
  import type { IBase } from "./base.interface";
2
+ import type { massObject } from "../types/notify";
3
+ type NotifyCallback = (data: massObject) => void;
2
4
  /**
3
5
  * Represents a characteristic of a Bluetooth service.
4
6
  */
@@ -36,41 +38,53 @@ export interface IDevice extends IBase {
36
38
  /** Reference to the BluetoothDevice object representing this device */
37
39
  bluetooth?: BluetoothDevice;
38
40
  /**
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.
41
+ * Connects to a Bluetooth device.
42
+ * @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
43
+ * @param {Function} [onError] - Optional callback function to execute on error. Default logs the error.
46
44
  */
47
- handleNotifications(event: Event): void;
45
+ connect(onSuccess?: () => void, onError?: (error: Error) => void): Promise<void>;
48
46
  /**
49
- * Handles the 'connected' event.
50
- * @param {Function} onSuccess - Callback function to execute on successful connection.
47
+ * Disconnects the device if it is currently connected.
48
+ * - Checks if the device is connected via it's GATT server.
49
+ * - If the device is connected, it attempts to gracefully disconnect.
51
50
  */
52
- onConnected(onSuccess: () => void): Promise<void>;
51
+ disconnect(): void;
53
52
  /**
54
53
  * Returns UUIDs of all services associated with the device.
55
54
  * @returns {string[]} Array of service UUIDs.
56
55
  */
57
56
  getAllServiceUUIDs(): string[];
58
57
  /**
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.
58
+ * Handles notifications received from a characteristic.
59
+ * @param {Event} event - The notification event.
62
60
  */
63
- connect(onSuccess?: () => void, onError?: (error: Error) => void): Promise<void>;
61
+ handleNotifications(event: Event): void;
64
62
  /**
65
63
  * Checks if a Bluetooth device is connected.
66
64
  * @returns {boolean} A boolean indicating whether the device is connected.
67
65
  */
68
66
  isConnected(): boolean;
69
67
  /**
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.
68
+ * Sets the callback function to be called when notifications are received.
69
+ * @param {NotifyCallback} callback - The callback function to be set.
70
+ * @returns {void}
73
71
  */
74
- disconnect(): void;
72
+ notify(callback: NotifyCallback): void;
73
+ /**
74
+ * Defines the type for the callback function.
75
+ * @callback NotifyCallback
76
+ * @param {massObject} data - The data passed to the callback.
77
+ */
78
+ notifyCallback: NotifyCallback;
79
+ /**
80
+ * Handles the 'connected' event.
81
+ * @param {Function} onSuccess - Callback function to execute on successful connection.
82
+ */
83
+ onConnected(onSuccess: () => void): Promise<void>;
84
+ /**
85
+ * Handles the 'disconnected' event.
86
+ * @param {Event} event - The 'disconnected' event.
87
+ */
88
+ onDisconnected(event: Event): void;
75
89
  }
76
90
  export {};
@@ -4,12 +4,17 @@ export declare class Entralpi extends Device implements IEntralpi {
4
4
  constructor();
5
5
  /**
6
6
  * Retrieves battery or voltage information from the device.
7
- * @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information,
7
+ * @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
8
8
  */
9
9
  battery: () => Promise<string | undefined>;
10
+ /**
11
+ * Retrieves IEEE 11073-20601 Regulatory Certification from the device.
12
+ * @returns {Promise<string>} A Promise that resolves with the certification.
13
+ */
14
+ certification: () => Promise<string | undefined>;
10
15
  /**
11
16
  * Retrieves firmware version from the device.
12
- * @returns {Promise<string>} A Promise that resolves with the firmware version,
17
+ * @returns {Promise<string>} A Promise that resolves with the firmware version.
13
18
  */
14
19
  firmware: () => Promise<string | undefined>;
15
20
  /**
@@ -22,22 +27,33 @@ export declare class Entralpi extends Device implements IEntralpi {
22
27
  handleNotifications: (event: Event) => void;
23
28
  /**
24
29
  * Retrieves hardware version from the device.
25
- * @returns {Promise<string>} A Promise that resolves with the hardware version,
30
+ * @returns {Promise<string>} A Promise that resolves with the hardware version.
26
31
  */
27
32
  hardware: () => Promise<string | undefined>;
28
33
  /**
29
34
  * Retrieves manufacturer information from the device.
30
- * @returns {Promise<string>} A Promise that resolves with the manufacturer information,
35
+ * @returns {Promise<string>} A Promise that resolves with the manufacturer information.
31
36
  */
32
37
  manufacturer: () => Promise<string | undefined>;
33
38
  /**
34
39
  * Retrieves model number from the device.
35
- * @returns {Promise<string>} A Promise that resolves with the model number,
40
+ * @returns {Promise<string>} A Promise that resolves with the model number.
36
41
  */
37
42
  model: () => Promise<string | undefined>;
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>} A Promise that resolves with the PnP ID.
47
+ */
48
+ pnp: () => Promise<string | undefined>;
38
49
  /**
39
50
  * Retrieves software version from the device.
40
- * @returns {Promise<string>} A Promise that resolves with the software version,
51
+ * @returns {Promise<string>} A Promise that resolves with the software version.
41
52
  */
42
53
  software: () => Promise<string | undefined>;
54
+ /**
55
+ * Retrieves system id from the device.
56
+ * @returns {Promise<string>} A Promise that resolves with the system id.
57
+ */
58
+ system: () => Promise<string | undefined>;
43
59
  }