@hangtime/grip-connect 0.3.6 → 0.3.7

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.
@@ -44,18 +44,18 @@ export const Motherboard = {
44
44
  ],
45
45
  },
46
46
  {
47
- name: "Unknown Service",
48
- id: "unknown",
47
+ name: "LED Service",
48
+ id: "led",
49
49
  uuid: "10ababcd-15e1-28ff-de13-725bea03b127",
50
50
  characteristics: [
51
51
  {
52
- name: "Unknown 01",
53
- id: "01",
52
+ name: "Red LED",
53
+ id: "red",
54
54
  uuid: "10ab1524-15e1-28ff-de13-725bea03b127",
55
55
  },
56
56
  {
57
- name: "Unknown 02",
58
- id: "02",
57
+ name: "Green LED",
58
+ id: "green",
59
59
  uuid: "10ab1525-15e1-28ff-de13-725bea03b127",
60
60
  },
61
61
  ],
@@ -8,6 +8,6 @@ export const isConnected = (board) => {
8
8
  if (!board?.device) {
9
9
  return false;
10
10
  }
11
- // Check if the device is connected using optional chaining
11
+ // Check if the device is connected
12
12
  return !!board.device.gatt?.connected;
13
13
  };
package/dist/led.d.ts CHANGED
@@ -11,9 +11,10 @@ declare class ClimbPlacement {
11
11
  */
12
12
  export declare function prepBytesV3(climbPlacementList: ClimbPlacement[]): number[];
13
13
  /**
14
- * Set device leds.
15
- * @param {Device} board - The device to retrieve information from.
16
- * @returns {Promise<void>} A promise that resolves when the information retrieval is completed.
14
+ * Sets the LEDs on the specified device.
15
+ * @param {Device} board - The device on which to set the LEDs.
16
+ * @param {ClimbPlacement[]} [placement] - An optional array of climb placements for LED positioning.
17
+ * @returns {Promise<number[] | undefined>} A promise that resolves with the payload array if LED settings were applied, or `undefined` if no action was taken.
17
18
  */
18
19
  export declare const led: (board: Device, placement?: ClimbPlacement[]) => Promise<number[] | undefined>;
19
20
  export {};
package/dist/led.js CHANGED
@@ -155,9 +155,10 @@ async function writeMessageSeries(messages) {
155
155
  }
156
156
  }
157
157
  /**
158
- * Set device leds.
159
- * @param {Device} board - The device to retrieve information from.
160
- * @returns {Promise<void>} A promise that resolves when the information retrieval is completed.
158
+ * Sets the LEDs on the specified device.
159
+ * @param {Device} board - The device on which to set the LEDs.
160
+ * @param {ClimbPlacement[]} [placement] - An optional array of climb placements for LED positioning.
161
+ * @returns {Promise<number[] | undefined>} A promise that resolves with the payload array if LED settings were applied, or `undefined` if no action was taken.
161
162
  */
162
163
  export const led = async (board, placement) => {
163
164
  // Check if the filter contains the Aurora Climbing Advertising service
@@ -175,9 +176,17 @@ export const led = async (board, placement) => {
175
176
  }
176
177
  }
177
178
  if (board.filters.some((filter) => filter.name === "Motherboard")) {
178
- // Orange
179
- await write(Motherboard, "led", "01", "0", 1000);
180
- // Yellow
181
- await write(Motherboard, "led", "02", "0", 1000);
179
+ console.log("Green");
180
+ await write(Motherboard, "led", "red", new Uint8Array([0x00]));
181
+ await write(Motherboard, "led", "green", new Uint8Array([0x01]), 2500);
182
+ console.log("Red");
183
+ await write(Motherboard, "led", "red", new Uint8Array([0x01]));
184
+ await write(Motherboard, "led", "green", new Uint8Array([0x00]), 2500);
185
+ console.log("Orage");
186
+ await write(Motherboard, "led", "red", new Uint8Array([0x01]));
187
+ await write(Motherboard, "led", "green", new Uint8Array([0x01]), 2500);
188
+ console.log("Off");
189
+ await write(Motherboard, "led", "red", new Uint8Array([0x00]));
190
+ await write(Motherboard, "led", "green", new Uint8Array([0x00]), 2500);
182
191
  }
183
192
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hangtime/grip-connect",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "A client that can establish connections with various Force-Sensing Hangboards/Plates used by climbers for strength measurement. Examples of such hangboards include the Griptonite Motherboard, Climbro, SmartBoard, Entralpi or Tindeq Progressor",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -46,18 +46,18 @@ export const Motherboard: Device = {
46
46
  ],
47
47
  },
48
48
  {
49
- name: "Unknown Service",
50
- id: "unknown",
49
+ name: "LED Service",
50
+ id: "led",
51
51
  uuid: "10ababcd-15e1-28ff-de13-725bea03b127",
52
52
  characteristics: [
53
53
  {
54
- name: "Unknown 01",
55
- id: "01",
54
+ name: "Red LED",
55
+ id: "red",
56
56
  uuid: "10ab1524-15e1-28ff-de13-725bea03b127",
57
57
  },
58
58
  {
59
- name: "Unknown 02",
60
- id: "02",
59
+ name: "Green LED",
60
+ id: "green",
61
61
  uuid: "10ab1525-15e1-28ff-de13-725bea03b127",
62
62
  },
63
63
  ],
@@ -10,6 +10,6 @@ export const isConnected = (board?: Device): boolean => {
10
10
  if (!board?.device) {
11
11
  return false
12
12
  }
13
- // Check if the device is connected using optional chaining
13
+ // Check if the device is connected
14
14
  return !!board.device.gatt?.connected
15
15
  }
package/src/led.ts CHANGED
@@ -168,9 +168,10 @@ async function writeMessageSeries(messages: Uint8Array[]) {
168
168
  }
169
169
  }
170
170
  /**
171
- * Set device leds.
172
- * @param {Device} board - The device to retrieve information from.
173
- * @returns {Promise<void>} A promise that resolves when the information retrieval is completed.
171
+ * Sets the LEDs on the specified device.
172
+ * @param {Device} board - The device on which to set the LEDs.
173
+ * @param {ClimbPlacement[]} [placement] - An optional array of climb placements for LED positioning.
174
+ * @returns {Promise<number[] | undefined>} A promise that resolves with the payload array if LED settings were applied, or `undefined` if no action was taken.
174
175
  */
175
176
  export const led = async (board: Device, placement?: ClimbPlacement[]): Promise<number[] | undefined> => {
176
177
  // Check if the filter contains the Aurora Climbing Advertising service
@@ -188,9 +189,17 @@ export const led = async (board: Device, placement?: ClimbPlacement[]): Promise<
188
189
  }
189
190
  }
190
191
  if (board.filters.some((filter) => filter.name === "Motherboard")) {
191
- // Orange
192
- await write(Motherboard, "led", "01", "0", 1000)
193
- // Yellow
194
- await write(Motherboard, "led", "02", "0", 1000)
192
+ console.log("Green")
193
+ await write(Motherboard, "led", "red", new Uint8Array([0x00]))
194
+ await write(Motherboard, "led", "green", new Uint8Array([0x01]), 2500)
195
+ console.log("Red")
196
+ await write(Motherboard, "led", "red", new Uint8Array([0x01]))
197
+ await write(Motherboard, "led", "green", new Uint8Array([0x00]), 2500)
198
+ console.log("Orage")
199
+ await write(Motherboard, "led", "red", new Uint8Array([0x01]))
200
+ await write(Motherboard, "led", "green", new Uint8Array([0x01]), 2500)
201
+ console.log("Off")
202
+ await write(Motherboard, "led", "red", new Uint8Array([0x00]))
203
+ await write(Motherboard, "led", "green", new Uint8Array([0x00]), 2500)
195
204
  }
196
205
  }