@moshenguo/ms-data-sdk 0.1.9 → 0.1.11

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.
@@ -69,10 +69,11 @@ export declare const DeviceConst: {
69
69
  CMD_SETTING_HRV_TIME: number;
70
70
  CMD_CLOSE_DEVICE: number;
71
71
  CMD_AUTO_CHECK_STATUS: number;
72
- CMD_GET_BLOODSUGAR: number;
73
72
  CMD_GET_BLOODSUGAR_DATA: number;
74
73
  CMD_Set_ActivityAlarm: number;
75
74
  CMD_Get_ActivityAlarm: number;
75
+ CMD_Get_SleepActivityData: number;
76
+ CMD_Get_PPG_Waveform: number;
76
77
  };
77
78
  /**
78
79
  * Bluetooth Feature Constants
@@ -266,6 +267,9 @@ export declare const BleConst: {
266
267
  GetSedentaryReminder_V4: string;
267
268
  /** Set sedentary reminder V4 */
268
269
  SetSedentaryReminder_V4: string;
270
+ GetRealTimeTemperatureCorrection: string;
271
+ /** PPG Realtime */
272
+ PPGRealtime: string;
269
273
  };
270
274
  /**
271
275
  * Device key constants, used for reading/writing device data.
@@ -342,6 +346,8 @@ export declare const DeviceKey: {
342
346
  PPI_LIST: string;
343
347
  /** PPI data count */
344
348
  PPI_NUM: string;
349
+ /** PPI data unit */
350
+ PPI_UNIT: string;
345
351
  /** HRV time mode */
346
352
  HRV_TIME_MODE: string;
347
353
  /** HRV time value */
@@ -362,6 +368,10 @@ export declare const DeviceKey: {
362
368
  TempUnit: string;
363
369
  /** Night mode switch */
364
370
  NightMode: string;
371
+ /** ANCS mode switch */
372
+ ANCSMode: string;
373
+ /** ANCS sub status */
374
+ ANCSSubStatus: string;
365
375
  /** Base heart rate */
366
376
  KBaseHeart: string;
367
377
  /** Screen brightness (0-100) */
@@ -406,6 +416,8 @@ export declare const DeviceKey: {
406
416
  ArraySteps: string;
407
417
  /** Sleep array */
408
418
  ArraySleep: string;
419
+ /** Activity array */
420
+ ActivityArray: string;
409
421
  /** Sleep unit length */
410
422
  sleepUnitLength: string;
411
423
  /** Static heart rate */
@@ -418,6 +430,8 @@ export declare const DeviceKey: {
418
430
  TemperatureCorrectionValue: string;
419
431
  /** HRV data */
420
432
  HRV: string;
433
+ /** The number of ECG points T1 and T2 (with the higher points following) */
434
+ ECGPointCount: string;
421
435
  /** ECG mood value */
422
436
  ECGMoodValue: string;
423
437
  /** ECG value */
@@ -428,7 +442,7 @@ export declare const DeviceKey: {
428
442
  KAlarmId: string;
429
443
  /** Alarm switch */
430
444
  OpenOrClose: string;
431
- /** Alarm type */
445
+ /** Alarm clock type, 0 indicates Disable; 1 is an Enable alarm clock, 2 is a reminder for taking medicine, and 3 is a reminder for drinking water. */
432
446
  ClockType: string;
433
447
  /** Alarm time */
434
448
  ClockTime: string;
@@ -438,6 +452,10 @@ export declare const DeviceKey: {
438
452
  KAlarmContent: string;
439
453
  /** Alarm length */
440
454
  KAlarmLength: string;
455
+ /** Total number of alarms */
456
+ KAlarmTotal: string;
457
+ /** Alarm index */
458
+ KAlarmIndex: string;
441
459
  /** Axillary temperature */
442
460
  axillaryTemperature: string;
443
461
  /** Band number */
@@ -492,4 +510,19 @@ export declare const DeviceKey: {
492
510
  TextLength: string;
493
511
  /** Whether to delete data */
494
512
  IsDeleteData: string;
513
+ /** Whether to delete data */
514
+ SportEnable: string;
515
+ /** Whether to delete data */
516
+ HeartEnable: string;
517
+ /** Whether to delete data */
518
+ HeartDayEnable: string;
519
+ /** Final temperature value */
520
+ highestTemp: string;
521
+ /** Display temperature */
522
+ displayTemp: string;
523
+ /** ntc temperature*/
524
+ ntcTemps: string;
525
+ /** ECG Id */
526
+ ECGId: string;
495
527
  };
528
+ export type DeviceType = '2208' | '2208A' | 'V4' | 'V5' | '2025';
@@ -1,4 +1,5 @@
1
1
  import { MyPersonalInfo, MyDeviceInfo, MyAutomaticHRMonitoring, MySedentaryReminderV4 } from './models';
2
+ import { DeviceType } from './bleConst';
2
3
  /**
3
4
  * Convert data into firmware commands. Call the corresponding method to get the appropriate command, and send this command to the firmware.
4
5
  * The `dataParsingWithData` method parses the firmware response into an object form.
@@ -34,7 +35,7 @@ export declare class BleSDK {
34
35
  * @param rawData The raw data returned from Bluetooth
35
36
  * @returns The parsed data
36
37
  */
37
- static dataParsingWithData(value: number[]): {
38
+ static dataParsingWithData(value: number[], deviceType?: DeviceType): {
38
39
  [key: string]: any;
39
40
  };
40
41
  /**
@@ -276,12 +277,48 @@ export declare class BleSDK {
276
277
  */
277
278
  static getDeviceTime(): number[];
278
279
  /**
279
- *
280
+ * 2025E Device Information Settings
280
281
  * Set device information
281
282
  * @param {MyDeviceInfo} deviceBaseParameter
282
283
  * @return {*} {number[]} Command packet to send to the firmware
283
284
  */
284
285
  static setDeviceInfo(deviceBaseParameter: MyDeviceInfo): number[];
286
+ /**
287
+ * Set device information
288
+ * @param isHeart Flash light when heart rate is too high in exercise mode
289
+ * @param isMotionDetection Flash light during exercise mode
290
+ * @param isDay Enable all-day heart rate monitoring
291
+ * @returns
292
+ */
293
+ static setDeviceInfoV5(isHeart: boolean, isMotionDetection: boolean, isDay: boolean): number[];
294
+ /**
295
+ * Generate the "Set Device ID" command
296
+ * @param idBytes number[] 6-byte ID, high byte first
297
+ * @returns number[] command array ready to send
298
+ */
299
+ static setDeviceID(idBytes: number[]): number[];
300
+ /**
301
+ * Generate reminder command
302
+ * @param type reminder type (0~11, 0xFF = stop call)
303
+ * @param message reminder content (max 60 bytes)
304
+ * @param contact contact content (max 15 bytes)
305
+ */
306
+ static reminderCommand(type: number, message: string, contact: string): number[];
307
+ /**
308
+ * Generate weather update command (Hermes safe)
309
+ */
310
+ static updateWeather(params: {
311
+ weatherCode: number;
312
+ currentTemp: number;
313
+ maxTemp: number;
314
+ minTemp: number;
315
+ aqi: number;
316
+ address: string;
317
+ }): number[];
318
+ /**
319
+ * Seniverse weather code → device AA
320
+ */
321
+ static mapWeatherCode(code: number | string): number;
285
322
  /**
286
323
  * Health measurement control
287
324
  *
@@ -408,6 +445,19 @@ export declare class BleSDK {
408
445
  */
409
446
  static setAlarmClock(arrayClockAlarm: any[]): number[][];
410
447
  /**
448
+ * Convert text to UTF-8 bytes safely, max 30 bytes, Chinese safe
449
+ * @param text Input text
450
+ * @param maxBytes Maximum bytes, default 30
451
+ * @returns number[] Byte array, automatically filled with 0
452
+ */
453
+ static textToUtf8BytesSafe(text: string, maxBytes?: number): number[];
454
+ /**
455
+ * Encode a single character to UTF-8 bytes
456
+ * @param char Single character
457
+ * @returns number[]
458
+ */
459
+ private static utf8EncodeChar;
460
+ /**
411
461
  *
412
462
  * Get sedentary reminder settings
413
463
  * @return {*} {number[]} Command packet to send to the firmware
@@ -421,5 +471,63 @@ export declare class BleSDK {
421
471
  * @return {*} {number[]} Command packet to send to the firmware
422
472
  */
423
473
  static setSedentaryReminder(reminder: MySedentaryReminderV4): number[];
474
+ /**
475
+ *
476
+ * Get detailed sleep data + activity level
477
+ * @param {number} mode 0: Read the most recent sleep detail data
478
+ * 1: Read sleep detail data at the specified position.
479
+ 2: Continue reading the next segment of data from the last read position.
480
+ * 0x99: Delete sleep detail data.
481
+ * @return {*} {number[]} Command packet to send to the device
482
+ */
483
+ static getRealTimeSleepDataWithMode(mode: number): number[];
484
+ /**
485
+ * Entering Take Photo mode
486
+ * @returns
487
+ */
488
+ static enterTakePhoto(): number[];
489
+ /**
490
+ * SOS function
491
+ * @returns
492
+ */
493
+ static enterSOS(): number[];
494
+ /**
495
+ *One-click clear the historical data of the wristband without putting it into sleep mode.
496
+ * @returns
497
+ */
498
+ static clearBraceletData(): number[];
499
+ /**
500
+ * start PPG realtime waveform transmission
501
+ */
502
+ static startPPGRealtime(isOpen: boolean): number[];
503
+ /**
504
+ * Confirm unbind action
505
+ * @param confirm true = Yes (0x81), false = No (0x80)
506
+ */
507
+ static confirmUnbind(confirm: boolean): number[];
508
+ /**
509
+ * Set Social Distance parameters
510
+ * @param interval Interval value (前提是开关打开设置的参数才生效)扫描时间间隔,单位是分钟。默认是2分钟
511
+ * @param duration Duration value 每次扫描时长:单位是秒。现在默认是30S
512
+ * @param rssi RSSI threshold 报警信号值:类型是int8,现在默认是-90 单字节带符号。
513
+ */
514
+ static setSocialSetting(interval: number, duration: number, rssi: number): number[];
515
+ /**
516
+ * Get Social Distance parameters
517
+ */
518
+ static getSocialSetting(): number[];
519
+ /**
520
+ *
521
+ * Get HRV test data
522
+ * @param {number} index Read the data from the first read test. The range is from 0 to 9, and a total of 10 sets of waveforms are saved.
523
+ * @param {string} time yyyy-MM-dd HH:mm:ss
524
+ * @return {*} {number[]} command packet, to be sent to the firmware
525
+ */
526
+ static getEcgHistory(index: number, time: string): number[];
527
+ /**
528
+ * Delete all HRV test data
529
+ * @returns {*} {number[]} command packet, to be sent to the firmware
530
+ */
531
+ static deleteAllEcgHistory(): number[];
424
532
  }
425
533
  export default BleSDK;
@@ -17,6 +17,21 @@ export interface MyWeeksV4 {
17
17
  /** Whether Saturday is enabled */
18
18
  saturday: boolean;
19
19
  }
20
+ export declare const ANCS_MASK: {
21
+ CALL: number;
22
+ SMS: number;
23
+ WECHAT: number;
24
+ FACEBOOK: number;
25
+ INSTAGRAM: number;
26
+ SKYPE: number;
27
+ TELEGRAM: number;
28
+ TWITTER: number;
29
+ VK: number;
30
+ WHATSAPP: number;
31
+ QQ: number;
32
+ LINKEDIN: number;
33
+ ENABLE_FLAG: number;
34
+ };
20
35
  /**
21
36
  * Personal information
22
37
  */
@@ -36,7 +51,7 @@ export interface MyPersonalInfo {
36
51
  * Device details
37
52
  */
38
53
  export interface MyDeviceInfo {
39
- /** Distance unit, true = kilometers, false = miles */
54
+ /** Distance unit, true = miles, false = kilometers */
40
55
  distanceUnit: boolean;
41
56
  /** Whether using 12-hour format, true = 12-hour, false = 24-hour */
42
57
  is12Hour: boolean;
@@ -46,14 +61,20 @@ export interface MyDeviceInfo {
46
61
  fahrenheit: boolean;
47
62
  /** Night mode, true = on, false = off */
48
63
  nightMode: boolean;
64
+ /** ancs */
65
+ ancs: boolean;
66
+ /** ANCS 子开关掩码(0~0x7FFF) */
67
+ ancsMask: number;
49
68
  /** Base heart rate */
50
69
  baseHeart: number;
51
- /** Screen brightness (0-100) */
70
+ /** Screen brightness (0-100) 屏幕亮度调节,调节范围80-8f(0为最亮,f为最暗)*/
52
71
  screenBrightness: number;
53
- /** Dial index */
72
+ /** Dial index 表盘界面更换80-8A */
54
73
  indexDial: number;
55
74
  /** Language setting, e.g., 0 = Chinese, 1 = English */
56
75
  languages: number;
76
+ /** 13 MM 社交距离 */
77
+ socialDistance: boolean;
57
78
  }
58
79
  /**
59
80
  * Automatic heart rate monitoring configuration
@@ -1,8 +1,10 @@
1
+ import { DeviceType } from './bleConst';
1
2
  /**
2
3
  * Byte operation utility class Data parsing class.
3
4
  * Takes Bluetooth data as input and returns it as a dictionary object.
4
5
  */
5
6
  export declare class ResolveUtil {
7
+ static startDeviceMeasurementWithType: boolean;
6
8
  private static hexByte2Int;
7
9
  private static bcd2String;
8
10
  static intList2String(bytes: number[]): string;
@@ -40,7 +42,7 @@ export declare class ResolveUtil {
40
42
  * @param value - Raw data from the device
41
43
  * @returns Parsed device information
42
44
  */
43
- static getDeviceInfo(value: number[]): any;
45
+ static getDeviceInfo(value: number[], deviceType?: DeviceType): any;
44
46
  /**
45
47
  * Parse real-time step information
46
48
  * @param value - Raw data from the device
@@ -151,6 +153,12 @@ export declare class ResolveUtil {
151
153
  * @returns
152
154
  */
153
155
  static getSleepData(value: number[]): any;
156
+ /**
157
+ * Get detailed sleep data + activity levels, sleep data and activity levels.
158
+ * @param value
159
+ * @returns
160
+ */
161
+ static getSleepActivityLevelsData(value: number[]): any;
154
162
  /**
155
163
  * Automated Blood Oxygen Data Analysis
156
164
  * @param value
@@ -240,11 +248,17 @@ export declare class ResolveUtil {
240
248
  * @returns
241
249
  */
242
250
  static setMethodSuccessful(dataType: string): any;
251
+ static getRealTimeTemperatureValue(value: number[]): any;
252
+ private static _leToInt;
243
253
  /**
244
254
  * ECG Data Analysis
245
255
  * @param value
246
256
  * @returns
247
257
  */
258
+ /**
259
+ * ECG History Data Analysis
260
+ * @param value raw BLE data
261
+ */
248
262
  static getEcgHistoryData(value: number[]): any;
249
263
  private static getEcgDataString;
250
264
  /**
@@ -278,6 +292,8 @@ export declare class ResolveUtil {
278
292
  * @returns
279
293
  */
280
294
  static measurementWithType(flag: boolean, value: number[]): any;
295
+ static measurementWithTypeV5(flag: boolean, value: number[]): Record<string, any>;
296
+ static measurementWithTypeV4(flag: boolean, value: number[]): Record<string, any>;
281
297
  /**
282
298
  * Smartband watch face settings
283
299
  * @param isRunning
@@ -340,7 +356,7 @@ export declare class ResolveUtil {
340
356
  */
341
357
  static setBoolSugarStatus(value: number[]): any;
342
358
  /**
343
- * Set blood glucose level Set blood glucose levels
359
+ * Obtain blood glucose data
344
360
  * @param value
345
361
  * @returns
346
362
  */
@@ -382,6 +398,7 @@ export declare class ResolveUtil {
382
398
  * @returns
383
399
  */
384
400
  static getPPITestData(value: number[]): any;
401
+ static getPPIV5Data(value: number[]): any;
385
402
  /**
386
403
  * Acquire HRV measurement time data
387
404
  * @param value
@@ -400,4 +417,10 @@ export declare class ResolveUtil {
400
417
  * @returns
401
418
  */
402
419
  static getOffCheckStatus(value: number[]): any;
420
+ static getStepCount(value: number[]): number;
421
+ /**
422
+ * Obtain the real-time waveform of PPG. (2025E-03)
423
+ * @param value raw BLE data
424
+ */
425
+ static getPPGWaveformData(value: number[]): any;
403
426
  }
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- var t=1,e=65,a=2,n=66,r=3,i=4,c=5,o=9,s=11,u=75,h=19,l=34,g=39,d=18,S=46,D=54,y=61,f=62,v=42,p=43,m=35,I=77,B=81,T=82,_=83,V=84,E=96,M=102,x=85,b=87,C=92,A=86,G=100,H=25,k=24,P=71,R=56,w=6,L=7,W=32,O=22,F=16,K=131,N=170,U=171,Q=21,j=36,Y=20,q=68,z=40,J=23,X=52,Z=90,$=97,tt=254,et=98,at=101,nt=176,rt=156,it=113,ct=120,ot=28,st=30,ut=99,ht=136,lt=137,gt=138,dt=120,St=58,Dt=37,yt=38,ft={GetDeviceTime:"get_device_time",GetPersonalInfo:"get_personal_info",GetDeviceInfo:"get_device_info",RealTimeStep:"real_time_step",GetStepGoal:"get_step_goal",GetDeviceBatteryLevel:"get_device_battery_level",GetDeviceMacAddress:"get_device_mac_address",GetDeviceVersion:"get_device_version",CMD_Reset:"cmd_reset",CMD_MCUReset:"cmd_mcu_reset",Notify:"notify",GetDeviceName:"get_device_name",SetAlarmClockWithAllClock:"set_alarm_clock_with_all_clock",Gps:"GPS",GetPPIData:"GetPPIData",GetHrvTimeValue:"GetHrvTimeValue",CloseDevices:"CloseDevices",GetOffCheckStatus:"GetOffCheckStatus",GetAutomaticHRMonitoring:"GetAutomaticHRMonitoring",GetSedentaryReminder:"GetSedentaryReminder",GetTotalActivityData:"GetTotalActivityData",GetDetailActivityData:"GetDetailActivityData",GetDetailSleepData:"GetDetailSleepData",AutoBloodOxygen:"AutoBloodOxygen",GetDynamicHR:"GetDynamicHR",ECGdata:"ECGdata",GetWomenHealth:"GetWomenHealth",CMD_Set_TemperatureCorrection:"CMD_Set_TemperatureCorrection",GetStaticHR:"GetStaticHR",Blood_oxygen:"Blood_oxygen",GetHRVData:"GetHRVData",GetAxillaryTemperatureDataWithMode:"GetAxillaryTemperatureDataWithMode",EnterQrCode:"EnterQrCode",QrCodeBandBack:"QrCodeBandBack",ExitQrCode:"ExitQrCode",Temperature_history:"Temperature_history",GetActivityModeData:"GetActivityModeData",EnterActivityMode:"EnterActivityMode",SetDeviceTime:"SetDeviceTime",GetAlarmClock:"GetAlarmClock",EcgppGstatus:"EcgppGstatus",GetEcgPpgStatus:"GetEcgPpgStatus",ENTERECG:"ENTERECG",MeasurementHrvCallback:"MeasurementHrvCallback",MeasurementHeartCallback:"MeasurementHeartCallback",MeasurementOxygenCallback:"MeasurementOxygenCallback",MeasurementTempCallback:"MeasurementTempCallback",StopMeasurementHrvCallback:"StopMeasurementHrvCallback",StopMeasurementHeartCallback:"StopMeasurementHeartCallback",StopMeasurementOxygenCallback:"StopMeasurementOxygenCallback",StopMeasurementTempCallback:"StopMeasurementTempCallback",Braceletdial:"Braceletdial",Braceletdialok:"Braceletdialok",GetSportMode:"GetSportMode",GPSControlCommand:"GPSControlCommand",SocialdistanceGetting:"SocialdistanceGetting",EcgppG:"EcgppG",DeviceSendDataToAPP:"DeviceSendDataToAPP",SetNewDeviceInfo:"SetNewDeviceInfo",GetNewDeviceInfo:"GetNewDeviceInfo",BoolsugarStatus:"BoolsugarStatus",BoolsugarValue:"BoolsugarValue",GetPregnancyCycle:"GetPregnancyCycle",SetStepGoal:"SetStepGoal",SetPersonalInfo:"SetPersonalInfo",SetMotorVibrationWithTimes:"SetMotorVibrationWithTimes",SetDeviceInfo:"SetDeviceInfo",SetAutomaticHRMonitoring:"SetAutomaticHRMonitoring",SetSedentaryReminder:"SetSedentaryReminder",EnterPhotoMode:"EnterPhotoMode",BackHomeView:"BackHomeView",Weather:"Weather",SportMode:"SportMode",Clear_Bracelet_data:"Clear_Bracelet_data",SocialdistanceSetting:"SocialdistanceSetting",Sos:"Sos",SetPregnancyCycle:"SetPregnancyCycle",DeleteECGdata:"DeleteECGdata",ECG:"ECG",SetWomenHealth:"SetWomenHealth",ppgStartSucessed:"ppgStartSucessed",ppgResult:"ppgResult",ppgStop:"ppgStop",ppgMeasurementProgress:"ppgMeasurementProgress",ppgQuit:"ppgQuit",ppgStartFailed:"ppgStartFailed",CMD_Set_Mac:"CMD_Set_Mac",CloseECG:"CloseECG",GetAlarmClock_V4:"GetAlarmClock_V4",DeleteAllAlarmClock_V4:"DeleteAllAlarmClock_V4",SetAlarmClock_V4:"SetAlarmClock_V4",GetSedentaryReminder_V4:"GetSedentaryReminder_V4",SetSedentaryReminder_V4:"SetSedentaryReminder_V4"},vt={DeviceTime:"device_time",GPSTime:"gps_time",DataType:"data_type",End:"end",Data:"data",Gender:"gender",Age:"age",Height:"height",Weight:"weight",Stride:"stride",KUserDeviceId:"k_user_device_id",KClockLast:"k_clock_last",Step:"step",Calories:"calories",Distance:"distance",ExerciseMinutes:"exercise_minutes",HeartRate:"heart_rate",ActiveMinutes:"active_minutes",TempData:"temp_data",Blood_oxygen:"blood_oxygen",StepGoal:"step_goal",DistanceGoal:"distance_goal",CalorieGoal:"calorie_goal",SleepTimeGoal:"sleep_time_goal",BatteryLevel:"battery_level",MacAddress:"mac_address",DeviceVersion:"device_version",DeviceName:"device_name",Date:"date",Latitude:"latitude",Longitude:"longitude",TOTAL_ID:"totalId",PPI_ID:"ppiId",PPI_LIST:"ppiList",PPI_NUM:"ppiNum",HRV_TIME_MODE:"hrvTimeMode",HRV_TIME_Value:"hrvTimeValue",RESULT:"result",GET_OFF_TAG:"getOffTag",GET_OFF_STATE:"getOffState",DistanceUnit:"distance_unit",TimeUnit:"time_unit",StatusOfTheRaisedHandOnscreen:"status_of_the_raised_hand_onscreen",TempUnit:"temp_unit",NightMode:"night_mode",KBaseHeart:"k_base_heart",ScreenBrightness:"screen_brightness",Dialinterface:"dial_interface",SocialDistancedwitch:"social_distance_switch",ChineseOrEnglish:"chinese_or_english",WorkMode:"work_mode",StartTime:"start_time",KHeartStartMinter:"kheart_start_minter",EndTime:"end_time",KHeartEndMinter:"kheart_end_minter",Weeks:"weeks",IntervalTime:"interval_time",StartTimeHour:"StartTimeHour",StartTimeMin:"StartTimeMin",EndTimeHour:"EndTimeHour",EndTimeMin:"EndTimeMin",LeastSteps:"LeastSteps",Week:"week",Goal:"Goal",KDetailMinterStep:"KDetailMinterStep",ArraySteps:"ArraySteps",ArraySleep:"ArraySleep",sleepUnitLength:"sleepUnitLength",StaticHR:"StaticHR",WomenHealthPeriod:"WomenHealthPeriod",WomenHealthLength:"WomenHealthLength",TemperatureCorrectionValue:"TemperatureCorrectionValue",HRV:"HRV",ECGMoodValue:"ECGMoodValue",ECGValue:"ECGValue",ArrayDynamicHR:"ArrayDynamicHR",KAlarmId:"KAlarmId",OpenOrClose:"OpenOrClose",ClockType:"ClockType",ClockTime:"ClockTime",KAlarmMinter:"KAlarmMinter",KAlarmContent:"KAlarmContent",KAlarmLength:"KAlarmLength",axillaryTemperature:"axillaryTemperature",Band:"Band",temperature:"temperature",ActivityMode:"ActivityMode",Pace:"Pace",KPhoneDataLength:"KPhoneDataLength",VascularAging:"VascularAging",Stress:"Stress",highBP:"highBP",lowBP:"lowBP",EcgStatus:"ecgStatus",PPGValue:"ppgValue",ECGHrvValue:"ecgHrvValue",ECGAvBlockValue:"ecgAvBlockValue",ECGHrValue:"ecgHrValue",ECGStreesValue:"ecgStressValue",ECGhighBpValue:"ecgHighBpValue",ECGLowBpValue:"ecgLowBpValue",ECGBreathValue:"ecgBreathValue",KActivityLocationTime:"activityLocationTime",KActivityLocationLatitude:"activityLocationLatitude",KActivityLocationLongitude:"activityLocationLongitude",KActivityLocationCount:"activityLocationCount",DayOfWeek:"dayOfWeek",Text:"text",TextLength:"textLength",IsDeleteData:"isDeleteData"},pt=function(){function t(){}return t.hexByte2Int=function(t,e){return(255&t)*Math.pow(256,e)},t.bcd2String=function(t){var e=15&t;return"".concat((240&t)>>4).concat(e)},t.intList2String=function(t){return t.map(function(t){return t.toString(16).padStart(2,"0").toUpperCase()}).join(" ")},t.intList3String=function(t){return t.map(function(t){return t.toString(16).padStart(2,"0").toLowerCase()}).join(" ")},t.setMacSuccessful=function(){var t;return(t={})[vt.DataType]=ft.CMD_Set_Mac,t[vt.End]=!0,t[vt.Data]={},t},t.intBitToDouble=function(t){var e=new ArrayBuffer(8),a=new DataView(e);return a.setInt32(0,t,!1),a.getFloat32(0,!1)},t.getDeviceTime=function(t){var e,a,n="20".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2]),"-").concat(this.bcd2String(t[3])," ").concat(this.bcd2String(t[4]),":").concat(this.bcd2String(t[5]),":").concat(this.bcd2String(t[6])),r="".concat(this.bcd2String(t[9]),".").concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]));return(e={})[vt.DataType]=ft.GetDeviceTime,e[vt.End]=!0,e[vt.Data]=((a={})[vt.DeviceTime]=n,a[vt.GPSTime]=r,a),e},t.int2Ascll=function(t){if(t<0||t>255)throw new Error("Value must be between 0 and 255");return String.fromCharCode(t)},t.getGpsTime=function(t){return"".concat(this.bcd2String(t[9]),".").concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]))},t.getUserInfo=function(t){for(var e,a,n=new Array(6).fill(0),r=0;r<5;r++)n[r]=this.hexByte2Int(t[r+1],0);var i="";for(r=6;r<12;r++)0!==t[r]&&(i+=String.fromCharCode(this.hexByte2Int(t[r],0)));return(e={})[vt.DataType]=ft.GetPersonalInfo,e[vt.End]=!0,e[vt.Data]=((a={})[vt.Gender]=n[0],a[vt.Age]=n[1],a[vt.Height]=n[2],a[vt.Weight]=n[3],a[vt.Stride]=n[4],a[vt.KUserDeviceId]=i,a),e},t.getDeviceInfo=function(t){var e,a;return(e={})[vt.DataType]=ft.GetDeviceInfo,e[vt.End]=!0,e[vt.Data]=((a={})[vt.DistanceUnit]=this.hexByte2Int(t[1],0).toString(),a[vt.TimeUnit]=this.hexByte2Int(t[2],0).toString(),a[vt.StatusOfTheRaisedHandOnscreen]=this.hexByte2Int(t[3],0).toString(),a[vt.TempUnit]=this.hexByte2Int(t[4],0).toString(),a[vt.NightMode]=this.hexByte2Int(t[5],0).toString(),a[vt.KBaseHeart]=this.hexByte2Int(t[9],0).toString(),a[vt.ScreenBrightness]=this.hexByte2Int(t[11],0).toString(),a[vt.Dialinterface]=this.hexByte2Int(t[12],0).toString(),a[vt.SocialDistancedwitch]=this.hexByte2Int(t[13],0).toString(),a[vt.ChineseOrEnglish]=this.hexByte2Int(t[14],0).toString(),a),e},t.getActivityData=function(t){for(var e,a,n=0,r=0,i=0,c=0,o=0,s=1;s<5;s++)n+=this.hexByte2Int(t[s],s-1);for(s=5;s<9;s++)r+=this.hexByte2Int(t[s],s-5);for(s=9;s<13;s++)i+=this.hexByte2Int(t[s],s-9);for(s=13;s<17;s++)c+=this.hexByte2Int(t[s],s-13);for(s=17;s<21;s++)o+=this.hexByte2Int(t[s],s-17);var u=this.hexByte2Int(t[21],0),h=0,l=0;return t.length>22&&(h=this.hexByte2Int(t[22],0)+this.hexByte2Int(t[23],1),t.length>24&&(l=this.hexByte2Int(t[24],0))),(e={})[vt.DataType]=ft.RealTimeStep,e[vt.End]=!0,e[vt.Data]=((a={})[vt.Step]=n.toString(),a[vt.Calories]=(r/100).toFixed(1),a[vt.Distance]=(i/100).toFixed(1),a[vt.ExerciseMinutes]=(c/60).toString(),a[vt.HeartRate]=u.toString(),a[vt.ActiveMinutes]=o.toString(),a[vt.TempData]=h.toFixed(1),a[vt.Blood_oxygen]=l.toString(),a),e},t.getGoal=function(t){for(var e,a,n=0,r=0,i=0,c=0,o=0;o<4;o++)n+=this.hexByte2Int(t[o+1],o);for(o=0;o<=1;o++)r+=this.hexByte2Int(t[o+7],o);for(o=0;o<=1;o++)i+=this.hexByte2Int(t[o+9],o);for(o=0;o<=1;o++)c+=this.hexByte2Int(t[o+11],o);return(e={})[vt.DataType]=ft.GetStepGoal,e[vt.End]=!0,e[vt.Data]=((a={})[vt.StepGoal]=n.toString(),a[vt.DistanceGoal]=r.toString(),a[vt.CalorieGoal]=i.toString(),a[vt.SleepTimeGoal]=c.toString(),a),e},t.getDeviceBattery=function(t){var e,a,n=this.hexByte2Int(t[1],0);return(e={})[vt.DataType]=ft.GetDeviceBatteryLevel,e[vt.End]=!0,e[vt.Data]=((a={})[vt.BatteryLevel]=n.toString(),a),e},t.getDeviceAddress=function(t){var e,a;if(0===t.length)return{};for(var n=[],r=1;r<7;r++){var i=t[r].toString(16).padStart(2,"0");n.push(i)}var c=n.join(":");return(e={})[vt.DataType]=ft.GetDeviceMacAddress,e[vt.End]=!0,e[vt.Data]=((a={})[vt.MacAddress]=c,a),e},t.getDeviceVersion=function(t){var e,a;if(0===t.length)return{};for(var n=[],r=1;r<5;r++)n.push(t[r].toString(16));var i=n.join(".");return(e={})[vt.DataType]=ft.GetDeviceVersion,e[vt.End]=!0,e[vt.Data]=((a={})[vt.DeviceVersion]=i,a),e},t.reset=function(){var t;return(t={})[vt.DataType]=ft.CMD_Reset,t[vt.End]=!0,t},t.mcuReset=function(){var t;return(t={})[vt.DataType]=ft.CMD_MCUReset,t[vt.End]=!0,t},t.notify=function(){var t;return(t={})[vt.DataType]=ft.Notify,t[vt.End]=!0,t},t.getDeviceName=function(t){for(var e,a,n="",r=1;r<15;r++){var i=this.hexByte2Int(t[r],0);0===i||i>127||(n+=String.fromCharCode(i))}return(e={})[vt.DataType]=ft.GetDeviceName,e[vt.End]=!0,e[vt.Data]=((a={})[vt.DeviceName]=n,a),e},t.getAutoHeart=function(t){var e,a,n=this.hexByte2Int(t[7],0)+this.hexByte2Int(t[8],1);return(e={})[vt.DataType]=ft.GetAutomaticHRMonitoring,e[vt.End]=!0,e[vt.Data]=((a={})[vt.WorkMode]=this.hexByte2Int(t[1],0).toString(),a[vt.StartTime]=this.bcd2String(t[2]),a[vt.KHeartStartMinter]=this.bcd2String(t[3]),a[vt.EndTime]=this.bcd2String(t[4]),a[vt.KHeartEndMinter]=this.bcd2String(t[5]),a[vt.Weeks]=this.getByteString(t[6]),a[vt.IntervalTime]=n.toString(),a),e},t.getWeekInt=function(t){for(var e=0,a=0;a<t.length;a++)1===t[a]&&(e+=Math.pow(2,a));return e},t.getByteString=function(t){for(var e=new Array(8).fill(0),a=[],n=0;n<=6;n++)e[n]=1&t,t>>=1,a.push(e[n].toString());return a.join("-")},t.getByteArray=function(t){for(var e=new Array(8).fill(0),a="",n=0;n<=7;n++)e[n]=1&t,t>>=1,a+=e[n];return a},t._hexByte2Int=function(t,e){return t<<8*e},t._bcd2String=function(t){var e=15&t;return"".concat(t>>4&15).concat(e)},t.getActivityAlarm=function(t){var e,a,n=((e={})[vt.StartTimeHour]=this._bcd2String(t[1]),e[vt.StartTimeMin]=this._bcd2String(t[2]),e[vt.EndTimeHour]=this._bcd2String(t[3]),e[vt.EndTimeMin]=this._bcd2String(t[4]),e[vt.Week]=this.getByteString(t[5]),e[vt.IntervalTime]=this._hexByte2Int(t[6],0).toString(),e[vt.LeastSteps]=this._hexByte2Int(t[7],0).toString(),e[vt.OpenOrClose]=this._hexByte2Int(t[8],0).toString(),e);return(a={})[vt.DataType]=ft.GetSedentaryReminder,a[vt.End]=!0,a[vt.Data]=n,a},t.getTotalStepData=function(t){var e,a;console.log("total:",t);var n=((e={})[vt.DataType]=ft.GetTotalActivityData,e[vt.End]=!1,e[vt.Data]=[],e),r=27,i=t.length,c=Math.floor(i/r);if(0===c)return n[vt.End]=!0,n;for(var o=0;o<c;o++){var s=1+(o+1)*r;s<i&&255===t[s]&&(n[vt.End]=!0);for(var u="20".concat(this._bcd2String(t[2+o*r]),".").concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r])),h=0,l=0;l<4;l++)h+=this._hexByte2Int(t[5+l+o*r],l);var g=0;for(l=0;l<4;l++)g+=this._hexByte2Int(t[9+l+o*r],l);var d=0;for(l=0;l<4;l++)d+=this._hexByte2Int(t[13+l+o*r],l);var S=0;for(l=0;l<4;l++)S+=this._hexByte2Int(t[17+l+o*r],l);var D=this._hexByte2Int(t[21+o*r],0)+this._hexByte2Int(t[22+o*r],1),y=0;for(l=0;l<4;l++)y+=this._hexByte2Int(t[23+l+o*r],l);n[vt.Data].push(((a={})[vt.Date]=u,a[vt.Step]=h.toString(),a[vt.ExerciseMinutes]=g.toString(),a[vt.Calories]=(S/100).toFixed(1),a[vt.Distance]=(d/100).toFixed(1),a[vt.Goal]=D.toString(),a[vt.ActiveMinutes]=y,a))}return n},t.getDetailData=function(t){var e,a,n=((e={})[vt.DataType]=ft.GetDetailActivityData,e[vt.End]=!1,e[vt.Data]=[],e),r=t.length,i=Math.floor(r/25);if(0===i)return n[vt.End]=!0,n;for(var c=0;c<i;c++){255===t[r-1]&&(n[vt.End]=!0);for(var o="20".concat(this._bcd2String(t[3+25*c]),".").concat(this._bcd2String(t[4+25*c]),".").concat(this._bcd2String(t[5+25*c])," ").concat(this._bcd2String(t[6+25*c]),":").concat(this._bcd2String(t[7+25*c]),":").concat(this._bcd2String(t[8+25*c])),s=0,u=0;u<2;u++)s+=this._hexByte2Int(t[9+u+25*c],u);var h=0;for(u=0;u<2;u++)h+=this._hexByte2Int(t[11+u+25*c],u);var l=0;for(u=0;u<2;u++)l+=this._hexByte2Int(t[13+u+25*c],u);var g=[];for(u=0;u<10;u++)g.push(this._hexByte2Int(t[15+u+25*c],0).toString());n[vt.Data].push(((a={})[vt.Date]=o,a[vt.KDetailMinterStep]=s.toString(),a[vt.Calories]=(h/100).toFixed(2),a[vt.Distance]=(l/100).toFixed(2),a[vt.ArraySteps]=g.join(" "),a))}return n},t.getSleepData=function(t){var e,a,n,r=t.length,i=((e={})[vt.DataType]=ft.GetDetailSleepData,e[vt.End]=!1,e[vt.Data]=[],e),c=255===t[t.length-1]&&t[t.length-2]===_;if(c&&(i[vt.End]=!0),130===r||c&&132===r){for(var o="20".concat(this._bcd2String(t[3]),"-").concat(this._bcd2String(t[4]),"-").concat(this._bcd2String(t[5])," ").concat(this._bcd2String(t[6]),":").concat(this._bcd2String(t[7]),":").concat(this._bcd2String(t[8])),s=this._hexByte2Int(t[9],0),u=[],h=0;h<s;h++)u.push(this._hexByte2Int(t[10+h],0).toString());i[vt.Data].push(((a={})[vt.Date]=o,a[vt.ArraySleep]=u.join(" "),a[vt.sleepUnitLength]="1",a))}else{var l=Math.floor(r/34);if(0===l)return i[vt.End]=!0,i;for(var g=0;g<l;g++){for(o="20".concat(this._bcd2String(t[3+34*g]),"-").concat(this._bcd2String(t[4+34*g]),"-").concat(this._bcd2String(t[5+34*g])," ").concat(this._bcd2String(t[6+34*g]),":").concat(this._bcd2String(t[7+34*g]),":").concat(this._bcd2String(t[8+34*g])),s=this._hexByte2Int(t[9+34*g],0),u=[],h=0;h<s;h++)u.push(this._hexByte2Int(t[10+h+34*g],0).toString());i[vt.Data].push(((n={})[vt.Date]=o,n[vt.ArraySleep]=u.join(" "),n[vt.sleepUnitLength]="5",n))}}return i},t.getAutoBloodOxygen=function(t){var e,a,n=((e={})[vt.DataType]=ft.AutoBloodOxygen,e[vt.End]=!1,e[vt.Data]=[],e),r=10,i=t.length,c=Math.floor(i/r);if(0===c)return n[vt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[vt.End]=!0);var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),u=this._hexByte2Int(t[9+10*o],0).toString();n[vt.Data].push(((a={})[vt.Date]=s,a[vt.Blood_oxygen]=u,a))}return n},t.getBloodoxygen=function(t){var e,a,n=((e={})[vt.DataType]=ft.Blood_oxygen,e[vt.End]=!1,e[vt.Data]=[],e),r=10,i=t.length,c=Math.floor(i/r);if(0===c)return n[vt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[vt.End]=!0);var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),u=this._hexByte2Int(t[9+10*o],0).toString();n[vt.Data].push(((a={})[vt.Date]=s,a[vt.Blood_oxygen]=u,a))}return n},t.getHeartData=function(t){var e,a,n=((e={})[vt.DataType]=ft.GetDynamicHR,e[vt.End]=!1,e[vt.Data]=[],e),r=24,i=t.length,c=Math.floor(i/r);if(0===c)return n[vt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[vt.End]=!0);for(var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),u=[],h=0;h<15;h++)u.push(this._hexByte2Int(t[9+h+o*r],0).toString());n[vt.Data].push(((a={})[vt.Date]=s,a[vt.ArrayDynamicHR]=u.join(" "),a))}return n},t.getOnceHeartData=function(t){var e,a,n=((e={})[vt.DataType]=ft.GetStaticHR,e[vt.End]=!1,e[vt.Data]=[],e),r=t.length,i=Math.floor(r/10);if(0===i||1===i&&153===t[1])return n[vt.End]=!0,n;for(var c=0;c<i;c++){255===t[r-1]&&(n[vt.End]=!0);var o="20".concat(this._bcd2String(t[3+10*c]),".").concat(this._bcd2String(t[4+10*c]),".").concat(this._bcd2String(t[5+10*c])," ").concat(this._bcd2String(t[6+10*c]),":").concat(this._bcd2String(t[7+10*c]),":").concat(this._bcd2String(t[8+10*c])),s=this._hexByte2Int(t[9+10*c],0).toString();n[vt.Data].push(((a={})[vt.Date]=o,a[vt.StaticHR]=s,a))}return n},t.getHrvTestData=function(t){var e,a,n=((e={})[vt.DataType]=ft.GetHRVData,e[vt.End]=!1,e[vt.Data]=[],e),r=15,i=t.length,c=Math.floor(i/r);if(0===c)return n[vt.End]=!0,n;255===t[t.length-1]&&(n[vt.End]=!0);for(var o=0;o<c;o++){var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),u=this.hexByte2Int(t[9+o*r],0).toString(),h=this.hexByte2Int(t[10+o*r],0).toString(),l=this.hexByte2Int(t[11+o*r],0).toString(),g=this.hexByte2Int(t[12+o*r],0).toString(),d=this.hexByte2Int(t[13+o*r],0).toString(),S=this.hexByte2Int(t[14+o*r],0).toString();n[vt.Data].push(((a={})[vt.Date]=s,a[vt.HRV]=u,a[vt.VascularAging]=h,a[vt.HeartRate]=l,a[vt.Stress]=g,a[vt.highBP]=d,a[vt.lowBP]=S,a))}return n},t.getClockData=function(t){var e,a;console.log("getClockData:",t);var n=((e={})[vt.DataType]=ft.GetAlarmClock,e[vt.End]=!1,e[vt.Data]=[],e),r=41,i=t.length,c=!1,o=Math.floor(i/r);if(0===o)return n[vt.End]=!0,n;153==t[1]&&16==i&&(c=!0),n[vt.IsDeleteData]=c;for(var s=0;s<o;s++){var u=1+(s+1)*r;u<i&&255===t[u]&&(n[vt.End]=!0);for(var h=this.hexByte2Int(t[4+s*r],0).toString(),l=this.hexByte2Int(t[5+s*r],0).toString(),g=this.hexByte2Int(t[6+s*r],0).toString(),d=this.bcd2String(t[7+s*r]),S=this.bcd2String(t[8+s*r]),D=this.hexByte2Int(t[9+s*r],0),y=this.hexByte2Int(t[10+s*r],0),f="",v=0;v<y;v++){var p=t[11+v+s*r];0!==p&&(f+=this.int2Ascll(this.hexByte2Int(p,0)))}n[vt.Data].push(((a={})[vt.KAlarmId]=h,a[vt.OpenOrClose]=l,a[vt.ClockType]=g,a[vt.ClockTime]=d,a[vt.KAlarmMinter]=S,a[vt.Week]=D,a[vt.KAlarmContent]=f,a[vt.KAlarmLength]=y.toString(),a))}return n},t.getTempDataer=function(t){var e,a,n=((e={})[vt.DataType]=ft.GetAxillaryTemperatureDataWithMode,e[vt.End]=!1,e[vt.Data]=[],e),r=11,i=t.length,c=Math.floor(i/r);if(0===c||255===t[i-1])return n[vt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[vt.End]=!0);var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),u=this.hexByte2Int(t[9+o*r],0)+this.hexByte2Int(t[10+o*r],1);n[vt.Data].push(((a={})[vt.Date]=s,a[vt.axillaryTemperature]=(.1*u).toFixed(1),a))}return n},t.getQrCode=function(t,e){var a,n,r,i;return e?((a={})[vt.DataType]=ft.EnterQrCode,a[vt.End]=!0,a[vt.Data]={},a):128===t[1]||129===t[1]?((n={})[vt.DataType]=ft.QrCodeBandBack,n[vt.End]=!0,n[vt.Data]=((r={})[vt.Band]=129===t[1]?"1":"0",r),n):((i={})[vt.DataType]=ft.ExitQrCode,i[vt.End]=!0,i[vt.Data]={},i)},t.getTempData=function(t){var e,a,n=((e={})[vt.DataType]=ft.Temperature_history,e[vt.End]=!1,e[vt.Data]=[],e),r=11,i=t.length,c=Math.floor(i/r);if(0===c||255===t[i-1]||1===c&&153===t[1])return n[vt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[vt.End]=!0);var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),u=this.hexByte2Int(t[9+o*r],0)+this.hexByte2Int(t[10+o*r],1);n[vt.Data].push(((a={})[vt.Date]=s,a[vt.temperature]=(.1*u).toFixed(1),a))}return n},t.getExerciseData=function(t){var e,a,n=((e={})[vt.DataType]=ft.GetActivityModeData,e[vt.End]=!1,e[vt.Data]=[],e),r=25,i=t.length,c=Math.floor(i/r);if(0===c)return n[vt.End]=!0,n;for(var o=0;o<c;o++){var s=1+(o+1)*r;s<i&&o===c-1&&255===t[s]&&(n[vt.End]=!0);for(var u="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),h=this.hexByte2Int(t[9+o*r],0).toString(),l=this.hexByte2Int(t[10+o*r],0).toString(),g=this.getData(2,11+o*r,t),d=this.getData(2,13+o*r,t),S=this.hexByte2Int(t[15+o*r],0),D=this.hexByte2Int(t[16+o*r],0),y=new Array(4).fill(0),f=0;f<4;f++)y[3-f]=t[17+f+o*r];var v=new Array(4).fill(0);for(f=0;f<4;f++)v[3-f]=t[21+f+o*r];var p=this.getFloat(y,0),m=this.getFloat(v,0);n[vt.Data].push(((a={})[vt.Date]=u,a[vt.ActivityMode]=h,a[vt.HeartRate]=l,a[vt.ActiveMinutes]=g.toString(),a[vt.Step]=d.toString(),a[vt.Pace]="".concat(S.toString(16),"'").concat(D.toString(16)),a[vt.Distance]=m.toFixed(2),a[vt.Calories]=p.toFixed(1),a))}return n},t.getActivityExerciseData=function(t){for(var e,a,n=0,r=0,i=new Array(4).fill(0),c=0;c<4;c++)n+=this.hexByte2Int(t[c+2],c),i[3-c]=t[c+6],r+=this.hexByte2Int(t[c+10],c);var o=this.hexByte2Int(t[1],0),s=this.getFloat(i,0);return(e={})[vt.DataType]=ft.EnterActivityMode,e[vt.End]=!0,e[vt.Data]=((a={})[vt.HeartRate]=o.toString(),a[vt.Step]=n.toString(),a[vt.Calories]=s.toFixed(1),a[vt.ActiveMinutes]=r.toString(),a),e},t.setTimeSuccessful=function(t){var e,a;return(e={})[vt.DataType]=ft.SetDeviceTime,e[vt.End]=!0,e[vt.Data]=((a={})[vt.KPhoneDataLength]=this.hexByte2Int(t[1],0).toString(),a),e},t.getData=function(t,e,a){for(var n=0,r=0;r<t;r++)n+=this.hexByte2Int(a[r+e],r);return n},t.getFloat=function(t,e){return this.intBitToDouble(this.getInt(t,e))},t.getInt=function(t,e){return(255&t[e])<<24|(255&t[e+1])<<16|(255&t[e+2])<<8|255&t[e+3]},t.setMethodSuccessful=function(t){var e;return(e={})[vt.DataType]=t,e[vt.End]=!0,e[vt.Data]={},e},t.getEcgHistoryData=function(t){var e,a=((e={})[vt.DataType]=ft.ECGdata,e[vt.End]=!1,e[vt.Data]={},e),n=t.length;if(3===n||113===t[n-3]&&255===t[n-2]&&255===t[n-1])return a[vt.End]=!0,a;var r=3;if(0===this.hexByte2Int(t[1],0)+this.hexByte2Int(t[2],1)){var i="20".concat(this.bcd2String(t[3]),"-").concat(this.bcd2String(t[4]),"-").concat(this.bcd2String(t[5])," ").concat(this.bcd2String(t[6]),":").concat(this.bcd2String(t[7]),":").concat(this.bcd2String(t[8])),c=this.hexByte2Int(t[11],0).toString(),o=this.hexByte2Int(t[12],0).toString(),s=this.hexByte2Int(t[13],0).toString();a[vt.Data][vt.Date]=i,a[vt.Data][vt.HRV]=c,a[vt.Data][vt.HeartRate]=o,a[vt.Data][vt.ECGMoodValue]=s,r=27}var u=t.slice(r,n),h=this.getEcgDataString(u);return a[vt.Data][vt.ECGValue]=h,a},t.getEcgDataString=function(t){for(var e=[],a=Math.floor(t.length/2)-1,n=0;n<a;n++){var r=this.hexByte2Int(t[2*n+1],1)+this.hexByte2Int(t[2*n+2],0);r>=32768&&(r-=65536),e.push(r.toString())}return e.join(",")},t.ecgData=function(t){var e,a,n=this.hexByte2Int(t[1],0);return(e={})[vt.DataType]=ft.EcgppGstatus,e[vt.End]=!0,e[vt.Data]=((a={})[vt.EcgStatus]=n.toString(),a),e},t.ppgData=function(t){var e,a;return(e={})[vt.DataType]=ft.EcgppGstatus,e[vt.End]=!0,e[vt.Data]=((a={})[vt.PPGValue]=t,a),e},t.ecgResult=function(t){var e,a,n=((e={})[vt.DataType]=ft.GetEcgPpgStatus,e[vt.End]=!0,e[vt.Data]={},e);if(3===this.hexByte2Int(t[1],0)){var r="20".concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]),".").concat(this.bcd2String(t[12])," ").concat(this.bcd2String(t[13]),":").concat(this.bcd2String(t[14]),":").concat(this.bcd2String(t[15]));n[vt.Data]=((a={})[vt.Date]=r,a[vt.ECGHrvValue]=this.hexByte2Int(t[2],0).toString(),a[vt.ECGAvBlockValue]=this.hexByte2Int(t[3],0).toString(),a[vt.ECGHrValue]=this.hexByte2Int(t[4],0).toString(),a[vt.ECGStreesValue]=this.hexByte2Int(t[5],0).toString(),a[vt.ECGhighBpValue]=this.hexByte2Int(t[6],0).toString(),a[vt.ECGLowBpValue]=this.hexByte2Int(t[7],0).toString(),a[vt.ECGMoodValue]=this.hexByte2Int(t[8],0).toString(),a[vt.ECGBreathValue]=this.hexByte2Int(t[9],0).toString(),a)}return n},t.enterEcg=function(t){var e;return(e={})[vt.DataType]=ft.ENTERECG,e[vt.End]=!0,e[vt.Data]={},e},t.measurementWithType=function(t,e){var a,n,r,i,c,o,s,u;if(t)switch(e[1]){case 1:var h=this.hexByte2Int(e[6],0).toString(),l=this.hexByte2Int(e[7],0).toString();return(a={})[vt.DataType]=ft.MeasurementHrvCallback,a[vt.End]=!0,a[vt.Data]=((n={})[vt.HRV]=this.hexByte2Int(e[4],0),n[vt.highBP]=h,n[vt.lowBP]=l,n),a;case 2:return(r={})[vt.DataType]=ft.MeasurementHeartCallback,r[vt.End]=!0,r[vt.Data]=((i={})[vt.HeartRate]=this.hexByte2Int(e[2],0),i),r;case 3:return(c={})[vt.DataType]=ft.MeasurementOxygenCallback,c[vt.End]=!0,c[vt.Data]=((o={})[vt.Blood_oxygen]=this.hexByte2Int(e[3],0),o),c;case 4:var g=this.hexByte2Int(e[8],0)+this.hexByte2Int(e[9],1);return(s={})[vt.DataType]=ft.MeasurementTempCallback,s[vt.End]=!0,s[vt.Data]=((u={})[vt.temperature]=(.1*g).toFixed(1),u),s}else{var d={1:ft.StopMeasurementHrvCallback,2:ft.StopMeasurementHeartCallback,3:ft.StopMeasurementOxygenCallback,4:ft.StopMeasurementTempCallback};if(d[e[1]])return this.setMethodSuccessful(d[e[1]])}return{}},t.braceletdial=function(t,e){var a,n;return t?((a={})[vt.DataType]=ft.Braceletdial,a[vt.End]=!0,a):((n={})[vt.DataType]=ft.Braceletdialok,n[vt.End]=!0,n[vt.Data]={index:e[1].toString()},n)},t.getSportMode=function(t){for(var e,a=this.hexByte2Int(t[1],0),n=[],r=0;r<a;r++)n.push(this.hexByte2Int(t[r+2],0).toString());return(e={})[vt.DataType]=ft.GetSportMode,e[vt.End]=!0,e[vt.Data]=n.join(","),e},t.gPSControlCommand=function(t){for(var e,a,n="20".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2]),"-").concat(this.bcd2String(t[3])," ").concat(this.bcd2String(t[4]),":").concat(this.bcd2String(t[5]),":").concat(this.bcd2String(t[6])),r=new Array(4).fill(0),i=new Array(4).fill(0),c=0;c<4;c++)r[3-c]=t[9+c],i[3-c]=t[14+c];var o=this.getFloat(r,0).toString(),s=this.getFloat(i,0).toString(),u=this.hexByte2Int(t[18],0);return(e={})[vt.DataType]=ft.GPSControlCommand,e[vt.End]=!0,e[vt.Data]=((a={})[vt.KActivityLocationTime]=n,a[vt.KActivityLocationLatitude]=o,a[vt.KActivityLocationLongitude]=s,a[vt.KActivityLocationCount]=u.toString(),a),e},t.setSocial=function(t){var e;return(e={})[vt.DataType]=ft.SocialdistanceGetting,e[vt.End]=!0,e[vt.Data]={scanInterval:this.hexByte2Int(t[2],0).toString(),scanTime:this.hexByte2Int(t[3],0).toString(),signalStrength:t[4].toString()},e},t.ecgQuality=function(t){var e;return(e={})[vt.DataType]=ft.EcgppG,e[vt.End]=!0,e[vt.Data]={heartValue:this.hexByte2Int(t[1],0).toString(),hrvValue:this.hexByte2Int(t[2],0).toString(),Quality:this.hexByte2Int(t[3],0).toString()},e},t.enterPhotoModeback=function(t){var e,a="";switch(t[1]){case 1:a=0===t[2]?"0":"1";break;case 2:a="2";break;case 3:switch(t[2]){case 1:a="3";break;case 2:a="4";break;case 3:a="5";break;case 4:a="6";break;case 5:a="7"}break;case 4:a="8"}return(e={})[vt.DataType]=ft.DeviceSendDataToAPP,e[vt.End]=!0,e[vt.Data]={type:a},e},t.setNewDeviceInfo=function(t){var e;return(e={})[vt.DataType]=ft.SetNewDeviceInfo,e[vt.End]=!0,e[vt.Data]={},e},t.getNewDeviceInfo=function(t){var e;return(e={})[vt.DataType]=ft.GetNewDeviceInfo,e[vt.End]=!0,e[vt.Data]={KEcg:this.hexByte2Int(t[1],0).toString()},e},t.updateClockSuccessful=function(t){var e,a;return console.log("updateClockSuccessful:",t),(e={})[vt.DataType]=ft.SetAlarmClockWithAllClock,e[vt.End]=!0,e[vt.Data]=((a={})[vt.KClockLast]=this.hexByte2Int(t[t.length-1],0).toString(),a),e},t.setBoolSugarStatus=function(t){var e,a;return(e={})[vt.DataType]=ft.BoolsugarStatus,e[vt.End]=!0,e[vt.Data]=((a={})[vt.EcgStatus]=this.hexByte2Int(t[2],0),a),e},t.setBoolSugarValue=function(t){for(var e,a=t.slice(3),n=[],r=0;r<Math.floor(a.length/3);r++){var i=this.hexByte2Int(a[3*r],2)+this.hexByte2Int(a[3*r+1],1)+this.hexByte2Int(a[3*r+2],0);n.push(i)}return(e={})[vt.DataType]=ft.BoolsugarValue,e[vt.End]=!0,e[vt.Data]={timestamp:Math.floor(Date.now()/1e3),ppg:n},e},t.setMethodError=function(t){var e;return(e={})[vt.DataType]=t,e[vt.End]=!1,e[vt.Data]={},e},t.readPregnancyCycle=function(t){var e,a;return(e={})[vt.DataType]=ft.GetPregnancyCycle,e[vt.End]=!0,e[vt.Data]=((a={})[vt.Date]="20".concat(this.bcd2String(t[3]),"-").concat(this.bcd2String(t[4]),"-").concat(this.bcd2String(t[5])),a[vt.Week]=this.hexByte2Int(t[1],0),a[vt.DayOfWeek]=this.hexByte2Int(t[2],0),a),e},t.readWomenHealth=function(t){var e,a;return(e={})[vt.DataType]=ft.GetWomenHealth,e[vt.End]=!0,e[vt.Data]=((a={})[vt.Date]="".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2])),a[vt.WomenHealthPeriod]=this.hexByte2Int(t[3],0),a[vt.WomenHealthLength]=this.hexByte2Int(t[4],0),a),e},t.getTemperatureCorrectionValue=function(t){var e,a,n=[t[3],t[2]],r=this.byteArrayToInt(n);return(e={})[vt.DataType]=ft.CMD_Set_TemperatureCorrection,e[vt.End]=!0,e[vt.Data]=((a={})[vt.TemperatureCorrectionValue]=r.toString(),a),e},t.byteArrayToInt=function(t){return t[0]<<8&65280|255&t[1]},t.getHistoryGpsData=function(t){var e,a=[],n=((e={})[vt.DataType]=ft.Gps,e[vt.End]=!1,e),r=59,i=t.length,c=Math.floor(i/r);if(0===c)return n;255===t[t.length-1]&&90===t[t.length-2]&&(n[vt.End]=!0);for(var o=0;o<c;o++){for(var s={},u="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),h=[],l=[],g=0;g<6;g++){for(var d=new Array(4).fill(0),S=new Array(4).fill(0),D=0;D<4;D++)d[3-D]=t[9+D+o*r+8*g],S[3-D]=t[13+D+o*r+8*g];var y=this.getFloat(d,0).toString(),f=this.getFloat(S,0).toString();h.push(y),l.push(f)}s[vt.Date]=17===u.length?u:"2019.01.01 00:00:00",s[vt.Latitude]=h.join(","),s[vt.Longitude]=l.join(","),a.push(s)}return n[vt.Data]=a,n},t.getPPITestData=function(t){var e,a=((e={})[vt.DataType]=ft.GetPPIData,e[vt.End]=!1,e[vt.Data]=[],e),n=123,r=t.length,i=Math.floor(r/n);if(0===i)return a[vt.End]=!0,a;255===t[t.length-1]&&(a[vt.End]=!0);for(var c=0;c<i;c++){for(var o={},s=new Array(2).fill(0),u=0;u<2;u++)s[1-u]=t[1+u+c*n];for(var h=this.getInt(s,0),l="20".concat(this.bcd2String(t[3+c*n]),".").concat(this.bcd2String(t[4+c*n]),".").concat(this.bcd2String(t[5+c*n])," ").concat(this.bcd2String(t[6+c*n]),":").concat(this.bcd2String(t[7+c*n]),":").concat(this.bcd2String(t[8+c*n])),g=this.hexByte2Int(t[9+c*n],0),d=this.hexByte2Int(t[10+c*n],0).toString(),S=[],D=0;D<56;D++){for(var y=11+2*D,f=new Array(2).fill(0),v=0;v<2;v++)f[1-v]=t[y+v+c*n];var p=this.getFloat(f,0);if(0===p)break;S.push(p)}o[vt.TOTAL_ID]=g.toString(),o[vt.PPI_ID]=d,o[vt.DeviceTime]=l,o[vt.PPI_LIST]=S,o[vt.PPI_NUM]=h,a[vt.Data].push(o)}return a},t.getHrvTimeData=function(t){var e,a;return(e={})[vt.DataType]=ft.GetHrvTimeValue,e[vt.End]=!0,e[vt.Data]=((a={})[vt.HRV_TIME_MODE]=this.hexByte2Int(t[1],0),a[vt.HRV_TIME_Value]=this.hexByte2Int(t[2],0),a),e},t.closeDevices=function(t){var e,a;return(e={})[vt.DataType]=ft.CloseDevices,e[vt.End]=!0,e[vt.Data]=((a={})[vt.RESULT]=!0,a),e},t.getOffCheckStatus=function(t){var e,a;return(e={})[vt.DataType]=ft.GetOffCheckStatus,e[vt.End]=!0,e[vt.Data]=((a={})[vt.GET_OFF_TAG]=this.hexByte2Int(t[1],0),a[vt.GET_OFF_STATE]=this.hexByte2Int(t[2],0),a),e},t}();"function"==typeof SuppressedError&&SuppressedError;var mt=function(){function vt(){}return vt.generateValue=function(t){return new Array(t).fill(0)},vt.hexByte2Int=function(t,e){return(255&t)*Math.pow(256,e)},vt.generateInitValue=function(){return this.generateValue(16)},vt.arrayCopy=function(t,e,a,n,r){for(var i=0;i<r;i++)a[n+i]=t[e+i]},vt.crcValue=function(t){for(var e=0,a=0;a<t.length-1;a++)e+=t[a];t[t.length-1]=255&e},vt.crcDynamicValue=function(t){for(var e=0,a=0,n=t;a<n.length;a++){e+=n[a]}t[t.length-1]=255&e},vt.getBcdValue=function(t){return 16*Math.floor(t/10)+t%10},vt.dataParsingWithData=function(P){if(!P||0===P.length)return pt.setMethodError("Empty data");switch(P[0]){case s:return pt.setMethodSuccessful(ft.SetStepGoal);case a:return pt.setMethodSuccessful(ft.SetPersonalInfo);case y:break;case D:return pt.setMethodSuccessful(ft.SetMotorVibrationWithTimes);case r:return pt.setMethodSuccessful(ft.SetDeviceInfo);case v:return pt.setMethodSuccessful(ft.SetAutomaticHRMonitoring);case Dt:return pt.setMethodSuccessful(ft.SetSedentaryReminder);case c:return pt.setMacSuccessful();case H:return pt.setMethodSuccessful(ft.EnterActivityMode);case R:return 0!==P[2]&&0!==P[3]?pt.getTemperatureCorrectionValue(P):pt.setMethodSuccessful(ft.CMD_Set_TemperatureCorrection);case k:return pt.getActivityExerciseData(P);case t:return pt.setTimeSuccessful(P);case C:return pt.getExerciseData(P);case e:return pt.getDeviceTime(P);case n:return pt.getUserInfo(P);case i:return pt.getDeviceInfo(P);case o:return pt.getActivityData(P);case u:return pt.getGoal(P);case h:return pt.getDeviceBattery(P);case l:return pt.getDeviceAddress(P);case g:return pt.getDeviceVersion(P);case f:return pt.getDeviceName(P);case p:return pt.getAutoHeart(P);case d:return pt.reset();case S:return pt.mcuReset();case I:return pt.notify();case yt:return pt.getActivityAlarm(P);case B:return pt.getTotalStepData(P);case T:return pt.getDetailData(P);case _:return pt.getSleepData(P);case V:return pt.getHeartData(P);case x:return pt.getOnceHeartData(P);case A:return pt.getHrvTestData(P);case b:return pt.getClockData(P);case m:return pt.updateClockSuccessful(P);case w:return pt.setNewDeviceInfo(P);case L:return pt.getNewDeviceInfo(P);case O:return pt.enterPhotoModeback(P);case W:return pt.setMethodSuccessful(ft.EnterPhotoMode);case F:return pt.setMethodSuccessful(ft.BackHomeView);case K:return pt.ecgQuality(P);case N:case U:break;case Q:return pt.setMethodSuccessful(ft.Weather);case j:return pt.braceletdial(!1,P);case Y:return pt.setMethodSuccessful(ft.SportMode);case q:return pt.getSportMode(P);case z:return pt.measurementWithType(!0,P);case X:return pt.gPSControlCommand(P);case Z:return pt.getHistoryGpsData(P);case $:return pt.setMethodSuccessful(ft.Clear_Bracelet_data);case M:return pt.getAutoBloodOxygen(P);case E:return pt.getBloodoxygen(P);case G:return pt.setMethodSuccessful(ft.SocialdistanceSetting);case tt:return pt.setMethodSuccessful(ft.Sos);case et:return pt.getTempData(P);case at:return pt.getTempDataer(P);case nt:return pt.getQrCode(P,!1);case dt:return pt.setBoolSugarStatus(P);case St:return pt.setBoolSugarValue(P);case rt:return pt.ecgResult(P);case st:return pt.readPregnancyCycle(P);case it:return pt.getEcgHistoryData(P);case ot:return 0===P[1]?pt.setMethodSuccessful(ft.SetWomenHealth):pt.readWomenHealth(P);case ct:switch(this.hexByte2Int(P[2],0)){case 1:return pt.setMethodSuccessful(ft.ppgStartSucessed);case 2:return pt.setMethodSuccessful(ft.ppgResult);case 3:return pt.setMethodSuccessful(ft.ppgStop);case 4:return pt.setMethodSuccessful(ft.ppgMeasurementProgress);case 5:return pt.setMethodSuccessful(ft.ppgQuit);default:return pt.setMethodSuccessful(ft.ppgStartFailed)}case ut:return pt.getPPITestData(P);case ht:return pt.getHrvTimeData(P);case lt:return pt.closeDevices(P);case gt:return pt.getOffCheckStatus(P)}return pt.setMethodError(this.getBcdValue(P[0]).toString())},vt.bloodsugarWithMode=function(t,e){var a=this.generateInitValue();return a[0]=ct,a[1]=t,2!==t&&4!==t||(a[2]=e),this.crcValue(a),a},vt.getDetailSleepDataWithMode=function(t){var e=this.generateInitValue();return e[0]=_,e[1]=99===t?153:t,this.crcValue(e),e},vt.insertDateValue=function(t,e){if(e&&!(e.length<=0)){var a=e.split(" "),n=a[0],r=a[1],i=n.split("-").map(Number),c=i[0],o=i[1],s=i[2],u=r.split(":").map(Number),h=u[0],l=u[1],g=u[2];t[4]=this.getBcdValue(c-2e3),t[5]=this.getBcdValue(o),t[6]=this.getBcdValue(s),t[7]=this.getBcdValue(h),t[8]=this.getBcdValue(l),t[9]=this.getBcdValue(g)}},vt.getHRVDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=A,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},vt.getPPIDDataWithMode=function(t){var e=this.generateInitValue();return e[0]=ut,e[1]=99===t?153:0===t?0:1===t?1:2,this.crcValue(e),e},vt.getHrvTestTime=function(){var t=this.generateInitValue();return t[0]=ht,t[1]=0,this.crcValue(t),t},vt.setHrvTestTime=function(t){var e=this.generateInitValue();return e[0]=ht,e[1]=1,e[2]=t,this.crcValue(e),e},vt.closeBlueDevice=function(){var t=this.generateInitValue();return t[0]=lt,this.crcValue(t),t},vt.startBloodSugar=function(){var t=this.generateInitValue();return t[0]=dt,t[1]=1,this.crcValue(t),t},vt.progressBloodSugar=function(t){var e=this.generateInitValue();return e[0]=dt,e[1]=4,e[2]=t,this.crcValue(e),e},vt.endBloodSugar=function(){var t=this.generateInitValue();return t[0]=dt,t[1]=3,this.crcValue(t),t},vt.getTotalActivityDataWithMode=function(t){var e=this.generateInitValue();return e[0]=B,e[1]=99===t?153:0===t?0:1===t?1:2,this.crcValue(e),e},vt.getTotalActivityDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=B,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},vt.getDetailSleepDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=_,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},vt.getDetailActivityDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=T,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},vt.getTemperature_historyDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=et,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},vt.getAxillaryTemperatureDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=at,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},vt.enterActivityMode=function(t,e){var a=this.generateInitValue();return a[0]=H,a[1]=e,a[2]=t,this.crcValue(a),a},vt.sendHeartPackage=function(t,e,a){var n=this.generateInitValue(),r=255&Math.floor(e/60),i=e%60&255,c=new ArrayBuffer(4);new DataView(c).setFloat32(0,t,!0);var o=Array.from(new Uint8Array(c));return n[0]=J,this.arrayCopy(o,0,n,1,o.length),n[5]=r,n[6]=i,n[7]=255&a,this.crcValue(n),n},vt.realTimeStep=function(t,e){var a=this.generateInitValue();return a[0]=o,a[1]=t?1:0,a[2]=e?1:0,this.crcValue(a),a},vt.stopGo=function(){var t=this.generateInitValue();return t[0]=o,t[1]=0,this.crcValue(t),t},vt.setPersonalInfo=function(t){var e=this.generateInitValue();return e[0]=a,e[1]=t.sex,e[2]=t.age,e[3]=t.height,e[4]=t.weight,t.stepLength&&(e[5]=t.stepLength),this.crcValue(e),e},vt.getPersonalInfo=function(){var t=this.generateInitValue();return t[0]=n,this.crcValue(t),t},vt.enterOTA=function(){var t=this.generateInitValue();return t[0]=P,this.crcValue(t),t},vt.getDeviceVersion=function(){var t=this.generateInitValue();return t[0]=g,this.crcValue(t),t},vt.reset=function(){var t=this.generateInitValue();return t[0]=d,this.crcValue(t),t},vt.getDeviceMacAddress=function(){var t=this.generateInitValue();return t[0]=l,this.crcValue(t),t},vt.getDeviceBatteryLevel=function(){var t=this.generateInitValue();return t[0]=h,this.crcValue(t),t},vt.mcuReset=function(){var t=this.generateInitValue();return t[0]=S,this.crcValue(t),t},vt.setDeviceName=function(t){var e=this.generateInitValue(),a=Math.min(t.length,14);e[0]=y;for(var n=0;n<a;n++)e[n+1]=t.charCodeAt(n);for(n=a+1;n<6;n++)e[n]=0;return this.crcValue(e),e},vt.getDeviceName=function(){var t=this.generateInitValue();t[0]=f;for(var e=1;e<6;e++)t[e]=0;return this.crcValue(t),t},vt.setDeviceTime=function(e){var a=this.generateInitValue(),n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),c=e.getHours(),o=e.getMinutes(),s=e.getSeconds();return a[0]=t,a[1]=this.getBcdValue(n),a[2]=this.getBcdValue(r),a[3]=this.getBcdValue(i),a[4]=this.getBcdValue(c),a[5]=this.getBcdValue(o),a[6]=this.getBcdValue(s),this.crcValue(a),a},vt.getDeviceTime=function(){var t=this.generateInitValue();return t[0]=e,this.crcValue(t),t},vt.setDeviceInfo=function(t){var e=this.generateInitValue();return e[0]=r,e[1]=t.distanceUnit?129:128,e[2]=t.is12Hour?129:128,e[3]=t.handUpLightScreenSwitch?129:128,e[4]=t.fahrenheit?128:129,e[5]=t.nightMode?129:128,e[6]=128,e[9]=128+t.baseHeart,e[11]=128+t.screenBrightness,e[12]=128+t.indexDial,e[14]=128+t.languages,this.crcValue(e),e},vt.healthMeasurementWithDataType=function(t,e){this.StartDeviceMeasurementWithType=e;var a=this.generateInitValue();return a[0]=z,a[1]=t,a[2]=e?1:0,this.crcValue(a),a},vt.setBraceletdial=function(t){this.isRuning=!0;var e=this.generateInitValue();return e[0]=j,e[1]=t,this.crcValue(e),e},vt.setAutomaticHRMonitoring=function(t){var e=this.generateInitValue(),a=t.time;return e[0]=v,e[1]=t.open,e[2]=this.getBcdValue(t.startHour),e[3]=this.getBcdValue(t.startMinute),e[4]=this.getBcdValue(t.endHour),e[5]=this.getBcdValue(t.endMinute),e[6]=t.week,e[7]=255&a,e[8]=a>>8&255,e[9]=t.type,this.crcValue(e),e},vt.getAutomaticHRMonitoring=function(t){var e=this.generateInitValue();return e[0]=p,e[1]=t,this.crcValue(e),e},vt.getActivityModeDataWithMode=function(t){var e=this.generateInitValue();return e[0]=C,e[1]=t,this.crcValue(e),e},vt.getStaticHRWithMode=function(t,e){var a=this.generateInitValue();return a[0]=x,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},vt.getDynamicHRWithMode=function(t,e){var a=this.generateInitValue();return a[0]=V,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},vt.getBloodOxygen=function(t,e){var a=this.generateInitValue();return a[0]=E,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},vt.getAutoBloodOxygen=function(t,e){var a=this.generateInitValue();return a[0]=M,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},vt.setStepGoal=function(t,e,a,n,r){var i=this.generateInitValue();return i[0]=s,i[4]=t>>24&255,i[3]=t>>16&255,i[2]=t>>8&255,i[1]=255&t,i[6]=e>>8&255,i[5]=255&e,i[8]=a>>8&255,i[7]=255&a,i[10]=n>>8&255,i[9]=255&n,i[12]=r>>8&255,i[11]=255&r,this.crcValue(i),i},vt.GetStepGoal=function(){var t=this.generateInitValue();return t[0]=u,this.crcValue(t),t},vt.getDeviceInfo=function(){var t=this.generateInitValue();return t[0]=i,this.crcValue(t),t},vt.sendHex=function(t,e){var a=function(t,e,a){if(a||2===arguments.length)for(var n,r=0,i=e.length;r<i;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}([],t,!0);return e&&this.crcDynamicValue(a),a},vt.getAlarmClock=function(){var t=this.generateInitValue();return t[0]=b,this.crcValue(t),t},vt.deleteAllAlarmClock=function(){var t=this.generateInitValue();return t[0]=b,t[1]=153,this.crcValue(t),t},vt.setAlarmClock=function(t){var e=this,a=[],n=39*t.length+2;if(n>128)for(var r=Math.floor(128/39),i=Math.ceil(t.length/r),c=0;c<i;c++){for(var o=c===i-1,s=o?t.length-r*c:r,u=new Array(39*s+(o?2:0)).fill(0),h=0;h<s;h++){var l=t[r*c+h],g=l.openOrClose,d=l.clockType,S=l.clockTime,D=l.week,y=l.textLength,f=l.text,v=39*h;u[v]=35,u[v+1]=t.length,u[v+2]=r*c+h,u[v+3]=g,u[v+4]=d,u[v+5]=this.getBcdValue(S.substring(0,2)),u[v+6]=this.getBcdValue(S.substring(3,5)),u[v+7]=D,u[v+8]=y;for(var p=0;p<y;p++)u[v+9+p]=f.charCodeAt(p)||0}o&&(u[u.length-2]=35,u[u.length-1]=255),a.push(u)}else{var m=new Array(n).fill(0);t.forEach(function(a,n){var r=a.openOrClose,i=a.clockType,c=a.clockTime,o=a.week,s=a.textLength,u=a.text,h=39*n;m[h]=35,m[h+1]=t.length,m[h+2]=n,m[h+3]=r,m[h+4]=i,m[h+5]=e.getBcdValue(c.substring(0,2)),m[h+6]=e.getBcdValue(c.substring(3,5)),m[h+7]=o,m[h+8]=s;for(var l=0;l<s;l++)m[h+9+l]=u.charCodeAt(l)||0}),m[n-2]=35,m[n-1]=255,a.push(m)}return a},vt.getSedentaryReminder=function(){var t=this.generateInitValue();return t[0]=yt,this.crcValue(t),t},vt.setSedentaryReminder=function(t){var e=this.generateInitValue();e[0]=Dt,e[1]=this.getBcdValue(t.startTime_Hour),e[2]=this.getBcdValue(t.startTime_Minutes),e[3]=this.getBcdValue(t.endTime_Hour),e[4]=this.getBcdValue(t.endTime_Minutes);var a=(t.weeks.sunday?1:0)+(t.weeks.monday?2:0)+(t.weeks.tuesday?4:0)+(t.weeks.wednesday?8:0)+(t.weeks.thursday?16:0)+(t.weeks.friday?32:0)+(t.weeks.saturday?64:0);return e[5]=a,e[6]=t.intervalTime,e[7]=t.leastSteps,e[8]=t.mode,this.crcValue(e),e},vt.DATA_READ_START=0,vt.DATA_READ_CONTINUE=2,vt.DATA_DELETE=99,vt.DistanceMode_MILE=129,vt.DistanceMode_KM=128,vt.TimeMode_12h=129,vt.TimeMode_24h=128,vt.WristOn_Enable=129,vt.WristOn_DisEnable=128,vt.TempUnit_C=128,vt.TempUnit_F=129,vt.TAG="BleSDK",vt.isRuning=!1,vt.ecgopen=!1,vt.read=!1,vt.pregnancyCycleRead=!1,vt.isSettingSocial=!1,vt.StartDeviceMeasurementWithType=!1,vt}();export{ft as BleConst,mt as BleSDK,vt as DeviceKey,pt as ResolveUtil};
1
+ var t=1,e=65,a=2,n=66,r=3,i=4,c=5,o=9,s=11,h=75,u=19,l=34,g=39,d=18,S=46,y=54,f=61,D=62,v=42,p=43,m=35,I=77,T=81,B=82,V=83,E=84,_=96,M=102,x=85,b=87,C=92,A=86,G=100,H=25,k=24,P=71,R=56,w=6,L=7,W=32,O=22,N=16,K=131,F=170,U=171,Q=21,j=36,q=20,Y=68,z=40,J=23,X=52,Z=90,$=97,tt=254,et=98,at=101,nt=176,rt=156,it=113,ct=120,ot=28,st=30,ht=99,ut=136,lt=137,gt=138,dt=58,St=37,yt=38,ft=107,Dt=57,vt={GetDeviceTime:"get_device_time",GetPersonalInfo:"get_personal_info",GetDeviceInfo:"get_device_info",RealTimeStep:"real_time_step",GetStepGoal:"get_step_goal",GetDeviceBatteryLevel:"get_device_battery_level",GetDeviceMacAddress:"get_device_mac_address",GetDeviceVersion:"get_device_version",CMD_Reset:"cmd_reset",CMD_MCUReset:"cmd_mcu_reset",Notify:"notify",GetDeviceName:"get_device_name",SetAlarmClockWithAllClock:"set_alarm_clock_with_all_clock",Gps:"GPS",GetPPIData:"GetPPIData",GetHrvTimeValue:"GetHrvTimeValue",CloseDevices:"CloseDevices",GetOffCheckStatus:"GetOffCheckStatus",GetAutomaticHRMonitoring:"GetAutomaticHRMonitoring",GetSedentaryReminder:"GetSedentaryReminder",GetTotalActivityData:"GetTotalActivityData",GetDetailActivityData:"GetDetailActivityData",GetDetailSleepData:"GetDetailSleepData",AutoBloodOxygen:"AutoBloodOxygen",GetDynamicHR:"GetDynamicHR",ECGdata:"ECGdata",GetWomenHealth:"GetWomenHealth",CMD_Set_TemperatureCorrection:"CMD_Set_TemperatureCorrection",GetStaticHR:"GetStaticHR",Blood_oxygen:"Blood_oxygen",GetHRVData:"GetHRVData",GetAxillaryTemperatureDataWithMode:"GetAxillaryTemperatureDataWithMode",EnterQrCode:"EnterQrCode",QrCodeBandBack:"QrCodeBandBack",ExitQrCode:"ExitQrCode",Temperature_history:"Temperature_history",GetActivityModeData:"GetActivityModeData",EnterActivityMode:"EnterActivityMode",SetDeviceTime:"SetDeviceTime",GetAlarmClock:"GetAlarmClock",EcgppGstatus:"EcgppGstatus",GetEcgPpgStatus:"GetEcgPpgStatus",ENTERECG:"ENTERECG",MeasurementHrvCallback:"MeasurementHrvCallback",MeasurementHeartCallback:"MeasurementHeartCallback",MeasurementOxygenCallback:"MeasurementOxygenCallback",MeasurementTempCallback:"MeasurementTempCallback",StopMeasurementHrvCallback:"StopMeasurementHrvCallback",StopMeasurementHeartCallback:"StopMeasurementHeartCallback",StopMeasurementOxygenCallback:"StopMeasurementOxygenCallback",StopMeasurementTempCallback:"StopMeasurementTempCallback",Braceletdial:"Braceletdial",Braceletdialok:"Braceletdialok",GetSportMode:"GetSportMode",GPSControlCommand:"GPSControlCommand",SocialdistanceGetting:"SocialdistanceGetting",EcgppG:"EcgppG",DeviceSendDataToAPP:"DeviceSendDataToAPP",SetNewDeviceInfo:"SetNewDeviceInfo",GetNewDeviceInfo:"GetNewDeviceInfo",BoolsugarStatus:"BoolsugarStatus",BoolsugarValue:"BoolsugarValue",GetPregnancyCycle:"GetPregnancyCycle",SetStepGoal:"SetStepGoal",SetPersonalInfo:"SetPersonalInfo",SetMotorVibrationWithTimes:"SetMotorVibrationWithTimes",SetDeviceInfo:"SetDeviceInfo",SetAutomaticHRMonitoring:"SetAutomaticHRMonitoring",SetSedentaryReminder:"SetSedentaryReminder",EnterPhotoMode:"EnterPhotoMode",BackHomeView:"BackHomeView",Weather:"Weather",SportMode:"SportMode",Clear_Bracelet_data:"Clear_Bracelet_data",SocialdistanceSetting:"SocialdistanceSetting",Sos:"Sos",SetPregnancyCycle:"SetPregnancyCycle",DeleteECGdata:"DeleteECGdata",ECG:"ECG",SetWomenHealth:"SetWomenHealth",ppgStartSucessed:"ppgStartSucessed",ppgResult:"ppgResult",ppgStop:"ppgStop",ppgMeasurementProgress:"ppgMeasurementProgress",ppgQuit:"ppgQuit",ppgStartFailed:"ppgStartFailed",CMD_Set_Mac:"CMD_Set_Mac",CloseECG:"CloseECG",GetAlarmClock_V4:"GetAlarmClock_V4",DeleteAllAlarmClock_V4:"DeleteAllAlarmClock_V4",SetAlarmClock_V4:"SetAlarmClock_V4",GetSedentaryReminder_V4:"GetSedentaryReminder_V4",SetSedentaryReminder_V4:"SetSedentaryReminder_V4",GetRealTimeTemperatureCorrection:"GetRealTimeTemperatureCorrection",PPGRealtime:"PPGRealtime"},pt={DeviceTime:"device_time",GPSTime:"gps_time",DataType:"data_type",End:"end",Data:"data",Gender:"gender",Age:"age",Height:"height",Weight:"weight",Stride:"stride",KUserDeviceId:"k_user_device_id",KClockLast:"k_clock_last",Step:"step",Calories:"calories",Distance:"distance",ExerciseMinutes:"exercise_minutes",HeartRate:"heart_rate",ActiveMinutes:"active_minutes",TempData:"temp_data",Blood_oxygen:"blood_oxygen",StepGoal:"step_goal",DistanceGoal:"distance_goal",CalorieGoal:"calorie_goal",SleepTimeGoal:"sleep_time_goal",BatteryLevel:"battery_level",MacAddress:"mac_address",DeviceVersion:"device_version",DeviceName:"device_name",Date:"date",Latitude:"latitude",Longitude:"longitude",TOTAL_ID:"totalId",PPI_ID:"ppiId",PPI_LIST:"ppiList",PPI_NUM:"ppiNum",PPI_UNIT:"ppiUnit",HRV_TIME_MODE:"hrvTimeMode",HRV_TIME_Value:"hrvTimeValue",RESULT:"result",GET_OFF_TAG:"getOffTag",GET_OFF_STATE:"getOffState",DistanceUnit:"distance_unit",TimeUnit:"time_unit",StatusOfTheRaisedHandOnscreen:"status_of_the_raised_hand_onscreen",TempUnit:"temp_unit",NightMode:"night_mode",ANCSMode:"ANCS_mode",ANCSSubStatus:"ANCS_sub_status",KBaseHeart:"k_base_heart",ScreenBrightness:"screen_brightness",Dialinterface:"dial_interface",SocialDistancedwitch:"social_distance_switch",ChineseOrEnglish:"chinese_or_english",WorkMode:"work_mode",StartTime:"start_time",KHeartStartMinter:"kheart_start_minter",EndTime:"end_time",KHeartEndMinter:"kheart_end_minter",Weeks:"weeks",IntervalTime:"interval_time",StartTimeHour:"StartTimeHour",StartTimeMin:"StartTimeMin",EndTimeHour:"EndTimeHour",EndTimeMin:"EndTimeMin",LeastSteps:"LeastSteps",Week:"week",Goal:"Goal",KDetailMinterStep:"KDetailMinterStep",ArraySteps:"ArraySteps",ArraySleep:"ArraySleep",ActivityArray:"ActivityArray",sleepUnitLength:"sleepUnitLength",StaticHR:"StaticHR",WomenHealthPeriod:"WomenHealthPeriod",WomenHealthLength:"WomenHealthLength",TemperatureCorrectionValue:"TemperatureCorrectionValue",HRV:"HRV",ECGPointCount:"ECGPointCount",ECGMoodValue:"ECGMoodValue",ECGValue:"ECGValue",ArrayDynamicHR:"ArrayDynamicHR",KAlarmId:"KAlarmId",OpenOrClose:"OpenOrClose",ClockType:"ClockType",ClockTime:"ClockTime",KAlarmMinter:"KAlarmMinter",KAlarmContent:"KAlarmContent",KAlarmLength:"KAlarmLength",KAlarmTotal:"KAlarmTotal",KAlarmIndex:"KAlarmIndex",axillaryTemperature:"axillaryTemperature",Band:"Band",temperature:"temperature",ActivityMode:"ActivityMode",Pace:"Pace",KPhoneDataLength:"KPhoneDataLength",VascularAging:"VascularAging",Stress:"Stress",highBP:"highBP",lowBP:"lowBP",EcgStatus:"ecgStatus",PPGValue:"ppgValue",ECGHrvValue:"ecgHrvValue",ECGAvBlockValue:"ecgAvBlockValue",ECGHrValue:"ecgHrValue",ECGStreesValue:"ecgStressValue",ECGhighBpValue:"ecgHighBpValue",ECGLowBpValue:"ecgLowBpValue",ECGBreathValue:"ecgBreathValue",KActivityLocationTime:"activityLocationTime",KActivityLocationLatitude:"activityLocationLatitude",KActivityLocationLongitude:"activityLocationLongitude",KActivityLocationCount:"activityLocationCount",DayOfWeek:"dayOfWeek",Text:"text",TextLength:"textLength",IsDeleteData:"isDeleteData",SportEnable:"SportEnable",HeartEnable:"HeartEnable",HeartDayEnable:"HeartDayEnable",highestTemp:"highestTemp",displayTemp:"displayTemp",ntcTemps:"ntcTemps",ECGId:"ECGId"},mt={CALL:1,SMS:2,WECHAT:4,FACEBOOK:8,INSTAGRAM:16,SKYPE:32,TELEGRAM:64,TWITTER:128,VK:256,WHATSAPP:512,QQ:1024,LINKEDIN:2048,ENABLE_FLAG:16384},It=function(){function t(){}return t.hexByte2Int=function(t,e){return(255&t)*Math.pow(256,e)},t.bcd2String=function(t){var e=15&t;return"".concat((240&t)>>4).concat(e)},t.intList2String=function(t){return t.map(function(t){return t.toString(16).padStart(2,"0").toUpperCase()}).join(" ")},t.intList3String=function(t){return t.map(function(t){return t.toString(16).padStart(2,"0").toLowerCase()}).join(" ")},t.setMacSuccessful=function(){var t;return(t={})[pt.DataType]=vt.CMD_Set_Mac,t[pt.End]=!0,t[pt.Data]={},t},t.intBitToDouble=function(t){var e=new ArrayBuffer(8),a=new DataView(e);return a.setInt32(0,t,!1),a.getFloat32(0,!1)},t.getDeviceTime=function(t){var e,a,n="20".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2]),"-").concat(this.bcd2String(t[3])," ").concat(this.bcd2String(t[4]),":").concat(this.bcd2String(t[5]),":").concat(this.bcd2String(t[6])),r="".concat(this.bcd2String(t[9]),".").concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]));return(e={})[pt.DataType]=vt.GetDeviceTime,e[pt.End]=!0,e[pt.Data]=((a={})[pt.DeviceTime]=n,a[pt.GPSTime]=r,a),e},t.int2Ascll=function(t){if(t<0||t>255)throw new Error("Value must be between 0 and 255");return String.fromCharCode(t)},t.getGpsTime=function(t){return"".concat(this.bcd2String(t[9]),".").concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]))},t.getUserInfo=function(t){for(var e,a,n=new Array(6).fill(0),r=0;r<5;r++)n[r]=this.hexByte2Int(t[r+1],0);var i="";for(r=6;r<12;r++)0!==t[r]&&(i+=String.fromCharCode(this.hexByte2Int(t[r],0)));return(e={})[pt.DataType]=vt.GetPersonalInfo,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Gender]=n[0],a[pt.Age]=n[1],a[pt.Height]=n[2],a[pt.Weight]=n[3],a[pt.Stride]=n[4],a[pt.KUserDeviceId]=i,a),e},t.getDeviceInfo=function(t,e){var a,n,r,i,c,o;switch(void 0===e&&(e="2208"),e){case"2025":var s=t[8]<<8|t[7],h={enableFlag:Boolean(s&mt.ENABLE_FLAG),call:Boolean(s&mt.CALL),sms:Boolean(s&mt.SMS),wechat:Boolean(s&mt.WECHAT),facebook:Boolean(s&mt.FACEBOOK),instagram:Boolean(s&mt.INSTAGRAM),skype:Boolean(s&mt.SKYPE),telegram:Boolean(s&mt.TELEGRAM),twitter:Boolean(s&mt.TWITTER),vk:Boolean(s&mt.VK),whatsapp:Boolean(s&mt.WHATSAPP),qq:Boolean(s&mt.QQ),linkedin:Boolean(s&mt.LINKEDIN)};return(a={})[pt.DataType]=vt.GetDeviceInfo,a[pt.End]=!0,a[pt.Data]=((n={})[pt.DistanceUnit]=this.hexByte2Int(t[1],0).toString(),n[pt.TimeUnit]=this.hexByte2Int(t[2],0).toString(),n[pt.StatusOfTheRaisedHandOnscreen]=this.hexByte2Int(t[3],0).toString(),n[pt.TempUnit]=this.hexByte2Int(t[4],0).toString(),n[pt.NightMode]=this.hexByte2Int(t[5],0).toString(),n[pt.ANCSMode]=this.hexByte2Int(t[6],0).toString(),n[pt.ANCSSubStatus]=h,n[pt.KBaseHeart]=this.hexByte2Int(t[9],0).toString(),n[pt.ScreenBrightness]=this.hexByte2Int(t[11],0).toString(),n[pt.Dialinterface]=this.hexByte2Int(t[12],0).toString(),n[pt.SocialDistancedwitch]=this.hexByte2Int(t[13],0).toString(),n[pt.ChineseOrEnglish]=this.hexByte2Int(t[14],0).toString(),n),a;case"V5":return(r={})[pt.DataType]=vt.GetDeviceInfo,r[pt.End]=!0,r[pt.Data]=((i={})[pt.SportEnable]=this.hexByte2Int(t[5],0).toString(),i[pt.HeartEnable]=this.hexByte2Int(t[6],0).toString(),i[pt.HeartDayEnable]=this.hexByte2Int(t[14],0).toString(),i),r;default:return(c={})[pt.DataType]=vt.GetDeviceInfo,c[pt.End]=!0,c[pt.Data]=((o={})[pt.DistanceUnit]=this.hexByte2Int(t[1],0).toString(),o[pt.TimeUnit]=this.hexByte2Int(t[2],0).toString(),o[pt.StatusOfTheRaisedHandOnscreen]=this.hexByte2Int(t[3],0).toString(),o[pt.TempUnit]=this.hexByte2Int(t[4],0).toString(),o[pt.NightMode]=this.hexByte2Int(t[5],0).toString(),o[pt.ANCSMode]=this.hexByte2Int(t[6],0).toString(),o[pt.KBaseHeart]=this.hexByte2Int(t[9],0).toString(),o[pt.ScreenBrightness]=this.hexByte2Int(t[11],0).toString(),o[pt.Dialinterface]=this.hexByte2Int(t[12],0).toString(),o[pt.SocialDistancedwitch]=this.hexByte2Int(t[13],0).toString(),o[pt.ChineseOrEnglish]=this.hexByte2Int(t[14],0).toString(),o),c}},t.getActivityData=function(t){for(var e,a,n=0,r=0,i=0,c=0,o=0,s=1;s<5;s++)n+=this.hexByte2Int(t[s],s-1);for(s=5;s<9;s++)r+=this.hexByte2Int(t[s],s-5);for(s=9;s<13;s++)i+=this.hexByte2Int(t[s],s-9);for(s=13;s<17;s++)c+=this.hexByte2Int(t[s],s-13);for(s=17;s<21;s++)o+=this.hexByte2Int(t[s],s-17);var h=this.hexByte2Int(t[21],0),u=0,l=0;return t.length>22&&(u=this.hexByte2Int(t[22],0)+this.hexByte2Int(t[23],1),t.length>24&&(l=this.hexByte2Int(t[24],0))),(e={})[pt.DataType]=vt.RealTimeStep,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Step]=n.toString(),a[pt.Calories]=(r/100).toFixed(1),a[pt.Distance]=(i/100).toFixed(1),a[pt.ExerciseMinutes]=(c/60).toString(),a[pt.HeartRate]=h.toString(),a[pt.ActiveMinutes]=o.toString(),a[pt.TempData]=u.toFixed(1),a[pt.Blood_oxygen]=l.toString(),a),e},t.getGoal=function(t){for(var e,a,n=0,r=0,i=0,c=0,o=0;o<4;o++)n+=this.hexByte2Int(t[o+1],o);for(o=0;o<=1;o++)r+=this.hexByte2Int(t[o+7],o);for(o=0;o<=1;o++)i+=this.hexByte2Int(t[o+9],o);for(o=0;o<=1;o++)c+=this.hexByte2Int(t[o+11],o);return(e={})[pt.DataType]=vt.GetStepGoal,e[pt.End]=!0,e[pt.Data]=((a={})[pt.StepGoal]=n.toString(),a[pt.DistanceGoal]=r.toString(),a[pt.CalorieGoal]=i.toString(),a[pt.SleepTimeGoal]=c.toString(),a),e},t.getDeviceBattery=function(t){var e,a,n=this.hexByte2Int(t[1],0);return(e={})[pt.DataType]=vt.GetDeviceBatteryLevel,e[pt.End]=!0,e[pt.Data]=((a={})[pt.BatteryLevel]=n.toString(),a),e},t.getDeviceAddress=function(t){var e,a;if(0===t.length)return{};for(var n=[],r=1;r<7;r++){var i=t[r].toString(16).padStart(2,"0");n.push(i)}var c=n.join(":");return(e={})[pt.DataType]=vt.GetDeviceMacAddress,e[pt.End]=!0,e[pt.Data]=((a={})[pt.MacAddress]=c,a),e},t.getDeviceVersion=function(t){var e,a;if(0===t.length)return{};for(var n=[],r=1;r<5;r++)n.push(t[r].toString(16));var i=n.join(".");return(e={})[pt.DataType]=vt.GetDeviceVersion,e[pt.End]=!0,e[pt.Data]=((a={})[pt.DeviceVersion]=i,a),e},t.reset=function(){var t;return(t={})[pt.DataType]=vt.CMD_Reset,t[pt.End]=!0,t},t.mcuReset=function(){var t;return(t={})[pt.DataType]=vt.CMD_MCUReset,t[pt.End]=!0,t},t.notify=function(){var t;return(t={})[pt.DataType]=vt.Notify,t[pt.End]=!0,t},t.getDeviceName=function(t){for(var e,a,n="",r=1;r<15;r++){var i=this.hexByte2Int(t[r],0);0===i||i>127||(n+=String.fromCharCode(i))}return(e={})[pt.DataType]=vt.GetDeviceName,e[pt.End]=!0,e[pt.Data]=((a={})[pt.DeviceName]=n,a),e},t.getAutoHeart=function(t){var e,a,n=this.hexByte2Int(t[7],0)+this.hexByte2Int(t[8],1);return(e={})[pt.DataType]=vt.GetAutomaticHRMonitoring,e[pt.End]=!0,e[pt.Data]=((a={})[pt.WorkMode]=this.hexByte2Int(t[1],0).toString(),a[pt.StartTime]=this.bcd2String(t[2]),a[pt.KHeartStartMinter]=this.bcd2String(t[3]),a[pt.EndTime]=this.bcd2String(t[4]),a[pt.KHeartEndMinter]=this.bcd2String(t[5]),a[pt.Weeks]=this.getByteString(t[6]),a[pt.IntervalTime]=n.toString(),a),e},t.getWeekInt=function(t){for(var e=0,a=0;a<t.length;a++)1===t[a]&&(e+=Math.pow(2,a));return e},t.getByteString=function(t){for(var e=new Array(8).fill(0),a=[],n=0;n<=6;n++)e[n]=1&t,t>>=1,a.push(e[n].toString());return a.join("-")},t.getByteArray=function(t){for(var e=new Array(8).fill(0),a="",n=0;n<=7;n++)e[n]=1&t,t>>=1,a+=e[n];return a},t._hexByte2Int=function(t,e){return t<<8*e},t._bcd2String=function(t){var e=15&t;return"".concat(t>>4&15).concat(e)},t.getActivityAlarm=function(t){var e,a,n=((e={})[pt.StartTimeHour]=this._bcd2String(t[1]),e[pt.StartTimeMin]=this._bcd2String(t[2]),e[pt.EndTimeHour]=this._bcd2String(t[3]),e[pt.EndTimeMin]=this._bcd2String(t[4]),e[pt.Week]=this.getByteString(t[5]),e[pt.IntervalTime]=this._hexByte2Int(t[6],0).toString(),e[pt.LeastSteps]=this._hexByte2Int(t[7],0).toString(),e[pt.OpenOrClose]=this._hexByte2Int(t[8],0).toString(),e);return(a={})[pt.DataType]=vt.GetSedentaryReminder,a[pt.End]=!0,a[pt.Data]=n,a},t.getTotalStepData=function(t){var e,a;console.log("total:",t);var n=((e={})[pt.DataType]=vt.GetTotalActivityData,e[pt.End]=!1,e[pt.Data]=[],e),r=this.getStepCount(t),i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){var s=1+(o+1)*r;s<i&&255===t[s]&&(n[pt.End]=!0);for(var h="20".concat(this._bcd2String(t[2+o*r]),".").concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r])),u=0,l=0;l<4;l++)u+=this._hexByte2Int(t[5+l+o*r],l);var g=0;for(l=0;l<4;l++)g+=this._hexByte2Int(t[9+l+o*r],l);var d=0;for(l=0;l<4;l++)d+=this._hexByte2Int(t[13+l+o*r],l);var S=0;for(l=0;l<4;l++)S+=this._hexByte2Int(t[17+l+o*r],l);var y=26==r?this._hexByte2Int(t[21+o*r],0):this._hexByte2Int(t[21+o*r],0)+this._hexByte2Int(t[22+o*r],1),f=0;for(l=0;l<4;l++)f+=this._hexByte2Int(t[r-4+l+o*r],l);n[pt.Data].push(((a={})[pt.Date]=h,a[pt.Step]=u.toString(),a[pt.ExerciseMinutes]=g.toString(),a[pt.Calories]=(S/100).toFixed(1),a[pt.Distance]=(d/100).toFixed(1),a[pt.Goal]=y.toString(),a[pt.ActiveMinutes]=f,a))}return n},t.getDetailData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetDetailActivityData,e[pt.End]=!1,e[pt.Data]=[],e),r=t.length,i=Math.floor(r/25);if(0===i)return n[pt.End]=!0,n;for(var c=0;c<i;c++){255===t[r-1]&&(n[pt.End]=!0);for(var o="20".concat(this._bcd2String(t[3+25*c]),".").concat(this._bcd2String(t[4+25*c]),".").concat(this._bcd2String(t[5+25*c])," ").concat(this._bcd2String(t[6+25*c]),":").concat(this._bcd2String(t[7+25*c]),":").concat(this._bcd2String(t[8+25*c])),s=0,h=0;h<2;h++)s+=this._hexByte2Int(t[9+h+25*c],h);var u=0;for(h=0;h<2;h++)u+=this._hexByte2Int(t[11+h+25*c],h);var l=0;for(h=0;h<2;h++)l+=this._hexByte2Int(t[13+h+25*c],h);var g=[];for(h=0;h<10;h++)g.push(this._hexByte2Int(t[15+h+25*c],0).toString());n[pt.Data].push(((a={})[pt.Date]=o,a[pt.KDetailMinterStep]=s.toString(),a[pt.Calories]=(u/100).toFixed(2),a[pt.Distance]=(l/100).toFixed(2),a[pt.ArraySteps]=g.join(" "),a))}return n},t.getSleepData=function(t){var e,a,n,r=t.length,i=((e={})[pt.DataType]=vt.GetDetailSleepData,e[pt.End]=!1,e[pt.Data]=[],e),c=255===t[t.length-1]&&t[t.length-2]===V;if(c&&(i[pt.End]=!0),130===r||c&&132===r){for(var o="20".concat(this._bcd2String(t[3]),"-").concat(this._bcd2String(t[4]),"-").concat(this._bcd2String(t[5])," ").concat(this._bcd2String(t[6]),":").concat(this._bcd2String(t[7]),":").concat(this._bcd2String(t[8])),s=this._hexByte2Int(t[9],0),h=[],u=0;u<s;u++)h.push(this._hexByte2Int(t[10+u],0).toString());i[pt.Data].push(((a={})[pt.Date]=o,a[pt.ArraySleep]=h.join(" "),a[pt.sleepUnitLength]="1",a))}else{var l=Math.floor(r/34);if(0===l)return i[pt.End]=!0,i;for(var g=0;g<l;g++){for(o="20".concat(this._bcd2String(t[3+34*g]),"-").concat(this._bcd2String(t[4+34*g]),"-").concat(this._bcd2String(t[5+34*g])," ").concat(this._bcd2String(t[6+34*g]),":").concat(this._bcd2String(t[7+34*g]),":").concat(this._bcd2String(t[8+34*g])),s=this._hexByte2Int(t[9+34*g],0),h=[],u=0;u<s;u++)h.push(this._hexByte2Int(t[10+u+34*g],0).toString());i[pt.Data].push(((n={})[pt.Date]=o,n[pt.ArraySleep]=h.join(" "),n[pt.sleepUnitLength]="5",n))}}return i},t.getSleepActivityLevelsData=function(t){var e,a=t.length,n=((e={})[pt.DataType]=vt.GetRealTimeTemperatureCorrection,e),r=[];n[pt.Data]=r;var i=255===t[t.length-1]&&t[t.length-2]===ft;if(i&&(n[pt.End]=!0),130===a||i&&132===a){var c={},o="20".concat(this._bcd2String(t[3]),"-").concat(this._bcd2String(t[4]),"-").concat(this._bcd2String(t[5])," ").concat(this._bcd2String(t[6]),":").concat(this._bcd2String(t[7]),":").concat(this._bcd2String(t[8]));c[pt.Date]=o;for(var s=this._hexByte2Int(t[9],0),h=[],u=0;u<s;u++){var l=t[10+u],g=l>>4&15,d=15&l;h.push(g,d)}for(var S="",y=10+s;y<t.length;y++)S+=this._hexByte2Int(t[y],0),y!==t.length-1&&(S+=" ");var f="";for(u=0;u<h.length;u++)f+=h[u],u!==h.length-1&&(f+=" ");c[pt.ArraySleep]=f,c[pt.ActivityArray]=S,c[pt.sleepUnitLength]="1",r.push(c)}return n},t.getAutoBloodOxygen=function(t){var e,a,n=((e={})[pt.DataType]=vt.AutoBloodOxygen,e[pt.End]=!1,e[pt.Data]=[],e),r=10,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),h=this._hexByte2Int(t[9+10*o],0).toString();n[pt.Data].push(((a={})[pt.Date]=s,a[pt.Blood_oxygen]=h,a))}return n},t.getBloodoxygen=function(t){var e,a,n=((e={})[pt.DataType]=vt.Blood_oxygen,e[pt.End]=!1,e[pt.Data]=[],e),r=10,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),h=this._hexByte2Int(t[9+10*o],0).toString();n[pt.Data].push(((a={})[pt.Date]=s,a[pt.Blood_oxygen]=h,a))}return n},t.getHeartData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetDynamicHR,e[pt.End]=!1,e[pt.Data]=[],e),r=24,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);for(var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),h=[],u=0;u<15;u++)h.push(this._hexByte2Int(t[9+u+o*r],0).toString());n[pt.Data].push(((a={})[pt.Date]=s,a[pt.ArrayDynamicHR]=h.join(" "),a))}return n},t.getOnceHeartData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetStaticHR,e[pt.End]=!1,e[pt.Data]=[],e),r=t.length,i=Math.floor(r/10);if(0===i||1===i&&153===t[1])return n[pt.End]=!0,n;for(var c=0;c<i;c++){255===t[r-1]&&(n[pt.End]=!0);var o="20".concat(this._bcd2String(t[3+10*c]),".").concat(this._bcd2String(t[4+10*c]),".").concat(this._bcd2String(t[5+10*c])," ").concat(this._bcd2String(t[6+10*c]),":").concat(this._bcd2String(t[7+10*c]),":").concat(this._bcd2String(t[8+10*c])),s=this._hexByte2Int(t[9+10*c],0).toString();n[pt.Data].push(((a={})[pt.Date]=o,a[pt.StaticHR]=s,a))}return n},t.getHrvTestData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetHRVData,e[pt.End]=!1,e[pt.Data]=[],e),r=15,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;255===t[t.length-1]&&(n[pt.End]=!0);for(var o=0;o<c;o++){var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),h=this.hexByte2Int(t[9+o*r],0).toString(),u=this.hexByte2Int(t[10+o*r],0).toString(),l=this.hexByte2Int(t[11+o*r],0).toString(),g=this.hexByte2Int(t[12+o*r],0).toString(),d=this.hexByte2Int(t[13+o*r],0).toString(),S=this.hexByte2Int(t[14+o*r],0).toString();n[pt.Data].push(((a={})[pt.Date]=s,a[pt.HRV]=h,a[pt.VascularAging]=u,a[pt.HeartRate]=l,a[pt.Stress]=g,a[pt.highBP]=d,a[pt.lowBP]=S,a))}return n},t.getClockData=function(t){var e,a;console.log("getClockData:",t);var n=((e={})[pt.DataType]=vt.GetAlarmClock,e[pt.End]=!1,e[pt.Data]=[],e),r=41,i=t.length,c=!1,o=Math.floor(i/r);if(0===o)return n[pt.End]=!0,n;153==t[1]&&16==i&&(c=!0),n[pt.IsDeleteData]=c;for(var s=0;s<o;s++){var h=1+(s+1)*r;h<i&&255===t[h]&&(n[pt.End]=!0);for(var u=this.hexByte2Int(t[4+s*r],0).toString(),l=this.hexByte2Int(t[5+s*r],0).toString(),g=this.hexByte2Int(t[6+s*r],0).toString(),d=this.bcd2String(t[7+s*r]),S=this.bcd2String(t[8+s*r]),y=this.hexByte2Int(t[9+s*r],0),f=this.hexByte2Int(t[10+s*r],0),D="",v=0;v<f;v++){var p=t[11+v+s*r];0!==p&&(D+=this.int2Ascll(this.hexByte2Int(p,0)))}n[pt.Data].push(((a={})[pt.KAlarmId]=u,a[pt.OpenOrClose]=l,a[pt.ClockType]=g,a[pt.ClockTime]=d,a[pt.KAlarmMinter]=S,a[pt.Week]=y,a[pt.KAlarmContent]=D,a[pt.KAlarmLength]=f.toString(),a))}return n},t.getTempDataer=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetAxillaryTemperatureDataWithMode,e[pt.End]=!1,e[pt.Data]=[],e),r=11,i=t.length,c=Math.floor(i/r);if(0===c||255===t[i-1])return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),h=this.hexByte2Int(t[9+o*r],0)+this.hexByte2Int(t[10+o*r],1);n[pt.Data].push(((a={})[pt.Date]=s,a[pt.axillaryTemperature]=(.1*h).toFixed(1),a))}return n},t.getQrCode=function(t,e){var a,n,r,i;return e?((a={})[pt.DataType]=vt.EnterQrCode,a[pt.End]=!0,a[pt.Data]={},a):128===t[1]||129===t[1]?((n={})[pt.DataType]=vt.QrCodeBandBack,n[pt.End]=!0,n[pt.Data]=((r={})[pt.Band]=129===t[1]?"1":"0",r),n):((i={})[pt.DataType]=vt.ExitQrCode,i[pt.End]=!0,i[pt.Data]={},i)},t.getTempData=function(t){var e,a,n=((e={})[pt.DataType]=vt.Temperature_history,e[pt.End]=!1,e[pt.Data]=[],e),r=11,i=t.length,c=Math.floor(i/r);if(0===c||255===t[i-1]||1===c&&153===t[1])return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),h=this.hexByte2Int(t[9+o*r],0)+this.hexByte2Int(t[10+o*r],1);n[pt.Data].push(((a={})[pt.Date]=s,a[pt.temperature]=(.1*h).toFixed(1),a))}return n},t.getExerciseData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetActivityModeData,e[pt.End]=!1,e[pt.Data]=[],e),r=25,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){var s=1+(o+1)*r;s<i&&o===c-1&&255===t[s]&&(n[pt.End]=!0);for(var h="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),u=this.hexByte2Int(t[9+o*r],0).toString(),l=this.hexByte2Int(t[10+o*r],0).toString(),g=this.getData(2,11+o*r,t),d=this.getData(2,13+o*r,t),S=this.hexByte2Int(t[15+o*r],0),y=this.hexByte2Int(t[16+o*r],0),f=new Array(4).fill(0),D=0;D<4;D++)f[3-D]=t[17+D+o*r];var v=new Array(4).fill(0);for(D=0;D<4;D++)v[3-D]=t[21+D+o*r];var p=this.getFloat(f,0),m=this.getFloat(v,0);n[pt.Data].push(((a={})[pt.Date]=h,a[pt.ActivityMode]=u,a[pt.HeartRate]=l,a[pt.ActiveMinutes]=g.toString(),a[pt.Step]=d.toString(),a[pt.Pace]="".concat(S.toString(16),"'").concat(y.toString(16)),a[pt.Distance]=m.toFixed(2),a[pt.Calories]=p.toFixed(1),a))}return n},t.getActivityExerciseData=function(t){for(var e,a,n=0,r=0,i=new Array(4).fill(0),c=0;c<4;c++)n+=this.hexByte2Int(t[c+2],c),i[3-c]=t[c+6],r+=this.hexByte2Int(t[c+10],c);var o=this.hexByte2Int(t[1],0),s=this.getFloat(i,0),h=0;if(t.length>=18){var u=[0,0,0,0];for(c=0;c<4;c++)u[3-c]=t[c+14];h=this.getFloat(u,0)}return(e={})[pt.DataType]=vt.EnterActivityMode,e[pt.End]=!0,e[pt.Data]=((a={})[pt.HeartRate]=o.toString(),a[pt.Step]=n.toString(),a[pt.Calories]=s.toFixed(1),a[pt.Distance]=h.toFixed(1),a[pt.ActiveMinutes]=r.toString(),a),e},t.setTimeSuccessful=function(t){var e,a;return(e={})[pt.DataType]=vt.SetDeviceTime,e[pt.End]=!0,e[pt.Data]=((a={})[pt.KPhoneDataLength]=this.hexByte2Int(t[1],0).toString(),a),e},t.getData=function(t,e,a){for(var n=0,r=0;r<t;r++)n+=this.hexByte2Int(a[r+e],r);return n},t.getFloat=function(t,e){return this.intBitToDouble(this.getInt(t,e))},t.getInt=function(t,e){return(255&t[e])<<24|(255&t[e+1])<<16|(255&t[e+2])<<8|255&t[e+3]},t.setMethodSuccessful=function(t){var e;return(e={})[pt.DataType]=t,e[pt.End]=!0,e[pt.Data]={},e},t.getRealTimeTemperatureValue=function(t){var e,a=((e={})[pt.DataType]=vt.GetRealTimeTemperatureCorrection,e[pt.End]=!0,e),n={};a[pt.Data]=n;var r=t[1],i=t[2],c=t[3],o=t[4],s=t[5],h=t[6],u=t[7],l=t[8],g=t[9],d=t[10],S=this._leToInt(r,i)/10,y=this._leToInt(c,o)/10,f=this._leToInt(s,h)/10,D=this._leToInt(u,l)/10,v=this._leToInt(g,d)/10;return n[pt.highestTemp]=S,n[pt.displayTemp]=y,n[pt.ntcTemps]=[f,D,v],a},t._leToInt=function(t,e){return e<<8|t},t.getEcgHistoryData=function(t){var e,a=((e={})[pt.DataType]=vt.ECGdata,e[pt.End]=!1,e[pt.Data]={},e),n=t.length;if(n>=3&&113===t[0]&&255===t[1]&&255===t[2])return a[pt.End]=!0,a;if(113!==t[0]||n<3)return a;var r=this.hexByte2Int(t[1],0)+this.hexByte2Int(t[2],1);a[pt.Data][pt.ECGId]=r.toString();var i=3;if(n>=27){var c="20".concat(this.bcd2String(t[i]),"-")+"".concat(this.bcd2String(t[i+1]),"-")+"".concat(this.bcd2String(t[i+2])," ")+"".concat(this.bcd2String(t[i+3]),":")+"".concat(this.bcd2String(t[i+4]),":")+"".concat(this.bcd2String(t[i+5]));a[pt.Data][pt.Date]=c,i+=6;var o=this.hexByte2Int(t[i],0)+this.hexByte2Int(t[i+1],1);a[pt.Data][pt.ECGPointCount]=o.toString(),i+=2,a[pt.Data][pt.HRV]=this.hexByte2Int(t[i++],0).toString(),a[pt.Data][pt.HeartRate]=this.hexByte2Int(t[i++],0).toString(),a[pt.Data][pt.ECGMoodValue]=this.hexByte2Int(t[i++],0).toString(),i+=13}for(var s=[];i+1<n;){var h=this.hexByte2Int(t[i],0)+this.hexByte2Int(t[i+1],1);s.push(h),i+=2}return a[pt.Data][pt.ECGValue]=s,a},t.getEcgDataString=function(t){for(var e=[],a=Math.floor(t.length/2)-1,n=0;n<a;n++){var r=this.hexByte2Int(t[2*n+1],1)+this.hexByte2Int(t[2*n+2],0);r>=32768&&(r-=65536),e.push(r.toString())}return e.join(",")},t.ecgData=function(t){var e,a,n=this.hexByte2Int(t[1],0);return(e={})[pt.DataType]=vt.EcgppGstatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.EcgStatus]=n.toString(),a),e},t.ppgData=function(t){var e,a;return(e={})[pt.DataType]=vt.EcgppGstatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.PPGValue]=t,a),e},t.ecgResult=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetEcgPpgStatus,e[pt.End]=!0,e[pt.Data]={},e);if(3===this.hexByte2Int(t[1],0)){var r="20".concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]),".").concat(this.bcd2String(t[12])," ").concat(this.bcd2String(t[13]),":").concat(this.bcd2String(t[14]),":").concat(this.bcd2String(t[15]));n[pt.Data]=((a={})[pt.Date]=r,a[pt.ECGHrvValue]=this.hexByte2Int(t[2],0).toString(),a[pt.ECGAvBlockValue]=this.hexByte2Int(t[3],0).toString(),a[pt.ECGHrValue]=this.hexByte2Int(t[4],0).toString(),a[pt.ECGStreesValue]=this.hexByte2Int(t[5],0).toString(),a[pt.ECGhighBpValue]=this.hexByte2Int(t[6],0).toString(),a[pt.ECGLowBpValue]=this.hexByte2Int(t[7],0).toString(),a[pt.ECGMoodValue]=this.hexByte2Int(t[8],0).toString(),a[pt.ECGBreathValue]=this.hexByte2Int(t[9],0).toString(),a)}return n},t.enterEcg=function(t){var e;return(e={})[pt.DataType]=vt.ENTERECG,e[pt.End]=!0,e[pt.Data]={},e},t.measurementWithType=function(t,e){var a,n,r,i,c,o,s,h;if(t)switch(e[1]){case 1:var u=this.hexByte2Int(e[6],0).toString(),l=this.hexByte2Int(e[7],0).toString();return(a={})[pt.DataType]=vt.MeasurementHrvCallback,a[pt.End]=!0,a[pt.Data]=((n={})[pt.HRV]=this.hexByte2Int(e[4],0),n[pt.highBP]=u,n[pt.lowBP]=l,n),a;case 2:return(r={})[pt.DataType]=vt.MeasurementHeartCallback,r[pt.End]=!0,r[pt.Data]=((i={})[pt.HeartRate]=this.hexByte2Int(e[2],0),i),r;case 3:return(c={})[pt.DataType]=vt.MeasurementOxygenCallback,c[pt.End]=!0,c[pt.Data]=((o={})[pt.Blood_oxygen]=this.hexByte2Int(e[3],0),o),c;case 4:var g=this.hexByte2Int(e[8],0)+this.hexByte2Int(e[9],1);return(s={})[pt.DataType]=vt.MeasurementTempCallback,s[pt.End]=!0,s[pt.Data]=((h={})[pt.temperature]=(.1*g).toFixed(1),h),s}else{var d={1:vt.StopMeasurementHrvCallback,2:vt.StopMeasurementHeartCallback,3:vt.StopMeasurementOxygenCallback,4:vt.StopMeasurementTempCallback};if(d[e[1]])return this.setMethodSuccessful(d[e[1]])}return{}},t.measurementWithTypeV5=function(t,e){if(t)switch(e[1]){case 1:return this.setMethodSuccessful(vt.MeasurementHrvCallback);case 2:return this.setMethodSuccessful(vt.MeasurementHeartCallback);case 3:return this.setMethodSuccessful(vt.MeasurementOxygenCallback)}else switch(e[1]){case 1:return this.setMethodSuccessful(vt.StopMeasurementHrvCallback);case 2:return this.setMethodSuccessful(vt.StopMeasurementHeartCallback);case 3:return this.setMethodSuccessful(vt.StopMeasurementOxygenCallback)}return{}},t.measurementWithTypeV4=function(t,e){if(t)switch(e[1]){case 1:var a={},n={};return a[pt.DataType]=vt.MeasurementHrvCallback,a[pt.End]=!0,a[pt.Data]=n,n[pt.HRV]=this.hexByte2Int(e[4],0),n[pt.Stress]=this.hexByte2Int(e[5],0),n[pt.highBP]=this.hexByte2Int(e[6],0),n[pt.lowBP]=this.hexByte2Int(e[7],0),a;case 2:var r={},i={};return r[pt.DataType]=vt.MeasurementHeartCallback,r[pt.End]=!0,r[pt.Data]=i,i[pt.HeartRate]=this.hexByte2Int(e[2],0),r;case 3:var c={},o={};return c[pt.DataType]=vt.MeasurementOxygenCallback,c[pt.End]=!0,c[pt.Data]=o,o[pt.Blood_oxygen]=this.hexByte2Int(e[3],0),c}else switch(e[1]){case 1:return this.setMethodSuccessful(vt.StopMeasurementHrvCallback);case 2:return this.setMethodSuccessful(vt.StopMeasurementHeartCallback);case 3:return this.setMethodSuccessful(vt.StopMeasurementOxygenCallback);case 4:return this.setMethodSuccessful(vt.StopMeasurementTempCallback)}return{}},t.braceletdial=function(t,e){var a,n;return t?((a={})[pt.DataType]=vt.Braceletdial,a[pt.End]=!0,a):((n={})[pt.DataType]=vt.Braceletdialok,n[pt.End]=!0,n[pt.Data]={index:e[1].toString()},n)},t.getSportMode=function(t){for(var e,a=this.hexByte2Int(t[1],0),n=[],r=0;r<a;r++)n.push(this.hexByte2Int(t[r+2],0).toString());return(e={})[pt.DataType]=vt.GetSportMode,e[pt.End]=!0,e[pt.Data]=n.join(","),e},t.gPSControlCommand=function(t){for(var e,a,n="20".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2]),"-").concat(this.bcd2String(t[3])," ").concat(this.bcd2String(t[4]),":").concat(this.bcd2String(t[5]),":").concat(this.bcd2String(t[6])),r=new Array(4).fill(0),i=new Array(4).fill(0),c=0;c<4;c++)r[3-c]=t[9+c],i[3-c]=t[14+c];var o=this.getFloat(r,0).toString(),s=this.getFloat(i,0).toString(),h=this.hexByte2Int(t[18],0);return(e={})[pt.DataType]=vt.GPSControlCommand,e[pt.End]=!0,e[pt.Data]=((a={})[pt.KActivityLocationTime]=n,a[pt.KActivityLocationLatitude]=o,a[pt.KActivityLocationLongitude]=s,a[pt.KActivityLocationCount]=h.toString(),a),e},t.setSocial=function(t){var e;return(e={})[pt.DataType]=vt.SocialdistanceGetting,e[pt.End]=!0,e[pt.Data]={scanInterval:this.hexByte2Int(t[2],0).toString(),scanTime:this.hexByte2Int(t[3],0).toString(),signalStrength:t[4].toString()},e},t.ecgQuality=function(t){var e;return(e={})[pt.DataType]=vt.EcgppG,e[pt.End]=!0,e[pt.Data]={heartValue:this.hexByte2Int(t[1],0).toString(),hrvValue:this.hexByte2Int(t[2],0).toString(),Quality:this.hexByte2Int(t[3],0).toString()},e},t.enterPhotoModeback=function(t){var e,a="";switch(t[1]){case 1:a=0===t[2]?"0":"1";break;case 2:a="2";break;case 3:switch(t[2]){case 1:a="3";break;case 2:a="4";break;case 3:a="5";break;case 4:a="6";break;case 5:a="7"}break;case 4:a="8"}return(e={})[pt.DataType]=vt.DeviceSendDataToAPP,e[pt.End]=!0,e[pt.Data]={type:a},e},t.setNewDeviceInfo=function(t){var e;return(e={})[pt.DataType]=vt.SetNewDeviceInfo,e[pt.End]=!0,e[pt.Data]={},e},t.getNewDeviceInfo=function(t){var e;return(e={})[pt.DataType]=vt.GetNewDeviceInfo,e[pt.End]=!0,e[pt.Data]={KEcg:this.hexByte2Int(t[1],0).toString()},e},t.updateClockSuccessful=function(t){var e,a;return console.log("updateClockSuccessful:",t),(e={})[pt.DataType]=vt.SetAlarmClockWithAllClock,e[pt.End]=!0,e[pt.Data]=((a={})[pt.KClockLast]=this.hexByte2Int(t[t.length-1],0).toString(),a),e},t.setBoolSugarStatus=function(t){var e,a;return(e={})[pt.DataType]=vt.BoolsugarStatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.EcgStatus]=this.hexByte2Int(t[2],0),a),e},t.setBoolSugarValue=function(t){for(var e,a=t.slice(3),n=[],r=0;r<Math.floor(a.length/3);r++){var i=this.hexByte2Int(a[3*r],2)+this.hexByte2Int(a[3*r+1],1)+this.hexByte2Int(a[3*r+2],0);n.push(i)}return(e={})[pt.DataType]=vt.BoolsugarValue,e[pt.End]=!0,e[pt.Data]={timestamp:Math.floor(Date.now()/1e3),ppg:n},e},t.setMethodError=function(t){var e;return(e={})[pt.DataType]=t,e[pt.End]=!1,e[pt.Data]={},e},t.readPregnancyCycle=function(t){var e,a;return(e={})[pt.DataType]=vt.GetPregnancyCycle,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Date]="20".concat(this.bcd2String(t[3]),"-").concat(this.bcd2String(t[4]),"-").concat(this.bcd2String(t[5])),a[pt.Week]=this.hexByte2Int(t[1],0),a[pt.DayOfWeek]=this.hexByte2Int(t[2],0),a),e},t.readWomenHealth=function(t){var e,a;return(e={})[pt.DataType]=vt.GetWomenHealth,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Date]="".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2])),a[pt.WomenHealthPeriod]=this.hexByte2Int(t[3],0),a[pt.WomenHealthLength]=this.hexByte2Int(t[4],0),a),e},t.getTemperatureCorrectionValue=function(t){var e,a,n=[t[3],t[2]],r=this.byteArrayToInt(n);return(e={})[pt.DataType]=vt.CMD_Set_TemperatureCorrection,e[pt.End]=!0,e[pt.Data]=((a={})[pt.TemperatureCorrectionValue]=r.toString(),a),e},t.byteArrayToInt=function(t){return t[0]<<8&65280|255&t[1]},t.getHistoryGpsData=function(t){var e,a=[],n=((e={})[pt.DataType]=vt.Gps,e[pt.End]=!1,e),r=59,i=t.length,c=Math.floor(i/r);if(0===c)return n;255===t[t.length-1]&&90===t[t.length-2]&&(n[pt.End]=!0);for(var o=0;o<c;o++){for(var s={},h="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),u=[],l=[],g=0;g<6;g++){for(var d=new Array(4).fill(0),S=new Array(4).fill(0),y=0;y<4;y++)d[3-y]=t[9+y+o*r+8*g],S[3-y]=t[13+y+o*r+8*g];var f=this.getFloat(d,0).toString(),D=this.getFloat(S,0).toString();u.push(f),l.push(D)}s[pt.Date]=17===h.length?h:"2019.01.01 00:00:00",s[pt.Latitude]=u.join(","),s[pt.Longitude]=l.join(","),a.push(s)}return n[pt.Data]=a,n},t.getPPITestData=function(t){var e,a=((e={})[pt.DataType]=vt.GetPPIData,e[pt.End]=!1,e[pt.Data]=[],e),n=123,r=t.length,i=Math.floor(r/n);if(0===i)return a[pt.End]=!0,a;255===t[t.length-1]&&(a[pt.End]=!0);for(var c=0;c<i;c++){for(var o={},s=new Array(2).fill(0),h=0;h<2;h++)s[1-h]=t[1+h+c*n];for(var u=this.getInt(s,0),l="20".concat(this.bcd2String(t[3+c*n]),".").concat(this.bcd2String(t[4+c*n]),".").concat(this.bcd2String(t[5+c*n])," ").concat(this.bcd2String(t[6+c*n]),":").concat(this.bcd2String(t[7+c*n]),":").concat(this.bcd2String(t[8+c*n])),g=this.hexByte2Int(t[9+c*n],0),d=this.hexByte2Int(t[10+c*n],0).toString(),S=[],y=0;y<56;y++){for(var f=11+2*y,D=new Array(2).fill(0),v=0;v<2;v++)D[1-v]=t[f+v+c*n];var p=this.getFloat(D,0);if(0===p)break;S.push(p)}o[pt.TOTAL_ID]=g.toString(),o[pt.PPI_ID]=d,o[pt.DeviceTime]=l,o[pt.PPI_LIST]=S,o[pt.PPI_NUM]=u,a[pt.Data].push(o)}return a},t.getPPIV5Data=function(t){var e,a,n=t.length,r=((e={})[pt.DataType]=vt.GetPPIData,e[pt.End]=!1,e),i=[];r[pt.Data]=i,t.length>1&&255===t[t.length-1]&&t[t.length-2]===ht&&(r[pt.End]=!0);for(var c=0;c<Math.floor(n/123);c++){for(var o=123*c,s="20".concat(this.bcd2String(t[o+3]),".").concat(this.bcd2String(t[o+4]),".").concat(this.bcd2String(t[o+5])," ").concat(this.bcd2String(t[o+6]),":").concat(this.bcd2String(t[o+7]),":").concat(this.bcd2String(t[o+8])),h=this.hexByte2Int(t[o+9],0),u=this.hexByte2Int(t[o+10],0),l=[],g=0;g<56;g++){var d=t[o+11+2*g],S=t[o+11+2*g+1]<<8|d;if(0===S)break;l.push(S)}i.push(((a={})[pt.Date]=s,a[pt.PPI_LIST]=l,a[pt.PPI_UNIT]="ms",a[pt.PPI_NUM]=h,a[pt.PPI_ID]=u,a))}return r},t.getHrvTimeData=function(t){var e,a;return(e={})[pt.DataType]=vt.GetHrvTimeValue,e[pt.End]=!0,e[pt.Data]=((a={})[pt.HRV_TIME_MODE]=this.hexByte2Int(t[1],0),a[pt.HRV_TIME_Value]=this.hexByte2Int(t[2],0),a),e},t.closeDevices=function(t){var e,a;return(e={})[pt.DataType]=vt.CloseDevices,e[pt.End]=!0,e[pt.Data]=((a={})[pt.RESULT]=!0,a),e},t.getOffCheckStatus=function(t){var e,a;return(e={})[pt.DataType]=vt.GetOffCheckStatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.GET_OFF_TAG]=this.hexByte2Int(t[1],0),a[pt.GET_OFF_STATE]=this.hexByte2Int(t[2],0),a),e},t.getStepCount=function(t){var e=27,a=t.length;return 2!==a&&(a%26==0?e=26:a%27==0?e=27:(a-2)%26==0?e=26:(a-2)%27==0&&(e=27)),e},t.getPPGWaveformData=function(t){var e,a=((e={})[pt.DataType]=vt.PPGRealtime,e[pt.End]=!1,e[pt.Data]=[],e);if(!t||t.length<4)return a;if(57!==t[0])return a;for(var n=2,r=[];n+1<t.length;){var i=this.hexByte2Int(t[n],0)+this.hexByte2Int(t[n+1],1);r.push(i),n+=2}return a[pt.Data]=r,a},t.startDeviceMeasurementWithType=!1,t}();"function"==typeof SuppressedError&&SuppressedError;var Tt=function(){function pt(){}return pt.generateValue=function(t){return new Array(t).fill(0)},pt.hexByte2Int=function(t,e){return(255&t)*Math.pow(256,e)},pt.generateInitValue=function(){return this.generateValue(16)},pt.arrayCopy=function(t,e,a,n,r){for(var i=0;i<r;i++)a[n+i]=t[e+i]},pt.crcValue=function(t){for(var e=0,a=0;a<t.length-1;a++)e+=t[a];t[t.length-1]=255&e},pt.crcDynamicValue=function(t){for(var e=0,a=0,n=t;a<n.length;a++){e+=n[a]}t[t.length-1]=255&e},pt.getBcdValue=function(t){return 16*Math.floor(t/10)+t%10},pt.dataParsingWithData=function(P,J){if(void 0===J&&(J="2208"),!P||0===P.length)return It.setMethodError("Empty data");switch(P[0]){case s:return It.setMethodSuccessful(vt.SetStepGoal);case a:return It.setMethodSuccessful(vt.SetPersonalInfo);case f:break;case y:return It.setMethodSuccessful(vt.SetMotorVibrationWithTimes);case r:return It.setMethodSuccessful(vt.SetDeviceInfo);case v:return It.setMethodSuccessful(vt.SetAutomaticHRMonitoring);case St:return It.setMethodSuccessful(vt.SetSedentaryReminder);case c:return It.setMacSuccessful();case H:return It.setMethodSuccessful(vt.EnterActivityMode);case R:return 0!==P[2]&&0!==P[3]?It.getTemperatureCorrectionValue(P):It.setMethodSuccessful(vt.CMD_Set_TemperatureCorrection);case k:return It.getActivityExerciseData(P);case t:return It.setTimeSuccessful(P);case C:return It.getExerciseData(P);case e:return It.getDeviceTime(P);case n:return It.getUserInfo(P);case i:return It.getDeviceInfo(P,J);case o:return It.getActivityData(P);case h:return It.getGoal(P);case u:return It.getDeviceBattery(P);case l:return It.getDeviceAddress(P);case g:return It.getDeviceVersion(P);case D:return It.getDeviceName(P);case p:return It.getAutoHeart(P);case d:return It.reset();case S:return It.mcuReset();case I:return It.notify();case yt:return It.getActivityAlarm(P);case T:return It.getTotalStepData(P);case B:return It.getDetailData(P);case V:return It.getSleepData(P);case E:return It.getHeartData(P);case x:return It.getOnceHeartData(P);case A:return It.getHrvTestData(P);case b:return It.getClockData(P);case m:return It.updateClockSuccessful(P);case w:return It.setNewDeviceInfo(P);case L:return It.getNewDeviceInfo(P);case O:return It.enterPhotoModeback(P);case W:return It.setMethodSuccessful(vt.EnterPhotoMode);case N:return It.setMethodSuccessful(vt.BackHomeView);case K:return It.ecgQuality(P);case F:case U:break;case Q:return It.setMethodSuccessful(vt.Weather);case j:return It.braceletdial(!1,P);case q:return"V4"===J||"V5"===J?It.getRealTimeTemperatureValue(P):It.setMethodSuccessful(vt.SportMode);case Y:return It.getSportMode(P);case z:return"V4"===J?It.measurementWithTypeV4(this.StartDeviceMeasurementWithType,P):"V5"===J||"2025"===J?It.measurementWithTypeV5(this.StartDeviceMeasurementWithType,P):It.measurementWithType(this.StartDeviceMeasurementWithType,P);case X:return It.gPSControlCommand(P);case Z:return It.getHistoryGpsData(P);case $:return It.setMethodSuccessful(vt.Clear_Bracelet_data);case M:return It.getAutoBloodOxygen(P);case _:return It.getBloodoxygen(P);case G:if(this.isSettingSocial)return It.setMethodSuccessful(vt.SocialdistanceSetting);It.setSocial(P);case tt:return It.setMethodSuccessful(vt.Sos);case et:return It.getTempData(P);case at:return It.getTempDataer(P);case nt:return It.getQrCode(P,!1);case dt:return It.setBoolSugarValue(P);case rt:return It.ecgResult(P);case st:return It.readPregnancyCycle(P);case it:return It.getEcgHistoryData(P);case ot:return 0===P[1]?It.setMethodSuccessful(vt.SetWomenHealth):It.readWomenHealth(P);case ct:var pt=this.hexByte2Int(P[1],0),mt=this.hexByte2Int(P[2],0);if(0!==pt)return It.setMethodSuccessful(vt.ppgStartFailed);switch(mt){case 1:return It.setMethodSuccessful(vt.ppgStartSucessed);case 2:return It.setMethodSuccessful(vt.ppgResult);case 3:return It.setMethodSuccessful(vt.ppgStop);case 4:return It.setMethodSuccessful(vt.ppgMeasurementProgress);case 5:return It.setMethodSuccessful(vt.ppgQuit);default:return It.setMethodSuccessful(vt.ppgStartFailed)}case ht:return"V4"===J||"V5"===J?It.getPPIV5Data(P):It.getPPITestData(P);case ut:return It.getHrvTimeData(P);case lt:return It.closeDevices(P);case gt:return It.getOffCheckStatus(P);case ft:return It.getSleepActivityLevelsData(P);case Dt:return It.getPPGWaveformData(P)}return It.setMethodError(this.getBcdValue(P[0]).toString())},pt.bloodsugarWithMode=function(t,e){var a=this.generateInitValue();return a[0]=ct,a[1]=t,2!==t&&4!==t||(a[2]=e),this.crcValue(a),a},pt.getDetailSleepDataWithMode=function(t){var e=this.generateInitValue();return e[0]=V,e[1]=99===t?153:t,this.crcValue(e),e},pt.insertDateValue=function(t,e){if(e&&!(e.length<=0)){var a=e.split(" "),n=a[0],r=a[1],i=n.split("-").map(Number),c=i[0],o=i[1],s=i[2],h=r.split(":").map(Number),u=h[0],l=h[1],g=h[2];t[4]=this.getBcdValue(c-2e3),t[5]=this.getBcdValue(o),t[6]=this.getBcdValue(s),t[7]=this.getBcdValue(u),t[8]=this.getBcdValue(l),t[9]=this.getBcdValue(g)}},pt.getHRVDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=A,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},pt.getPPIDDataWithMode=function(t){var e=this.generateInitValue();return e[0]=ht,e[1]=99===t?153:0===t?0:1===t?1:2,this.crcValue(e),e},pt.getHrvTestTime=function(){var t=this.generateInitValue();return t[0]=ut,t[1]=0,this.crcValue(t),t},pt.setHrvTestTime=function(t){var e=this.generateInitValue();return e[0]=ut,e[1]=1,e[2]=t,this.crcValue(e),e},pt.closeBlueDevice=function(){var t=this.generateInitValue();return t[0]=lt,this.crcValue(t),t},pt.startBloodSugar=function(){var t=this.generateInitValue();return t[0]=ct,t[1]=1,this.crcValue(t),t},pt.progressBloodSugar=function(t){var e=this.generateInitValue();return e[0]=ct,e[1]=4,e[2]=t,this.crcValue(e),e},pt.endBloodSugar=function(){var t=this.generateInitValue();return t[0]=ct,t[1]=3,this.crcValue(t),t},pt.getTotalActivityDataWithMode=function(t){var e=this.generateInitValue();return e[0]=T,e[1]=99===t?153:0===t?0:1===t?1:2,this.crcValue(e),e},pt.getTotalActivityDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=T,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},pt.getDetailSleepDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=V,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getDetailActivityDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=B,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getTemperature_historyDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=et,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getAxillaryTemperatureDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=at,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},pt.enterActivityMode=function(t,e){var a=this.generateInitValue();return a[0]=H,a[1]=e,a[2]=t,this.crcValue(a),a},pt.sendHeartPackage=function(t,e,a){var n=this.generateInitValue(),r=255&Math.floor(e/60),i=e%60&255,c=new ArrayBuffer(4);new DataView(c).setFloat32(0,t,!0);var o=Array.from(new Uint8Array(c));return n[0]=J,this.arrayCopy(o,0,n,1,o.length),n[5]=r,n[6]=i,n[7]=255&a,this.crcValue(n),n},pt.realTimeStep=function(t,e){var a=this.generateInitValue();return a[0]=o,a[1]=t?1:0,a[2]=e?1:0,this.crcValue(a),a},pt.stopGo=function(){var t=this.generateInitValue();return t[0]=o,t[1]=0,this.crcValue(t),t},pt.setPersonalInfo=function(t){var e=this.generateInitValue();return e[0]=a,e[1]=t.sex,e[2]=t.age,e[3]=t.height,e[4]=t.weight,t.stepLength&&(e[5]=t.stepLength),this.crcValue(e),e},pt.getPersonalInfo=function(){var t=this.generateInitValue();return t[0]=n,this.crcValue(t),t},pt.enterOTA=function(){var t=this.generateInitValue();return t[0]=P,this.crcValue(t),t},pt.getDeviceVersion=function(){var t=this.generateInitValue();return t[0]=g,this.crcValue(t),t},pt.reset=function(){var t=this.generateInitValue();return t[0]=d,this.crcValue(t),t},pt.getDeviceMacAddress=function(){var t=this.generateInitValue();return t[0]=l,this.crcValue(t),t},pt.getDeviceBatteryLevel=function(){var t=this.generateInitValue();return t[0]=u,this.crcValue(t),t},pt.mcuReset=function(){var t=this.generateInitValue();return t[0]=S,this.crcValue(t),t},pt.setDeviceName=function(t){var e=this.generateInitValue(),a=Math.min(t.length,14);e[0]=f;for(var n=0;n<a;n++)e[n+1]=t.charCodeAt(n);for(n=a+1;n<6;n++)e[n]=0;return this.crcValue(e),e},pt.getDeviceName=function(){var t=this.generateInitValue();t[0]=D;for(var e=1;e<6;e++)t[e]=0;return this.crcValue(t),t},pt.setDeviceTime=function(e){var a=this.generateInitValue(),n=e.getFullYear()%100,r=e.getMonth()+1,i=e.getDate(),c=e.getHours(),o=e.getMinutes(),s=e.getSeconds();return a[0]=t,a[1]=this.getBcdValue(n),a[2]=this.getBcdValue(r),a[3]=this.getBcdValue(i),a[4]=this.getBcdValue(c),a[5]=this.getBcdValue(o),a[6]=this.getBcdValue(s),this.crcValue(a),a},pt.getDeviceTime=function(){var t=this.generateInitValue();return t[0]=e,this.crcValue(t),t},pt.setDeviceInfo=function(t){var e=this.generateInitValue();return e[0]=r,e[1]=t.distanceUnit?129:128,e[2]=t.is12Hour?129:128,e[3]=t.handUpLightScreenSwitch?129:128,e[4]=t.fahrenheit?128:129,e[5]=t.nightMode?129:128,e[6]=t.ancs?129:128,e[7]=255&t.ancsMask,e[8]=t.ancsMask>>8&255,e[9]=128|t.baseHeart,e[11]=128+t.screenBrightness,e[12]=128+t.indexDial,e[13]=t.socialDistance?129:128,e[14]=128+t.languages,this.crcValue(e),e},pt.setDeviceInfoV5=function(t,e,a){var n=this.generateInitValue();return n[0]=r,n[6]=t?129:128,n[5]=e?129:128,n[14]=a?129:128,this.crcValue(n),n},pt.setDeviceID=function(t){var e=this.generateInitValue();if(e[0]=c,t.length>=6)for(var a=0;a<6;a++)e[1+a]=t[a];return this.crcValue(e),e},pt.reminderCommand=function(t,e,a){var n=this.generateValue(80);n[0]=I,n[1]=255&t;var r=new TextEncoder,i=Array.from(r.encode(e)).slice(0,60);n[2]=i.length;for(var c=0;c<i.length;c++)n[3+c]=i[c];var o=Array.from(r.encode(a)).slice(0,15);n[63]=o.length;for(c=0;c<o.length;c++)n[64+c]=o[c];return n},pt.updateWeather=function(t){var e=this.generateValue(41);e[0]=Q,e[1]=255&t.weatherCode,e[2]=255&t.currentTemp,e[3]=255&t.maxTemp,e[4]=255&t.minTemp,e[5]=255&t.aqi,e[6]=t.aqi>>8&255;var a=new TextEncoder,n=Array.from(a.encode(t.address)).slice(0,32);e[7]=n.length;for(var r=0;r<n.length;r++)e[8+r]=n[r];return e},pt.mapWeatherCode=function(t){var e=Number(t);return Number.isNaN(e)?153:e>=0&&e<=38?e:153},pt.healthMeasurementWithDataType=function(t,e){this.StartDeviceMeasurementWithType=e;var a=this.generateInitValue();return a[0]=z,a[1]=t,a[2]=e?1:0,this.crcValue(a),a},pt.setBraceletdial=function(t){this.isRuning=!0;var e=this.generateInitValue();return e[0]=j,e[1]=t,this.crcValue(e),e},pt.setAutomaticHRMonitoring=function(t){var e=this.generateInitValue(),a=t.time;return e[0]=v,e[1]=t.open,e[2]=this.getBcdValue(t.startHour),e[3]=this.getBcdValue(t.startMinute),e[4]=this.getBcdValue(t.endHour),e[5]=this.getBcdValue(t.endMinute),e[6]=t.week,e[7]=255&a,e[8]=a>>8&255,e[9]=t.type,this.crcValue(e),e},pt.getAutomaticHRMonitoring=function(t){var e=this.generateInitValue();return e[0]=p,e[1]=t,this.crcValue(e),e},pt.getActivityModeDataWithMode=function(t){var e=this.generateInitValue();return e[0]=C,e[1]=t,this.crcValue(e),e},pt.getStaticHRWithMode=function(t,e){var a=this.generateInitValue();return a[0]=x,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getDynamicHRWithMode=function(t,e){var a=this.generateInitValue();return a[0]=E,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getBloodOxygen=function(t,e){var a=this.generateInitValue();return a[0]=_,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getAutoBloodOxygen=function(t,e){var a=this.generateInitValue();return a[0]=M,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.setStepGoal=function(t,e,a,n,r){var i=this.generateInitValue();return i[0]=s,i[4]=t>>24&255,i[3]=t>>16&255,i[2]=t>>8&255,i[1]=255&t,i[6]=e>>8&255,i[5]=255&e,i[8]=a>>8&255,i[7]=255&a,i[10]=n>>8&255,i[9]=255&n,i[12]=r>>8&255,i[11]=255&r,this.crcValue(i),i},pt.GetStepGoal=function(){var t=this.generateInitValue();return t[0]=h,this.crcValue(t),t},pt.getDeviceInfo=function(){var t=this.generateInitValue();return t[0]=i,this.crcValue(t),t},pt.sendHex=function(t,e){var a=function(t,e,a){if(a||2===arguments.length)for(var n,r=0,i=e.length;r<i;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}([],t,!0);return e&&this.crcDynamicValue(a),a},pt.getAlarmClock=function(){var t=this.generateInitValue();return t[0]=b,this.crcValue(t),t},pt.deleteAllAlarmClock=function(){var t=this.generateInitValue();return t[0]=b,t[1]=153,this.crcValue(t),t},pt.setAlarmClock=function(t){var e,a=this,n=[],r=39*t.length+2;if(r>128)for(var i=Math.floor(128/39),c=Math.ceil(t.length/i),o=0;o<c;o++){for(var s=o===c-1,h=s?t.length-i*o:i,u=new Array(39*h+(s?2:0)).fill(0),l=0;l<h;l++){var g=t[i*o+l],d=g.openOrClose,S=g.clockType,y=g.clockTime,f=g.week,D=g.text,v=39*l;u[v]=35,u[v+1]=t.length,u[v+2]=i*o+l,u[v+3]=d,u[v+4]=S,u[v+5]=this.getBcdValue(y.substring(0,2)),u[v+6]=this.getBcdValue(y.substring(3,5)),u[v+7]=f;var p=this.textToUtf8BytesSafe(D),m=Math.min(p.length,30);u[v+8]=m;for(var I=0;I<m;I++)u[v+9+I]=null!==(e=p[I])&&void 0!==e?e:0}s&&(u[u.length-2]=35,u[u.length-1]=255),n.push(u)}else{var T=new Array(r).fill(0);t.forEach(function(e,n){var r,i=e.openOrClose,c=e.clockType,o=e.clockTime,s=e.week,h=e.text,u=39*n;T[u]=35,T[u+1]=t.length,T[u+2]=n,T[u+3]=i,T[u+4]=c,T[u+5]=a.getBcdValue(o.substring(0,2)),T[u+6]=a.getBcdValue(o.substring(3,5)),T[u+7]=s;var l=a.textToUtf8BytesSafe(h),g=Math.min(l.length,30);T[u+8]=g;for(var d=0;d<g;d++)T[u+9+d]=null!==(r=l[d])&&void 0!==r?r:0}),T[r-2]=35,T[r-1]=255,n.push(T)}return n},pt.textToUtf8BytesSafe=function(t,e){void 0===e&&(e=30);for(var a=[],n=0,r=0;r<t.length;r++){var i=t[r],c=this.utf8EncodeChar(i);if(n+c.length>e)break;a.push.apply(a,c),n+=c.length}for(;a.length<e;)a.push(0);return a},pt.utf8EncodeChar=function(t){var e=t.codePointAt(0);return void 0===e?[]:e<=127?[e]:e<=2047?[192|e>>6,128|63&e]:e<=65535?[224|e>>12,128|e>>6&63,128|63&e]:[240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e]},pt.getSedentaryReminder=function(){var t=this.generateInitValue();return t[0]=yt,this.crcValue(t),t},pt.setSedentaryReminder=function(t){var e=this.generateInitValue();e[0]=St,e[1]=this.getBcdValue(t.startTime_Hour),e[2]=this.getBcdValue(t.startTime_Minutes),e[3]=this.getBcdValue(t.endTime_Hour),e[4]=this.getBcdValue(t.endTime_Minutes);var a=(t.weeks.sunday?1:0)+(t.weeks.monday?2:0)+(t.weeks.tuesday?4:0)+(t.weeks.wednesday?8:0)+(t.weeks.thursday?16:0)+(t.weeks.friday?32:0)+(t.weeks.saturday?64:0);return e[5]=a,e[6]=t.intervalTime,e[7]=t.leastSteps,e[8]=t.mode,this.crcValue(e),e},pt.getRealTimeSleepDataWithMode=function(t){var e=this.generateInitValue();return e[0]=ft,e[1]=t,this.crcValue(e),e},pt.enterTakePhoto=function(){var t=this.generateInitValue();return t[0]=W,this.crcValue(t),t},pt.enterSOS=function(){var t=this.generateInitValue();return t[0]=tt,this.crcValue(t),t},pt.clearBraceletData=function(){var t=this.generateInitValue();return t[0]=$,this.crcValue(t),t},pt.startPPGRealtime=function(t){var e=this.generateInitValue();return e[0]=Dt,e[1]=t?1:0,this.crcValue(e),e},pt.confirmUnbind=function(t){var e=this.generateInitValue();return e[0]=nt,e[1]=t?129:128,this.crcValue(e),e},pt.setSocialSetting=function(t,e,a){this.isSettingSocial=!0;var n=this.generateInitValue();return n[0]=G,n[1]=1,n[2]=t,n[3]=e,n[4]=a,this.crcValue(n),n},pt.getSocialSetting=function(){this.isSettingSocial=!1;var t=this.generateInitValue();return t[0]=G,t[1]=0,this.crcValue(t),t},pt.getEcgHistory=function(t,e){var a=this.generateInitValue();return a[0]=it,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.deleteAllEcgHistory=function(){var t=this.generateInitValue();return t[0]=it,this.crcValue(t),t},pt.DATA_READ_START=0,pt.DATA_READ_CONTINUE=2,pt.DATA_DELETE=99,pt.DistanceMode_MILE=129,pt.DistanceMode_KM=128,pt.TimeMode_12h=129,pt.TimeMode_24h=128,pt.WristOn_Enable=129,pt.WristOn_DisEnable=128,pt.TempUnit_C=128,pt.TempUnit_F=129,pt.TAG="BleSDK",pt.isRuning=!1,pt.ecgopen=!1,pt.read=!1,pt.pregnancyCycleRead=!1,pt.isSettingSocial=!1,pt.StartDeviceMeasurementWithType=!1,pt}();export{mt as ANCS_MASK,vt as BleConst,Tt as BleSDK,pt as DeviceKey,It as ResolveUtil};
2
2
  //# sourceMappingURL=index.esm.js.map