@hangtime/grip-connect 0.5.2 → 0.5.3

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 (76) hide show
  1. package/dist/{download.d.ts → helpers/download.d.ts} +1 -1
  2. package/dist/helpers/is-device.d.ts +16 -16
  3. package/dist/helpers/is-device.js +18 -18
  4. package/dist/index.d.ts +4 -4
  5. package/dist/index.js +4 -5
  6. package/dist/interfaces/callback.interface.d.ts +49 -0
  7. package/dist/interfaces/command.interface.d.ts +85 -0
  8. package/dist/interfaces/device.interface.d.ts +19 -19
  9. package/dist/models/device/entralpi.model.js +9 -14
  10. package/dist/models/device/forceboard.model.js +4 -4
  11. package/dist/models/device/kilterboard.model.d.ts +61 -2
  12. package/dist/models/device/kilterboard.model.js +91 -11
  13. package/dist/models/device/motherboard.model.d.ts +24 -1
  14. package/dist/models/device/motherboard.model.js +56 -33
  15. package/dist/models/device/progressor.model.js +61 -22
  16. package/dist/models/device/wh-c06.model.d.ts +7 -0
  17. package/dist/models/device/wh-c06.model.js +18 -17
  18. package/dist/models/device.model.d.ts +71 -22
  19. package/dist/models/device.model.js +76 -21
  20. package/package.json +1 -1
  21. package/src/{download.ts → helpers/download.ts} +1 -1
  22. package/src/helpers/is-device.ts +23 -23
  23. package/src/index.ts +4 -5
  24. package/src/interfaces/callback.interface.ts +56 -0
  25. package/src/interfaces/command.interface.ts +106 -0
  26. package/src/interfaces/device.interface.ts +22 -21
  27. package/src/models/device/entralpi.model.ts +9 -15
  28. package/src/models/device/forceboard.model.ts +4 -4
  29. package/src/models/device/kilterboard.model.ts +93 -13
  30. package/src/models/device/motherboard.model.ts +61 -37
  31. package/src/models/device/progressor.model.ts +64 -22
  32. package/src/models/device/wh-c06.model.ts +20 -18
  33. package/src/models/device.model.ts +92 -30
  34. package/dist/commands/climbro.d.ts +0 -6
  35. package/dist/commands/climbro.js +0 -5
  36. package/dist/commands/entralpi.d.ts +0 -6
  37. package/dist/commands/entralpi.js +0 -5
  38. package/dist/commands/forceboard.d.ts +0 -6
  39. package/dist/commands/forceboard.js +0 -5
  40. package/dist/commands/index.d.ts +0 -7
  41. package/dist/commands/index.js +0 -7
  42. package/dist/commands/kilterboard.d.ts +0 -35
  43. package/dist/commands/kilterboard.js +0 -65
  44. package/dist/commands/motherboard.d.ts +0 -6
  45. package/dist/commands/motherboard.js +0 -13
  46. package/dist/commands/mysmartboard.d.ts +0 -6
  47. package/dist/commands/mysmartboard.js +0 -5
  48. package/dist/commands/progressor.d.ts +0 -17
  49. package/dist/commands/progressor.js +0 -30
  50. package/dist/commands/wh-c06.d.ts +0 -6
  51. package/dist/commands/wh-c06.js +0 -5
  52. package/dist/types/commands.d.ts +0 -18
  53. package/dist/types/notify.d.ts +0 -14
  54. package/src/commands/climbro.ts +0 -6
  55. package/src/commands/entralpi.ts +0 -6
  56. package/src/commands/forceboard.ts +0 -6
  57. package/src/commands/index.ts +0 -13
  58. package/src/commands/kilterboard.ts +0 -64
  59. package/src/commands/motherboard.ts +0 -14
  60. package/src/commands/mysmartboard.ts +0 -6
  61. package/src/commands/progressor.ts +0 -31
  62. package/src/commands/wh-c06.ts +0 -6
  63. package/src/types/commands.ts +0 -21
  64. package/src/types/notify.ts +0 -14
  65. /package/dist/{download.js → helpers/download.js} +0 -0
  66. /package/dist/{is-active.d.ts → helpers/is-active.d.ts} +0 -0
  67. /package/dist/{is-active.js → helpers/is-active.js} +0 -0
  68. /package/dist/{tare.d.ts → helpers/tare.d.ts} +0 -0
  69. /package/dist/{tare.js → helpers/tare.js} +0 -0
  70. /package/dist/{types/commands.js → interfaces/callback.interface.js} +0 -0
  71. /package/dist/{types/download.js → interfaces/command.interface.js} +0 -0
  72. /package/dist/{types/download.d.ts → interfaces/download.interface.d.ts} +0 -0
  73. /package/dist/{types/notify.js → interfaces/download.interface.js} +0 -0
  74. /package/src/{is-active.ts → helpers/is-active.ts} +0 -0
  75. /package/src/{tare.ts → helpers/tare.ts} +0 -0
  76. /package/src/{types/download.ts → interfaces/download.interface.ts} +0 -0
@@ -1,14 +1,86 @@
1
1
  import { BaseModel } from "./../models/base.model";
2
- let server;
3
2
  export class Device extends BaseModel {
3
+ /**
4
+ * Filters to identify the device during Bluetooth scanning.
5
+ * Used to match devices that meet specific criteria such as name, service UUIDs, etc.
6
+ */
4
7
  filters;
8
+ /**
9
+ * Array of services provided by the device.
10
+ * Services represent functionalities that the device supports, such as weight measurement, battery information, or custom services.
11
+ */
5
12
  services;
13
+ /**
14
+ * Reference to the `BluetoothDevice` object representing this device.
15
+ * This is the actual device object obtained from the Web Bluetooth API after a successful connection.
16
+ */
6
17
  bluetooth;
18
+ /**
19
+ * Object representing the set of commands available for this device.
20
+ * These commands allow communication with the device to perform various operations such as starting measurements, retrieving data, or calibrating the device.
21
+ */
22
+ commands;
23
+ /**
24
+ * The BluetoothRemoteGATTServer interface of the Web Bluetooth API represents a GATT Server on a remote device.
25
+ */
26
+ server;
27
+ /**
28
+ * Maximum mass recorded from the device, initialized to "0".
29
+ * @type {string}
30
+ * @protected
31
+ */
32
+ massMax;
33
+ /**
34
+ * Average mass calculated from the device data, initialized to "0".
35
+ * @type {string}
36
+ * @protected
37
+ */
38
+ massAverage;
39
+ /**
40
+ * Total sum of all mass data points recorded from the device.
41
+ * Used to calculate the average mass.
42
+ * @type {number}
43
+ * @protected
44
+ */
45
+ massTotalSum;
46
+ /**
47
+ * Number of data points received from the device.
48
+ * Used to calculate the average mass.
49
+ * @type {number}
50
+ * @protected
51
+ */
52
+ dataPointCount;
53
+ /**
54
+ * Optional callback for handling write operations.
55
+ * @callback NotifyCallback
56
+ * @param {massObject} data - The data passed to the callback.
57
+ * @type {NotifyCallback | undefined}
58
+ * @protected
59
+ */
60
+ notifyCallback = (data) => console.log(data);
61
+ /**
62
+ * Optional callback for handling write operations.
63
+ * @callback WriteCallback
64
+ * @param {string} data - The data passed to the callback.
65
+ * @type {WriteCallback | undefined}
66
+ * @protected
67
+ */
68
+ writeCallback = (data) => console.log(data);
69
+ /**
70
+ * The last message written to the device.
71
+ * @type {string | Uint8Array | null}
72
+ */
73
+ writeLast = null;
7
74
  constructor(device) {
8
75
  super(device);
9
76
  this.filters = device.filters || [];
10
77
  this.services = device.services || [];
78
+ this.commands = device.commands || {};
11
79
  this.bluetooth = device.bluetooth;
80
+ this.massMax = "0";
81
+ this.massAverage = "0";
82
+ this.massTotalSum = 0;
83
+ this.dataPointCount = 0;
12
84
  }
13
85
  /**
14
86
  * Connects to a Bluetooth device.
@@ -29,8 +101,8 @@ export class Device extends BaseModel {
29
101
  this.bluetooth.addEventListener("gattserverdisconnected", (event) => {
30
102
  this.onDisconnected(event);
31
103
  });
32
- server = await this.bluetooth.gatt.connect();
33
- if (server.connected) {
104
+ this.server = await this.bluetooth.gatt.connect();
105
+ if (this.server.connected) {
34
106
  await this.onConnected(onSuccess);
35
107
  }
36
108
  }
@@ -116,19 +188,13 @@ export class Device extends BaseModel {
116
188
  notify = (callback) => {
117
189
  this.notifyCallback = callback;
118
190
  };
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);
125
191
  /**
126
192
  * Handles the 'connected' event.
127
193
  * @param {Function} onSuccess - Callback function to execute on successful connection.
128
194
  */
129
195
  onConnected = async (onSuccess) => {
130
196
  // Connect to GATT server and set up characteristics
131
- const services = await server.getPrimaryServices();
197
+ const services = await this.server?.getPrimaryServices();
132
198
  if (!services || services.length === 0) {
133
199
  throw new Error("No services found");
134
200
  }
@@ -256,15 +322,4 @@ export class Device extends BaseModel {
256
322
  }
257
323
  }
258
324
  };
259
- /**
260
- * A default write callback that logs the response
261
- */
262
- writeCallback = (data) => {
263
- console.log(data);
264
- };
265
- /**
266
- * The last message written to the device.
267
- * @type {string | Uint8Array | null}
268
- */
269
- writeLast = null;
270
325
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hangtime/grip-connect",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
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,4 +1,4 @@
1
- import type { DownloadPacket } from "./types/download"
1
+ import type { DownloadPacket } from "../interfaces/download.interface"
2
2
  /**
3
3
  * Array of DownloadPacket entries.
4
4
  */
@@ -1,49 +1,49 @@
1
+ import { KilterBoard } from "../models"
1
2
  import type { Device } from "./../models/device.model"
2
- import { AuroraUUID } from "./../models/device/kilterboard.model"
3
3
 
4
4
  /**
5
- * Checks if the given device is an Entralpi device.
6
- * @param {Device} [board] - The device to check.
5
+ * Checks if the given device is an Entralpi.
6
+ * @param {Device} [device] - The device to check.
7
7
  * @returns {boolean} `true` if the device has a filter with the name "ENTRALPI", otherwise `false`.
8
8
  */
9
- export const isEntralpi = (board?: Device): boolean =>
10
- board?.filters.some((filter) => filter.name === "ENTRALPI") ?? false
9
+ export const isEntralpi = (device?: Device): boolean =>
10
+ device?.filters.some((filter) => filter.name === "ENTRALPI") ?? false
11
11
  /**
12
12
  * Checks if the given device is a Force Board.
13
- * @param {Device} [board] - The device to check.
13
+ * @param {Device} [device] - The device to check.
14
14
  * @returns {boolean} `true` if the device has a filter with the name "Force Board", otherwise `false`.
15
15
  */
16
- export const isForceBoard = (board?: Device): boolean =>
17
- board?.filters.some((filter) => filter.name === "Force Board") ?? false
16
+ export const isForceBoard = (device?: Device): boolean =>
17
+ device?.filters.some((filter) => filter.name === "Force Board") ?? false
18
18
  /**
19
- * Checks if the given device is a Kilterboard.
20
- * @param {Device} [board] - The device to check.
21
- * @returns {boolean} `true` if the device has a service UUID matching the Kilterboard Aurora UUID, otherwise `false`.
19
+ * Checks if the given device is a Kilter Board.
20
+ * @param {Device} [device] - The device to check.
21
+ * @returns {boolean} `true` if the device has a service UUID matching the Kilter Board Aurora UUID, otherwise `false`.
22
22
  */
23
- export const isKilterboard = (board?: Device): boolean => {
24
- return board?.filters.some((filter) => filter.services?.includes(AuroraUUID)) ?? false
23
+ export const isKilterBoard = (device?: Device): boolean => {
24
+ return device?.filters.some((filter) => filter.services?.includes(KilterBoard.AuroraUUID)) ?? false
25
25
  }
26
26
  /**
27
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`.
28
+ * @param {Device} [device] - The device to check.
29
+ * @returns {boolean} `true` if the device has a filter with the name "Motherdevice", otherwise `false`.
30
30
  */
31
- export const isMotherboard = (board?: Device): boolean =>
32
- board?.filters.some((filter) => filter.name === "Motherboard") ?? false
31
+ export const isMotherboard = (device?: Device): boolean =>
32
+ device?.filters.some((filter) => filter.name === "Motherdevice") ?? false
33
33
  /**
34
34
  * Checks if the given device is a Progressor.
35
- * @param {Device} [board] - The device to check.
35
+ * @param {Device} [device] - The device to check.
36
36
  * @returns {boolean} `true` if the device has a filter with a namePrefix of "Progressor", otherwise `false`.
37
37
  */
38
- export const isProgressor = (board?: Device): boolean =>
39
- board?.filters.some((filter) => filter.namePrefix === "Progressor") ?? false
38
+ export const isProgressor = (device?: Device): boolean =>
39
+ device?.filters.some((filter) => filter.namePrefix === "Progressor") ?? false
40
40
  /**
41
41
  * Checks if the given device is a WH-C06.
42
- * @param {Device} [board] - The device to check.
42
+ * @param {Device} [device] - The device to check.
43
43
  * @returns {boolean} `true` if the device has a filter with the company identifier 0x0100, otherwise `false`.
44
44
  */
45
- export const isWHC06 = (board?: Device): boolean =>
46
- board?.filters.some((filter) =>
45
+ export const isWHC06 = (device?: Device): boolean =>
46
+ device?.filters.some((filter) =>
47
47
  filter.manufacturerData?.some(
48
48
  (data) => data.companyIdentifier === 0x0100, // Company identifier for WH-C06, also used by 'TomTom International BV': https://www.bluetooth.com/specifications/assigned-numbers/
49
49
  ),
package/src/index.ts CHANGED
@@ -10,11 +10,10 @@ export {
10
10
  } from "./models/index"
11
11
 
12
12
  // helpers
13
- export { isEntralpi, isKilterboard, isMotherboard, isWHC06, isProgressor } from "./helpers/is-device"
13
+ export { isEntralpi, isKilterBoard, isMotherboard, isWHC06, isProgressor } from "./helpers/is-device"
14
14
 
15
- // TODO: Make functions device specific
16
- export { download } from "./download"
15
+ export { download } from "./helpers/download"
17
16
 
18
- export { active, isActive } from "./is-active"
17
+ export { active, isActive } from "./helpers/is-active"
19
18
 
20
- export { tare } from "./tare"
19
+ export { tare } from "./helpers/tare"
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Represents the mass data collected from a device.
3
+ */
4
+ export interface massObject {
5
+ /**
6
+ * The total mass measured from the device.
7
+ * This is the overall weight or force reading.
8
+ */
9
+ massTotal: string
10
+
11
+ /**
12
+ * The maximum mass recorded during the session.
13
+ * This is the highest weight or force value detected.
14
+ */
15
+ massMax: string
16
+
17
+ /**
18
+ * The average mass calculated from all the recorded data points.
19
+ * This represents the mean value of the mass measurements.
20
+ */
21
+ massAverage: string
22
+
23
+ /**
24
+ * The mass recorded on the left side of the device (optional for Motherboard devices).
25
+ * Used for devices that measure force across multiple zones.
26
+ */
27
+ massLeft?: string
28
+
29
+ /**
30
+ * The mass recorded at the center of the device (optional for Motherboard devices).
31
+ * Used for devices that measure force distribution across a center zone.
32
+ */
33
+ massCenter?: string
34
+
35
+ /**
36
+ * The mass recorded on the right side of the device (optional for Motherboard devices).
37
+ * Used for devices that measure force across multiple zones.
38
+ */
39
+ massRight?: string
40
+ }
41
+
42
+ /**
43
+ * Defines the type for a callback function that handles mass data notifications.
44
+ * The callback receives a `massObject` as the parameter.
45
+ * @callback NotifyCallback
46
+ * @param {massObject} data - The mass data passed to the callback.
47
+ */
48
+ export type NotifyCallback = (data: massObject) => void
49
+
50
+ /**
51
+ * Defines the type for a callback function that handles write operations to the device.
52
+ * The callback receives the data string written to the device.
53
+ * @callback WriteCallback
54
+ * @param {string} data - The string data passed to the callback.
55
+ */
56
+ export type WriteCallback = (data: string) => void
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Represents the available commands for various devices such as the Motherboard and Tindeq Progressor.
3
+ */
4
+ export interface Commands {
5
+ // Motherboard, Progressor
6
+
7
+ /**
8
+ * Starts a weight measurement on the device.
9
+ * Used to begin collecting weight or force data.
10
+ */
11
+ START_WEIGHT_MEAS?: string
12
+
13
+ /**
14
+ * Stops the current weight measurement on the device.
15
+ * Used to end the data collection.
16
+ */
17
+ STOP_WEIGHT_MEAS?: string
18
+
19
+ /**
20
+ * Puts the device to sleep or in a low-power mode.
21
+ * The format can be a string or a number depending on the device.
22
+ */
23
+ SLEEP?: number | string
24
+
25
+ /**
26
+ * Retrieves the serial number of the device.
27
+ * This command fetches the unique identifier assigned by the manufacturer.
28
+ */
29
+ GET_SERIAL?: string
30
+
31
+ // Griptonite Motherboard
32
+
33
+ /**
34
+ * Retrieves textual information from the device.
35
+ * May include readable data.
36
+ */
37
+ GET_TEXT?: string
38
+
39
+ /**
40
+ * Starts or stops a debug data stream from the device.
41
+ * Used for diagnostic purposes or to monitor real-time data.
42
+ */
43
+ DEBUG_STREAM?: string
44
+
45
+ /**
46
+ * Retrieves calibration data from the device.
47
+ * Used to ensure accurate measurements by applying calibration points.
48
+ */
49
+ GET_CALIBRATION?: string
50
+
51
+ // Tindeq Progressor
52
+
53
+ /**
54
+ * Tares the scale, zeroing the current weight measurement.
55
+ * Used to reset the baseline for weight data.
56
+ */
57
+ TARE_SCALE?: string
58
+
59
+ /**
60
+ * Starts measuring the peak rate of force development (RFD).
61
+ * Captures how quickly force is applied over time.
62
+ */
63
+ START_PEAK_RFD_MEAS?: string
64
+
65
+ /**
66
+ * Starts measuring a series of peak RFD measurements.
67
+ * This captures multiple RFD data points over a period of time.
68
+ */
69
+ START_PEAK_RFD_MEAS_SERIES?: string
70
+
71
+ /**
72
+ * Adds a calibration point to the device.
73
+ * Used to improve the accuracy of future measurements.
74
+ */
75
+ ADD_CALIB_POINT?: string
76
+
77
+ /**
78
+ * Saves the current calibration settings to the device.
79
+ * Ensures the device remembers the calibration for future sessions.
80
+ */
81
+ SAVE_CALIB?: string
82
+
83
+ /**
84
+ * Retrieves the firmware version of the device.
85
+ * Useful for ensuring compatibility and tracking updates.
86
+ */
87
+ GET_FW_VERSION?: string
88
+
89
+ /**
90
+ * Retrieves error information from the device.
91
+ * Provides details on any faults or issues that occurred during operation.
92
+ */
93
+ GET_ERR_INFO?: string
94
+
95
+ /**
96
+ * Clears the error information on the device.
97
+ * Used to reset error logs after troubleshooting or repair.
98
+ */
99
+ CLR_ERR_INFO?: string
100
+
101
+ /**
102
+ * Retrieves the battery voltage level of the device.
103
+ * Provides insight into the device's remaining battery power.
104
+ */
105
+ GET_BATT_VLTG?: string
106
+ }
@@ -1,5 +1,6 @@
1
1
  import type { IBase } from "./base.interface"
2
- import type { massObject } from "../types/notify"
2
+ import type { massObject } from "./callback.interface"
3
+ import type { Commands } from "./command.interface"
3
4
 
4
5
  /**
5
6
  * Represents a characteristic of a Bluetooth service.
@@ -33,13 +34,30 @@ export interface Service {
33
34
  * Represents a Bluetooth device.
34
35
  */
35
36
  export interface IDevice extends IBase {
36
- /** Filters to indentify the device */
37
+ /**
38
+ * Filters to identify the device during Bluetooth scanning.
39
+ * Used to match devices that meet specific criteria such as name, service UUIDs, etc.
40
+ */
37
41
  filters: BluetoothLEScanFilter[]
38
- /** Array of services provided by the device */
42
+
43
+ /**
44
+ * Array of services provided by the device.
45
+ * Services represent functionalities that the device supports, such as weight measurement, battery information, or custom services.
46
+ */
39
47
  services: Service[]
40
- /** Reference to the BluetoothDevice object representing this device */
48
+
49
+ /**
50
+ * Reference to the `BluetoothDevice` object representing this device.
51
+ * This is the actual device object obtained from the Web Bluetooth API after a successful connection.
52
+ */
41
53
  bluetooth?: BluetoothDevice
42
54
 
55
+ /**
56
+ * Object representing the set of commands available for this device.
57
+ * These commands allow communication with the device to perform various operations such as starting measurements, retrieving data, or calibrating the device.
58
+ */
59
+ commands: Commands
60
+
43
61
  /**
44
62
  * Connects to a Bluetooth device.
45
63
  * @param {Function} [onSuccess] - Optional callback function to execute on successful connection. Default logs success.
@@ -87,13 +105,6 @@ export interface IDevice extends IBase {
87
105
  */
88
106
  notify(callback: (data: massObject) => void): void
89
107
 
90
- /**
91
- * Defines the type for the callback function.
92
- * @callback NotifyCallback
93
- * @param {massObject} data - The data passed to the callback.
94
- */
95
- notifyCallback: (data: massObject) => void
96
-
97
108
  /**
98
109
  * Handles the 'connected' event.
99
110
  * @param {Function} onSuccess - Callback function to execute on successful connection.
@@ -140,14 +151,4 @@ export interface IDevice extends IBase {
140
151
  duration?: number,
141
152
  callback?: (data: string) => void,
142
153
  ): Promise<void>
143
-
144
- /**
145
- * A default write callback that logs the response
146
- */
147
- writeCallback: (data: string) => void
148
- /**
149
- * The last message written to the device.
150
- * @type {string | Uint8Array | null}
151
- */
152
- writeLast: string | Uint8Array | null
153
154
  }
@@ -1,13 +1,7 @@
1
1
  import { Device } from "../device.model"
2
2
  import type { IEntralpi } from "../../interfaces/device/entralpi.interface"
3
- import { applyTare } from "../../tare"
4
- import { checkActivity } from "../../is-active"
5
-
6
- // Constants
7
- let MASS_MAX = "0"
8
- let MASS_AVERAGE = "0"
9
- let MASS_TOTAL_SUM = 0
10
- let DATAPOINT_COUNT = 0
3
+ import { applyTare } from "../../helpers/tare"
4
+ import { checkActivity } from "../../helpers/is-active"
11
5
 
12
6
  export class Entralpi extends Device implements IEntralpi {
13
7
  constructor() {
@@ -194,24 +188,24 @@ export class Entralpi extends Device implements IEntralpi {
194
188
  // Tare correction
195
189
  numericData -= applyTare(numericData)
196
190
 
197
- // Update MASS_MAX
198
- MASS_MAX = Math.max(Number(MASS_MAX), numericData).toFixed(1)
191
+ // Update massMax
192
+ this.massMax = Math.max(Number(this.massMax), numericData).toFixed(1)
199
193
 
200
194
  // Update running sum and count
201
195
  const currentMassTotal = Math.max(-1000, numericData)
202
- MASS_TOTAL_SUM += currentMassTotal
203
- DATAPOINT_COUNT++
196
+ this.massTotalSum += currentMassTotal
197
+ this.dataPointCount++
204
198
 
205
199
  // Calculate the average dynamically
206
- MASS_AVERAGE = (MASS_TOTAL_SUM / DATAPOINT_COUNT).toFixed(1)
200
+ this.massAverage = (this.massTotalSum / this.dataPointCount).toFixed(1)
207
201
 
208
202
  // Check if device is being used
209
203
  checkActivity(numericData)
210
204
 
211
205
  // Notify with weight data
212
206
  this.notifyCallback({
213
- massMax: MASS_MAX,
214
- massAverage: MASS_AVERAGE,
207
+ massMax: this.massMax,
208
+ massAverage: this.massAverage,
215
209
  massTotal: Math.max(-1000, numericData).toFixed(1),
216
210
  })
217
211
  }
@@ -80,19 +80,19 @@ export class ForceBoard extends Device implements IForceBoard {
80
80
  ],
81
81
  },
82
82
  {
83
- name: "",
84
- id: "",
83
+ name: "Temperature Serivce",
84
+ id: "temperature",
85
85
  uuid: "3a90328c-c266-4c76-b05a-6af6104a0b13",
86
86
  characteristics: [
87
87
  {
88
88
  name: "Read",
89
- id: "",
89
+ id: "level",
90
90
  uuid: "3a90328d-c266-4c76-b05a-6af6104a0b13",
91
91
  },
92
92
  ],
93
93
  },
94
94
  {
95
- name: "",
95
+ name: "Forceboard Service",
96
96
  id: "forceboard",
97
97
  uuid: "9a88d67f-8df2-4afe-9e0d-c2bbbe773dd0",
98
98
  characteristics: [