@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
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
/**
|
|
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
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { IDevice } from "../device.interface"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interface representing the Griptonite Motherboard device.
|
|
5
|
+
*/
|
|
6
|
+
export interface IMotherboard extends IDevice {
|
|
7
|
+
/**
|
|
8
|
+
* Applies calibration to a 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.
|
|
12
|
+
*/
|
|
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>
|
|
70
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IDevice } from "../device.interface"
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing the mySmartBoard device, extending the base Device interface.
|
|
4
|
+
*/
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
6
|
+
export interface ImySmartBoard extends IDevice {}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { IDevice } from "../device.interface"
|
|
2
|
+
|
|
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
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { IBase } from "./base.interface"
|
|
2
|
+
import type { massObject } from "../types/notify"
|
|
3
|
+
|
|
4
|
+
type NotifyCallback = (data: massObject) => void
|
|
5
|
+
/**
|
|
6
|
+
* Represents a characteristic of a Bluetooth service.
|
|
7
|
+
*/
|
|
8
|
+
interface Characteristic {
|
|
9
|
+
/** Name of the characteristic */
|
|
10
|
+
name: string
|
|
11
|
+
/** Identifier of the characteristic */
|
|
12
|
+
id: string
|
|
13
|
+
/** UUID of the characteristic */
|
|
14
|
+
uuid: string
|
|
15
|
+
/** Reference to the characteristic object */
|
|
16
|
+
characteristic?: BluetoothRemoteGATTCharacteristic
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Represents a Bluetooth service.
|
|
21
|
+
*/
|
|
22
|
+
export interface Service {
|
|
23
|
+
/** Name of the service */
|
|
24
|
+
name: string
|
|
25
|
+
/** Identifier of the service */
|
|
26
|
+
id: string
|
|
27
|
+
/** UUID of the service */
|
|
28
|
+
uuid: string
|
|
29
|
+
/** Array of characteristics belonging to this service */
|
|
30
|
+
characteristics: Characteristic[]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents a Bluetooth device.
|
|
35
|
+
*/
|
|
36
|
+
export interface IDevice extends IBase {
|
|
37
|
+
/** Filters to indentify the device */
|
|
38
|
+
filters: BluetoothLEScanFilter[]
|
|
39
|
+
/** Array of services provided by the device */
|
|
40
|
+
services: Service[]
|
|
41
|
+
/** Reference to the BluetoothDevice object representing this device */
|
|
42
|
+
bluetooth?: BluetoothDevice
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Connects to a Bluetooth device.
|
|
46
|
+
* @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
|
|
47
|
+
* @param {Function} [onError] - Optional callback function to execute on error. Default logs the error.
|
|
48
|
+
*/
|
|
49
|
+
connect(onSuccess?: () => void, onError?: (error: Error) => void): Promise<void>
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Disconnects the device if it is currently connected.
|
|
53
|
+
* - Checks if the device is connected via it's GATT server.
|
|
54
|
+
* - If the device is connected, it attempts to gracefully disconnect.
|
|
55
|
+
*/
|
|
56
|
+
disconnect(): void
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Returns UUIDs of all services associated with the device.
|
|
60
|
+
* @returns {string[]} Array of service UUIDs.
|
|
61
|
+
*/
|
|
62
|
+
getAllServiceUUIDs(): string[]
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Handles notifications received from a characteristic.
|
|
66
|
+
* @param {Event} event - The notification event.
|
|
67
|
+
*/
|
|
68
|
+
handleNotifications(event: Event): void
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Checks if a Bluetooth device is connected.
|
|
72
|
+
* @returns {boolean} A boolean indicating whether the device is connected.
|
|
73
|
+
*/
|
|
74
|
+
isConnected(): boolean
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Sets the callback function to be called when notifications are received.
|
|
78
|
+
* @param {NotifyCallback} callback - The callback function to be set.
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
notify(callback: NotifyCallback): void
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Defines the type for the callback function.
|
|
85
|
+
* @callback NotifyCallback
|
|
86
|
+
* @param {massObject} data - The data passed to the callback.
|
|
87
|
+
*/
|
|
88
|
+
notifyCallback: NotifyCallback
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Handles the 'connected' event.
|
|
92
|
+
* @param {Function} onSuccess - Callback function to execute on successful connection.
|
|
93
|
+
*/
|
|
94
|
+
onConnected(onSuccess: () => void): Promise<void>
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Handles the 'disconnected' event.
|
|
98
|
+
* @param {Event} event - The 'disconnected' event.
|
|
99
|
+
*/
|
|
100
|
+
onDisconnected(event: Event): void
|
|
101
|
+
}
|
package/src/is-device.ts
CHANGED
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
import type { Device } from "./
|
|
2
|
-
import { AuroraUUID } from "./
|
|
1
|
+
import type { Device } from "./models/device.model"
|
|
2
|
+
import { AuroraUUID } from "./models/device/kilterboard.model"
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Checks if the given device is a Motherboard.
|
|
6
|
-
* @param {Device} [board] - The device to check.
|
|
7
|
-
* @returns {boolean} `true` if the device has a filter with the name "Motherboard", otherwise `false`.
|
|
8
|
-
*/
|
|
9
|
-
export const isMotherboard = (board?: Device): boolean =>
|
|
10
|
-
board?.filters.some((filter) => filter.name === "Motherboard") ?? false
|
|
11
|
-
/**
|
|
12
|
-
* Checks if the given device is a Progressor.
|
|
13
|
-
* @param {Device} [board] - The device to check.
|
|
14
|
-
* @returns {boolean} `true` if the device has a filter with a namePrefix of "Progressor", otherwise `false`.
|
|
15
|
-
*/
|
|
16
|
-
export const isProgressor = (board?: Device): boolean =>
|
|
17
|
-
board?.filters.some((filter) => filter.namePrefix === "Progressor") ?? false
|
|
18
4
|
/**
|
|
19
5
|
* Checks if the given device is an Entralpi device.
|
|
20
6
|
* @param {Device} [board] - The device to check.
|
|
@@ -22,6 +8,13 @@ export const isProgressor = (board?: Device): boolean =>
|
|
|
22
8
|
*/
|
|
23
9
|
export const isEntralpi = (board?: Device): boolean =>
|
|
24
10
|
board?.filters.some((filter) => filter.name === "ENTRALPI") ?? false
|
|
11
|
+
/**
|
|
12
|
+
* Checks if the given device is a Force Board.
|
|
13
|
+
* @param {Device} [board] - The device to check.
|
|
14
|
+
* @returns {boolean} `true` if the device has a filter with the name "Force Board", otherwise `false`.
|
|
15
|
+
*/
|
|
16
|
+
export const isForceBoard = (board?: Device): boolean =>
|
|
17
|
+
board?.filters.some((filter) => filter.name === "Force Board") ?? false
|
|
25
18
|
/**
|
|
26
19
|
* Checks if the given device is a Kilterboard.
|
|
27
20
|
* @param {Device} [board] - The device to check.
|
|
@@ -30,6 +23,20 @@ export const isEntralpi = (board?: Device): boolean =>
|
|
|
30
23
|
export const isKilterboard = (board?: Device): boolean => {
|
|
31
24
|
return board?.filters.some((filter) => filter.services?.includes(AuroraUUID)) ?? false
|
|
32
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the given device is a Motherboard.
|
|
28
|
+
* @param {Device} [board] - The device to check.
|
|
29
|
+
* @returns {boolean} `true` if the device has a filter with the name "Motherboard", otherwise `false`.
|
|
30
|
+
*/
|
|
31
|
+
export const isMotherboard = (board?: Device): boolean =>
|
|
32
|
+
board?.filters.some((filter) => filter.name === "Motherboard") ?? false
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the given device is a Progressor.
|
|
35
|
+
* @param {Device} [board] - The device to check.
|
|
36
|
+
* @returns {boolean} `true` if the device has a filter with a namePrefix of "Progressor", otherwise `false`.
|
|
37
|
+
*/
|
|
38
|
+
export const isProgressor = (board?: Device): boolean =>
|
|
39
|
+
board?.filters.some((filter) => filter.namePrefix === "Progressor") ?? false
|
|
33
40
|
/**
|
|
34
41
|
* Checks if the given device is a WH-C06.
|
|
35
42
|
* @param {Device} [board] - The device to check.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IBase } from "../interfaces/base.interface"
|
|
2
|
+
|
|
3
|
+
export abstract class BaseModel {
|
|
4
|
+
id?: string
|
|
5
|
+
|
|
6
|
+
createdAt?: Date
|
|
7
|
+
|
|
8
|
+
updatedAt?: Date
|
|
9
|
+
|
|
10
|
+
constructor(base: IBase) {
|
|
11
|
+
this.id = base.id ? base.id : self.crypto.randomUUID()
|
|
12
|
+
|
|
13
|
+
this.createdAt = base.createdAt
|
|
14
|
+
this.updatedAt = base.updatedAt
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Device } from "../device.model"
|
|
2
|
+
import type { IClimbro } from "../../interfaces/device/climbro.interface"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a Climbro device
|
|
6
|
+
* TODO: Add services, do you own a Climbro? Help us!
|
|
7
|
+
*/
|
|
8
|
+
export class Climbro extends Device implements IClimbro {
|
|
9
|
+
constructor() {
|
|
10
|
+
super({
|
|
11
|
+
filters: [{ name: "Climbro" }],
|
|
12
|
+
services: [],
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
}
|