@moshenguo/ms-data-sdk 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/sdk/bleConst.d.ts +23 -2
- package/build/sdk/bleSDK.d.ts +21 -2
- package/build/sdk/models.d.ts +2 -0
- package/build/sdk/resolveUtil.d.ts +17 -3
- package/dist/index.esm.js +1 -1
- package/dist/index.min.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/BleSDK.html +67 -55
- package/docs/classes/ResolveUtil.html +73 -65
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +2 -2
- package/docs/interfaces/MyAutomaticHRMonitoring.html +10 -10
- package/docs/interfaces/MyDeviceInfo.html +14 -12
- package/docs/interfaces/MyPersonalInfo.html +7 -7
- package/docs/interfaces/MySedentaryReminderV4.html +10 -10
- package/docs/interfaces/MyWeeksV4.html +9 -9
- package/docs/modules.html +1 -1
- package/docs/variables/BleConst.html +3 -3
- package/docs/variables/DeviceKey.html +13 -4
- package/package.json +8 -3
package/build/sdk/bleConst.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export declare const DeviceConst: {
|
|
|
73
73
|
CMD_GET_BLOODSUGAR_DATA: number;
|
|
74
74
|
CMD_Set_ActivityAlarm: number;
|
|
75
75
|
CMD_Get_ActivityAlarm: number;
|
|
76
|
+
CMD_Get_SleepActivityData: number;
|
|
76
77
|
};
|
|
77
78
|
/**
|
|
78
79
|
* Bluetooth Feature Constants
|
|
@@ -266,6 +267,7 @@ export declare const BleConst: {
|
|
|
266
267
|
GetSedentaryReminder_V4: string;
|
|
267
268
|
/** Set sedentary reminder V4 */
|
|
268
269
|
SetSedentaryReminder_V4: string;
|
|
270
|
+
GetRealTimeTemperatureCorrection: string;
|
|
269
271
|
};
|
|
270
272
|
/**
|
|
271
273
|
* Device key constants, used for reading/writing device data.
|
|
@@ -342,6 +344,8 @@ export declare const DeviceKey: {
|
|
|
342
344
|
PPI_LIST: string;
|
|
343
345
|
/** PPI data count */
|
|
344
346
|
PPI_NUM: string;
|
|
347
|
+
/** PPI data unit */
|
|
348
|
+
PPI_UNIT: string;
|
|
345
349
|
/** HRV time mode */
|
|
346
350
|
HRV_TIME_MODE: string;
|
|
347
351
|
/** HRV time value */
|
|
@@ -362,6 +366,8 @@ export declare const DeviceKey: {
|
|
|
362
366
|
TempUnit: string;
|
|
363
367
|
/** Night mode switch */
|
|
364
368
|
NightMode: string;
|
|
369
|
+
/** ANCS mode switch */
|
|
370
|
+
ANCSMode: string;
|
|
365
371
|
/** Base heart rate */
|
|
366
372
|
KBaseHeart: string;
|
|
367
373
|
/** Screen brightness (0-100) */
|
|
@@ -406,6 +412,8 @@ export declare const DeviceKey: {
|
|
|
406
412
|
ArraySteps: string;
|
|
407
413
|
/** Sleep array */
|
|
408
414
|
ArraySleep: string;
|
|
415
|
+
/** Activity array */
|
|
416
|
+
ActivityArray: string;
|
|
409
417
|
/** Sleep unit length */
|
|
410
418
|
sleepUnitLength: string;
|
|
411
419
|
/** Static heart rate */
|
|
@@ -454,9 +462,9 @@ export declare const DeviceKey: {
|
|
|
454
462
|
VascularAging: string;
|
|
455
463
|
/** Stress value */
|
|
456
464
|
Stress: string;
|
|
457
|
-
/**
|
|
465
|
+
/** systolic blood pressure (systolic pressure) */
|
|
458
466
|
highBP: string;
|
|
459
|
-
/**
|
|
467
|
+
/** Blood Pressure Diastolic (Relaxation Pressure) */
|
|
460
468
|
lowBP: string;
|
|
461
469
|
/** ECG status */
|
|
462
470
|
EcgStatus: string;
|
|
@@ -492,4 +500,17 @@ export declare const DeviceKey: {
|
|
|
492
500
|
TextLength: string;
|
|
493
501
|
/** Whether to delete data */
|
|
494
502
|
IsDeleteData: string;
|
|
503
|
+
/** Whether to delete data */
|
|
504
|
+
SportEnable: string;
|
|
505
|
+
/** Whether to delete data */
|
|
506
|
+
HeartEnable: string;
|
|
507
|
+
/** Whether to delete data */
|
|
508
|
+
HeartDayEnable: string;
|
|
509
|
+
/** Final temperature value */
|
|
510
|
+
highestTemp: string;
|
|
511
|
+
/** Display temperature */
|
|
512
|
+
displayTemp: string;
|
|
513
|
+
/** ntc temperature*/
|
|
514
|
+
ntcTemps: string;
|
|
495
515
|
};
|
|
516
|
+
export type DeviceType = '2208' | '2208A' | 'V4' | 'V5';
|
package/build/sdk/bleSDK.d.ts
CHANGED
|
@@ -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.
|
|
@@ -30,11 +31,11 @@ export declare class BleSDK {
|
|
|
30
31
|
private static crcDynamicValue;
|
|
31
32
|
private static getBcdValue;
|
|
32
33
|
/**
|
|
33
|
-
* Data parsing method
|
|
34
|
+
* Data parsing method;All returned data resembles a dictionary type. Use `data_type` to retrieve corresponding data—e.g., `GetDetailSleepData` indicates sleep data. `data` represents specific data, which is an array (possibly containing dictionaries). Each array element is a dictionary representing a data point. `end` indicates whether data collection is complete: `true` means finished, `false` means incomplete.
|
|
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
|
/**
|
|
@@ -282,6 +283,14 @@ export declare class BleSDK {
|
|
|
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[];
|
|
285
294
|
/**
|
|
286
295
|
* Health measurement control
|
|
287
296
|
*
|
|
@@ -421,5 +430,15 @@ export declare class BleSDK {
|
|
|
421
430
|
* @return {*} {number[]} Command packet to send to the firmware
|
|
422
431
|
*/
|
|
423
432
|
static setSedentaryReminder(reminder: MySedentaryReminderV4): number[];
|
|
433
|
+
/**
|
|
434
|
+
*
|
|
435
|
+
* Get detailed sleep data + activity level
|
|
436
|
+
* @param {number} mode 0: Read the most recent sleep detail data
|
|
437
|
+
* 1: Read sleep detail data at the specified position.
|
|
438
|
+
2: Continue reading the next segment of data from the last read position.
|
|
439
|
+
* 0x99: Delete sleep detail data.
|
|
440
|
+
* @return {*} {number[]} Command packet to send to the device
|
|
441
|
+
*/
|
|
442
|
+
static getRealTimeSleepDataWithMode(mode: number): number[];
|
|
424
443
|
}
|
|
425
444
|
export default BleSDK;
|
package/build/sdk/models.d.ts
CHANGED
|
@@ -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
|
|
@@ -146,11 +148,17 @@ export declare class ResolveUtil {
|
|
|
146
148
|
*/
|
|
147
149
|
static getDetailData(value: number[]): any;
|
|
148
150
|
/**
|
|
149
|
-
* Sleep Data Analysis
|
|
151
|
+
* Sleep Data Analysis,data represents the specific data, which is an array. Array elements are dictionaries. ArraySleep indicates sleep state (1: Deep Sleep, 2: Light Sleep, 3: REM, other numbers: Awake). date indicates sleep duration. sleepUnitLength represents the unit, specifying how many minutes each ArraySleep data point represents. 1 indicates 1 minute.
|
|
150
152
|
* @param value
|
|
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,6 +248,8 @@ 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
|
|
@@ -278,6 +288,8 @@ export declare class ResolveUtil {
|
|
|
278
288
|
* @returns
|
|
279
289
|
*/
|
|
280
290
|
static measurementWithType(flag: boolean, value: number[]): any;
|
|
291
|
+
static measurementWithTypeV5(flag: boolean, value: number[]): Record<string, any>;
|
|
292
|
+
static measurementWithTypeV4(flag: boolean, value: number[]): Record<string, any>;
|
|
281
293
|
/**
|
|
282
294
|
* Smartband watch face settings
|
|
283
295
|
* @param isRunning
|
|
@@ -340,7 +352,7 @@ export declare class ResolveUtil {
|
|
|
340
352
|
*/
|
|
341
353
|
static setBoolSugarStatus(value: number[]): any;
|
|
342
354
|
/**
|
|
343
|
-
*
|
|
355
|
+
* Obtain blood glucose data
|
|
344
356
|
* @param value
|
|
345
357
|
* @returns
|
|
346
358
|
*/
|
|
@@ -382,6 +394,7 @@ export declare class ResolveUtil {
|
|
|
382
394
|
* @returns
|
|
383
395
|
*/
|
|
384
396
|
static getPPITestData(value: number[]): any;
|
|
397
|
+
static getPPIV5Data(value: number[]): any;
|
|
385
398
|
/**
|
|
386
399
|
* Acquire HRV measurement time data
|
|
387
400
|
* @param value
|
|
@@ -400,4 +413,5 @@ export declare class ResolveUtil {
|
|
|
400
413
|
* @returns
|
|
401
414
|
*/
|
|
402
415
|
static getOffCheckStatus(value: number[]): any;
|
|
416
|
+
static getStepCount(value: number[]): number;
|
|
403
417
|
}
|
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:return(a={})[vt.DataType]=ft.MeasurementHrvCallback,a[vt.End]=!0,a[vt.Data]=((n={})[vt.HRV]=this.hexByte2Int(e[4],0),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 h=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*h).toFixed(1),u),s}else{var l={1:ft.StopMeasurementHrvCallback,2:ft.StopMeasurementHeartCallback,3:ft.StopMeasurementOxygenCallback,4:ft.StopMeasurementTempCallback};if(l[e[1]])return this.setMethodSuccessful(l[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,u=75,h=19,l=34,g=39,d=18,S=46,y=54,D=61,f=62,p=42,v=43,m=35,T=77,I=81,B=82,_=83,V=84,M=96,E=102,b=85,x=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,yt=37,Dt=38,ft=107,pt={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"},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",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",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",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",SportEnable:"SportEnable",HeartEnable:"HeartEnable",HeartDayEnable:"HeartDayEnable",highestTemp:"highestTemp",displayTemp:"displayTemp",ntcTemps:"ntcTemps"},mt=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]=pt.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]=pt.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]=pt.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,e){var a,n,r,i;return void 0===e&&(e="2208"),"V5"===e?((a={})[vt.DataType]=pt.GetDeviceInfo,a[vt.End]=!0,a[vt.Data]=((n={})[vt.SportEnable]=this.hexByte2Int(t[5],0).toString(),n[vt.HeartEnable]=this.hexByte2Int(t[6],0).toString(),n[vt.HeartDayEnable]=this.hexByte2Int(t[14],0).toString(),n),a):((r={})[vt.DataType]=pt.GetDeviceInfo,r[vt.End]=!0,r[vt.Data]=((i={})[vt.DistanceUnit]=this.hexByte2Int(t[1],0).toString(),i[vt.TimeUnit]=this.hexByte2Int(t[2],0).toString(),i[vt.StatusOfTheRaisedHandOnscreen]=this.hexByte2Int(t[3],0).toString(),i[vt.TempUnit]=this.hexByte2Int(t[4],0).toString(),i[vt.NightMode]=this.hexByte2Int(t[5],0).toString(),i[vt.ANCSMode]=this.hexByte2Int(t[6],0).toString(),i[vt.KBaseHeart]=this.hexByte2Int(t[9],0).toString(),i[vt.ScreenBrightness]=this.hexByte2Int(t[11],0).toString(),i[vt.Dialinterface]=this.hexByte2Int(t[12],0).toString(),i[vt.SocialDistancedwitch]=this.hexByte2Int(t[13],0).toString(),i[vt.ChineseOrEnglish]=this.hexByte2Int(t[14],0).toString(),i),r)},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]=pt.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]=pt.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]=pt.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]=pt.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]=pt.GetDeviceVersion,e[vt.End]=!0,e[vt.Data]=((a={})[vt.DeviceVersion]=i,a),e},t.reset=function(){var t;return(t={})[vt.DataType]=pt.CMD_Reset,t[vt.End]=!0,t},t.mcuReset=function(){var t;return(t={})[vt.DataType]=pt.CMD_MCUReset,t[vt.End]=!0,t},t.notify=function(){var t;return(t={})[vt.DataType]=pt.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]=pt.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]=pt.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]=pt.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]=pt.GetTotalActivityData,e[vt.End]=!1,e[vt.Data]=[],e),r=this.getStepCount(t),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 y=26==r?this._hexByte2Int(t[21+o*r],0):this._hexByte2Int(t[21+o*r],0)+this._hexByte2Int(t[22+o*r],1),D=0;for(l=0;l<4;l++)D+=this._hexByte2Int(t[r-4+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]=y.toString(),a[vt.ActiveMinutes]=D,a))}return n},t.getDetailData=function(t){var e,a,n=((e={})[vt.DataType]=pt.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]=pt.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.getSleepActivityLevelsData=function(t){var e,a=t.length,n=((e={})[vt.DataType]=pt.GetRealTimeTemperatureCorrection,e),r=[];n[vt.Data]=r;var i=255===t[t.length-1]&&t[t.length-2]===ft;if(i&&(n[vt.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[vt.Date]=o;for(var s=this._hexByte2Int(t[9],0),u=[],h=0;h<s;h++){var l=t[10+h],g=l>>4&15,d=15&l;u.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 D="";for(h=0;h<u.length;h++)D+=u[h],h!==u.length-1&&(D+=" ");c[vt.ArraySleep]=D,c[vt.ActivityArray]=S,c[vt.sleepUnitLength]="1",r.push(c)}return n},t.getAutoBloodOxygen=function(t){var e,a,n=((e={})[vt.DataType]=pt.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]=pt.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]=pt.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]=pt.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]=pt.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]=pt.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]),y=this.hexByte2Int(t[9+s*r],0),D=this.hexByte2Int(t[10+s*r],0),f="",p=0;p<D;p++){var v=t[11+p+s*r];0!==v&&(f+=this.int2Ascll(this.hexByte2Int(v,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]=y,a[vt.KAlarmContent]=f,a[vt.KAlarmLength]=D.toString(),a))}return n},t.getTempDataer=function(t){var e,a,n=((e={})[vt.DataType]=pt.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]=pt.EnterQrCode,a[vt.End]=!0,a[vt.Data]={},a):128===t[1]||129===t[1]?((n={})[vt.DataType]=pt.QrCodeBandBack,n[vt.End]=!0,n[vt.Data]=((r={})[vt.Band]=129===t[1]?"1":"0",r),n):((i={})[vt.DataType]=pt.ExitQrCode,i[vt.End]=!0,i[vt.Data]={},i)},t.getTempData=function(t){var e,a,n=((e={})[vt.DataType]=pt.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]=pt.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),y=this.hexByte2Int(t[16+o*r],0),D=new Array(4).fill(0),f=0;f<4;f++)D[3-f]=t[17+f+o*r];var p=new Array(4).fill(0);for(f=0;f<4;f++)p[3-f]=t[21+f+o*r];var v=this.getFloat(D,0),m=this.getFloat(p,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(y.toString(16)),a[vt.Distance]=m.toFixed(2),a[vt.Calories]=v.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),u=0;if(t.length>=18){var h=[0,0,0,0];for(c=0;c<4;c++)h[3-c]=t[c+14];u=this.getFloat(h,0)}return(e={})[vt.DataType]=pt.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.Distance]=u.toFixed(1),a[vt.ActiveMinutes]=r.toString(),a),e},t.setTimeSuccessful=function(t){var e,a;return(e={})[vt.DataType]=pt.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.getRealTimeTemperatureValue=function(t){var e,a=((e={})[vt.DataType]=pt.GetRealTimeTemperatureCorrection,e[vt.End]=!0,e),n={};a[vt.Data]=n;var r=t[1],i=t[2],c=t[3],o=t[4],s=t[5],u=t[6],h=t[7],l=t[8],g=t[9],d=t[10],S=this._leToInt(r,i)/10,y=this._leToInt(c,o)/10,D=this._leToInt(s,u)/10,f=this._leToInt(h,l)/10,p=this._leToInt(g,d)/10;return n[vt.highestTemp]=S,n[vt.displayTemp]=y,n[vt.ntcTemps]=[D,f,p],a},t._leToInt=function(t,e){return e<<8|t},t.getEcgHistoryData=function(t){var e,a=((e={})[vt.DataType]=pt.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]=pt.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]=pt.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]=pt.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]=pt.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]=pt.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]=pt.MeasurementHeartCallback,r[vt.End]=!0,r[vt.Data]=((i={})[vt.HeartRate]=this.hexByte2Int(e[2],0),i),r;case 3:return(c={})[vt.DataType]=pt.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]=pt.MeasurementTempCallback,s[vt.End]=!0,s[vt.Data]=((u={})[vt.temperature]=(.1*g).toFixed(1),u),s}else{var d={1:pt.StopMeasurementHrvCallback,2:pt.StopMeasurementHeartCallback,3:pt.StopMeasurementOxygenCallback,4:pt.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(pt.MeasurementHrvCallback);case 2:return this.setMethodSuccessful(pt.MeasurementHeartCallback);case 3:return this.setMethodSuccessful(pt.MeasurementOxygenCallback)}else switch(e[1]){case 1:return this.setMethodSuccessful(pt.StopMeasurementHrvCallback);case 2:return this.setMethodSuccessful(pt.StopMeasurementHeartCallback);case 3:return this.setMethodSuccessful(pt.StopMeasurementOxygenCallback)}return{}},t.measurementWithTypeV4=function(t,e){if(t)switch(e[1]){case 1:var a={},n={};return a[vt.DataType]=pt.MeasurementHrvCallback,a[vt.End]=!0,a[vt.Data]=n,n[vt.HRV]=this.hexByte2Int(e[4],0),n[vt.Stress]=this.hexByte2Int(e[5],0),n[vt.highBP]=this.hexByte2Int(e[6],0),n[vt.lowBP]=this.hexByte2Int(e[7],0),a;case 2:var r={},i={};return r[vt.DataType]=pt.MeasurementHeartCallback,r[vt.End]=!0,r[vt.Data]=i,i[vt.HeartRate]=this.hexByte2Int(e[2],0),r;case 3:var c={},o={};return c[vt.DataType]=pt.MeasurementOxygenCallback,c[vt.End]=!0,c[vt.Data]=o,o[vt.Blood_oxygen]=this.hexByte2Int(e[3],0),c}else switch(e[1]){case 1:return this.setMethodSuccessful(pt.StopMeasurementHrvCallback);case 2:return this.setMethodSuccessful(pt.StopMeasurementHeartCallback);case 3:return this.setMethodSuccessful(pt.StopMeasurementOxygenCallback);case 4:return this.setMethodSuccessful(pt.StopMeasurementTempCallback)}return{}},t.braceletdial=function(t,e){var a,n;return t?((a={})[vt.DataType]=pt.Braceletdial,a[vt.End]=!0,a):((n={})[vt.DataType]=pt.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]=pt.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]=pt.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]=pt.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]=pt.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]=pt.DeviceSendDataToAPP,e[vt.End]=!0,e[vt.Data]={type:a},e},t.setNewDeviceInfo=function(t){var e;return(e={})[vt.DataType]=pt.SetNewDeviceInfo,e[vt.End]=!0,e[vt.Data]={},e},t.getNewDeviceInfo=function(t){var e;return(e={})[vt.DataType]=pt.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]=pt.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]=pt.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]=pt.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]=pt.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]=pt.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]=pt.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]=pt.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),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 D=this.getFloat(d,0).toString(),f=this.getFloat(S,0).toString();h.push(D),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]=pt.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=[],y=0;y<56;y++){for(var D=11+2*y,f=new Array(2).fill(0),p=0;p<2;p++)f[1-p]=t[D+p+c*n];var v=this.getFloat(f,0);if(0===v)break;S.push(v)}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.getPPIV5Data=function(t){var e,a,n=t.length,r=((e={})[vt.DataType]=pt.GetPPIData,e[vt.End]=!1,e),i=[];r[vt.Data]=i,t.length>1&&255===t[t.length-1]&&t[t.length-2]===ut&&(r[vt.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])),u=this.hexByte2Int(t[o+9],0),h=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={})[vt.Date]=s,a[vt.PPI_LIST]=l,a[vt.PPI_UNIT]="ms",a[vt.PPI_NUM]=u,a[vt.PPI_ID]=h,a))}return r},t.getHrvTimeData=function(t){var e,a;return(e={})[vt.DataType]=pt.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]=pt.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]=pt.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.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.startDeviceMeasurementWithType=!1,t}();"function"==typeof SuppressedError&&SuppressedError;var Tt=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,J){if(void 0===J&&(J="2208"),!P||0===P.length)return mt.setMethodError("Empty data");switch(P[0]){case s:return mt.setMethodSuccessful(pt.SetStepGoal);case a:return mt.setMethodSuccessful(pt.SetPersonalInfo);case D:break;case y:return mt.setMethodSuccessful(pt.SetMotorVibrationWithTimes);case r:return mt.setMethodSuccessful(pt.SetDeviceInfo);case p:return mt.setMethodSuccessful(pt.SetAutomaticHRMonitoring);case yt:return mt.setMethodSuccessful(pt.SetSedentaryReminder);case c:return mt.setMacSuccessful();case H:return mt.setMethodSuccessful(pt.EnterActivityMode);case R:return 0!==P[2]&&0!==P[3]?mt.getTemperatureCorrectionValue(P):mt.setMethodSuccessful(pt.CMD_Set_TemperatureCorrection);case k:return mt.getActivityExerciseData(P);case t:return mt.setTimeSuccessful(P);case C:return mt.getExerciseData(P);case e:return mt.getDeviceTime(P);case n:return mt.getUserInfo(P);case i:return mt.getDeviceInfo(P,J);case o:return mt.getActivityData(P);case u:return mt.getGoal(P);case h:return mt.getDeviceBattery(P);case l:return mt.getDeviceAddress(P);case g:return mt.getDeviceVersion(P);case f:return mt.getDeviceName(P);case v:return mt.getAutoHeart(P);case d:return mt.reset();case S:return mt.mcuReset();case T:return mt.notify();case Dt:return mt.getActivityAlarm(P);case I:return mt.getTotalStepData(P);case B:return mt.getDetailData(P);case _:return mt.getSleepData(P);case V:return mt.getHeartData(P);case b:return mt.getOnceHeartData(P);case A:return mt.getHrvTestData(P);case x:return mt.getClockData(P);case m:return mt.updateClockSuccessful(P);case w:return mt.setNewDeviceInfo(P);case L:return mt.getNewDeviceInfo(P);case O:return mt.enterPhotoModeback(P);case W:return mt.setMethodSuccessful(pt.EnterPhotoMode);case F:return mt.setMethodSuccessful(pt.BackHomeView);case K:return mt.ecgQuality(P);case N:case U:break;case Q:return mt.setMethodSuccessful(pt.Weather);case j:return mt.braceletdial(!1,P);case Y:return"V4"===J||"V5"===J?mt.getRealTimeTemperatureValue(P):mt.setMethodSuccessful(pt.SportMode);case q:return mt.getSportMode(P);case z:return"V4"===J?mt.measurementWithTypeV4(this.StartDeviceMeasurementWithType,P):"V5"===J?mt.measurementWithTypeV5(this.StartDeviceMeasurementWithType,P):mt.measurementWithType(this.StartDeviceMeasurementWithType,P);case X:return mt.gPSControlCommand(P);case Z:return mt.getHistoryGpsData(P);case $:return mt.setMethodSuccessful(pt.Clear_Bracelet_data);case E:return mt.getAutoBloodOxygen(P);case M:return mt.getBloodoxygen(P);case G:return mt.setMethodSuccessful(pt.SocialdistanceSetting);case tt:return mt.setMethodSuccessful(pt.Sos);case et:return mt.getTempData(P);case at:return mt.getTempDataer(P);case nt:return mt.getQrCode(P,!1);case dt:return mt.setBoolSugarStatus(P);case St:return mt.setBoolSugarValue(P);case rt:return mt.ecgResult(P);case st:return mt.readPregnancyCycle(P);case it:return mt.getEcgHistoryData(P);case ot:return 0===P[1]?mt.setMethodSuccessful(pt.SetWomenHealth):mt.readWomenHealth(P);case ct:var vt=this.hexByte2Int(P[1],0),Tt=this.hexByte2Int(P[2],0);if(0!==vt)return mt.setMethodSuccessful(pt.ppgStartFailed);switch(Tt){case 1:return mt.setMethodSuccessful(pt.ppgStartSucessed);case 2:return mt.setMethodSuccessful(pt.ppgResult);case 3:return mt.setMethodSuccessful(pt.ppgStop);case 4:return mt.setMethodSuccessful(pt.ppgMeasurementProgress);case 5:return mt.setMethodSuccessful(pt.ppgQuit);default:return mt.setMethodSuccessful(pt.ppgStartFailed)}case ut:return"V4"===J||"V5"===J?mt.getPPIV5Data(P):mt.getPPITestData(P);case ht:return mt.getHrvTimeData(P);case lt:return mt.closeDevices(P);case gt:return mt.getOffCheckStatus(P);case ft:return mt.getSleepActivityLevelsData(P)}return mt.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]=I,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]=I,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]=B,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]=D;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]=t.ancs?129: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.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},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]=p,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]=v,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]=b,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]=M,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},vt.getAutoBloodOxygen=function(t,e){var a=this.generateInitValue();return a[0]=E,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]=x,this.crcValue(t),t},vt.deleteAllAlarmClock=function(){var t=this.generateInitValue();return t[0]=x,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,y=l.week,D=l.textLength,f=l.text,p=39*h;u[p]=35,u[p+1]=t.length,u[p+2]=r*c+h,u[p+3]=g,u[p+4]=d,u[p+5]=this.getBcdValue(S.substring(0,2)),u[p+6]=this.getBcdValue(S.substring(3,5)),u[p+7]=y,u[p+8]=D;for(var v=0;v<D;v++)u[p+9+v]=f.charCodeAt(v)||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]=Dt,this.crcValue(t),t},vt.setSedentaryReminder=function(t){var e=this.generateInitValue();e[0]=yt,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.getRealTimeSleepDataWithMode=function(t){var e=this.generateInitValue();return e[0]=ft,e[1]=t,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{pt as BleConst,Tt as BleSDK,vt as DeviceKey,mt as ResolveUtil};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|