@hangtime/grip-connect 0.8.3 → 0.8.5
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/deno.json +1 -1
- package/package.json +22 -3
- package/src/models/base.model.ts +15 -5
- package/src/models/device.model.ts +5 -2
- package/tsconfig.cjs.json +15 -0
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/interfaces/base.interface.d.ts +0 -18
- package/dist/interfaces/base.interface.d.ts.map +0 -1
- package/dist/interfaces/base.interface.js +0 -2
- package/dist/interfaces/base.interface.js.map +0 -1
- package/dist/interfaces/callback.interface.d.ts +0 -56
- package/dist/interfaces/callback.interface.d.ts.map +0 -1
- package/dist/interfaces/callback.interface.js +0 -2
- package/dist/interfaces/callback.interface.js.map +0 -1
- package/dist/interfaces/command.interface.d.ts +0 -92
- package/dist/interfaces/command.interface.d.ts.map +0 -1
- package/dist/interfaces/command.interface.js +0 -2
- package/dist/interfaces/command.interface.js.map +0 -1
- package/dist/interfaces/device/climbro.interface.d.ts +0 -7
- package/dist/interfaces/device/climbro.interface.d.ts.map +0 -1
- package/dist/interfaces/device/climbro.interface.js +0 -2
- package/dist/interfaces/device/climbro.interface.js.map +0 -1
- package/dist/interfaces/device/entralpi.interface.d.ts +0 -53
- package/dist/interfaces/device/entralpi.interface.d.ts.map +0 -1
- package/dist/interfaces/device/entralpi.interface.js +0 -2
- package/dist/interfaces/device/entralpi.interface.js.map +0 -1
- package/dist/interfaces/device/forceboard.interface.d.ts +0 -64
- package/dist/interfaces/device/forceboard.interface.d.ts.map +0 -1
- package/dist/interfaces/device/forceboard.interface.js +0 -2
- package/dist/interfaces/device/forceboard.interface.js.map +0 -1
- package/dist/interfaces/device/kilterboard.interface.d.ts +0 -16
- package/dist/interfaces/device/kilterboard.interface.d.ts.map +0 -1
- package/dist/interfaces/device/kilterboard.interface.js +0 -2
- package/dist/interfaces/device/kilterboard.interface.js.map +0 -1
- package/dist/interfaces/device/motherboard.interface.d.ts +0 -54
- package/dist/interfaces/device/motherboard.interface.d.ts.map +0 -1
- package/dist/interfaces/device/motherboard.interface.js +0 -2
- package/dist/interfaces/device/motherboard.interface.js.map +0 -1
- package/dist/interfaces/device/mysmartboard.interface.d.ts +0 -7
- package/dist/interfaces/device/mysmartboard.interface.d.ts.map +0 -1
- package/dist/interfaces/device/mysmartboard.interface.js +0 -2
- package/dist/interfaces/device/mysmartboard.interface.js.map +0 -1
- package/dist/interfaces/device/progressor.interface.d.ts +0 -28
- package/dist/interfaces/device/progressor.interface.d.ts.map +0 -1
- package/dist/interfaces/device/progressor.interface.js +0 -2
- package/dist/interfaces/device/progressor.interface.js.map +0 -1
- package/dist/interfaces/device/smartboard-pro.interface.d.ts +0 -7
- package/dist/interfaces/device/smartboard-pro.interface.d.ts.map +0 -1
- package/dist/interfaces/device/smartboard-pro.interface.js +0 -2
- package/dist/interfaces/device/smartboard-pro.interface.js.map +0 -1
- package/dist/interfaces/device/wh-c06.interface.d.ts +0 -7
- package/dist/interfaces/device/wh-c06.interface.d.ts.map +0 -1
- package/dist/interfaces/device/wh-c06.interface.js +0 -2
- package/dist/interfaces/device/wh-c06.interface.js.map +0 -1
- package/dist/interfaces/device.interface.d.ts +0 -203
- package/dist/interfaces/device.interface.d.ts.map +0 -1
- package/dist/interfaces/device.interface.js +0 -2
- package/dist/interfaces/device.interface.js.map +0 -1
- package/dist/interfaces/download.interface.d.ts +0 -16
- package/dist/interfaces/download.interface.d.ts.map +0 -1
- package/dist/interfaces/download.interface.js +0 -2
- package/dist/interfaces/download.interface.js.map +0 -1
- package/dist/interfaces/index.d.ts +0 -10
- package/dist/interfaces/index.d.ts.map +0 -1
- package/dist/interfaces/index.js +0 -2
- package/dist/interfaces/index.js.map +0 -1
- package/dist/models/base.model.d.ts +0 -8
- package/dist/models/base.model.d.ts.map +0 -1
- package/dist/models/base.model.js +0 -11
- package/dist/models/base.model.js.map +0 -1
- package/dist/models/device/climbro.model.d.ts +0 -11
- package/dist/models/device/climbro.model.d.ts.map +0 -1
- package/dist/models/device/climbro.model.js +0 -15
- package/dist/models/device/climbro.model.js.map +0 -1
- package/dist/models/device/entralpi.model.d.ts +0 -64
- package/dist/models/device/entralpi.model.d.ts.map +0 -1
- package/dist/models/device/entralpi.model.js +0 -240
- package/dist/models/device/entralpi.model.js.map +0 -1
- package/dist/models/device/forceboard.model.d.ts +0 -73
- package/dist/models/device/forceboard.model.d.ts.map +0 -1
- package/dist/models/device/forceboard.model.js +0 -312
- package/dist/models/device/forceboard.model.js.map +0 -1
- package/dist/models/device/kilterboard.model.d.ts +0 -144
- package/dist/models/device/kilterboard.model.d.ts.map +0 -1
- package/dist/models/device/kilterboard.model.js +0 -287
- package/dist/models/device/kilterboard.model.js.map +0 -1
- package/dist/models/device/motherboard.model.d.ts +0 -110
- package/dist/models/device/motherboard.model.d.ts.map +0 -1
- package/dist/models/device/motherboard.model.js +0 -378
- package/dist/models/device/motherboard.model.js.map +0 -1
- package/dist/models/device/mysmartboard.model.d.ts +0 -11
- package/dist/models/device/mysmartboard.model.d.ts.map +0 -1
- package/dist/models/device/mysmartboard.model.js +0 -15
- package/dist/models/device/mysmartboard.model.js.map +0 -1
- package/dist/models/device/progressor.model.d.ts +0 -39
- package/dist/models/device/progressor.model.d.ts.map +0 -1
- package/dist/models/device/progressor.model.js +0 -216
- package/dist/models/device/progressor.model.js.map +0 -1
- package/dist/models/device/smartboard-pro.model.d.ts +0 -11
- package/dist/models/device/smartboard-pro.model.d.ts.map +0 -1
- package/dist/models/device/smartboard-pro.model.js +0 -52
- package/dist/models/device/smartboard-pro.model.js.map +0 -1
- package/dist/models/device/wh-c06.model.d.ts +0 -57
- package/dist/models/device/wh-c06.model.d.ts.map +0 -1
- package/dist/models/device/wh-c06.model.js +0 -167
- package/dist/models/device/wh-c06.model.js.map +0 -1
- package/dist/models/device.model.d.ts +0 -408
- package/dist/models/device.model.d.ts.map +0 -1
- package/dist/models/device.model.js +0 -718
- package/dist/models/device.model.js.map +0 -1
- package/dist/models/index.d.ts +0 -10
- package/dist/models/index.d.ts.map +0 -1
- package/dist/models/index.js +0 -10
- package/dist/models/index.js.map +0 -1
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { Device } from "../device.model.js";
|
|
2
|
-
/**
|
|
3
|
-
* Represents a Entralpi device.
|
|
4
|
-
* {@link https://entralpi.com}
|
|
5
|
-
*/
|
|
6
|
-
export class Entralpi extends Device {
|
|
7
|
-
constructor() {
|
|
8
|
-
super({
|
|
9
|
-
filters: [
|
|
10
|
-
{
|
|
11
|
-
name: "ENTRALPI",
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
services: [
|
|
15
|
-
{
|
|
16
|
-
name: "Device Information",
|
|
17
|
-
id: "device",
|
|
18
|
-
uuid: "0000180a-0000-1000-8000-00805f9b34fb",
|
|
19
|
-
characteristics: [
|
|
20
|
-
{
|
|
21
|
-
name: "System ID",
|
|
22
|
-
id: "system",
|
|
23
|
-
uuid: "00002a23-0000-1000-8000-00805f9b34fb",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "Model Number String",
|
|
27
|
-
id: "model",
|
|
28
|
-
uuid: "00002a24-0000-1000-8000-00805f9b34fb",
|
|
29
|
-
},
|
|
30
|
-
// {
|
|
31
|
-
// name: "Serial Number String (Blocked)",
|
|
32
|
-
// id: "serial",
|
|
33
|
-
// uuid: "00002a25-0000-1000-8000-00805f9b34fb",
|
|
34
|
-
// },
|
|
35
|
-
{
|
|
36
|
-
name: "Firmware Revision String",
|
|
37
|
-
id: "firmware",
|
|
38
|
-
uuid: "00002a26-0000-1000-8000-00805f9b34fb",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "Hardware Revision String",
|
|
42
|
-
id: "hardware",
|
|
43
|
-
uuid: "00002a27-0000-1000-8000-00805f9b34fb",
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "Software Revision String",
|
|
47
|
-
id: "software",
|
|
48
|
-
uuid: "00002a28-0000-1000-8000-00805f9b34fb",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "Manufacturer Name String",
|
|
52
|
-
id: "manufacturer",
|
|
53
|
-
uuid: "00002a29-0000-1000-8000-00805f9b34fb",
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
name: "IEEE 11073-20601 Regulatory Certification Data List",
|
|
57
|
-
id: "certification",
|
|
58
|
-
uuid: "00002a2a-0000-1000-8000-00805f9b34fb",
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "PnP ID",
|
|
62
|
-
id: "pnp",
|
|
63
|
-
uuid: "00002a50-0000-1000-8000-00805f9b34fb",
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "Battery Service",
|
|
69
|
-
id: "battery",
|
|
70
|
-
uuid: "0000180f-0000-1000-8000-00805f9b34fb",
|
|
71
|
-
characteristics: [
|
|
72
|
-
{
|
|
73
|
-
name: "Battery Level",
|
|
74
|
-
id: "level",
|
|
75
|
-
uuid: "00002a19-0000-1000-8000-00805f9b34fb",
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: "Generic Attribute",
|
|
81
|
-
id: "attribute",
|
|
82
|
-
uuid: "f000ffc0-0451-4000-b000-000000000000",
|
|
83
|
-
characteristics: [
|
|
84
|
-
{
|
|
85
|
-
name: "",
|
|
86
|
-
id: "",
|
|
87
|
-
uuid: "f000ffc1-0451-4000-b000-000000000000",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: "",
|
|
91
|
-
id: "",
|
|
92
|
-
uuid: "f000ffc2-0451-4000-b000-000000000000",
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: "UART ISSC Transparent Service",
|
|
98
|
-
id: "uart",
|
|
99
|
-
uuid: "0000fff0-0000-1000-8000-00805f9b34fb",
|
|
100
|
-
characteristics: [
|
|
101
|
-
{
|
|
102
|
-
name: "TX",
|
|
103
|
-
id: "tx",
|
|
104
|
-
uuid: "0000fff1-0000-1000-8000-00805f9b34fb",
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: "RX",
|
|
108
|
-
id: "rx",
|
|
109
|
-
uuid: "0000fff4-0000-1000-8000-00805f9b34fb",
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: "Weight Scale",
|
|
115
|
-
id: "weight",
|
|
116
|
-
uuid: "0000181d-0000-1000-8000-00805f9b34fb",
|
|
117
|
-
characteristics: [
|
|
118
|
-
{
|
|
119
|
-
name: "notify",
|
|
120
|
-
id: "rx",
|
|
121
|
-
uuid: "0000fff1-0000-1000-8000-00805f9b34fb",
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Retrieves battery or voltage information from the device.
|
|
130
|
-
* @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information.
|
|
131
|
-
*/
|
|
132
|
-
battery = async () => {
|
|
133
|
-
return await this.read("battery", "level", 250);
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Retrieves IEEE 11073-20601 Regulatory Certification from the device.
|
|
137
|
-
* @returns {Promise<string>} A Promise that resolves with the certification.
|
|
138
|
-
*/
|
|
139
|
-
certification = async () => {
|
|
140
|
-
return await this.read("device", "certification", 250);
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Retrieves firmware version from the device.
|
|
144
|
-
* @returns {Promise<string>} A Promise that resolves with the firmware version.
|
|
145
|
-
*/
|
|
146
|
-
firmware = async () => {
|
|
147
|
-
return await this.read("device", "firmware", 250);
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Handles data received from the device, processes weight measurements,
|
|
151
|
-
* and updates mass data including maximum and average values.
|
|
152
|
-
* It also handles command responses for retrieving device information.
|
|
153
|
-
*
|
|
154
|
-
* @param {DataView} value - The notification event.
|
|
155
|
-
*/
|
|
156
|
-
handleNotifications = (value) => {
|
|
157
|
-
if (value) {
|
|
158
|
-
// Update timestamp
|
|
159
|
-
this.updateTimestamp();
|
|
160
|
-
if (value.buffer) {
|
|
161
|
-
const receivedTime = Date.now();
|
|
162
|
-
const receivedData = (value.getUint16(0) / 100).toFixed(1);
|
|
163
|
-
const convertedData = Number(receivedData);
|
|
164
|
-
// Adjust weight by using the tare value
|
|
165
|
-
// If tare is 0, use the original weight, otherwise subtract tare and invert.
|
|
166
|
-
// This will display the removed or 'no-hanging' weight.
|
|
167
|
-
const tare = this.applyTare(convertedData);
|
|
168
|
-
const numericData = tare === 0 ? convertedData : (convertedData - tare) * -1;
|
|
169
|
-
// Add data to downloadable Array
|
|
170
|
-
this.downloadPackets.push({
|
|
171
|
-
received: receivedTime,
|
|
172
|
-
sampleNum: this.dataPointCount,
|
|
173
|
-
battRaw: 0,
|
|
174
|
-
samples: [convertedData],
|
|
175
|
-
masses: [numericData],
|
|
176
|
-
});
|
|
177
|
-
// Update massMax
|
|
178
|
-
this.massMax = Math.max(Number(this.massMax), numericData).toFixed(1);
|
|
179
|
-
// Update running sum and count
|
|
180
|
-
const currentMassTotal = Math.max(-1000, numericData);
|
|
181
|
-
this.massTotalSum += currentMassTotal;
|
|
182
|
-
this.dataPointCount++;
|
|
183
|
-
// Calculate the average dynamically
|
|
184
|
-
this.massAverage = (this.massTotalSum / this.dataPointCount).toFixed(1);
|
|
185
|
-
// Check if device is being used
|
|
186
|
-
this.activityCheck(numericData);
|
|
187
|
-
// Notify with weight data
|
|
188
|
-
this.notifyCallback({
|
|
189
|
-
massMax: this.massMax,
|
|
190
|
-
massAverage: this.massAverage,
|
|
191
|
-
massTotal: Math.max(-1000, numericData).toFixed(1),
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* Retrieves hardware version from the device.
|
|
198
|
-
* @returns {Promise<string>} A Promise that resolves with the hardware version.
|
|
199
|
-
*/
|
|
200
|
-
hardware = async () => {
|
|
201
|
-
return await this.read("device", "hardware", 250);
|
|
202
|
-
};
|
|
203
|
-
/**
|
|
204
|
-
* Retrieves manufacturer information from the device.
|
|
205
|
-
* @returns {Promise<string>} A Promise that resolves with the manufacturer information.
|
|
206
|
-
*/
|
|
207
|
-
manufacturer = async () => {
|
|
208
|
-
return await this.read("device", "manufacturer", 250);
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* Retrieves model number from the device.
|
|
212
|
-
* @returns {Promise<string>} A Promise that resolves with the model number.
|
|
213
|
-
*/
|
|
214
|
-
model = async () => {
|
|
215
|
-
return await this.read("device", "model", 250);
|
|
216
|
-
};
|
|
217
|
-
/**
|
|
218
|
-
* Retrieves PnP ID from the device, a set of values that used to create a device ID value that is unique for this device.
|
|
219
|
-
* Included in the characteristic is a Vendor ID Source field, a Vendor ID field, a Product ID field and a Product Version field
|
|
220
|
-
* @returns {Promise<string>} A Promise that resolves with the PnP ID.
|
|
221
|
-
*/
|
|
222
|
-
pnp = async () => {
|
|
223
|
-
return await this.read("device", "pnp", 250);
|
|
224
|
-
};
|
|
225
|
-
/**
|
|
226
|
-
* Retrieves software version from the device.
|
|
227
|
-
* @returns {Promise<string>} A Promise that resolves with the software version.
|
|
228
|
-
*/
|
|
229
|
-
software = async () => {
|
|
230
|
-
return await this.read("device", "software", 250);
|
|
231
|
-
};
|
|
232
|
-
/**
|
|
233
|
-
* Retrieves system id from the device.
|
|
234
|
-
* @returns {Promise<string>} A Promise that resolves with the system id.
|
|
235
|
-
*/
|
|
236
|
-
system = async () => {
|
|
237
|
-
return await this.read("device", "system", 250);
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
//# sourceMappingURL=entralpi.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entralpi.model.js","sourceRoot":"","sources":["../../../src/models/device/entralpi.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAG3C;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,MAAM;IAClC;QACE,KAAK,CAAC;YACJ,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,UAAU;iBACjB;aACF;YACD,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,oBAAoB;oBAC1B,EAAE,EAAE,QAAQ;oBACZ,IAAI,EAAE,sCAAsC;oBAC5C,eAAe,EAAE;wBACf;4BACE,IAAI,EAAE,WAAW;4BACjB,EAAE,EAAE,QAAQ;4BACZ,IAAI,EAAE,sCAAsC;yBAC7C;wBACD;4BACE,IAAI,EAAE,qBAAqB;4BAC3B,EAAE,EAAE,OAAO;4BACX,IAAI,EAAE,sCAAsC;yBAC7C;wBACD,IAAI;wBACJ,4CAA4C;wBAC5C,kBAAkB;wBAClB,kDAAkD;wBAClD,KAAK;wBACL;4BACE,IAAI,EAAE,0BAA0B;4BAChC,EAAE,EAAE,UAAU;4BACd,IAAI,EAAE,sCAAsC;yBAC7C;wBACD;4BACE,IAAI,EAAE,0BAA0B;4BAChC,EAAE,EAAE,UAAU;4BACd,IAAI,EAAE,sCAAsC;yBAC7C;wBACD;4BACE,IAAI,EAAE,0BAA0B;4BAChC,EAAE,EAAE,UAAU;4BACd,IAAI,EAAE,sCAAsC;yBAC7C;wBACD;4BACE,IAAI,EAAE,0BAA0B;4BAChC,EAAE,EAAE,cAAc;4BAClB,IAAI,EAAE,sCAAsC;yBAC7C;wBACD;4BACE,IAAI,EAAE,qDAAqD;4BAC3D,EAAE,EAAE,eAAe;4BACnB,IAAI,EAAE,sCAAsC;yBAC7C;wBACD;4BACE,IAAI,EAAE,QAAQ;4BACd,EAAE,EAAE,KAAK;4BACT,IAAI,EAAE,sCAAsC;yBA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G,CAAC,CAAA;IAChD,CAAC,CAAA;IAED;;;;OAIG;IACH,GAAG,GAAG,KAAK,IAAiC,EAAE;QAC5C,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IAC9C,CAAC,CAAA;IAED;;;OAGG;IACH,QAAQ,GAAG,KAAK,IAAiC,EAAE;QACjD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAC,CAAA;IACnD,CAAC,CAAA;IAED;;;OAGG;IACH,MAAM,GAAG,KAAK,IAAiC,EAAE;QAC/C,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;IACjD,CAAC,CAAA;CACF"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Device } from "../device.model.js";
|
|
2
|
-
import type { IForceBoard } from "../../interfaces/device/forceboard.interface.js";
|
|
3
|
-
/**
|
|
4
|
-
* Represents a PitchSix Force Board device.
|
|
5
|
-
* {@link https://pitchsix.com}
|
|
6
|
-
*/
|
|
7
|
-
export declare class ForceBoard extends Device implements IForceBoard {
|
|
8
|
-
constructor();
|
|
9
|
-
/**
|
|
10
|
-
* Retrieves battery or voltage information from the device.
|
|
11
|
-
* @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information,
|
|
12
|
-
*/
|
|
13
|
-
battery: () => Promise<string | undefined>;
|
|
14
|
-
/**
|
|
15
|
-
* Handles data received from the device, processes weight measurements,
|
|
16
|
-
* and updates mass data including maximum and average values.
|
|
17
|
-
* It also handles command responses for retrieving device information.
|
|
18
|
-
*
|
|
19
|
-
* @param {DataView} value - The notification event.
|
|
20
|
-
*/
|
|
21
|
-
handleNotifications: (value: DataView) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Retrieves humidity level from the device.
|
|
24
|
-
* @returns {Promise<string>} A Promise that resolves with the humidity level,
|
|
25
|
-
*/
|
|
26
|
-
humidity: () => Promise<string | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* Retrieves manufacturer information from the device.
|
|
29
|
-
* @returns {Promise<string>} A Promise that resolves with the manufacturer information,
|
|
30
|
-
*/
|
|
31
|
-
manufacturer: () => Promise<string | undefined>;
|
|
32
|
-
/**
|
|
33
|
-
* Stops the data stream on the specified device by setting it to Idle mode.
|
|
34
|
-
* @returns {Promise<void>} A promise that resolves when the stream is stopped.
|
|
35
|
-
*/
|
|
36
|
-
stop: () => Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Starts streaming data from the specified device in Streaming Data Mode.
|
|
39
|
-
* @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely.
|
|
40
|
-
* @returns {Promise<void>} A promise that resolves when the streaming operation is completed.
|
|
41
|
-
*/
|
|
42
|
-
stream: (duration?: number) => Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Sets the threshold in Lbs for the Quick Start mode.
|
|
45
|
-
* @param {number} thresholdLbs - The threshold value in pounds.
|
|
46
|
-
* @returns {Promise<void>} A promise that resolves when the threshold is set.
|
|
47
|
-
*/
|
|
48
|
-
threshold: (thresholdLbs: number) => Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Tares the Force Board device using a characteristic to zero out the current load value.
|
|
51
|
-
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
52
|
-
*/
|
|
53
|
-
tareByCharacteristic: () => Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Initiates a tare routine via the Device Mode characteristic.
|
|
56
|
-
* Writes 0x05 to the Device Mode characteristic to zero out the current load value.
|
|
57
|
-
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
58
|
-
*/
|
|
59
|
-
tareByMode: () => Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Retrieves temperature information from the device.
|
|
62
|
-
* @returns {Promise<string>} A Promise that resolves with the temperature information,
|
|
63
|
-
*/
|
|
64
|
-
temperature: () => Promise<string | undefined>;
|
|
65
|
-
/**
|
|
66
|
-
* Starts the Force Board in Quick Start mode.
|
|
67
|
-
* Writes 0x06 to the Device Mode characteristic.
|
|
68
|
-
* @param {number} [duration=0] - The duration in milliseconds. If set to 0, mode will continue indefinitely.
|
|
69
|
-
* @returns {Promise<void>} A promise that resolves when the operation is completed.
|
|
70
|
-
*/
|
|
71
|
-
quick: (duration?: number) => Promise<void>;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=forceboard.model.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forceboard.model.d.ts","sourceRoot":"","sources":["../../../src/models/device/forceboard.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAElF;;;GAGG;AACH,qBAAa,UAAW,SAAQ,MAAO,YAAW,WAAW;;IAsK3D;;;OAGG;IACH,OAAO,QAAa,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE9C;IAED;;;;;;OAMG;IACM,mBAAmB,GAAI,OAAO,QAAQ,KAAG,IAAI,CAuDrD;IAED;;;OAGG;IACH,QAAQ,QAAa,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE/C;IAED;;;OAGG;IACH,YAAY,QAAa,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEnD;IAED;;;OAGG;IACH,IAAI,QAAa,OAAO,CAAC,IAAI,CAAC,CAE7B;IAED;;;;OAIG;IACH,MAAM,GAAU,iBAAY,KAAG,OAAO,CAAC,IAAI,CAAC,CAG3C;IAED;;;;OAIG;IACH,SAAS,GAAU,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAStD;IAED;;;OAGG;IACH,oBAAoB,QAAa,OAAO,CAAC,IAAI,CAAC,CAI7C;IAED;;;;OAIG;IACH,UAAU,QAAa,OAAO,CAAC,IAAI,CAAC,CAEnC;IAED;;;OAGG;IACH,WAAW,QAAa,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAElD;IAED;;;;;OAKG;IACH,KAAK,GAAU,iBAAY,KAAG,OAAO,CAAC,IAAI,CAAC,CAG1C;CACF"}
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import { Device } from "../device.model.js";
|
|
2
|
-
/**
|
|
3
|
-
* Represents a PitchSix Force Board device.
|
|
4
|
-
* {@link https://pitchsix.com}
|
|
5
|
-
*/
|
|
6
|
-
export class ForceBoard extends Device {
|
|
7
|
-
constructor() {
|
|
8
|
-
super({
|
|
9
|
-
filters: [{ name: "Force Board" }],
|
|
10
|
-
services: [
|
|
11
|
-
{
|
|
12
|
-
name: "Device Information",
|
|
13
|
-
id: "device",
|
|
14
|
-
uuid: "0000180a-0000-1000-8000-00805f9b34fb",
|
|
15
|
-
characteristics: [
|
|
16
|
-
// {
|
|
17
|
-
// name: "Serial Number String (Blocked)",
|
|
18
|
-
// id: "serial",
|
|
19
|
-
// uuid: "00002a25-0000-1000-8000-00805f9b34fb",
|
|
20
|
-
// },
|
|
21
|
-
// {
|
|
22
|
-
// name: "Firmware Revision String (Blocked)",
|
|
23
|
-
// id: "firmware",
|
|
24
|
-
// uuid: "00002a26-0000-1000-8000-00805f9b34f",
|
|
25
|
-
// },
|
|
26
|
-
{
|
|
27
|
-
name: "Manufacturer Name String",
|
|
28
|
-
id: "manufacturer",
|
|
29
|
-
uuid: "00002a29-0000-1000-8000-00805f9b34fb",
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "Battery Service",
|
|
35
|
-
id: "battery",
|
|
36
|
-
uuid: "0000180f-0000-1000-8000-00805f9b34fb",
|
|
37
|
-
characteristics: [
|
|
38
|
-
{
|
|
39
|
-
name: "Battery Level",
|
|
40
|
-
id: "level",
|
|
41
|
-
uuid: "00002a19-0000-1000-8000-00805f9b34fb",
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "Nordic Device Firmware Update (DFU) Service",
|
|
47
|
-
id: "dfu",
|
|
48
|
-
uuid: "0000fe59-0000-1000-8000-00805f9b34fb",
|
|
49
|
-
characteristics: [
|
|
50
|
-
{
|
|
51
|
-
name: "Buttonless DFU",
|
|
52
|
-
id: "dfu",
|
|
53
|
-
uuid: "8ec90003-f315-4f60-9fb8-838830daea50",
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: "",
|
|
59
|
-
id: "",
|
|
60
|
-
uuid: "f3641400-00b0-4240-ba50-05ca45bf8abc",
|
|
61
|
-
characteristics: [
|
|
62
|
-
{
|
|
63
|
-
name: "Read + Indicate",
|
|
64
|
-
id: "",
|
|
65
|
-
uuid: "f3641401-00b0-4240-ba50-05ca45bf8abc",
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "Humidity Service",
|
|
71
|
-
id: "humidity",
|
|
72
|
-
uuid: "cf194c6f-d0c1-47b2-aeff-dc610f09bd18",
|
|
73
|
-
characteristics: [
|
|
74
|
-
{
|
|
75
|
-
name: "Humidity Level",
|
|
76
|
-
id: "level",
|
|
77
|
-
uuid: "cf194c70-d0c1-47b2-aeff-dc610f09bd18",
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: "Temperature Serivce",
|
|
83
|
-
id: "temperature",
|
|
84
|
-
uuid: "3a90328c-c266-4c76-b05a-6af6104a0b13",
|
|
85
|
-
characteristics: [
|
|
86
|
-
{
|
|
87
|
-
name: "Read",
|
|
88
|
-
id: "level",
|
|
89
|
-
uuid: "3a90328d-c266-4c76-b05a-6af6104a0b13",
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
name: "Forceboard Service",
|
|
95
|
-
id: "forceboard",
|
|
96
|
-
uuid: "9a88d67f-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
97
|
-
characteristics: [
|
|
98
|
-
{
|
|
99
|
-
name: "Write",
|
|
100
|
-
id: "",
|
|
101
|
-
uuid: "9a88d680-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: "Read + Indicate",
|
|
105
|
-
id: "",
|
|
106
|
-
uuid: "9a88d681-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "Force Data",
|
|
110
|
-
id: "rx",
|
|
111
|
-
uuid: "9a88d682-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: "Tare",
|
|
115
|
-
id: "tare",
|
|
116
|
-
uuid: "9a88d683-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: "Read",
|
|
120
|
-
id: "",
|
|
121
|
-
uuid: "9a88d685-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
name: "Threshold",
|
|
125
|
-
id: "threshold",
|
|
126
|
-
uuid: "9a88d686-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: "Read + Write",
|
|
130
|
-
id: "",
|
|
131
|
-
uuid: "9a88d687-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: "Serial / Read + Write",
|
|
135
|
-
id: "",
|
|
136
|
-
uuid: "9a88d688-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: "Read + Write",
|
|
140
|
-
id: "",
|
|
141
|
-
uuid: "9a88d689-8df2-4afe-9e0d-c2bbbe773dd0",
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: "Weight Service",
|
|
147
|
-
id: "weight",
|
|
148
|
-
uuid: "467a8516-6e39-11eb-9439-0242ac130002",
|
|
149
|
-
characteristics: [
|
|
150
|
-
{
|
|
151
|
-
name: "Device Mode",
|
|
152
|
-
id: "tx",
|
|
153
|
-
uuid: "467a8517-6e39-11eb-9439-0242ac130002",
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: "Read + Write",
|
|
157
|
-
id: "",
|
|
158
|
-
uuid: "467a8518-6e39-11eb-9439-0242ac130002",
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
commands: {
|
|
164
|
-
START_WEIGHT_MEAS: String.fromCharCode(0x04), // Streaming Data Mode: continuously streams force data.
|
|
165
|
-
TARE_SCALE: String.fromCharCode(0x05), // Tare function: zeroes out the current load value
|
|
166
|
-
START_QUICK_MEAS: String.fromCharCode(0x06), // Quick Start Mode: Starts data transmission when a force value exceeds the Threshold and stops data transmission when the force data drops below the Threshold.
|
|
167
|
-
STOP_WEIGHT_MEAS: String.fromCharCode(0x07), // Idle Mode: Force Board is idle.
|
|
168
|
-
},
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Retrieves battery or voltage information from the device.
|
|
173
|
-
* @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information,
|
|
174
|
-
*/
|
|
175
|
-
battery = async () => {
|
|
176
|
-
return await this.read("battery", "level", 250);
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* Handles data received from the device, processes weight measurements,
|
|
180
|
-
* and updates mass data including maximum and average values.
|
|
181
|
-
* It also handles command responses for retrieving device information.
|
|
182
|
-
*
|
|
183
|
-
* @param {DataView} value - The notification event.
|
|
184
|
-
*/
|
|
185
|
-
handleNotifications = (value) => {
|
|
186
|
-
if (value) {
|
|
187
|
-
// Update timestamp
|
|
188
|
-
this.updateTimestamp();
|
|
189
|
-
if (value.buffer) {
|
|
190
|
-
const receivedTime = Date.now();
|
|
191
|
-
const dataArray = new Uint8Array(value.buffer);
|
|
192
|
-
// First two bytes contain the number of samples in the packet
|
|
193
|
-
const numSamples = (dataArray[0] << 8) | dataArray[1];
|
|
194
|
-
// Process each sample (3 bytes per sample)
|
|
195
|
-
for (let i = 0; i < numSamples; i++) {
|
|
196
|
-
const offset = 2 + i * 3; // Skip the first 2 bytes which indicate number of samples
|
|
197
|
-
if (offset + 2 < dataArray.length) {
|
|
198
|
-
// Sample = byte1*32768 + byte2*256 + byte3
|
|
199
|
-
const receivedData = dataArray[offset] * 32768 + dataArray[offset + 1] * 256 + dataArray[offset + 2];
|
|
200
|
-
// Convert from LBS to KG
|
|
201
|
-
const convertedReceivedData = receivedData * 0.453592;
|
|
202
|
-
// Tare correction
|
|
203
|
-
const numericData = convertedReceivedData - this.applyTare(convertedReceivedData);
|
|
204
|
-
// Add data to downloadable Array
|
|
205
|
-
this.downloadPackets.push({
|
|
206
|
-
received: receivedTime,
|
|
207
|
-
sampleNum: this.dataPointCount,
|
|
208
|
-
battRaw: 0,
|
|
209
|
-
samples: [convertedReceivedData],
|
|
210
|
-
masses: [numericData],
|
|
211
|
-
});
|
|
212
|
-
// Update massMax
|
|
213
|
-
this.massMax = Math.max(Number(this.massMax), numericData).toFixed(1);
|
|
214
|
-
// Update running sum and count
|
|
215
|
-
const currentMassTotal = Math.max(-1000, numericData);
|
|
216
|
-
this.massTotalSum += currentMassTotal;
|
|
217
|
-
this.dataPointCount++;
|
|
218
|
-
// Calculate the average dynamically
|
|
219
|
-
this.massAverage = (this.massTotalSum / this.dataPointCount).toFixed(1);
|
|
220
|
-
// Check if device is being used
|
|
221
|
-
this.activityCheck(numericData);
|
|
222
|
-
// Notify with weight data
|
|
223
|
-
this.notifyCallback({
|
|
224
|
-
massMax: this.massMax,
|
|
225
|
-
massAverage: this.massAverage,
|
|
226
|
-
massTotal: Math.max(-1000, numericData).toFixed(1),
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* Retrieves humidity level from the device.
|
|
235
|
-
* @returns {Promise<string>} A Promise that resolves with the humidity level,
|
|
236
|
-
*/
|
|
237
|
-
humidity = async () => {
|
|
238
|
-
return await this.read("humidity", "level", 250);
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Retrieves manufacturer information from the device.
|
|
242
|
-
* @returns {Promise<string>} A Promise that resolves with the manufacturer information,
|
|
243
|
-
*/
|
|
244
|
-
manufacturer = async () => {
|
|
245
|
-
return await this.read("device", "manufacturer", 250);
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* Stops the data stream on the specified device by setting it to Idle mode.
|
|
249
|
-
* @returns {Promise<void>} A promise that resolves when the stream is stopped.
|
|
250
|
-
*/
|
|
251
|
-
stop = async () => {
|
|
252
|
-
await this.write("weight", "tx", this.commands.STOP_WEIGHT_MEAS, 0);
|
|
253
|
-
};
|
|
254
|
-
/**
|
|
255
|
-
* Starts streaming data from the specified device in Streaming Data Mode.
|
|
256
|
-
* @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely.
|
|
257
|
-
* @returns {Promise<void>} A promise that resolves when the streaming operation is completed.
|
|
258
|
-
*/
|
|
259
|
-
stream = async (duration = 0) => {
|
|
260
|
-
// Start streaming data - Streaming Data Mode
|
|
261
|
-
await this.write("weight", "tx", this.commands.START_WEIGHT_MEAS, duration);
|
|
262
|
-
};
|
|
263
|
-
/**
|
|
264
|
-
* Sets the threshold in Lbs for the Quick Start mode.
|
|
265
|
-
* @param {number} thresholdLbs - The threshold value in pounds.
|
|
266
|
-
* @returns {Promise<void>} A promise that resolves when the threshold is set.
|
|
267
|
-
*/
|
|
268
|
-
threshold = async (thresholdLbs) => {
|
|
269
|
-
const thresholdHex = thresholdLbs.toString(16).padStart(6, "0");
|
|
270
|
-
// 3-byte array from the hex string
|
|
271
|
-
const bytes = new Uint8Array(3);
|
|
272
|
-
bytes[0] = parseInt(thresholdHex.substring(0, 2), 16);
|
|
273
|
-
bytes[1] = parseInt(thresholdHex.substring(2, 4), 16);
|
|
274
|
-
bytes[2] = parseInt(thresholdHex.substring(4, 6), 16);
|
|
275
|
-
await this.write("forceboard", "threshold", String.fromCharCode(...bytes), 0);
|
|
276
|
-
};
|
|
277
|
-
/**
|
|
278
|
-
* Tares the Force Board device using a characteristic to zero out the current load value.
|
|
279
|
-
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
280
|
-
*/
|
|
281
|
-
tareByCharacteristic = async () => {
|
|
282
|
-
// Send tare command (0x01) to the tare characteristic
|
|
283
|
-
const tareValue = String.fromCharCode(0x01);
|
|
284
|
-
await this.write("forceboard", "tare", tareValue, 0);
|
|
285
|
-
};
|
|
286
|
-
/**
|
|
287
|
-
* Initiates a tare routine via the Device Mode characteristic.
|
|
288
|
-
* Writes 0x05 to the Device Mode characteristic to zero out the current load value.
|
|
289
|
-
* @returns {Promise<void>} A promise that resolves when the tare operation is completed.
|
|
290
|
-
*/
|
|
291
|
-
tareByMode = async () => {
|
|
292
|
-
await this.write("weight", "tx", this.commands.TARE_SCALE, 0);
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* Retrieves temperature information from the device.
|
|
296
|
-
* @returns {Promise<string>} A Promise that resolves with the temperature information,
|
|
297
|
-
*/
|
|
298
|
-
temperature = async () => {
|
|
299
|
-
return await this.read("temperature", "level", 250);
|
|
300
|
-
};
|
|
301
|
-
/**
|
|
302
|
-
* Starts the Force Board in Quick Start mode.
|
|
303
|
-
* Writes 0x06 to the Device Mode characteristic.
|
|
304
|
-
* @param {number} [duration=0] - The duration in milliseconds. If set to 0, mode will continue indefinitely.
|
|
305
|
-
* @returns {Promise<void>} A promise that resolves when the operation is completed.
|
|
306
|
-
*/
|
|
307
|
-
quick = async (duration = 0) => {
|
|
308
|
-
// Start in Quick Start mode
|
|
309
|
-
await this.write("weight", "tx", this.commands.START_QUICK_MEAS, duration);
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
//# sourceMappingURL=forceboard.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forceboard.model.js","sourceRoot":"","sources":["../../../src/models/device/forceboard.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAG3C;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAM;IACpC;QACE,KAAK,CAAC;YACJ,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;YAClC,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,oBAAoB;oBAC1B,EAAE,EAAE,QAAQ;oBACZ,IAAI,EAAE,sCAAsC;oBAC5C,eAAe,EAAE;wBACf,IAAI;wBACJ,4CAA4C;wBAC5C,kBAAkB;wBAClB,kDAAkD;wBAClD,KAAK;wBACL,IAAI;wBACJ,gDAAgD;wBAChD,oBAAoB;wBACpB,iDAAiD;wBACjD,KAAK;wBACL;4BACE,IAAI,EAAE,0BAA0B;4BAChC,EAAE,EAAE,cAAc;4BAClB,IAAI,EAAE,sCAAsC;yBAC7C;qBACF;iBACF;gBACD;oBACE,IAAI,EAAE,iBAAiB;oBACvB,EAAE,EAAE,SAAS;oBACb,IAAI,EAAE,sCAAsC;oBAC5C,eAAe,EAAE;wBACf;4BACE,IAAI,EAAE,eAAe;4BACrB,EAAE,EAAE,OAAO;4BACX,IAAI,EAAE,sCAAsC;yBAC7C;qBACF;iBACF;gBACD;oBACE,IAAI,EAAE,6CAA6C;oBACnD,EAAE,EAAE,KAAK;oBACT,IAAI,EAAE,sCAAsC;oBAC5C,eAAe,EAAE;wBACf;4BACE,IAAI,EAAE,gBAAgB;4BACtB,EAAE,EAAE,KAAK;4BACT,IAAI,EAAE,sCAAsC;yBAC7C;qBACF;iB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