@moshenguo/ms-data-sdk 0.1.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 (38) hide show
  1. package/README.md +35 -0
  2. package/build/MsDataSdk.types.d.ts +18 -0
  3. package/build/MsDataSdk.types.d.ts.map +1 -0
  4. package/build/MsDataSdk.types.js +2 -0
  5. package/build/MsDataSdk.types.js.map +1 -0
  6. package/build/MsDataSdkModule.d.ts +10 -0
  7. package/build/MsDataSdkModule.d.ts.map +1 -0
  8. package/build/MsDataSdkModule.js +4 -0
  9. package/build/MsDataSdkModule.js.map +1 -0
  10. package/build/MsDataSdkModule.web.d.ts +10 -0
  11. package/build/MsDataSdkModule.web.d.ts.map +1 -0
  12. package/build/MsDataSdkModule.web.js +12 -0
  13. package/build/MsDataSdkModule.web.js.map +1 -0
  14. package/build/index.d.ts +8 -0
  15. package/build/index.d.ts.map +1 -0
  16. package/build/index.js +11 -0
  17. package/build/index.js.map +1 -0
  18. package/build/sdk/bleConst.d.ts +286 -0
  19. package/build/sdk/bleConst.d.ts.map +1 -0
  20. package/build/sdk/bleConst.js +289 -0
  21. package/build/sdk/bleConst.js.map +1 -0
  22. package/build/sdk/bleSDK.d.ts +114 -0
  23. package/build/sdk/bleSDK.d.ts.map +1 -0
  24. package/build/sdk/bleSDK.js +977 -0
  25. package/build/sdk/bleSDK.js.map +1 -0
  26. package/build/sdk/constants.d.ts +10 -0
  27. package/build/sdk/constants.d.ts.map +1 -0
  28. package/build/sdk/constants.js +20 -0
  29. package/build/sdk/constants.js.map +1 -0
  30. package/build/sdk/models.d.ts +58 -0
  31. package/build/sdk/models.d.ts.map +1 -0
  32. package/build/sdk/models.js +2 -0
  33. package/build/sdk/models.js.map +1 -0
  34. package/build/sdk/resolveUtil.d.ts +113 -0
  35. package/build/sdk/resolveUtil.d.ts.map +1 -0
  36. package/build/sdk/resolveUtil.js +1448 -0
  37. package/build/sdk/resolveUtil.js.map +1 -0
  38. package/package.json +61 -0
@@ -0,0 +1,977 @@
1
+ import { DeviceConst, BleConst } from './bleConst';
2
+ import { ResolveUtil } from './resolveUtil';
3
+ export class BleSDK {
4
+ static DATA_READ_START = 0;
5
+ static DATA_READ_CONTINUE = 2;
6
+ static DATA_DELETE = 99;
7
+ static DistanceMode_MILE = 0x81;
8
+ static DistanceMode_KM = 0x80;
9
+ static TimeMode_12h = 0x81;
10
+ static TimeMode_24h = 0x80;
11
+ static WristOn_Enable = 0x81;
12
+ static WristOn_DisEnable = 0x80;
13
+ static TempUnit_C = 0x80;
14
+ static TempUnit_F = 0x81;
15
+ static TAG = "BleSDK";
16
+ static isRuning = false;
17
+ static ecgopen = false;
18
+ static read = false;
19
+ static pregnancyCycleRead = false;
20
+ static isSettingSocial = false;
21
+ static StartDeviceMeasurementWithType = false;
22
+ static generateValue(size) {
23
+ return new Array(size).fill(0);
24
+ }
25
+ static hexByte2Int(b, count) {
26
+ return (b & 0xff) * Math.pow(256, count);
27
+ }
28
+ static generateInitValue() {
29
+ return this.generateValue(16);
30
+ }
31
+ static arrayCopy(source, srcPos, dest, destPos, length) {
32
+ for (let i = 0; i < length; i++) {
33
+ dest[destPos + i] = source[srcPos + i];
34
+ }
35
+ }
36
+ static crcValue(list) {
37
+ let crcValue = 0;
38
+ for (const value of list) {
39
+ crcValue += value;
40
+ }
41
+ list[15] = crcValue & 0xff;
42
+ }
43
+ static crcDynamicValue(list) {
44
+ let crcValue = 0;
45
+ for (const value of list) {
46
+ crcValue += value;
47
+ }
48
+ list[list.length - 1] = crcValue & 0xff;
49
+ }
50
+ static getBcdValue(value) {
51
+ // let data = value.toString();
52
+ // if (data.length > 2) data = data.substring(0, 2);
53
+ // return parseInt(data, 16);
54
+ return Math.floor(value / 10) * 16 + (value % 10);
55
+ }
56
+ static DataParsingWithData(value) {
57
+ if (!value || value.length === 0) {
58
+ return ResolveUtil.setMethodError('Empty data');
59
+ }
60
+ const cmd = value[0];
61
+ switch (cmd) {
62
+ case DeviceConst.CMD_Set_Goal:
63
+ return ResolveUtil.setMethodSuccessful(BleConst.SetStepGoal);
64
+ case DeviceConst.CMD_Set_UseInfo:
65
+ return ResolveUtil.setMethodSuccessful(BleConst.SetPersonalInfo);
66
+ case DeviceConst.CMD_Set_Name:
67
+ break;
68
+ case DeviceConst.CMD_Set_MOT_SIGN:
69
+ return ResolveUtil.setMethodSuccessful(BleConst.SetMotorVibrationWithTimes);
70
+ case DeviceConst.CMD_Set_DeviceInfo:
71
+ return ResolveUtil.setMethodSuccessful(BleConst.SetDeviceInfo);
72
+ case DeviceConst.CMD_Set_AutoHeart:
73
+ return ResolveUtil.setMethodSuccessful(BleConst.SetAutomaticHRMonitoring);
74
+ case DeviceConst.CMD_Set_ActivityAlarm: //设置 久坐提醒
75
+ return ResolveUtil.setMethodSuccessful(BleConst.SetSedentaryReminder);
76
+ case DeviceConst.CMD_Set_DeviceID:
77
+ return ResolveUtil.setMacSuccessful();
78
+ case DeviceConst.CMD_Start_EXERCISE:
79
+ return ResolveUtil.setMethodSuccessful(BleConst.EnterActivityMode);
80
+ case DeviceConst.CMD_Set_TemperatureCorrection:
81
+ if (value[2] !== 0 && value[3] !== 0) {
82
+ return ResolveUtil.getTemperatureCorrectionValue(value);
83
+ }
84
+ else {
85
+ return ResolveUtil.setMethodSuccessful(BleConst.CMD_Set_TemperatureCorrection);
86
+ }
87
+ case DeviceConst.CMD_HeartPackageFromDevice:
88
+ return ResolveUtil.getActivityExerciseData(value);
89
+ case DeviceConst.CMD_SET_TIME:
90
+ return ResolveUtil.setTimeSuccessful(value);
91
+ case DeviceConst.CMD_Get_SPORTData:
92
+ return ResolveUtil.getExerciseData(value);
93
+ case DeviceConst.CMD_GET_TIME:
94
+ return ResolveUtil.getDeviceTime(value);
95
+ case DeviceConst.CMD_GET_USERINFO:
96
+ return ResolveUtil.getUserInfo(value);
97
+ case DeviceConst.CMD_Get_DeviceInfo:
98
+ return ResolveUtil.getDeviceInfo(value);
99
+ case DeviceConst.CMD_Enable_Activity:
100
+ return ResolveUtil.getActivityData(value);
101
+ case DeviceConst.CMD_Get_Goal:
102
+ return ResolveUtil.getGoal(value);
103
+ case DeviceConst.CMD_Get_BatteryLevel:
104
+ return ResolveUtil.getDeviceBattery(value);
105
+ case DeviceConst.CMD_Get_Address:
106
+ return ResolveUtil.getDeviceAddress(value);
107
+ case DeviceConst.CMD_Get_Version:
108
+ return ResolveUtil.getDeviceVersion(value);
109
+ case DeviceConst.CMD_Get_Name:
110
+ return ResolveUtil.getDeviceName(value);
111
+ case DeviceConst.CMD_Get_AutoHeart:
112
+ return ResolveUtil.getAutoHeart(value);
113
+ case DeviceConst.CMD_Reset:
114
+ return ResolveUtil.Reset();
115
+ case DeviceConst.CMD_Mcu_Reset:
116
+ return ResolveUtil.MCUReset();
117
+ case DeviceConst.CMD_Notify:
118
+ return ResolveUtil.Notify();
119
+ case DeviceConst.CMD_Get_ActivityAlarm:
120
+ return ResolveUtil.getActivityAlarm(value);
121
+ case DeviceConst.CMD_Get_TotalData:
122
+ return ResolveUtil.getTotalStepData(value);
123
+ case DeviceConst.CMD_Get_DetailData:
124
+ return ResolveUtil.getDetailData(value);
125
+ case DeviceConst.CMD_Get_SleepData:
126
+ return ResolveUtil.getSleepData(value);
127
+ case DeviceConst.CMD_Get_HeartData:
128
+ return ResolveUtil.getHeartData(value);
129
+ case DeviceConst.CMD_Get_OnceHeartData:
130
+ return ResolveUtil.getOnceHeartData(value);
131
+ case DeviceConst.CMD_Get_HrvTestData:
132
+ return ResolveUtil.getHrvTestData(value);
133
+ case DeviceConst.CMD_Get_Clock: //获取闹钟数据
134
+ return ResolveUtil.getClockData(value);
135
+ case DeviceConst.CMD_Set_Clock:
136
+ return ResolveUtil.updateClockSuccessful(value);
137
+ case DeviceConst.CMD_Set_NewDeviceInfo:
138
+ return ResolveUtil.setNewDeviceInfo(value);
139
+ case DeviceConst.CMD_Get_NewDeviceInfo:
140
+ return ResolveUtil.getNewDeviceInfo(value);
141
+ case DeviceConst.Enter_photo_modeback:
142
+ return ResolveUtil.enterPhotoModeback(value);
143
+ case DeviceConst.Enter_photo_mode:
144
+ return ResolveUtil.setMethodSuccessful(BleConst.EnterPhotoMode);
145
+ case DeviceConst.Exit_photo_mode:
146
+ return ResolveUtil.setMethodSuccessful(BleConst.BackHomeView);
147
+ case DeviceConst.CMD_ECGQuality:
148
+ return ResolveUtil.eCGQuality(value);
149
+ case DeviceConst.CMD_ECGDATA:
150
+ case DeviceConst.CMD_PPGGDATA:
151
+ break;
152
+ case DeviceConst.Weather:
153
+ return ResolveUtil.setMethodSuccessful(BleConst.Weather);
154
+ case DeviceConst.Braceletdial:
155
+ return ResolveUtil.braceletdial(false, value); // isRunning 暂设为 false
156
+ case DeviceConst.SportMode:
157
+ return ResolveUtil.setMethodSuccessful(BleConst.SportMode);
158
+ case DeviceConst.GetSportMode:
159
+ return ResolveUtil.getSportMode(value);
160
+ case DeviceConst.MeasurementWithType:
161
+ return ResolveUtil.measurementWithType(true, value); // StartDeviceMeasurementWithType 设为 true
162
+ case DeviceConst.GPSControlCommand:
163
+ return ResolveUtil.gPSControlCommand(value);
164
+ case DeviceConst.CMD_Get_GPSDATA:
165
+ return ResolveUtil.getHistoryGpsData(value);
166
+ case DeviceConst.Clear_Bracelet_data:
167
+ return ResolveUtil.setMethodSuccessful(BleConst.Clear_Bracelet_data);
168
+ case DeviceConst.CMD_Get_Auto_Blood_oxygen:
169
+ return ResolveUtil.getAutoBloodOxygen(value);
170
+ case DeviceConst.CMD_Get_Blood_oxygen:
171
+ return ResolveUtil.getBloodoxygen(value);
172
+ case DeviceConst.CMD_SET_SOCIAL:
173
+ return ResolveUtil.setMethodSuccessful(BleConst.SocialdistanceSetting);
174
+ case DeviceConst.Sos:
175
+ return ResolveUtil.setMethodSuccessful(BleConst.Sos);
176
+ case DeviceConst.Temperature_history:
177
+ return ResolveUtil.getTempData(value);
178
+ case DeviceConst.GetAxillaryTemperatureDataWithMode:
179
+ return ResolveUtil.getTempDataer(value);
180
+ case DeviceConst.CMD_QrCode:
181
+ return ResolveUtil.getQrCode(value, false);
182
+ case DeviceConst.CMD_GET_BLOODSUGAR:
183
+ return ResolveUtil.setBoolSugarStatus(value);
184
+ case DeviceConst.CMD_GET_BLOODSUGAR_DATA:
185
+ return ResolveUtil.setBoolSugarValue(value);
186
+ case DeviceConst.GetEcgPpgStatus:
187
+ return ResolveUtil.ECGResult(value);
188
+ case DeviceConst.PregnancyCycle:
189
+ return ResolveUtil.readPregnancyCycle(value);
190
+ case DeviceConst.GetEcgSaveData:
191
+ return ResolveUtil.getEcgHistoryData(value);
192
+ case DeviceConst.Openecg:
193
+ if (value.length >= 16) {
194
+ return ResolveUtil.ecgData(value);
195
+ }
196
+ else {
197
+ return ResolveUtil.setMethodSuccessful(BleConst.ECG);
198
+ }
199
+ case DeviceConst.WomenHealth:
200
+ if (value[1] === 0) {
201
+ return ResolveUtil.setMethodSuccessful(BleConst.SetWomenHealth);
202
+ }
203
+ else {
204
+ return ResolveUtil.readWomenHealth(value);
205
+ }
206
+ case DeviceConst.Closeecg:
207
+ return ResolveUtil.setMethodSuccessful(BleConst.CloseECG);
208
+ case DeviceConst.BloodsugarWithMode:
209
+ const ppi2 = this.hexByte2Int(value[2], 0);
210
+ switch (ppi2) {
211
+ case 1:
212
+ return ResolveUtil.setMethodSuccessful(BleConst.ppgStartSucessed);
213
+ case 2:
214
+ return ResolveUtil.setMethodSuccessful(BleConst.ppgResult);
215
+ case 3:
216
+ return ResolveUtil.setMethodSuccessful(BleConst.ppgStop);
217
+ case 4:
218
+ return ResolveUtil.setMethodSuccessful(BleConst.ppgMeasurementProgress);
219
+ case 5:
220
+ return ResolveUtil.setMethodSuccessful(BleConst.ppgQuit);
221
+ default:
222
+ return ResolveUtil.setMethodSuccessful(BleConst.ppgStartFailed);
223
+ }
224
+ case DeviceConst.CMD_Get_PPITestData:
225
+ return ResolveUtil.getPPITestData(value);
226
+ case DeviceConst.CMD_SETTING_HRV_TIME:
227
+ return ResolveUtil.getHrvTimeData(value);
228
+ case DeviceConst.CMD_CLOSE_DEVICE:
229
+ return ResolveUtil.closeDevices(value);
230
+ case DeviceConst.CMD_AUTO_CHECK_STATUS:
231
+ return ResolveUtil.getOffCheckStatus(value);
232
+ }
233
+ return ResolveUtil.setMethodError(this.getBcdValue(value[0]).toString());
234
+ }
235
+ ///血糖
236
+ static bloodsugarWithMode(ppgMode, ppgStatus) {
237
+ const value = this.generateInitValue();
238
+ value[0] = DeviceConst.BloodsugarWithMode;
239
+ value[1] = ppgMode;
240
+ if (ppgMode === 2 || ppgMode === 4) {
241
+ value[2] = ppgStatus;
242
+ }
243
+ this.crcValue(value);
244
+ return value;
245
+ }
246
+ static openECGPPG(level, time) {
247
+ this.ecgopen = level !== 0;
248
+ const value = this.generateInitValue();
249
+ value[0] = DeviceConst.Openecg;
250
+ value[1] = level;
251
+ value[3] = (time) & 0xff;
252
+ value[4] = (time >> 8) & 0xff;
253
+ this.crcValue(value);
254
+ return value;
255
+ }
256
+ static stopEcgPPg() {
257
+ const value = this.generateInitValue();
258
+ value[0] = DeviceConst.Closeecg;
259
+ this.crcValue(value);
260
+ return value;
261
+ }
262
+ ///获得睡眠详细数据
263
+ ///mode : 0-读最近的睡眠详细数据 2-继续上次读的位置下一段数据 99-删除睡眠数据
264
+ ///Obtain detailed sleep data
265
+ ///mode : 0-Read the latest sleep detailed data 2-Continue with the next data segment at the last read location 99-Delete sleep data
266
+ static getDetailSleepDataWithMode(mode) {
267
+ const value = this.generateInitValue();
268
+ value[0] = DeviceConst.CMD_Get_SleepData;
269
+ value[1] = mode === 99 ? 0x99 : mode;
270
+ this.crcValue(value);
271
+ return value;
272
+ }
273
+ static insertDateValue(list, time) {
274
+ if (!time || time.length <= 0)
275
+ return;
276
+ const [datePart, timePart] = time.split(' ');
277
+ const [year, month, day] = datePart.split('-').map(Number);
278
+ const [hour, minute, second] = timePart.split(':').map(Number);
279
+ list[4] = this.getBcdValue(year - 2000);
280
+ list[5] = this.getBcdValue(month);
281
+ list[6] = this.getBcdValue(day);
282
+ list[7] = this.getBcdValue(hour);
283
+ list[8] = this.getBcdValue(minute);
284
+ list[9] = this.getBcdValue(second);
285
+ }
286
+ ///获得HRV测试数据
287
+ ///mode : 0-读最近的详细数据 2-继续上次读的位置下一段数据 99-删除数据 time: yyyy-MM-dd HH:mm:ss
288
+ ///Get HRV test data
289
+ ///mode : 0-Read the latest detailed data 2-Continue with the next data segment at the last read location 99-Delete data time: yyyy-MM-dd HH:mm:ss
290
+ static getHRVDataWithMode(mode, time) {
291
+ const value = this.generateInitValue(); // 初始化 buffer
292
+ value[0] = DeviceConst.CMD_Get_HrvTestData;
293
+ if (mode === 99) {
294
+ value[1] = 0x99;
295
+ }
296
+ else if (mode === 0) {
297
+ value[1] = 0x00;
298
+ }
299
+ else if (mode === 1) {
300
+ value[1] = 0x01;
301
+ }
302
+ else {
303
+ value[1] = 0x02;
304
+ }
305
+ this.insertDateValue(value, time);
306
+ this.crcValue(value);
307
+ return value;
308
+ }
309
+ ///获取PPI测试数据
310
+ static getPPIDDataWithMode(mode) {
311
+ const value = this.generateInitValue(); // 初始化 buffer
312
+ value[0] = DeviceConst.CMD_Get_PPITestData;
313
+ if (mode === 99) {
314
+ value[1] = 0x99;
315
+ }
316
+ else if (mode === 0) {
317
+ value[1] = 0x00;
318
+ }
319
+ else if (mode === 1) {
320
+ value[1] = 0x01;
321
+ }
322
+ else {
323
+ value[1] = 0x02;
324
+ }
325
+ this.crcValue(value);
326
+ return value;
327
+ }
328
+ ///获取Hrv测量时长
329
+ static getHrvTestTime() {
330
+ const value = this.generateInitValue();
331
+ value[0] = DeviceConst.CMD_SETTING_HRV_TIME;
332
+ value[1] = 0x00;
333
+ this.crcValue(value);
334
+ return value;
335
+ }
336
+ /// 设置Hrv测试时长
337
+ static setHrvTestTime(time) {
338
+ const value = this.generateInitValue();
339
+ value[0] = DeviceConst.CMD_SETTING_HRV_TIME;
340
+ value[1] = 0x01;
341
+ value[2] = time;
342
+ this.crcValue(value);
343
+ return value;
344
+ }
345
+ //断开蓝牙
346
+ static closeBlueDevice() {
347
+ const value = this.generateInitValue();
348
+ value[0] = DeviceConst.CMD_CLOSE_DEVICE;
349
+ this.crcValue(value);
350
+ return value;
351
+ }
352
+ ///血糖开始测量
353
+ ///Start measuring blood sugar
354
+ static startBloodSugar() {
355
+ const value = this.generateInitValue();
356
+ value[0] = DeviceConst.CMD_GET_BLOODSUGAR;
357
+ value[1] = 0x01;
358
+ this.crcValue(value);
359
+ return value;
360
+ }
361
+ ///血糖进度设置
362
+ ///Blood glucose progress setting
363
+ static progressBloodSugar(progress) {
364
+ const value = this.generateInitValue();
365
+ value[0] = DeviceConst.CMD_GET_BLOODSUGAR;
366
+ value[1] = 0x04;
367
+ value[2] = progress;
368
+ this.crcValue(value);
369
+ return value;
370
+ }
371
+ ///结束测量血糖
372
+ ///End measuring blood glucose
373
+ static endBloodSugar() {
374
+ const value = this.generateInitValue();
375
+ value[0] = DeviceConst.CMD_GET_BLOODSUGAR;
376
+ value[1] = 0x03;
377
+ this.crcValue(value);
378
+ return value;
379
+ }
380
+ ///获取某天总数据
381
+ ///0:表⽰是从最新的位置开始读取(最多50组数据) 2:表⽰接着读取(当数据总数⼤于50的时候) 0x99:表⽰删除所有运动数据
382
+ ///Obtain total data for a certain day
383
+ ///0: Table 1 starts reading from the latest position (up to 50 sets of data) 2: Table 2 continues reading (when the total number of data exceeds 50) 0x99: Table 1 deletes all motion data
384
+ static getTotalActivityDataWithMode(mode) {
385
+ const value = this.generateInitValue(); // 初始化 buffer
386
+ value[0] = DeviceConst.CMD_Get_TotalData;
387
+ if (mode === 99) {
388
+ value[1] = 0x99;
389
+ }
390
+ else if (mode === 0) {
391
+ value[1] = 0x00;
392
+ }
393
+ else if (mode === 1) {
394
+ value[1] = 0x01;
395
+ }
396
+ else {
397
+ value[1] = 0x02;
398
+ }
399
+ this.crcValue(value);
400
+ return value;
401
+ }
402
+ ///根据某个日期获取到最新的总数据
403
+ ///mode: 0-表⽰是从最新的位置开始读取(最多50组数据) 2-表⽰接着读取(当数据总数⼤于50的时候) 99-表⽰删除所有运动数据
404
+ ///time: yyyy-MM-dd HH:mm:ss
405
+ ///Obtain the latest total data based on a certain date
406
+ ///mode: 0-Table 1 starts reading from the latest position (up to 50 sets of data) 2-Table 2 continues reading (when the total number of data exceeds 50) 99-Table 1 deletes all motion data
407
+ ///time: yyyy-MM-dd HH:mm:ss
408
+ static getTotalActivityDataWithModeForTime(mode, time) {
409
+ const value = this.generateInitValue(); // 初始化 buffer
410
+ value[0] = DeviceConst.CMD_Get_TotalData;
411
+ if (mode === 99) {
412
+ value[1] = 0x99;
413
+ }
414
+ else if (mode === 0) {
415
+ value[1] = 0x00;
416
+ }
417
+ else if (mode === 1) {
418
+ value[1] = 0x01;
419
+ }
420
+ else {
421
+ value[1] = 0x02;
422
+ }
423
+ this.insertDateValue(value, time);
424
+ this.crcValue(value);
425
+ return value;
426
+ }
427
+ ///获得睡眠详细数据
428
+ ///mode : 0-读最近的睡眠详细数据 2-继续上次读的位置下一段数据 99-删除睡眠数据 time: yyyy-MM-dd HH:mm:ss
429
+ ///Obtain detailed sleep data
430
+ ///mode : 0-Read the latest sleep detailed data 2-Continue with the next data segment at the last read location 99-Delete sleep data time: yyyy-MM-dd HH:mm:ss
431
+ static getDetailSleepDataWithModeForTime(mode, time) {
432
+ const value = this.generateInitValue();
433
+ value[0] = DeviceConst.CMD_Get_SleepData;
434
+ value[1] = mode === 99 ? 0x99 : mode;
435
+ this.insertDateValue(value, time);
436
+ this.crcValue(value);
437
+ return value;
438
+ }
439
+ ///获得步数详细数据
440
+ ///mode : 0-读最近的详细数据 2-继续上次读的位置下一段数据 99-删除数据
441
+ ///Obtain detailed step count data
442
+ ///mode : 0-Read the latest detailed data 2-Continue with the next data segment at the last read location 99-Delete data
443
+ static getDetailActivityDataWithModeForTime(mode, time) {
444
+ const value = this.generateInitValue();
445
+ value[0] = DeviceConst.CMD_Get_DetailData;
446
+ value[1] = mode === 99 ? 0x99 : mode;
447
+ this.insertDateValue(value, time);
448
+ this.crcValue(value);
449
+ return value;
450
+ }
451
+ ///自动测试温度数据
452
+ ///mode : 0-读最近的详细数据 2-继续上次读的位置下一段数据 99-删除数据 time : yyyy-MM-dd HH:mm:ss
453
+ ///Automatic testing of temperature data
454
+ ///mode : 0-Read the latest detailed data 2-Continue with the next data segment at the last read location 99-Delete data time : yyyy-MM-dd HH:mm:ss
455
+ static getTemperature_historyDataWithMode(mode, time) {
456
+ const value = this.generateInitValue();
457
+ value[0] = DeviceConst.Temperature_history;
458
+ value[1] = mode === 99 ? 0x99 : mode;
459
+ this.insertDateValue(value, time);
460
+ this.crcValue(value);
461
+ return value;
462
+ }
463
+ ///手动测试温度数据
464
+ ///mode : 0-读最近的详细数据 2-继续上次读的位置下一段数据 99-删除数据 time: yyyy-MM-dd HH:mm:ss
465
+ ///Manual testing of temperature data
466
+ ///mode : 0-Read the latest detailed data 2-Continue with the next data segment at the last read location 99-Delete data time: yyyy-MM-dd HH:mm:ss
467
+ static getAxillaryTemperatureDataWithMode(mode, time) {
468
+ const value = this.generateInitValue();
469
+ value[0] = DeviceConst.GetAxillaryTemperatureDataWithMode;
470
+ if (mode === 99) {
471
+ value[1] = 0x99;
472
+ }
473
+ else if (mode === 0) {
474
+ value[1] = 0x00;
475
+ }
476
+ else if (mode === 1) {
477
+ value[1] = 0x01;
478
+ }
479
+ else {
480
+ value[1] = 0x02;
481
+ }
482
+ this.insertDateValue(value, time);
483
+ this.crcValue(value);
484
+ return value;
485
+ }
486
+ ///运动模式开关
487
+ ///Sport mode switch
488
+ static enterActivityMode(activityMode, WorkMode) {
489
+ const value = this.generateInitValue();
490
+ value[0] = DeviceConst.CMD_Start_EXERCISE;
491
+ value[1] = WorkMode;
492
+ value[2] = activityMode;
493
+ this.crcValue(value);
494
+ return value;
495
+ }
496
+ ///发送运动模式心跳包(配合"EnterActivityMode"使用)
497
+ ///当手环是通过APP进入多运动模式后,APP必须每隔1秒发送一个数据给手环,否则手环会退出多运动模式
498
+ ///Send a sports mode heartbeat packet (used in conjunction with 'EnterActivityMode')
499
+ ///When the bracelet enters multi sport mode through the APP, the APP must send data to the bracelet every 1 second, otherwise the bracelet will exit multi sport mode
500
+ static sendHeartPackage(distance, space, rssi) {
501
+ // 1. 初始化数据包(8 字节 + 1 字节 CRC => 总共 9 字节?根据协议可调)
502
+ const value = this.generateInitValue(); // 返回长度为 8 或 9 的数组
503
+ // 2. 拆分 space 为 分钟 和 秒
504
+ const min = Math.floor(space / 60) & 0xff;
505
+ const second = (space % 60) & 0xff;
506
+ // 3. 使用 DataView 写入 float32(小端序)
507
+ const buffer = new ArrayBuffer(4);
508
+ const dataView = new DataView(buffer);
509
+ dataView.setFloat32(0, distance, true); // true = little endian
510
+ const distanceBytes = Array.from(new Uint8Array(buffer)); // 转为 [b0, b1, b2, b3]
511
+ // 4. 组装数据包
512
+ value[0] = DeviceConst.CMD_heart_package;
513
+ this.arrayCopy(distanceBytes, 0, value, 1, distanceBytes.length);
514
+ // 将 distanceBytes 复制到 value 的索引 1~4
515
+ // distanceBytes.forEach((byte, i) => {
516
+ // value[1 + i] = byte;
517
+ // });
518
+ value[5] = min;
519
+ value[6] = second;
520
+ value[7] = rssi & 0xff; // 确保是 1 字节
521
+ this.crcValue(value);
522
+ return value;
523
+ }
524
+ ///开始实时计步
525
+ ///Start real time step
526
+ static RealTimeStep(enable, tempEnable) {
527
+ const value = this.generateInitValue();
528
+ value[0] = DeviceConst.CMD_Enable_Activity;
529
+ value[1] = enable ? 1 : 0;
530
+ value[2] = tempEnable ? 1 : 0;
531
+ this.crcValue(value);
532
+ return value;
533
+ }
534
+ ///停止实时计步
535
+ ///Stop real-time step counting
536
+ static stopGo() {
537
+ const value = this.generateInitValue();
538
+ value[0] = DeviceConst.CMD_Enable_Activity;
539
+ value[1] = 0;
540
+ this.crcValue(value);
541
+ return value;
542
+ }
543
+ ///设置个人信息
544
+ ///Set user profile
545
+ static setPersonalInfo(info) {
546
+ const value = this.generateInitValue();
547
+ value[0] = DeviceConst.CMD_Set_UseInfo;
548
+ value[1] = info.sex;
549
+ value[2] = info.age;
550
+ value[3] = info.height;
551
+ value[4] = info.weight;
552
+ if (info.stepLength) {
553
+ value[5] = info.stepLength;
554
+ }
555
+ this.crcValue(value);
556
+ return value;
557
+ }
558
+ ///获取个人信息
559
+ ///Get user's personal information
560
+ static getPersonalInfo() {
561
+ const value = this.generateInitValue(); // 初始化 buffer
562
+ value[0] = DeviceConst.CMD_GET_USERINFO;
563
+ this.crcValue(value);
564
+ return value;
565
+ }
566
+ ///进入dfu模式
567
+ ///Entering dfu mode
568
+ static enterOTA() {
569
+ const value = this.generateInitValue();
570
+ value[0] = DeviceConst.CMD_Start_Ota;
571
+ this.crcValue(value);
572
+ return value;
573
+ }
574
+ ///获取设备版本号
575
+ ///Read software version number
576
+ static getDeviceVersion() {
577
+ const value = this.generateInitValue();
578
+ value[0] = DeviceConst.CMD_Get_Version;
579
+ this.crcValue(value);
580
+ return value;
581
+ }
582
+ ///恢复出厂设置
583
+ ///Restore factory settings
584
+ static reset() {
585
+ const value = this.generateInitValue();
586
+ value[0] = DeviceConst.CMD_Reset;
587
+ this.crcValue(value);
588
+ return value;
589
+ }
590
+ ///获取设备mac地址
591
+ ///Read MAC address
592
+ static getDeviceMacAddress() {
593
+ const value = this.generateInitValue();
594
+ value[0] = DeviceConst.CMD_Get_Address;
595
+ this.crcValue(value);
596
+ return value;
597
+ }
598
+ ///获取设备电量
599
+ ///Read device power
600
+ static getDeviceBatteryLevel() {
601
+ const value = this.generateInitValue();
602
+ value[0] = DeviceConst.CMD_Get_BatteryLevel;
603
+ this.crcValue(value);
604
+ return value;
605
+ }
606
+ ///重启设备
607
+ ///MCU soft reset command
608
+ static MCUReset() {
609
+ const value = this.generateInitValue();
610
+ value[0] = DeviceConst.CMD_Mcu_Reset;
611
+ this.crcValue(value);
612
+ return value;
613
+ }
614
+ /**
615
+ * 设置设备名称
616
+ * @param deviceName 设备名称(最多14个ASCII字符)
617
+ * @returns Uint8Array 指令包(7字节)
618
+ */
619
+ static setDeviceName(deviceName) {
620
+ const value = this.generateInitValue(); // 初始化7字节数组
621
+ const maxLength = 14;
622
+ const length = Math.min(deviceName.length, maxLength);
623
+ value[0] = DeviceConst.CMD_Set_Name;
624
+ // 写入设备名称(ASCII 编码)
625
+ for (let i = 0; i < length; i++) {
626
+ value[i + 1] = deviceName.charCodeAt(i); // 相当于 Dart 的 codeUnitAt(i)
627
+ }
628
+ // 填充剩余字节为 0(可选,保持干净)
629
+ for (let i = length + 1; i < 6; i++) {
630
+ value[i] = 0;
631
+ }
632
+ // 计算 CRC 并写入最后一个字节
633
+ this.crcValue(value);
634
+ return value;
635
+ }
636
+ /**
637
+ * 获取设备名称
638
+ * @returns Uint8Array 指令包(7字节)
639
+ */
640
+ static getDeviceName() {
641
+ const value = this.generateInitValue();
642
+ value[0] = DeviceConst.CMD_Get_Name;
643
+ // 其余字节保持为 0
644
+ for (let i = 1; i < 6; i++) {
645
+ value[i] = 0;
646
+ }
647
+ // 计算 CRC
648
+ this.crcValue(value);
649
+ return value;
650
+ }
651
+ ///设置设备时间
652
+ ///Set Device Time
653
+ static setDeviceTime(dateTime) {
654
+ const value = this.generateInitValue();
655
+ const year = dateTime.getFullYear();
656
+ const month = dateTime.getMonth() + 1;
657
+ const day = dateTime.getDate();
658
+ const hour = dateTime.getHours();
659
+ const minute = dateTime.getMinutes();
660
+ const second = dateTime.getSeconds();
661
+ value[0] = DeviceConst.CMD_SET_TIME;
662
+ value[1] = this.getBcdValue(year);
663
+ value[2] = this.getBcdValue(month);
664
+ value[3] = this.getBcdValue(day);
665
+ value[4] = this.getBcdValue(hour);
666
+ value[5] = this.getBcdValue(minute);
667
+ value[6] = this.getBcdValue(second);
668
+ this.crcValue(value);
669
+ return value;
670
+ }
671
+ ///获取设备时间
672
+ ///Get device time
673
+ static getDeviceTime() {
674
+ const value = this.generateInitValue();
675
+ value[0] = DeviceConst.CMD_GET_TIME;
676
+ this.crcValue(value);
677
+ return value;
678
+ }
679
+ ///设置设备信息
680
+ ///Set basic parameters of Bracelet
681
+ static setDeviceInfo(deviceBaseParameter) {
682
+ const value = this.generateInitValue();
683
+ value[0] = DeviceConst.CMD_Set_DeviceInfo;
684
+ value[1] = deviceBaseParameter.DistanceUnit ? 0x81 : 0x80;
685
+ value[2] = deviceBaseParameter.is12Hour ? 0x81 : 0x80;
686
+ value[3] = deviceBaseParameter.Hand_up_light_screen_switch ? 0x81 : 0x80;
687
+ value[4] = !deviceBaseParameter.Fahrenheit ? 0x81 : 0x80;
688
+ value[5] = deviceBaseParameter.Nightmode ? 0x81 : 0x80;
689
+ value[6] = 0x80;
690
+ value[9] = 0x80 + deviceBaseParameter.baseheart;
691
+ value[11] = 0x80 + deviceBaseParameter.screenBrightness;
692
+ value[12] = 0x80 + deviceBaseParameter.indexDial;
693
+ value[14] = 0x80 + deviceBaseParameter.languages;
694
+ this.crcValue(value);
695
+ return value;
696
+ }
697
+ ///健康测量控制
698
+ ///Health measurement control
699
+ static healthMeasurementWithDataType(dataType, open) {
700
+ this.StartDeviceMeasurementWithType = open;
701
+ const value = this.generateInitValue();
702
+ value[0] = DeviceConst.MeasurementWithType;
703
+ value[1] = dataType;
704
+ value[2] = open ? 0x01 : 0x00;
705
+ this.crcValue(value);
706
+ return value;
707
+ }
708
+ /**
709
+ * 设置手环表盘模式
710
+ * @param mode 表盘模式(0, 1, 2... 根据设备定义)
711
+ * @returns Uint8Array 指令包(7字节)
712
+ */
713
+ static setBraceletdial(mode) {
714
+ // 设置运行状态(可选,用于控制流程)
715
+ this.isRuning = true;
716
+ const value = this.generateInitValue(); // 初始化 7 字节数组
717
+ value[0] = DeviceConst.Braceletdial; // 命令字
718
+ value[1] = mode; // 模式值
719
+ this.crcValue(value);
720
+ return value;
721
+ }
722
+ ///设置自动检测心率时段
723
+ ///Set automatic heart rate detection period
724
+ static setAutomaticHRMonitoring(autoHeart) {
725
+ const value = this.generateInitValue();
726
+ const time = autoHeart.time;
727
+ value[0] = DeviceConst.CMD_Set_AutoHeart;
728
+ value[1] = autoHeart.open;
729
+ value[2] = this.getBcdValue(autoHeart.startHour);
730
+ value[3] = this.getBcdValue(autoHeart.startMinute);
731
+ value[4] = this.getBcdValue(autoHeart.endHour);
732
+ value[5] = this.getBcdValue(autoHeart.endMinute);
733
+ value[6] = autoHeart.week;
734
+ value[7] = (time & 0xff);
735
+ value[8] = ((time >> 8) & 0xff);
736
+ value[9] = autoHeart.type;
737
+ this.crcValue(value);
738
+ return value;
739
+ }
740
+ ///读取自动检测心率时段
741
+ ///1 心率 2 血氧 3 温度 4 HRV
742
+ ///Read auto detect heart rate period
743
+ ///1 Heart rate 2 Blood oxygen 3 Temperature 4 HRV
744
+ static getAutomaticHRMonitoring(type) {
745
+ const value = this.generateInitValue();
746
+ value[0] = DeviceConst.CMD_Get_AutoHeart;
747
+ value[1] = type;
748
+ this.crcValue(value);
749
+ return value;
750
+ }
751
+ ///获取多模式运动数据
752
+ ///mode 0:表⽰是从最新的位置开始读取(最多50组数据) 2:表⽰接着读取(当数据总数⼤于50的时候) 0x99:表⽰删除所有GPS数据
753
+ ///Obtain multimodal motion data
754
+ ///Mode 0: Table 1 starts reading from the latest position (up to 50 sets of data) 2: Table 2 continues reading (when the total number of data exceeds 50) 0x99: Table 1 deletes all GPS data
755
+ static getActivityModeDataWithMode(mode) {
756
+ const value = this.generateInitValue();
757
+ value[0] = DeviceConst.CMD_Get_SPORTData;
758
+ value[1] = mode;
759
+ this.crcValue(value);
760
+ return value;
761
+ }
762
+ ///获得单次心率数据(间隔测试心率)
763
+ ///mode : 0-读最近的详细数据 2-继续上次读的位置下一段数据 99-删除数据 time: yyyy-MM-dd HH:mm:ss
764
+ ///Obtain single heart rate data (interval test heart rate)
765
+ ///mode : 0-Read the latest detailed data 2-Continue with the next data segment at the last read location 99-Delete data time: yyyy-MM-dd HH:mm:ss
766
+ static getStaticHRWithMode(mode, time) {
767
+ const value = this.generateInitValue();
768
+ value[0] = DeviceConst.CMD_Get_OnceHeartData;
769
+ value[1] = mode;
770
+ this.insertDateValue(value, time);
771
+ this.crcValue(value);
772
+ return value;
773
+ }
774
+ ///获得心率数据
775
+ ///mode : 0-读最近的详细数据 2-继续上次读的位置下一段数据 99-删除数据 time: yyyy-MM-dd HH:mm:ss
776
+ ///Get heart rate data
777
+ ///mode : 0-Read the latest detailed data 2-Continue with the next data segment at the last read location 99-Delete data time: yyyy-MM-dd HH:mm:ss
778
+ static getDynamicHRWithMode(mode, time) {
779
+ const value = this.generateInitValue();
780
+ value[0] = DeviceConst.CMD_Get_HeartData;
781
+ value[1] = mode;
782
+ this.insertDateValue(value, time);
783
+ this.crcValue(value);
784
+ return value;
785
+ }
786
+ ///获得血氧数据
787
+ ///mode : 0-读最近的详细数据 2-继续上次读的位置下一段数据 99-删除数据 time: yyyy-MM-dd HH:mm:ss
788
+ ///Get blood oxygen data
789
+ ///mode : 0-Read the latest detailed data 2-Continue with the next data segment at the last read location 99-Delete data time: yyyy-MM-dd HH:mm:ss
790
+ static getBloodOxygen(mode, time) {
791
+ const value = this.generateInitValue();
792
+ value[0] = DeviceConst.CMD_Get_Blood_oxygen;
793
+ value[1] = mode;
794
+ this.insertDateValue(value, time);
795
+ this.crcValue(value);
796
+ return value;
797
+ }
798
+ ///获得血氧数据(自动测试)
799
+ ///mode : 0-读最近的详细数据 2-继续上次读的位置下一段数据 99-删除数据 time: yyyy-MM-dd HH:mm:ss
800
+ ///Obtain blood oxygen data (automatic testing)
801
+ ///mode : 0-Read the latest detailed data 2-Continue with the next data segment at the last read location 99-Delete data time: yyyy-MM-dd HH:mm:ss
802
+ static getAutoBloodOxygen(mode, time) {
803
+ const value = this.generateInitValue();
804
+ value[0] = DeviceConst.CMD_Get_Auto_Blood_oxygen;
805
+ value[1] = mode;
806
+ this.insertDateValue(value, time);
807
+ this.crcValue(value);
808
+ return value;
809
+ }
810
+ /**
811
+ * 设置目标步数指令
812
+ * @param stepGoal 步数目标 (int, 4 bytes, Big-Endian)
813
+ * @param targetExecutionTime 目标完成时间(分钟)(int, 2 bytes)
814
+ * @param distance 距离目标(千米)(int, 2 bytes)
815
+ * @param calorie 卡路里目标 (int, 2 bytes)
816
+ * @param sleepTime 睡眠时间目标(分钟)(int, 2 bytes)
817
+ * @returns number[] 指令字节数组(16字节,含CRC)
818
+ */
819
+ static setStepGoal(stepGoal, targetExecutionTime, distance, calorie, sleepTime) {
820
+ // 1. 初始化 16 字节数组,填充 0
821
+ const value = this.generateInitValue();
822
+ value[0] = DeviceConst.CMD_Set_Goal;
823
+ ;
824
+ // 3. 写入 stepGoal (4 bytes, Big-Endian: 高位在后)
825
+ value[4] = (stepGoal >> 24) & 0xff;
826
+ value[3] = (stepGoal >> 16) & 0xff;
827
+ value[2] = (stepGoal >> 8) & 0xff;
828
+ value[1] = stepGoal & 0xff;
829
+ // 4. 写入 targetExecutionTime (2 bytes, Big-Endian)
830
+ value[6] = (targetExecutionTime >> 8) & 0xff;
831
+ value[5] = targetExecutionTime & 0xff;
832
+ // 5. 写入 distance (2 bytes, Big-Endian)
833
+ value[8] = (distance >> 8) & 0xff;
834
+ value[7] = distance & 0xff;
835
+ // 6. 写入 calorie (2 bytes, Big-Endian)
836
+ value[10] = (calorie >> 8) & 0xff;
837
+ value[9] = calorie & 0xff;
838
+ // 7. 写入 sleepTime (2 bytes, Big-Endian)
839
+ value[12] = (sleepTime >> 8) & 0xff;
840
+ value[11] = sleepTime & 0xff;
841
+ this.crcValue(value);
842
+ return value;
843
+ }
844
+ ///读取目标步数
845
+ ///Read target steps
846
+ static GetStepGoal() {
847
+ const value = this.generateInitValue();
848
+ value[0] = DeviceConst.CMD_Get_Goal;
849
+ this.crcValue(value);
850
+ return value;
851
+ }
852
+ /**
853
+ * 获取手环基本参数(设备信息)
854
+ * @returns Uint8Array 指令包(7字节),用于发送 BLE 请求
855
+ */
856
+ static getDeviceInfo() {
857
+ const value = this.generateInitValue();
858
+ value[0] = DeviceConst.CMD_Get_DeviceInfo; // 设置命令字
859
+ this.crcValue(value);
860
+ return value;
861
+ }
862
+ static sendHex(data, isCrc) {
863
+ const current = [...data];
864
+ if (isCrc) {
865
+ this.crcDynamicValue(current);
866
+ }
867
+ return current;
868
+ }
869
+ //获取闹钟
870
+ static getAlarmClock() {
871
+ const value = this.generateInitValue();
872
+ value[0] = DeviceConst.CMD_Get_Clock;
873
+ this.crcValue(value);
874
+ return value;
875
+ }
876
+ // 删除所有闹钟
877
+ static deleteAllAlarmClock() {
878
+ const value = this.generateInitValue();
879
+ value[0] = DeviceConst.CMD_Get_Clock;
880
+ value[1] = 0x99;
881
+ this.crcValue(value);
882
+ return value;
883
+ }
884
+ // 设置所有闹钟
885
+ static setAlarmClock(arrayClockAlarm) {
886
+ const result = [];
887
+ const LENGTH_UNIT = 39;
888
+ const MAX_SEND_BYTES = 128;
889
+ const totalCount = arrayClockAlarm.length * LENGTH_UNIT + 2;
890
+ if (totalCount > MAX_SEND_BYTES) {
891
+ // 超过一次发送的长度,需要分包
892
+ const canSendCount = Math.floor(MAX_SEND_BYTES / LENGTH_UNIT);
893
+ const needSendCount = Math.ceil(arrayClockAlarm.length / canSendCount);
894
+ for (let i = 0; i < needSendCount; i++) {
895
+ const isLast = i === needSendCount - 1;
896
+ const countInThisPacket = isLast ? arrayClockAlarm.length - canSendCount * i : canSendCount;
897
+ const buffer = new Array(countInThisPacket * LENGTH_UNIT + (isLast ? 2 : 0)).fill(0);
898
+ for (let m = 0; m < countInThisPacket; m++) {
899
+ const dicClock = arrayClockAlarm[canSendCount * i + m];
900
+ const { openOrClose, clockType, clockTime, week, textLength, text } = dicClock;
901
+ const offset = m * LENGTH_UNIT;
902
+ buffer[offset] = 0x23;
903
+ buffer[offset + 1] = arrayClockAlarm.length;
904
+ buffer[offset + 2] = canSendCount * i + m;
905
+ buffer[offset + 3] = openOrClose;
906
+ buffer[offset + 4] = clockType;
907
+ buffer[offset + 5] = this.getBcdValue(clockTime.substring(0, 2));
908
+ buffer[offset + 6] = this.getBcdValue(clockTime.substring(3, 5));
909
+ buffer[offset + 7] = week;
910
+ buffer[offset + 8] = textLength;
911
+ for (let j = 0; j < textLength; j++) {
912
+ buffer[offset + 9 + j] = text.charCodeAt(j) || 0;
913
+ }
914
+ }
915
+ if (isLast) {
916
+ buffer[buffer.length - 2] = 0x23;
917
+ buffer[buffer.length - 1] = 0xff;
918
+ }
919
+ result.push(buffer);
920
+ }
921
+ }
922
+ else {
923
+ const buffer = new Array(totalCount).fill(0);
924
+ arrayClockAlarm.forEach((dicClock, i) => {
925
+ const { openOrClose, clockType, clockTime, week, textLength, text } = dicClock;
926
+ const offset = i * LENGTH_UNIT;
927
+ buffer[offset] = 0x23;
928
+ buffer[offset + 1] = arrayClockAlarm.length;
929
+ buffer[offset + 2] = i;
930
+ buffer[offset + 3] = openOrClose;
931
+ buffer[offset + 4] = clockType;
932
+ buffer[offset + 5] = this.getBcdValue(clockTime.substring(0, 2));
933
+ buffer[offset + 6] = this.getBcdValue(clockTime.substring(3, 5));
934
+ buffer[offset + 7] = week;
935
+ buffer[offset + 8] = textLength;
936
+ for (let j = 0; j < textLength; j++) {
937
+ buffer[offset + 9 + j] = text.charCodeAt(j) || 0;
938
+ }
939
+ });
940
+ buffer[totalCount - 2] = 0x23;
941
+ buffer[totalCount - 1] = 0xff;
942
+ result.push(buffer);
943
+ }
944
+ return result;
945
+ }
946
+ // 获取久坐提醒
947
+ static getSedentaryReminder() {
948
+ const value = this.generateInitValue();
949
+ value[0] = DeviceConst.CMD_Get_ActivityAlarm;
950
+ this.crcValue(value);
951
+ return value;
952
+ }
953
+ // 设置久坐提醒
954
+ static setSedentaryReminder(reminder) {
955
+ const value = this.generateInitValue();
956
+ value[0] = DeviceConst.CMD_Set_ActivityAlarm;
957
+ value[1] = this.getBcdValue(reminder.startTime_Hour);
958
+ value[2] = this.getBcdValue(reminder.startTime_Minutes);
959
+ value[3] = this.getBcdValue(reminder.endTime_Hour);
960
+ value[4] = this.getBcdValue(reminder.endTime_Minutes);
961
+ const week = (reminder.weeks.sunday ? 1 : 0) +
962
+ (reminder.weeks.monday ? 2 : 0) +
963
+ (reminder.weeks.Tuesday ? 4 : 0) +
964
+ (reminder.weeks.Wednesday ? 8 : 0) +
965
+ (reminder.weeks.Thursday ? 16 : 0) +
966
+ (reminder.weeks.Friday ? 32 : 0) +
967
+ (reminder.weeks.Saturday ? 64 : 0);
968
+ value[5] = week;
969
+ value[6] = reminder.intervalTime;
970
+ value[7] = reminder.leastSteps;
971
+ value[8] = reminder.mode;
972
+ this.crcValue(value);
973
+ return value;
974
+ }
975
+ }
976
+ export default BleSDK;
977
+ //# sourceMappingURL=bleSDK.js.map