@moshenguo/ms-data-sdk 0.1.11 → 0.1.12

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.
@@ -183,6 +183,8 @@ export declare const BleConst: {
183
183
  StopMeasurementOxygenCallback: string;
184
184
  /** Stop temperature measurement callback */
185
185
  StopMeasurementTempCallback: string;
186
+ /** ECG measurement callback */
187
+ MeasurementECGCallback: string;
186
188
  /** Watch face setting */
187
189
  Braceletdial: string;
188
190
  /** Watch face set successfully */
@@ -525,4 +527,4 @@ export declare const DeviceKey: {
525
527
  /** ECG Id */
526
528
  ECGId: string;
527
529
  };
528
- export type DeviceType = '2208' | '2208A' | 'V4' | 'V5' | '2025';
530
+ export type DeviceType = '2208' | '2208A' | 'V4' | 'V5' | '2025' | 'V8';
@@ -322,11 +322,21 @@ export declare class BleSDK {
322
322
  /**
323
323
  * Health measurement control
324
324
  *
325
- * @param {number} dataType Measurement type: 0x01 - HRV, 0x02 - Heart rate, 0x03 - Blood oxygen
325
+ * @param {number} dataType Measurement type: 0x01 - HRV, 0x02 - Heart rate, 0x03 - Blood oxygen Ox04 - ECG,
326
326
  * @param {boolean} open 1 to start measurement, 0 to stop measurement
327
+ * @param {number} measurementTime Measurement duration in seconds
327
328
  * @return {*} {number[]} Command packet to send to the firmware
328
329
  */
329
- static healthMeasurementWithDataType(dataType: number, open: boolean): number[];
330
+ static healthMeasurementWithDataType(dataType: number, open: boolean, measurementTime: number | null): number[];
331
+ /**
332
+ *
333
+ *
334
+ * @static ECG real-time waveform
335
+ * @param {boolean} open
336
+ * @return {*} {number[]}
337
+ * @memberof BleSDK
338
+ */
339
+ static realECGWave(open: boolean): number[];
330
340
  /**
331
341
  *
332
342
  * Set the wristband dial mode
@@ -292,6 +292,13 @@ export declare class ResolveUtil {
292
292
  * @returns
293
293
  */
294
294
  static measurementWithType(flag: boolean, value: number[]): any;
295
+ /**
296
+ * Measurement type handling
297
+ * @param flag Enable measurement. true: real-time blood glucose measurement returns
298
+ * @param value Data returned by the firmware
299
+ * @returns
300
+ */
301
+ static measurementWithTypeV8(flag: boolean, value: number[]): any;
295
302
  static measurementWithTypeV5(flag: boolean, value: number[]): Record<string, any>;
296
303
  static measurementWithTypeV4(flag: boolean, value: number[]): Record<string, any>;
297
304
  /**
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,h=75,u=19,l=34,g=39,d=18,S=46,y=54,f=61,D=62,v=42,p=43,m=35,I=77,T=81,B=82,V=83,E=84,_=96,M=102,x=85,b=87,C=92,A=86,G=100,H=25,k=24,P=71,R=56,w=6,L=7,W=32,O=22,N=16,K=131,F=170,U=171,Q=21,j=36,q=20,Y=68,z=40,J=23,X=52,Z=90,$=97,tt=254,et=98,at=101,nt=176,rt=156,it=113,ct=120,ot=28,st=30,ht=99,ut=136,lt=137,gt=138,dt=58,St=37,yt=38,ft=107,Dt=57,vt={GetDeviceTime:"get_device_time",GetPersonalInfo:"get_personal_info",GetDeviceInfo:"get_device_info",RealTimeStep:"real_time_step",GetStepGoal:"get_step_goal",GetDeviceBatteryLevel:"get_device_battery_level",GetDeviceMacAddress:"get_device_mac_address",GetDeviceVersion:"get_device_version",CMD_Reset:"cmd_reset",CMD_MCUReset:"cmd_mcu_reset",Notify:"notify",GetDeviceName:"get_device_name",SetAlarmClockWithAllClock:"set_alarm_clock_with_all_clock",Gps:"GPS",GetPPIData:"GetPPIData",GetHrvTimeValue:"GetHrvTimeValue",CloseDevices:"CloseDevices",GetOffCheckStatus:"GetOffCheckStatus",GetAutomaticHRMonitoring:"GetAutomaticHRMonitoring",GetSedentaryReminder:"GetSedentaryReminder",GetTotalActivityData:"GetTotalActivityData",GetDetailActivityData:"GetDetailActivityData",GetDetailSleepData:"GetDetailSleepData",AutoBloodOxygen:"AutoBloodOxygen",GetDynamicHR:"GetDynamicHR",ECGdata:"ECGdata",GetWomenHealth:"GetWomenHealth",CMD_Set_TemperatureCorrection:"CMD_Set_TemperatureCorrection",GetStaticHR:"GetStaticHR",Blood_oxygen:"Blood_oxygen",GetHRVData:"GetHRVData",GetAxillaryTemperatureDataWithMode:"GetAxillaryTemperatureDataWithMode",EnterQrCode:"EnterQrCode",QrCodeBandBack:"QrCodeBandBack",ExitQrCode:"ExitQrCode",Temperature_history:"Temperature_history",GetActivityModeData:"GetActivityModeData",EnterActivityMode:"EnterActivityMode",SetDeviceTime:"SetDeviceTime",GetAlarmClock:"GetAlarmClock",EcgppGstatus:"EcgppGstatus",GetEcgPpgStatus:"GetEcgPpgStatus",ENTERECG:"ENTERECG",MeasurementHrvCallback:"MeasurementHrvCallback",MeasurementHeartCallback:"MeasurementHeartCallback",MeasurementOxygenCallback:"MeasurementOxygenCallback",MeasurementTempCallback:"MeasurementTempCallback",StopMeasurementHrvCallback:"StopMeasurementHrvCallback",StopMeasurementHeartCallback:"StopMeasurementHeartCallback",StopMeasurementOxygenCallback:"StopMeasurementOxygenCallback",StopMeasurementTempCallback:"StopMeasurementTempCallback",Braceletdial:"Braceletdial",Braceletdialok:"Braceletdialok",GetSportMode:"GetSportMode",GPSControlCommand:"GPSControlCommand",SocialdistanceGetting:"SocialdistanceGetting",EcgppG:"EcgppG",DeviceSendDataToAPP:"DeviceSendDataToAPP",SetNewDeviceInfo:"SetNewDeviceInfo",GetNewDeviceInfo:"GetNewDeviceInfo",BoolsugarStatus:"BoolsugarStatus",BoolsugarValue:"BoolsugarValue",GetPregnancyCycle:"GetPregnancyCycle",SetStepGoal:"SetStepGoal",SetPersonalInfo:"SetPersonalInfo",SetMotorVibrationWithTimes:"SetMotorVibrationWithTimes",SetDeviceInfo:"SetDeviceInfo",SetAutomaticHRMonitoring:"SetAutomaticHRMonitoring",SetSedentaryReminder:"SetSedentaryReminder",EnterPhotoMode:"EnterPhotoMode",BackHomeView:"BackHomeView",Weather:"Weather",SportMode:"SportMode",Clear_Bracelet_data:"Clear_Bracelet_data",SocialdistanceSetting:"SocialdistanceSetting",Sos:"Sos",SetPregnancyCycle:"SetPregnancyCycle",DeleteECGdata:"DeleteECGdata",ECG:"ECG",SetWomenHealth:"SetWomenHealth",ppgStartSucessed:"ppgStartSucessed",ppgResult:"ppgResult",ppgStop:"ppgStop",ppgMeasurementProgress:"ppgMeasurementProgress",ppgQuit:"ppgQuit",ppgStartFailed:"ppgStartFailed",CMD_Set_Mac:"CMD_Set_Mac",CloseECG:"CloseECG",GetAlarmClock_V4:"GetAlarmClock_V4",DeleteAllAlarmClock_V4:"DeleteAllAlarmClock_V4",SetAlarmClock_V4:"SetAlarmClock_V4",GetSedentaryReminder_V4:"GetSedentaryReminder_V4",SetSedentaryReminder_V4:"SetSedentaryReminder_V4",GetRealTimeTemperatureCorrection:"GetRealTimeTemperatureCorrection",PPGRealtime:"PPGRealtime"},pt={DeviceTime:"device_time",GPSTime:"gps_time",DataType:"data_type",End:"end",Data:"data",Gender:"gender",Age:"age",Height:"height",Weight:"weight",Stride:"stride",KUserDeviceId:"k_user_device_id",KClockLast:"k_clock_last",Step:"step",Calories:"calories",Distance:"distance",ExerciseMinutes:"exercise_minutes",HeartRate:"heart_rate",ActiveMinutes:"active_minutes",TempData:"temp_data",Blood_oxygen:"blood_oxygen",StepGoal:"step_goal",DistanceGoal:"distance_goal",CalorieGoal:"calorie_goal",SleepTimeGoal:"sleep_time_goal",BatteryLevel:"battery_level",MacAddress:"mac_address",DeviceVersion:"device_version",DeviceName:"device_name",Date:"date",Latitude:"latitude",Longitude:"longitude",TOTAL_ID:"totalId",PPI_ID:"ppiId",PPI_LIST:"ppiList",PPI_NUM:"ppiNum",PPI_UNIT:"ppiUnit",HRV_TIME_MODE:"hrvTimeMode",HRV_TIME_Value:"hrvTimeValue",RESULT:"result",GET_OFF_TAG:"getOffTag",GET_OFF_STATE:"getOffState",DistanceUnit:"distance_unit",TimeUnit:"time_unit",StatusOfTheRaisedHandOnscreen:"status_of_the_raised_hand_onscreen",TempUnit:"temp_unit",NightMode:"night_mode",ANCSMode:"ANCS_mode",ANCSSubStatus:"ANCS_sub_status",KBaseHeart:"k_base_heart",ScreenBrightness:"screen_brightness",Dialinterface:"dial_interface",SocialDistancedwitch:"social_distance_switch",ChineseOrEnglish:"chinese_or_english",WorkMode:"work_mode",StartTime:"start_time",KHeartStartMinter:"kheart_start_minter",EndTime:"end_time",KHeartEndMinter:"kheart_end_minter",Weeks:"weeks",IntervalTime:"interval_time",StartTimeHour:"StartTimeHour",StartTimeMin:"StartTimeMin",EndTimeHour:"EndTimeHour",EndTimeMin:"EndTimeMin",LeastSteps:"LeastSteps",Week:"week",Goal:"Goal",KDetailMinterStep:"KDetailMinterStep",ArraySteps:"ArraySteps",ArraySleep:"ArraySleep",ActivityArray:"ActivityArray",sleepUnitLength:"sleepUnitLength",StaticHR:"StaticHR",WomenHealthPeriod:"WomenHealthPeriod",WomenHealthLength:"WomenHealthLength",TemperatureCorrectionValue:"TemperatureCorrectionValue",HRV:"HRV",ECGPointCount:"ECGPointCount",ECGMoodValue:"ECGMoodValue",ECGValue:"ECGValue",ArrayDynamicHR:"ArrayDynamicHR",KAlarmId:"KAlarmId",OpenOrClose:"OpenOrClose",ClockType:"ClockType",ClockTime:"ClockTime",KAlarmMinter:"KAlarmMinter",KAlarmContent:"KAlarmContent",KAlarmLength:"KAlarmLength",KAlarmTotal:"KAlarmTotal",KAlarmIndex:"KAlarmIndex",axillaryTemperature:"axillaryTemperature",Band:"Band",temperature:"temperature",ActivityMode:"ActivityMode",Pace:"Pace",KPhoneDataLength:"KPhoneDataLength",VascularAging:"VascularAging",Stress:"Stress",highBP:"highBP",lowBP:"lowBP",EcgStatus:"ecgStatus",PPGValue:"ppgValue",ECGHrvValue:"ecgHrvValue",ECGAvBlockValue:"ecgAvBlockValue",ECGHrValue:"ecgHrValue",ECGStreesValue:"ecgStressValue",ECGhighBpValue:"ecgHighBpValue",ECGLowBpValue:"ecgLowBpValue",ECGBreathValue:"ecgBreathValue",KActivityLocationTime:"activityLocationTime",KActivityLocationLatitude:"activityLocationLatitude",KActivityLocationLongitude:"activityLocationLongitude",KActivityLocationCount:"activityLocationCount",DayOfWeek:"dayOfWeek",Text:"text",TextLength:"textLength",IsDeleteData:"isDeleteData",SportEnable:"SportEnable",HeartEnable:"HeartEnable",HeartDayEnable:"HeartDayEnable",highestTemp:"highestTemp",displayTemp:"displayTemp",ntcTemps:"ntcTemps",ECGId:"ECGId"},mt={CALL:1,SMS:2,WECHAT:4,FACEBOOK:8,INSTAGRAM:16,SKYPE:32,TELEGRAM:64,TWITTER:128,VK:256,WHATSAPP:512,QQ:1024,LINKEDIN:2048,ENABLE_FLAG:16384},It=function(){function t(){}return t.hexByte2Int=function(t,e){return(255&t)*Math.pow(256,e)},t.bcd2String=function(t){var e=15&t;return"".concat((240&t)>>4).concat(e)},t.intList2String=function(t){return t.map(function(t){return t.toString(16).padStart(2,"0").toUpperCase()}).join(" ")},t.intList3String=function(t){return t.map(function(t){return t.toString(16).padStart(2,"0").toLowerCase()}).join(" ")},t.setMacSuccessful=function(){var t;return(t={})[pt.DataType]=vt.CMD_Set_Mac,t[pt.End]=!0,t[pt.Data]={},t},t.intBitToDouble=function(t){var e=new ArrayBuffer(8),a=new DataView(e);return a.setInt32(0,t,!1),a.getFloat32(0,!1)},t.getDeviceTime=function(t){var e,a,n="20".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2]),"-").concat(this.bcd2String(t[3])," ").concat(this.bcd2String(t[4]),":").concat(this.bcd2String(t[5]),":").concat(this.bcd2String(t[6])),r="".concat(this.bcd2String(t[9]),".").concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]));return(e={})[pt.DataType]=vt.GetDeviceTime,e[pt.End]=!0,e[pt.Data]=((a={})[pt.DeviceTime]=n,a[pt.GPSTime]=r,a),e},t.int2Ascll=function(t){if(t<0||t>255)throw new Error("Value must be between 0 and 255");return String.fromCharCode(t)},t.getGpsTime=function(t){return"".concat(this.bcd2String(t[9]),".").concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]))},t.getUserInfo=function(t){for(var e,a,n=new Array(6).fill(0),r=0;r<5;r++)n[r]=this.hexByte2Int(t[r+1],0);var i="";for(r=6;r<12;r++)0!==t[r]&&(i+=String.fromCharCode(this.hexByte2Int(t[r],0)));return(e={})[pt.DataType]=vt.GetPersonalInfo,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Gender]=n[0],a[pt.Age]=n[1],a[pt.Height]=n[2],a[pt.Weight]=n[3],a[pt.Stride]=n[4],a[pt.KUserDeviceId]=i,a),e},t.getDeviceInfo=function(t,e){var a,n,r,i,c,o;switch(void 0===e&&(e="2208"),e){case"2025":var s=t[8]<<8|t[7],h={enableFlag:Boolean(s&mt.ENABLE_FLAG),call:Boolean(s&mt.CALL),sms:Boolean(s&mt.SMS),wechat:Boolean(s&mt.WECHAT),facebook:Boolean(s&mt.FACEBOOK),instagram:Boolean(s&mt.INSTAGRAM),skype:Boolean(s&mt.SKYPE),telegram:Boolean(s&mt.TELEGRAM),twitter:Boolean(s&mt.TWITTER),vk:Boolean(s&mt.VK),whatsapp:Boolean(s&mt.WHATSAPP),qq:Boolean(s&mt.QQ),linkedin:Boolean(s&mt.LINKEDIN)};return(a={})[pt.DataType]=vt.GetDeviceInfo,a[pt.End]=!0,a[pt.Data]=((n={})[pt.DistanceUnit]=this.hexByte2Int(t[1],0).toString(),n[pt.TimeUnit]=this.hexByte2Int(t[2],0).toString(),n[pt.StatusOfTheRaisedHandOnscreen]=this.hexByte2Int(t[3],0).toString(),n[pt.TempUnit]=this.hexByte2Int(t[4],0).toString(),n[pt.NightMode]=this.hexByte2Int(t[5],0).toString(),n[pt.ANCSMode]=this.hexByte2Int(t[6],0).toString(),n[pt.ANCSSubStatus]=h,n[pt.KBaseHeart]=this.hexByte2Int(t[9],0).toString(),n[pt.ScreenBrightness]=this.hexByte2Int(t[11],0).toString(),n[pt.Dialinterface]=this.hexByte2Int(t[12],0).toString(),n[pt.SocialDistancedwitch]=this.hexByte2Int(t[13],0).toString(),n[pt.ChineseOrEnglish]=this.hexByte2Int(t[14],0).toString(),n),a;case"V5":return(r={})[pt.DataType]=vt.GetDeviceInfo,r[pt.End]=!0,r[pt.Data]=((i={})[pt.SportEnable]=this.hexByte2Int(t[5],0).toString(),i[pt.HeartEnable]=this.hexByte2Int(t[6],0).toString(),i[pt.HeartDayEnable]=this.hexByte2Int(t[14],0).toString(),i),r;default:return(c={})[pt.DataType]=vt.GetDeviceInfo,c[pt.End]=!0,c[pt.Data]=((o={})[pt.DistanceUnit]=this.hexByte2Int(t[1],0).toString(),o[pt.TimeUnit]=this.hexByte2Int(t[2],0).toString(),o[pt.StatusOfTheRaisedHandOnscreen]=this.hexByte2Int(t[3],0).toString(),o[pt.TempUnit]=this.hexByte2Int(t[4],0).toString(),o[pt.NightMode]=this.hexByte2Int(t[5],0).toString(),o[pt.ANCSMode]=this.hexByte2Int(t[6],0).toString(),o[pt.KBaseHeart]=this.hexByte2Int(t[9],0).toString(),o[pt.ScreenBrightness]=this.hexByte2Int(t[11],0).toString(),o[pt.Dialinterface]=this.hexByte2Int(t[12],0).toString(),o[pt.SocialDistancedwitch]=this.hexByte2Int(t[13],0).toString(),o[pt.ChineseOrEnglish]=this.hexByte2Int(t[14],0).toString(),o),c}},t.getActivityData=function(t){for(var e,a,n=0,r=0,i=0,c=0,o=0,s=1;s<5;s++)n+=this.hexByte2Int(t[s],s-1);for(s=5;s<9;s++)r+=this.hexByte2Int(t[s],s-5);for(s=9;s<13;s++)i+=this.hexByte2Int(t[s],s-9);for(s=13;s<17;s++)c+=this.hexByte2Int(t[s],s-13);for(s=17;s<21;s++)o+=this.hexByte2Int(t[s],s-17);var h=this.hexByte2Int(t[21],0),u=0,l=0;return t.length>22&&(u=this.hexByte2Int(t[22],0)+this.hexByte2Int(t[23],1),t.length>24&&(l=this.hexByte2Int(t[24],0))),(e={})[pt.DataType]=vt.RealTimeStep,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Step]=n.toString(),a[pt.Calories]=(r/100).toFixed(1),a[pt.Distance]=(i/100).toFixed(1),a[pt.ExerciseMinutes]=(c/60).toString(),a[pt.HeartRate]=h.toString(),a[pt.ActiveMinutes]=o.toString(),a[pt.TempData]=u.toFixed(1),a[pt.Blood_oxygen]=l.toString(),a),e},t.getGoal=function(t){for(var e,a,n=0,r=0,i=0,c=0,o=0;o<4;o++)n+=this.hexByte2Int(t[o+1],o);for(o=0;o<=1;o++)r+=this.hexByte2Int(t[o+7],o);for(o=0;o<=1;o++)i+=this.hexByte2Int(t[o+9],o);for(o=0;o<=1;o++)c+=this.hexByte2Int(t[o+11],o);return(e={})[pt.DataType]=vt.GetStepGoal,e[pt.End]=!0,e[pt.Data]=((a={})[pt.StepGoal]=n.toString(),a[pt.DistanceGoal]=r.toString(),a[pt.CalorieGoal]=i.toString(),a[pt.SleepTimeGoal]=c.toString(),a),e},t.getDeviceBattery=function(t){var e,a,n=this.hexByte2Int(t[1],0);return(e={})[pt.DataType]=vt.GetDeviceBatteryLevel,e[pt.End]=!0,e[pt.Data]=((a={})[pt.BatteryLevel]=n.toString(),a),e},t.getDeviceAddress=function(t){var e,a;if(0===t.length)return{};for(var n=[],r=1;r<7;r++){var i=t[r].toString(16).padStart(2,"0");n.push(i)}var c=n.join(":");return(e={})[pt.DataType]=vt.GetDeviceMacAddress,e[pt.End]=!0,e[pt.Data]=((a={})[pt.MacAddress]=c,a),e},t.getDeviceVersion=function(t){var e,a;if(0===t.length)return{};for(var n=[],r=1;r<5;r++)n.push(t[r].toString(16));var i=n.join(".");return(e={})[pt.DataType]=vt.GetDeviceVersion,e[pt.End]=!0,e[pt.Data]=((a={})[pt.DeviceVersion]=i,a),e},t.reset=function(){var t;return(t={})[pt.DataType]=vt.CMD_Reset,t[pt.End]=!0,t},t.mcuReset=function(){var t;return(t={})[pt.DataType]=vt.CMD_MCUReset,t[pt.End]=!0,t},t.notify=function(){var t;return(t={})[pt.DataType]=vt.Notify,t[pt.End]=!0,t},t.getDeviceName=function(t){for(var e,a,n="",r=1;r<15;r++){var i=this.hexByte2Int(t[r],0);0===i||i>127||(n+=String.fromCharCode(i))}return(e={})[pt.DataType]=vt.GetDeviceName,e[pt.End]=!0,e[pt.Data]=((a={})[pt.DeviceName]=n,a),e},t.getAutoHeart=function(t){var e,a,n=this.hexByte2Int(t[7],0)+this.hexByte2Int(t[8],1);return(e={})[pt.DataType]=vt.GetAutomaticHRMonitoring,e[pt.End]=!0,e[pt.Data]=((a={})[pt.WorkMode]=this.hexByte2Int(t[1],0).toString(),a[pt.StartTime]=this.bcd2String(t[2]),a[pt.KHeartStartMinter]=this.bcd2String(t[3]),a[pt.EndTime]=this.bcd2String(t[4]),a[pt.KHeartEndMinter]=this.bcd2String(t[5]),a[pt.Weeks]=this.getByteString(t[6]),a[pt.IntervalTime]=n.toString(),a),e},t.getWeekInt=function(t){for(var e=0,a=0;a<t.length;a++)1===t[a]&&(e+=Math.pow(2,a));return e},t.getByteString=function(t){for(var e=new Array(8).fill(0),a=[],n=0;n<=6;n++)e[n]=1&t,t>>=1,a.push(e[n].toString());return a.join("-")},t.getByteArray=function(t){for(var e=new Array(8).fill(0),a="",n=0;n<=7;n++)e[n]=1&t,t>>=1,a+=e[n];return a},t._hexByte2Int=function(t,e){return t<<8*e},t._bcd2String=function(t){var e=15&t;return"".concat(t>>4&15).concat(e)},t.getActivityAlarm=function(t){var e,a,n=((e={})[pt.StartTimeHour]=this._bcd2String(t[1]),e[pt.StartTimeMin]=this._bcd2String(t[2]),e[pt.EndTimeHour]=this._bcd2String(t[3]),e[pt.EndTimeMin]=this._bcd2String(t[4]),e[pt.Week]=this.getByteString(t[5]),e[pt.IntervalTime]=this._hexByte2Int(t[6],0).toString(),e[pt.LeastSteps]=this._hexByte2Int(t[7],0).toString(),e[pt.OpenOrClose]=this._hexByte2Int(t[8],0).toString(),e);return(a={})[pt.DataType]=vt.GetSedentaryReminder,a[pt.End]=!0,a[pt.Data]=n,a},t.getTotalStepData=function(t){var e,a;console.log("total:",t);var n=((e={})[pt.DataType]=vt.GetTotalActivityData,e[pt.End]=!1,e[pt.Data]=[],e),r=this.getStepCount(t),i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){var s=1+(o+1)*r;s<i&&255===t[s]&&(n[pt.End]=!0);for(var h="20".concat(this._bcd2String(t[2+o*r]),".").concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r])),u=0,l=0;l<4;l++)u+=this._hexByte2Int(t[5+l+o*r],l);var g=0;for(l=0;l<4;l++)g+=this._hexByte2Int(t[9+l+o*r],l);var d=0;for(l=0;l<4;l++)d+=this._hexByte2Int(t[13+l+o*r],l);var S=0;for(l=0;l<4;l++)S+=this._hexByte2Int(t[17+l+o*r],l);var y=26==r?this._hexByte2Int(t[21+o*r],0):this._hexByte2Int(t[21+o*r],0)+this._hexByte2Int(t[22+o*r],1),f=0;for(l=0;l<4;l++)f+=this._hexByte2Int(t[r-4+l+o*r],l);n[pt.Data].push(((a={})[pt.Date]=h,a[pt.Step]=u.toString(),a[pt.ExerciseMinutes]=g.toString(),a[pt.Calories]=(S/100).toFixed(1),a[pt.Distance]=(d/100).toFixed(1),a[pt.Goal]=y.toString(),a[pt.ActiveMinutes]=f,a))}return n},t.getDetailData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetDetailActivityData,e[pt.End]=!1,e[pt.Data]=[],e),r=t.length,i=Math.floor(r/25);if(0===i)return n[pt.End]=!0,n;for(var c=0;c<i;c++){255===t[r-1]&&(n[pt.End]=!0);for(var o="20".concat(this._bcd2String(t[3+25*c]),".").concat(this._bcd2String(t[4+25*c]),".").concat(this._bcd2String(t[5+25*c])," ").concat(this._bcd2String(t[6+25*c]),":").concat(this._bcd2String(t[7+25*c]),":").concat(this._bcd2String(t[8+25*c])),s=0,h=0;h<2;h++)s+=this._hexByte2Int(t[9+h+25*c],h);var u=0;for(h=0;h<2;h++)u+=this._hexByte2Int(t[11+h+25*c],h);var l=0;for(h=0;h<2;h++)l+=this._hexByte2Int(t[13+h+25*c],h);var g=[];for(h=0;h<10;h++)g.push(this._hexByte2Int(t[15+h+25*c],0).toString());n[pt.Data].push(((a={})[pt.Date]=o,a[pt.KDetailMinterStep]=s.toString(),a[pt.Calories]=(u/100).toFixed(2),a[pt.Distance]=(l/100).toFixed(2),a[pt.ArraySteps]=g.join(" "),a))}return n},t.getSleepData=function(t){var e,a,n,r=t.length,i=((e={})[pt.DataType]=vt.GetDetailSleepData,e[pt.End]=!1,e[pt.Data]=[],e),c=255===t[t.length-1]&&t[t.length-2]===V;if(c&&(i[pt.End]=!0),130===r||c&&132===r){for(var o="20".concat(this._bcd2String(t[3]),"-").concat(this._bcd2String(t[4]),"-").concat(this._bcd2String(t[5])," ").concat(this._bcd2String(t[6]),":").concat(this._bcd2String(t[7]),":").concat(this._bcd2String(t[8])),s=this._hexByte2Int(t[9],0),h=[],u=0;u<s;u++)h.push(this._hexByte2Int(t[10+u],0).toString());i[pt.Data].push(((a={})[pt.Date]=o,a[pt.ArraySleep]=h.join(" "),a[pt.sleepUnitLength]="1",a))}else{var l=Math.floor(r/34);if(0===l)return i[pt.End]=!0,i;for(var g=0;g<l;g++){for(o="20".concat(this._bcd2String(t[3+34*g]),"-").concat(this._bcd2String(t[4+34*g]),"-").concat(this._bcd2String(t[5+34*g])," ").concat(this._bcd2String(t[6+34*g]),":").concat(this._bcd2String(t[7+34*g]),":").concat(this._bcd2String(t[8+34*g])),s=this._hexByte2Int(t[9+34*g],0),h=[],u=0;u<s;u++)h.push(this._hexByte2Int(t[10+u+34*g],0).toString());i[pt.Data].push(((n={})[pt.Date]=o,n[pt.ArraySleep]=h.join(" "),n[pt.sleepUnitLength]="5",n))}}return i},t.getSleepActivityLevelsData=function(t){var e,a=t.length,n=((e={})[pt.DataType]=vt.GetRealTimeTemperatureCorrection,e),r=[];n[pt.Data]=r;var i=255===t[t.length-1]&&t[t.length-2]===ft;if(i&&(n[pt.End]=!0),130===a||i&&132===a){var c={},o="20".concat(this._bcd2String(t[3]),"-").concat(this._bcd2String(t[4]),"-").concat(this._bcd2String(t[5])," ").concat(this._bcd2String(t[6]),":").concat(this._bcd2String(t[7]),":").concat(this._bcd2String(t[8]));c[pt.Date]=o;for(var s=this._hexByte2Int(t[9],0),h=[],u=0;u<s;u++){var l=t[10+u],g=l>>4&15,d=15&l;h.push(g,d)}for(var S="",y=10+s;y<t.length;y++)S+=this._hexByte2Int(t[y],0),y!==t.length-1&&(S+=" ");var f="";for(u=0;u<h.length;u++)f+=h[u],u!==h.length-1&&(f+=" ");c[pt.ArraySleep]=f,c[pt.ActivityArray]=S,c[pt.sleepUnitLength]="1",r.push(c)}return n},t.getAutoBloodOxygen=function(t){var e,a,n=((e={})[pt.DataType]=vt.AutoBloodOxygen,e[pt.End]=!1,e[pt.Data]=[],e),r=10,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),h=this._hexByte2Int(t[9+10*o],0).toString();n[pt.Data].push(((a={})[pt.Date]=s,a[pt.Blood_oxygen]=h,a))}return n},t.getBloodoxygen=function(t){var e,a,n=((e={})[pt.DataType]=vt.Blood_oxygen,e[pt.End]=!1,e[pt.Data]=[],e),r=10,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),h=this._hexByte2Int(t[9+10*o],0).toString();n[pt.Data].push(((a={})[pt.Date]=s,a[pt.Blood_oxygen]=h,a))}return n},t.getHeartData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetDynamicHR,e[pt.End]=!1,e[pt.Data]=[],e),r=24,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);for(var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),h=[],u=0;u<15;u++)h.push(this._hexByte2Int(t[9+u+o*r],0).toString());n[pt.Data].push(((a={})[pt.Date]=s,a[pt.ArrayDynamicHR]=h.join(" "),a))}return n},t.getOnceHeartData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetStaticHR,e[pt.End]=!1,e[pt.Data]=[],e),r=t.length,i=Math.floor(r/10);if(0===i||1===i&&153===t[1])return n[pt.End]=!0,n;for(var c=0;c<i;c++){255===t[r-1]&&(n[pt.End]=!0);var o="20".concat(this._bcd2String(t[3+10*c]),".").concat(this._bcd2String(t[4+10*c]),".").concat(this._bcd2String(t[5+10*c])," ").concat(this._bcd2String(t[6+10*c]),":").concat(this._bcd2String(t[7+10*c]),":").concat(this._bcd2String(t[8+10*c])),s=this._hexByte2Int(t[9+10*c],0).toString();n[pt.Data].push(((a={})[pt.Date]=o,a[pt.StaticHR]=s,a))}return n},t.getHrvTestData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetHRVData,e[pt.End]=!1,e[pt.Data]=[],e),r=15,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;255===t[t.length-1]&&(n[pt.End]=!0);for(var o=0;o<c;o++){var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),h=this.hexByte2Int(t[9+o*r],0).toString(),u=this.hexByte2Int(t[10+o*r],0).toString(),l=this.hexByte2Int(t[11+o*r],0).toString(),g=this.hexByte2Int(t[12+o*r],0).toString(),d=this.hexByte2Int(t[13+o*r],0).toString(),S=this.hexByte2Int(t[14+o*r],0).toString();n[pt.Data].push(((a={})[pt.Date]=s,a[pt.HRV]=h,a[pt.VascularAging]=u,a[pt.HeartRate]=l,a[pt.Stress]=g,a[pt.highBP]=d,a[pt.lowBP]=S,a))}return n},t.getClockData=function(t){var e,a;console.log("getClockData:",t);var n=((e={})[pt.DataType]=vt.GetAlarmClock,e[pt.End]=!1,e[pt.Data]=[],e),r=41,i=t.length,c=!1,o=Math.floor(i/r);if(0===o)return n[pt.End]=!0,n;153==t[1]&&16==i&&(c=!0),n[pt.IsDeleteData]=c;for(var s=0;s<o;s++){var h=1+(s+1)*r;h<i&&255===t[h]&&(n[pt.End]=!0);for(var u=this.hexByte2Int(t[4+s*r],0).toString(),l=this.hexByte2Int(t[5+s*r],0).toString(),g=this.hexByte2Int(t[6+s*r],0).toString(),d=this.bcd2String(t[7+s*r]),S=this.bcd2String(t[8+s*r]),y=this.hexByte2Int(t[9+s*r],0),f=this.hexByte2Int(t[10+s*r],0),D="",v=0;v<f;v++){var p=t[11+v+s*r];0!==p&&(D+=this.int2Ascll(this.hexByte2Int(p,0)))}n[pt.Data].push(((a={})[pt.KAlarmId]=u,a[pt.OpenOrClose]=l,a[pt.ClockType]=g,a[pt.ClockTime]=d,a[pt.KAlarmMinter]=S,a[pt.Week]=y,a[pt.KAlarmContent]=D,a[pt.KAlarmLength]=f.toString(),a))}return n},t.getTempDataer=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetAxillaryTemperatureDataWithMode,e[pt.End]=!1,e[pt.Data]=[],e),r=11,i=t.length,c=Math.floor(i/r);if(0===c||255===t[i-1])return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),h=this.hexByte2Int(t[9+o*r],0)+this.hexByte2Int(t[10+o*r],1);n[pt.Data].push(((a={})[pt.Date]=s,a[pt.axillaryTemperature]=(.1*h).toFixed(1),a))}return n},t.getQrCode=function(t,e){var a,n,r,i;return e?((a={})[pt.DataType]=vt.EnterQrCode,a[pt.End]=!0,a[pt.Data]={},a):128===t[1]||129===t[1]?((n={})[pt.DataType]=vt.QrCodeBandBack,n[pt.End]=!0,n[pt.Data]=((r={})[pt.Band]=129===t[1]?"1":"0",r),n):((i={})[pt.DataType]=vt.ExitQrCode,i[pt.End]=!0,i[pt.Data]={},i)},t.getTempData=function(t){var e,a,n=((e={})[pt.DataType]=vt.Temperature_history,e[pt.End]=!1,e[pt.Data]=[],e),r=11,i=t.length,c=Math.floor(i/r);if(0===c||255===t[i-1]||1===c&&153===t[1])return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),h=this.hexByte2Int(t[9+o*r],0)+this.hexByte2Int(t[10+o*r],1);n[pt.Data].push(((a={})[pt.Date]=s,a[pt.temperature]=(.1*h).toFixed(1),a))}return n},t.getExerciseData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetActivityModeData,e[pt.End]=!1,e[pt.Data]=[],e),r=25,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){var s=1+(o+1)*r;s<i&&o===c-1&&255===t[s]&&(n[pt.End]=!0);for(var h="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),u=this.hexByte2Int(t[9+o*r],0).toString(),l=this.hexByte2Int(t[10+o*r],0).toString(),g=this.getData(2,11+o*r,t),d=this.getData(2,13+o*r,t),S=this.hexByte2Int(t[15+o*r],0),y=this.hexByte2Int(t[16+o*r],0),f=new Array(4).fill(0),D=0;D<4;D++)f[3-D]=t[17+D+o*r];var v=new Array(4).fill(0);for(D=0;D<4;D++)v[3-D]=t[21+D+o*r];var p=this.getFloat(f,0),m=this.getFloat(v,0);n[pt.Data].push(((a={})[pt.Date]=h,a[pt.ActivityMode]=u,a[pt.HeartRate]=l,a[pt.ActiveMinutes]=g.toString(),a[pt.Step]=d.toString(),a[pt.Pace]="".concat(S.toString(16),"'").concat(y.toString(16)),a[pt.Distance]=m.toFixed(2),a[pt.Calories]=p.toFixed(1),a))}return n},t.getActivityExerciseData=function(t){for(var e,a,n=0,r=0,i=new Array(4).fill(0),c=0;c<4;c++)n+=this.hexByte2Int(t[c+2],c),i[3-c]=t[c+6],r+=this.hexByte2Int(t[c+10],c);var o=this.hexByte2Int(t[1],0),s=this.getFloat(i,0),h=0;if(t.length>=18){var u=[0,0,0,0];for(c=0;c<4;c++)u[3-c]=t[c+14];h=this.getFloat(u,0)}return(e={})[pt.DataType]=vt.EnterActivityMode,e[pt.End]=!0,e[pt.Data]=((a={})[pt.HeartRate]=o.toString(),a[pt.Step]=n.toString(),a[pt.Calories]=s.toFixed(1),a[pt.Distance]=h.toFixed(1),a[pt.ActiveMinutes]=r.toString(),a),e},t.setTimeSuccessful=function(t){var e,a;return(e={})[pt.DataType]=vt.SetDeviceTime,e[pt.End]=!0,e[pt.Data]=((a={})[pt.KPhoneDataLength]=this.hexByte2Int(t[1],0).toString(),a),e},t.getData=function(t,e,a){for(var n=0,r=0;r<t;r++)n+=this.hexByte2Int(a[r+e],r);return n},t.getFloat=function(t,e){return this.intBitToDouble(this.getInt(t,e))},t.getInt=function(t,e){return(255&t[e])<<24|(255&t[e+1])<<16|(255&t[e+2])<<8|255&t[e+3]},t.setMethodSuccessful=function(t){var e;return(e={})[pt.DataType]=t,e[pt.End]=!0,e[pt.Data]={},e},t.getRealTimeTemperatureValue=function(t){var e,a=((e={})[pt.DataType]=vt.GetRealTimeTemperatureCorrection,e[pt.End]=!0,e),n={};a[pt.Data]=n;var r=t[1],i=t[2],c=t[3],o=t[4],s=t[5],h=t[6],u=t[7],l=t[8],g=t[9],d=t[10],S=this._leToInt(r,i)/10,y=this._leToInt(c,o)/10,f=this._leToInt(s,h)/10,D=this._leToInt(u,l)/10,v=this._leToInt(g,d)/10;return n[pt.highestTemp]=S,n[pt.displayTemp]=y,n[pt.ntcTemps]=[f,D,v],a},t._leToInt=function(t,e){return e<<8|t},t.getEcgHistoryData=function(t){var e,a=((e={})[pt.DataType]=vt.ECGdata,e[pt.End]=!1,e[pt.Data]={},e),n=t.length;if(n>=3&&113===t[0]&&255===t[1]&&255===t[2])return a[pt.End]=!0,a;if(113!==t[0]||n<3)return a;var r=this.hexByte2Int(t[1],0)+this.hexByte2Int(t[2],1);a[pt.Data][pt.ECGId]=r.toString();var i=3;if(n>=27){var c="20".concat(this.bcd2String(t[i]),"-")+"".concat(this.bcd2String(t[i+1]),"-")+"".concat(this.bcd2String(t[i+2])," ")+"".concat(this.bcd2String(t[i+3]),":")+"".concat(this.bcd2String(t[i+4]),":")+"".concat(this.bcd2String(t[i+5]));a[pt.Data][pt.Date]=c,i+=6;var o=this.hexByte2Int(t[i],0)+this.hexByte2Int(t[i+1],1);a[pt.Data][pt.ECGPointCount]=o.toString(),i+=2,a[pt.Data][pt.HRV]=this.hexByte2Int(t[i++],0).toString(),a[pt.Data][pt.HeartRate]=this.hexByte2Int(t[i++],0).toString(),a[pt.Data][pt.ECGMoodValue]=this.hexByte2Int(t[i++],0).toString(),i+=13}for(var s=[];i+1<n;){var h=this.hexByte2Int(t[i],0)+this.hexByte2Int(t[i+1],1);s.push(h),i+=2}return a[pt.Data][pt.ECGValue]=s,a},t.getEcgDataString=function(t){for(var e=[],a=Math.floor(t.length/2)-1,n=0;n<a;n++){var r=this.hexByte2Int(t[2*n+1],1)+this.hexByte2Int(t[2*n+2],0);r>=32768&&(r-=65536),e.push(r.toString())}return e.join(",")},t.ecgData=function(t){var e,a,n=this.hexByte2Int(t[1],0);return(e={})[pt.DataType]=vt.EcgppGstatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.EcgStatus]=n.toString(),a),e},t.ppgData=function(t){var e,a;return(e={})[pt.DataType]=vt.EcgppGstatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.PPGValue]=t,a),e},t.ecgResult=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetEcgPpgStatus,e[pt.End]=!0,e[pt.Data]={},e);if(3===this.hexByte2Int(t[1],0)){var r="20".concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]),".").concat(this.bcd2String(t[12])," ").concat(this.bcd2String(t[13]),":").concat(this.bcd2String(t[14]),":").concat(this.bcd2String(t[15]));n[pt.Data]=((a={})[pt.Date]=r,a[pt.ECGHrvValue]=this.hexByte2Int(t[2],0).toString(),a[pt.ECGAvBlockValue]=this.hexByte2Int(t[3],0).toString(),a[pt.ECGHrValue]=this.hexByte2Int(t[4],0).toString(),a[pt.ECGStreesValue]=this.hexByte2Int(t[5],0).toString(),a[pt.ECGhighBpValue]=this.hexByte2Int(t[6],0).toString(),a[pt.ECGLowBpValue]=this.hexByte2Int(t[7],0).toString(),a[pt.ECGMoodValue]=this.hexByte2Int(t[8],0).toString(),a[pt.ECGBreathValue]=this.hexByte2Int(t[9],0).toString(),a)}return n},t.enterEcg=function(t){var e;return(e={})[pt.DataType]=vt.ENTERECG,e[pt.End]=!0,e[pt.Data]={},e},t.measurementWithType=function(t,e){var a,n,r,i,c,o,s,h;if(t)switch(e[1]){case 1:var u=this.hexByte2Int(e[6],0).toString(),l=this.hexByte2Int(e[7],0).toString();return(a={})[pt.DataType]=vt.MeasurementHrvCallback,a[pt.End]=!0,a[pt.Data]=((n={})[pt.HRV]=this.hexByte2Int(e[4],0),n[pt.highBP]=u,n[pt.lowBP]=l,n),a;case 2:return(r={})[pt.DataType]=vt.MeasurementHeartCallback,r[pt.End]=!0,r[pt.Data]=((i={})[pt.HeartRate]=this.hexByte2Int(e[2],0),i),r;case 3:return(c={})[pt.DataType]=vt.MeasurementOxygenCallback,c[pt.End]=!0,c[pt.Data]=((o={})[pt.Blood_oxygen]=this.hexByte2Int(e[3],0),o),c;case 4:var g=this.hexByte2Int(e[8],0)+this.hexByte2Int(e[9],1);return(s={})[pt.DataType]=vt.MeasurementTempCallback,s[pt.End]=!0,s[pt.Data]=((h={})[pt.temperature]=(.1*g).toFixed(1),h),s}else{var d={1:vt.StopMeasurementHrvCallback,2:vt.StopMeasurementHeartCallback,3:vt.StopMeasurementOxygenCallback,4:vt.StopMeasurementTempCallback};if(d[e[1]])return this.setMethodSuccessful(d[e[1]])}return{}},t.measurementWithTypeV5=function(t,e){if(t)switch(e[1]){case 1:return this.setMethodSuccessful(vt.MeasurementHrvCallback);case 2:return this.setMethodSuccessful(vt.MeasurementHeartCallback);case 3:return this.setMethodSuccessful(vt.MeasurementOxygenCallback)}else switch(e[1]){case 1:return this.setMethodSuccessful(vt.StopMeasurementHrvCallback);case 2:return this.setMethodSuccessful(vt.StopMeasurementHeartCallback);case 3:return this.setMethodSuccessful(vt.StopMeasurementOxygenCallback)}return{}},t.measurementWithTypeV4=function(t,e){if(t)switch(e[1]){case 1:var a={},n={};return a[pt.DataType]=vt.MeasurementHrvCallback,a[pt.End]=!0,a[pt.Data]=n,n[pt.HRV]=this.hexByte2Int(e[4],0),n[pt.Stress]=this.hexByte2Int(e[5],0),n[pt.highBP]=this.hexByte2Int(e[6],0),n[pt.lowBP]=this.hexByte2Int(e[7],0),a;case 2:var r={},i={};return r[pt.DataType]=vt.MeasurementHeartCallback,r[pt.End]=!0,r[pt.Data]=i,i[pt.HeartRate]=this.hexByte2Int(e[2],0),r;case 3:var c={},o={};return c[pt.DataType]=vt.MeasurementOxygenCallback,c[pt.End]=!0,c[pt.Data]=o,o[pt.Blood_oxygen]=this.hexByte2Int(e[3],0),c}else switch(e[1]){case 1:return this.setMethodSuccessful(vt.StopMeasurementHrvCallback);case 2:return this.setMethodSuccessful(vt.StopMeasurementHeartCallback);case 3:return this.setMethodSuccessful(vt.StopMeasurementOxygenCallback);case 4:return this.setMethodSuccessful(vt.StopMeasurementTempCallback)}return{}},t.braceletdial=function(t,e){var a,n;return t?((a={})[pt.DataType]=vt.Braceletdial,a[pt.End]=!0,a):((n={})[pt.DataType]=vt.Braceletdialok,n[pt.End]=!0,n[pt.Data]={index:e[1].toString()},n)},t.getSportMode=function(t){for(var e,a=this.hexByte2Int(t[1],0),n=[],r=0;r<a;r++)n.push(this.hexByte2Int(t[r+2],0).toString());return(e={})[pt.DataType]=vt.GetSportMode,e[pt.End]=!0,e[pt.Data]=n.join(","),e},t.gPSControlCommand=function(t){for(var e,a,n="20".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2]),"-").concat(this.bcd2String(t[3])," ").concat(this.bcd2String(t[4]),":").concat(this.bcd2String(t[5]),":").concat(this.bcd2String(t[6])),r=new Array(4).fill(0),i=new Array(4).fill(0),c=0;c<4;c++)r[3-c]=t[9+c],i[3-c]=t[14+c];var o=this.getFloat(r,0).toString(),s=this.getFloat(i,0).toString(),h=this.hexByte2Int(t[18],0);return(e={})[pt.DataType]=vt.GPSControlCommand,e[pt.End]=!0,e[pt.Data]=((a={})[pt.KActivityLocationTime]=n,a[pt.KActivityLocationLatitude]=o,a[pt.KActivityLocationLongitude]=s,a[pt.KActivityLocationCount]=h.toString(),a),e},t.setSocial=function(t){var e;return(e={})[pt.DataType]=vt.SocialdistanceGetting,e[pt.End]=!0,e[pt.Data]={scanInterval:this.hexByte2Int(t[2],0).toString(),scanTime:this.hexByte2Int(t[3],0).toString(),signalStrength:t[4].toString()},e},t.ecgQuality=function(t){var e;return(e={})[pt.DataType]=vt.EcgppG,e[pt.End]=!0,e[pt.Data]={heartValue:this.hexByte2Int(t[1],0).toString(),hrvValue:this.hexByte2Int(t[2],0).toString(),Quality:this.hexByte2Int(t[3],0).toString()},e},t.enterPhotoModeback=function(t){var e,a="";switch(t[1]){case 1:a=0===t[2]?"0":"1";break;case 2:a="2";break;case 3:switch(t[2]){case 1:a="3";break;case 2:a="4";break;case 3:a="5";break;case 4:a="6";break;case 5:a="7"}break;case 4:a="8"}return(e={})[pt.DataType]=vt.DeviceSendDataToAPP,e[pt.End]=!0,e[pt.Data]={type:a},e},t.setNewDeviceInfo=function(t){var e;return(e={})[pt.DataType]=vt.SetNewDeviceInfo,e[pt.End]=!0,e[pt.Data]={},e},t.getNewDeviceInfo=function(t){var e;return(e={})[pt.DataType]=vt.GetNewDeviceInfo,e[pt.End]=!0,e[pt.Data]={KEcg:this.hexByte2Int(t[1],0).toString()},e},t.updateClockSuccessful=function(t){var e,a;return console.log("updateClockSuccessful:",t),(e={})[pt.DataType]=vt.SetAlarmClockWithAllClock,e[pt.End]=!0,e[pt.Data]=((a={})[pt.KClockLast]=this.hexByte2Int(t[t.length-1],0).toString(),a),e},t.setBoolSugarStatus=function(t){var e,a;return(e={})[pt.DataType]=vt.BoolsugarStatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.EcgStatus]=this.hexByte2Int(t[2],0),a),e},t.setBoolSugarValue=function(t){for(var e,a=t.slice(3),n=[],r=0;r<Math.floor(a.length/3);r++){var i=this.hexByte2Int(a[3*r],2)+this.hexByte2Int(a[3*r+1],1)+this.hexByte2Int(a[3*r+2],0);n.push(i)}return(e={})[pt.DataType]=vt.BoolsugarValue,e[pt.End]=!0,e[pt.Data]={timestamp:Math.floor(Date.now()/1e3),ppg:n},e},t.setMethodError=function(t){var e;return(e={})[pt.DataType]=t,e[pt.End]=!1,e[pt.Data]={},e},t.readPregnancyCycle=function(t){var e,a;return(e={})[pt.DataType]=vt.GetPregnancyCycle,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Date]="20".concat(this.bcd2String(t[3]),"-").concat(this.bcd2String(t[4]),"-").concat(this.bcd2String(t[5])),a[pt.Week]=this.hexByte2Int(t[1],0),a[pt.DayOfWeek]=this.hexByte2Int(t[2],0),a),e},t.readWomenHealth=function(t){var e,a;return(e={})[pt.DataType]=vt.GetWomenHealth,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Date]="".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2])),a[pt.WomenHealthPeriod]=this.hexByte2Int(t[3],0),a[pt.WomenHealthLength]=this.hexByte2Int(t[4],0),a),e},t.getTemperatureCorrectionValue=function(t){var e,a,n=[t[3],t[2]],r=this.byteArrayToInt(n);return(e={})[pt.DataType]=vt.CMD_Set_TemperatureCorrection,e[pt.End]=!0,e[pt.Data]=((a={})[pt.TemperatureCorrectionValue]=r.toString(),a),e},t.byteArrayToInt=function(t){return t[0]<<8&65280|255&t[1]},t.getHistoryGpsData=function(t){var e,a=[],n=((e={})[pt.DataType]=vt.Gps,e[pt.End]=!1,e),r=59,i=t.length,c=Math.floor(i/r);if(0===c)return n;255===t[t.length-1]&&90===t[t.length-2]&&(n[pt.End]=!0);for(var o=0;o<c;o++){for(var s={},h="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),u=[],l=[],g=0;g<6;g++){for(var d=new Array(4).fill(0),S=new Array(4).fill(0),y=0;y<4;y++)d[3-y]=t[9+y+o*r+8*g],S[3-y]=t[13+y+o*r+8*g];var f=this.getFloat(d,0).toString(),D=this.getFloat(S,0).toString();u.push(f),l.push(D)}s[pt.Date]=17===h.length?h:"2019.01.01 00:00:00",s[pt.Latitude]=u.join(","),s[pt.Longitude]=l.join(","),a.push(s)}return n[pt.Data]=a,n},t.getPPITestData=function(t){var e,a=((e={})[pt.DataType]=vt.GetPPIData,e[pt.End]=!1,e[pt.Data]=[],e),n=123,r=t.length,i=Math.floor(r/n);if(0===i)return a[pt.End]=!0,a;255===t[t.length-1]&&(a[pt.End]=!0);for(var c=0;c<i;c++){for(var o={},s=new Array(2).fill(0),h=0;h<2;h++)s[1-h]=t[1+h+c*n];for(var u=this.getInt(s,0),l="20".concat(this.bcd2String(t[3+c*n]),".").concat(this.bcd2String(t[4+c*n]),".").concat(this.bcd2String(t[5+c*n])," ").concat(this.bcd2String(t[6+c*n]),":").concat(this.bcd2String(t[7+c*n]),":").concat(this.bcd2String(t[8+c*n])),g=this.hexByte2Int(t[9+c*n],0),d=this.hexByte2Int(t[10+c*n],0).toString(),S=[],y=0;y<56;y++){for(var f=11+2*y,D=new Array(2).fill(0),v=0;v<2;v++)D[1-v]=t[f+v+c*n];var p=this.getFloat(D,0);if(0===p)break;S.push(p)}o[pt.TOTAL_ID]=g.toString(),o[pt.PPI_ID]=d,o[pt.DeviceTime]=l,o[pt.PPI_LIST]=S,o[pt.PPI_NUM]=u,a[pt.Data].push(o)}return a},t.getPPIV5Data=function(t){var e,a,n=t.length,r=((e={})[pt.DataType]=vt.GetPPIData,e[pt.End]=!1,e),i=[];r[pt.Data]=i,t.length>1&&255===t[t.length-1]&&t[t.length-2]===ht&&(r[pt.End]=!0);for(var c=0;c<Math.floor(n/123);c++){for(var o=123*c,s="20".concat(this.bcd2String(t[o+3]),".").concat(this.bcd2String(t[o+4]),".").concat(this.bcd2String(t[o+5])," ").concat(this.bcd2String(t[o+6]),":").concat(this.bcd2String(t[o+7]),":").concat(this.bcd2String(t[o+8])),h=this.hexByte2Int(t[o+9],0),u=this.hexByte2Int(t[o+10],0),l=[],g=0;g<56;g++){var d=t[o+11+2*g],S=t[o+11+2*g+1]<<8|d;if(0===S)break;l.push(S)}i.push(((a={})[pt.Date]=s,a[pt.PPI_LIST]=l,a[pt.PPI_UNIT]="ms",a[pt.PPI_NUM]=h,a[pt.PPI_ID]=u,a))}return r},t.getHrvTimeData=function(t){var e,a;return(e={})[pt.DataType]=vt.GetHrvTimeValue,e[pt.End]=!0,e[pt.Data]=((a={})[pt.HRV_TIME_MODE]=this.hexByte2Int(t[1],0),a[pt.HRV_TIME_Value]=this.hexByte2Int(t[2],0),a),e},t.closeDevices=function(t){var e,a;return(e={})[pt.DataType]=vt.CloseDevices,e[pt.End]=!0,e[pt.Data]=((a={})[pt.RESULT]=!0,a),e},t.getOffCheckStatus=function(t){var e,a;return(e={})[pt.DataType]=vt.GetOffCheckStatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.GET_OFF_TAG]=this.hexByte2Int(t[1],0),a[pt.GET_OFF_STATE]=this.hexByte2Int(t[2],0),a),e},t.getStepCount=function(t){var e=27,a=t.length;return 2!==a&&(a%26==0?e=26:a%27==0?e=27:(a-2)%26==0?e=26:(a-2)%27==0&&(e=27)),e},t.getPPGWaveformData=function(t){var e,a=((e={})[pt.DataType]=vt.PPGRealtime,e[pt.End]=!1,e[pt.Data]=[],e);if(!t||t.length<4)return a;if(57!==t[0])return a;for(var n=2,r=[];n+1<t.length;){var i=this.hexByte2Int(t[n],0)+this.hexByte2Int(t[n+1],1);r.push(i),n+=2}return a[pt.Data]=r,a},t.startDeviceMeasurementWithType=!1,t}();"function"==typeof SuppressedError&&SuppressedError;var Tt=function(){function pt(){}return pt.generateValue=function(t){return new Array(t).fill(0)},pt.hexByte2Int=function(t,e){return(255&t)*Math.pow(256,e)},pt.generateInitValue=function(){return this.generateValue(16)},pt.arrayCopy=function(t,e,a,n,r){for(var i=0;i<r;i++)a[n+i]=t[e+i]},pt.crcValue=function(t){for(var e=0,a=0;a<t.length-1;a++)e+=t[a];t[t.length-1]=255&e},pt.crcDynamicValue=function(t){for(var e=0,a=0,n=t;a<n.length;a++){e+=n[a]}t[t.length-1]=255&e},pt.getBcdValue=function(t){return 16*Math.floor(t/10)+t%10},pt.dataParsingWithData=function(P,J){if(void 0===J&&(J="2208"),!P||0===P.length)return It.setMethodError("Empty data");switch(P[0]){case s:return It.setMethodSuccessful(vt.SetStepGoal);case a:return It.setMethodSuccessful(vt.SetPersonalInfo);case f:break;case y:return It.setMethodSuccessful(vt.SetMotorVibrationWithTimes);case r:return It.setMethodSuccessful(vt.SetDeviceInfo);case v:return It.setMethodSuccessful(vt.SetAutomaticHRMonitoring);case St:return It.setMethodSuccessful(vt.SetSedentaryReminder);case c:return It.setMacSuccessful();case H:return It.setMethodSuccessful(vt.EnterActivityMode);case R:return 0!==P[2]&&0!==P[3]?It.getTemperatureCorrectionValue(P):It.setMethodSuccessful(vt.CMD_Set_TemperatureCorrection);case k:return It.getActivityExerciseData(P);case t:return It.setTimeSuccessful(P);case C:return It.getExerciseData(P);case e:return It.getDeviceTime(P);case n:return It.getUserInfo(P);case i:return It.getDeviceInfo(P,J);case o:return It.getActivityData(P);case h:return It.getGoal(P);case u:return It.getDeviceBattery(P);case l:return It.getDeviceAddress(P);case g:return It.getDeviceVersion(P);case D:return It.getDeviceName(P);case p:return It.getAutoHeart(P);case d:return It.reset();case S:return It.mcuReset();case I:return It.notify();case yt:return It.getActivityAlarm(P);case T:return It.getTotalStepData(P);case B:return It.getDetailData(P);case V:return It.getSleepData(P);case E:return It.getHeartData(P);case x:return It.getOnceHeartData(P);case A:return It.getHrvTestData(P);case b:return It.getClockData(P);case m:return It.updateClockSuccessful(P);case w:return It.setNewDeviceInfo(P);case L:return It.getNewDeviceInfo(P);case O:return It.enterPhotoModeback(P);case W:return It.setMethodSuccessful(vt.EnterPhotoMode);case N:return It.setMethodSuccessful(vt.BackHomeView);case K:return It.ecgQuality(P);case F:case U:break;case Q:return It.setMethodSuccessful(vt.Weather);case j:return It.braceletdial(!1,P);case q:return"V4"===J||"V5"===J?It.getRealTimeTemperatureValue(P):It.setMethodSuccessful(vt.SportMode);case Y:return It.getSportMode(P);case z:return"V4"===J?It.measurementWithTypeV4(this.StartDeviceMeasurementWithType,P):"V5"===J||"2025"===J?It.measurementWithTypeV5(this.StartDeviceMeasurementWithType,P):It.measurementWithType(this.StartDeviceMeasurementWithType,P);case X:return It.gPSControlCommand(P);case Z:return It.getHistoryGpsData(P);case $:return It.setMethodSuccessful(vt.Clear_Bracelet_data);case M:return It.getAutoBloodOxygen(P);case _:return It.getBloodoxygen(P);case G:if(this.isSettingSocial)return It.setMethodSuccessful(vt.SocialdistanceSetting);It.setSocial(P);case tt:return It.setMethodSuccessful(vt.Sos);case et:return It.getTempData(P);case at:return It.getTempDataer(P);case nt:return It.getQrCode(P,!1);case dt:return It.setBoolSugarValue(P);case rt:return It.ecgResult(P);case st:return It.readPregnancyCycle(P);case it:return It.getEcgHistoryData(P);case ot:return 0===P[1]?It.setMethodSuccessful(vt.SetWomenHealth):It.readWomenHealth(P);case ct:var pt=this.hexByte2Int(P[1],0),mt=this.hexByte2Int(P[2],0);if(0!==pt)return It.setMethodSuccessful(vt.ppgStartFailed);switch(mt){case 1:return It.setMethodSuccessful(vt.ppgStartSucessed);case 2:return It.setMethodSuccessful(vt.ppgResult);case 3:return It.setMethodSuccessful(vt.ppgStop);case 4:return It.setMethodSuccessful(vt.ppgMeasurementProgress);case 5:return It.setMethodSuccessful(vt.ppgQuit);default:return It.setMethodSuccessful(vt.ppgStartFailed)}case ht:return"V4"===J||"V5"===J?It.getPPIV5Data(P):It.getPPITestData(P);case ut:return It.getHrvTimeData(P);case lt:return It.closeDevices(P);case gt:return It.getOffCheckStatus(P);case ft:return It.getSleepActivityLevelsData(P);case Dt:return It.getPPGWaveformData(P)}return It.setMethodError(this.getBcdValue(P[0]).toString())},pt.bloodsugarWithMode=function(t,e){var a=this.generateInitValue();return a[0]=ct,a[1]=t,2!==t&&4!==t||(a[2]=e),this.crcValue(a),a},pt.getDetailSleepDataWithMode=function(t){var e=this.generateInitValue();return e[0]=V,e[1]=99===t?153:t,this.crcValue(e),e},pt.insertDateValue=function(t,e){if(e&&!(e.length<=0)){var a=e.split(" "),n=a[0],r=a[1],i=n.split("-").map(Number),c=i[0],o=i[1],s=i[2],h=r.split(":").map(Number),u=h[0],l=h[1],g=h[2];t[4]=this.getBcdValue(c-2e3),t[5]=this.getBcdValue(o),t[6]=this.getBcdValue(s),t[7]=this.getBcdValue(u),t[8]=this.getBcdValue(l),t[9]=this.getBcdValue(g)}},pt.getHRVDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=A,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},pt.getPPIDDataWithMode=function(t){var e=this.generateInitValue();return e[0]=ht,e[1]=99===t?153:0===t?0:1===t?1:2,this.crcValue(e),e},pt.getHrvTestTime=function(){var t=this.generateInitValue();return t[0]=ut,t[1]=0,this.crcValue(t),t},pt.setHrvTestTime=function(t){var e=this.generateInitValue();return e[0]=ut,e[1]=1,e[2]=t,this.crcValue(e),e},pt.closeBlueDevice=function(){var t=this.generateInitValue();return t[0]=lt,this.crcValue(t),t},pt.startBloodSugar=function(){var t=this.generateInitValue();return t[0]=ct,t[1]=1,this.crcValue(t),t},pt.progressBloodSugar=function(t){var e=this.generateInitValue();return e[0]=ct,e[1]=4,e[2]=t,this.crcValue(e),e},pt.endBloodSugar=function(){var t=this.generateInitValue();return t[0]=ct,t[1]=3,this.crcValue(t),t},pt.getTotalActivityDataWithMode=function(t){var e=this.generateInitValue();return e[0]=T,e[1]=99===t?153:0===t?0:1===t?1:2,this.crcValue(e),e},pt.getTotalActivityDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=T,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},pt.getDetailSleepDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=V,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getDetailActivityDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=B,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getTemperature_historyDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=et,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getAxillaryTemperatureDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=at,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},pt.enterActivityMode=function(t,e){var a=this.generateInitValue();return a[0]=H,a[1]=e,a[2]=t,this.crcValue(a),a},pt.sendHeartPackage=function(t,e,a){var n=this.generateInitValue(),r=255&Math.floor(e/60),i=e%60&255,c=new ArrayBuffer(4);new DataView(c).setFloat32(0,t,!0);var o=Array.from(new Uint8Array(c));return n[0]=J,this.arrayCopy(o,0,n,1,o.length),n[5]=r,n[6]=i,n[7]=255&a,this.crcValue(n),n},pt.realTimeStep=function(t,e){var a=this.generateInitValue();return a[0]=o,a[1]=t?1:0,a[2]=e?1:0,this.crcValue(a),a},pt.stopGo=function(){var t=this.generateInitValue();return t[0]=o,t[1]=0,this.crcValue(t),t},pt.setPersonalInfo=function(t){var e=this.generateInitValue();return e[0]=a,e[1]=t.sex,e[2]=t.age,e[3]=t.height,e[4]=t.weight,t.stepLength&&(e[5]=t.stepLength),this.crcValue(e),e},pt.getPersonalInfo=function(){var t=this.generateInitValue();return t[0]=n,this.crcValue(t),t},pt.enterOTA=function(){var t=this.generateInitValue();return t[0]=P,this.crcValue(t),t},pt.getDeviceVersion=function(){var t=this.generateInitValue();return t[0]=g,this.crcValue(t),t},pt.reset=function(){var t=this.generateInitValue();return t[0]=d,this.crcValue(t),t},pt.getDeviceMacAddress=function(){var t=this.generateInitValue();return t[0]=l,this.crcValue(t),t},pt.getDeviceBatteryLevel=function(){var t=this.generateInitValue();return t[0]=u,this.crcValue(t),t},pt.mcuReset=function(){var t=this.generateInitValue();return t[0]=S,this.crcValue(t),t},pt.setDeviceName=function(t){var e=this.generateInitValue(),a=Math.min(t.length,14);e[0]=f;for(var n=0;n<a;n++)e[n+1]=t.charCodeAt(n);for(n=a+1;n<6;n++)e[n]=0;return this.crcValue(e),e},pt.getDeviceName=function(){var t=this.generateInitValue();t[0]=D;for(var e=1;e<6;e++)t[e]=0;return this.crcValue(t),t},pt.setDeviceTime=function(e){var a=this.generateInitValue(),n=e.getFullYear()%100,r=e.getMonth()+1,i=e.getDate(),c=e.getHours(),o=e.getMinutes(),s=e.getSeconds();return a[0]=t,a[1]=this.getBcdValue(n),a[2]=this.getBcdValue(r),a[3]=this.getBcdValue(i),a[4]=this.getBcdValue(c),a[5]=this.getBcdValue(o),a[6]=this.getBcdValue(s),this.crcValue(a),a},pt.getDeviceTime=function(){var t=this.generateInitValue();return t[0]=e,this.crcValue(t),t},pt.setDeviceInfo=function(t){var e=this.generateInitValue();return e[0]=r,e[1]=t.distanceUnit?129:128,e[2]=t.is12Hour?129:128,e[3]=t.handUpLightScreenSwitch?129:128,e[4]=t.fahrenheit?128:129,e[5]=t.nightMode?129:128,e[6]=t.ancs?129:128,e[7]=255&t.ancsMask,e[8]=t.ancsMask>>8&255,e[9]=128|t.baseHeart,e[11]=128+t.screenBrightness,e[12]=128+t.indexDial,e[13]=t.socialDistance?129:128,e[14]=128+t.languages,this.crcValue(e),e},pt.setDeviceInfoV5=function(t,e,a){var n=this.generateInitValue();return n[0]=r,n[6]=t?129:128,n[5]=e?129:128,n[14]=a?129:128,this.crcValue(n),n},pt.setDeviceID=function(t){var e=this.generateInitValue();if(e[0]=c,t.length>=6)for(var a=0;a<6;a++)e[1+a]=t[a];return this.crcValue(e),e},pt.reminderCommand=function(t,e,a){var n=this.generateValue(80);n[0]=I,n[1]=255&t;var r=new TextEncoder,i=Array.from(r.encode(e)).slice(0,60);n[2]=i.length;for(var c=0;c<i.length;c++)n[3+c]=i[c];var o=Array.from(r.encode(a)).slice(0,15);n[63]=o.length;for(c=0;c<o.length;c++)n[64+c]=o[c];return n},pt.updateWeather=function(t){var e=this.generateValue(41);e[0]=Q,e[1]=255&t.weatherCode,e[2]=255&t.currentTemp,e[3]=255&t.maxTemp,e[4]=255&t.minTemp,e[5]=255&t.aqi,e[6]=t.aqi>>8&255;var a=new TextEncoder,n=Array.from(a.encode(t.address)).slice(0,32);e[7]=n.length;for(var r=0;r<n.length;r++)e[8+r]=n[r];return e},pt.mapWeatherCode=function(t){var e=Number(t);return Number.isNaN(e)?153:e>=0&&e<=38?e:153},pt.healthMeasurementWithDataType=function(t,e){this.StartDeviceMeasurementWithType=e;var a=this.generateInitValue();return a[0]=z,a[1]=t,a[2]=e?1:0,this.crcValue(a),a},pt.setBraceletdial=function(t){this.isRuning=!0;var e=this.generateInitValue();return e[0]=j,e[1]=t,this.crcValue(e),e},pt.setAutomaticHRMonitoring=function(t){var e=this.generateInitValue(),a=t.time;return e[0]=v,e[1]=t.open,e[2]=this.getBcdValue(t.startHour),e[3]=this.getBcdValue(t.startMinute),e[4]=this.getBcdValue(t.endHour),e[5]=this.getBcdValue(t.endMinute),e[6]=t.week,e[7]=255&a,e[8]=a>>8&255,e[9]=t.type,this.crcValue(e),e},pt.getAutomaticHRMonitoring=function(t){var e=this.generateInitValue();return e[0]=p,e[1]=t,this.crcValue(e),e},pt.getActivityModeDataWithMode=function(t){var e=this.generateInitValue();return e[0]=C,e[1]=t,this.crcValue(e),e},pt.getStaticHRWithMode=function(t,e){var a=this.generateInitValue();return a[0]=x,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getDynamicHRWithMode=function(t,e){var a=this.generateInitValue();return a[0]=E,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getBloodOxygen=function(t,e){var a=this.generateInitValue();return a[0]=_,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getAutoBloodOxygen=function(t,e){var a=this.generateInitValue();return a[0]=M,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.setStepGoal=function(t,e,a,n,r){var i=this.generateInitValue();return i[0]=s,i[4]=t>>24&255,i[3]=t>>16&255,i[2]=t>>8&255,i[1]=255&t,i[6]=e>>8&255,i[5]=255&e,i[8]=a>>8&255,i[7]=255&a,i[10]=n>>8&255,i[9]=255&n,i[12]=r>>8&255,i[11]=255&r,this.crcValue(i),i},pt.GetStepGoal=function(){var t=this.generateInitValue();return t[0]=h,this.crcValue(t),t},pt.getDeviceInfo=function(){var t=this.generateInitValue();return t[0]=i,this.crcValue(t),t},pt.sendHex=function(t,e){var a=function(t,e,a){if(a||2===arguments.length)for(var n,r=0,i=e.length;r<i;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}([],t,!0);return e&&this.crcDynamicValue(a),a},pt.getAlarmClock=function(){var t=this.generateInitValue();return t[0]=b,this.crcValue(t),t},pt.deleteAllAlarmClock=function(){var t=this.generateInitValue();return t[0]=b,t[1]=153,this.crcValue(t),t},pt.setAlarmClock=function(t){var e,a=this,n=[],r=39*t.length+2;if(r>128)for(var i=Math.floor(128/39),c=Math.ceil(t.length/i),o=0;o<c;o++){for(var s=o===c-1,h=s?t.length-i*o:i,u=new Array(39*h+(s?2:0)).fill(0),l=0;l<h;l++){var g=t[i*o+l],d=g.openOrClose,S=g.clockType,y=g.clockTime,f=g.week,D=g.text,v=39*l;u[v]=35,u[v+1]=t.length,u[v+2]=i*o+l,u[v+3]=d,u[v+4]=S,u[v+5]=this.getBcdValue(y.substring(0,2)),u[v+6]=this.getBcdValue(y.substring(3,5)),u[v+7]=f;var p=this.textToUtf8BytesSafe(D),m=Math.min(p.length,30);u[v+8]=m;for(var I=0;I<m;I++)u[v+9+I]=null!==(e=p[I])&&void 0!==e?e:0}s&&(u[u.length-2]=35,u[u.length-1]=255),n.push(u)}else{var T=new Array(r).fill(0);t.forEach(function(e,n){var r,i=e.openOrClose,c=e.clockType,o=e.clockTime,s=e.week,h=e.text,u=39*n;T[u]=35,T[u+1]=t.length,T[u+2]=n,T[u+3]=i,T[u+4]=c,T[u+5]=a.getBcdValue(o.substring(0,2)),T[u+6]=a.getBcdValue(o.substring(3,5)),T[u+7]=s;var l=a.textToUtf8BytesSafe(h),g=Math.min(l.length,30);T[u+8]=g;for(var d=0;d<g;d++)T[u+9+d]=null!==(r=l[d])&&void 0!==r?r:0}),T[r-2]=35,T[r-1]=255,n.push(T)}return n},pt.textToUtf8BytesSafe=function(t,e){void 0===e&&(e=30);for(var a=[],n=0,r=0;r<t.length;r++){var i=t[r],c=this.utf8EncodeChar(i);if(n+c.length>e)break;a.push.apply(a,c),n+=c.length}for(;a.length<e;)a.push(0);return a},pt.utf8EncodeChar=function(t){var e=t.codePointAt(0);return void 0===e?[]:e<=127?[e]:e<=2047?[192|e>>6,128|63&e]:e<=65535?[224|e>>12,128|e>>6&63,128|63&e]:[240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e]},pt.getSedentaryReminder=function(){var t=this.generateInitValue();return t[0]=yt,this.crcValue(t),t},pt.setSedentaryReminder=function(t){var e=this.generateInitValue();e[0]=St,e[1]=this.getBcdValue(t.startTime_Hour),e[2]=this.getBcdValue(t.startTime_Minutes),e[3]=this.getBcdValue(t.endTime_Hour),e[4]=this.getBcdValue(t.endTime_Minutes);var a=(t.weeks.sunday?1:0)+(t.weeks.monday?2:0)+(t.weeks.tuesday?4:0)+(t.weeks.wednesday?8:0)+(t.weeks.thursday?16:0)+(t.weeks.friday?32:0)+(t.weeks.saturday?64:0);return e[5]=a,e[6]=t.intervalTime,e[7]=t.leastSteps,e[8]=t.mode,this.crcValue(e),e},pt.getRealTimeSleepDataWithMode=function(t){var e=this.generateInitValue();return e[0]=ft,e[1]=t,this.crcValue(e),e},pt.enterTakePhoto=function(){var t=this.generateInitValue();return t[0]=W,this.crcValue(t),t},pt.enterSOS=function(){var t=this.generateInitValue();return t[0]=tt,this.crcValue(t),t},pt.clearBraceletData=function(){var t=this.generateInitValue();return t[0]=$,this.crcValue(t),t},pt.startPPGRealtime=function(t){var e=this.generateInitValue();return e[0]=Dt,e[1]=t?1:0,this.crcValue(e),e},pt.confirmUnbind=function(t){var e=this.generateInitValue();return e[0]=nt,e[1]=t?129:128,this.crcValue(e),e},pt.setSocialSetting=function(t,e,a){this.isSettingSocial=!0;var n=this.generateInitValue();return n[0]=G,n[1]=1,n[2]=t,n[3]=e,n[4]=a,this.crcValue(n),n},pt.getSocialSetting=function(){this.isSettingSocial=!1;var t=this.generateInitValue();return t[0]=G,t[1]=0,this.crcValue(t),t},pt.getEcgHistory=function(t,e){var a=this.generateInitValue();return a[0]=it,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.deleteAllEcgHistory=function(){var t=this.generateInitValue();return t[0]=it,this.crcValue(t),t},pt.DATA_READ_START=0,pt.DATA_READ_CONTINUE=2,pt.DATA_DELETE=99,pt.DistanceMode_MILE=129,pt.DistanceMode_KM=128,pt.TimeMode_12h=129,pt.TimeMode_24h=128,pt.WristOn_Enable=129,pt.WristOn_DisEnable=128,pt.TempUnit_C=128,pt.TempUnit_F=129,pt.TAG="BleSDK",pt.isRuning=!1,pt.ecgopen=!1,pt.read=!1,pt.pregnancyCycleRead=!1,pt.isSettingSocial=!1,pt.StartDeviceMeasurementWithType=!1,pt}();export{mt as ANCS_MASK,vt as BleConst,Tt as BleSDK,pt as DeviceKey,It as ResolveUtil};
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,v=42,p=43,m=35,I=77,T=81,B=82,V=83,E=84,M=96,_=102,x=85,C=87,b=92,A=86,G=100,k=25,H=24,P=71,R=56,w=6,W=7,L=32,O=22,N=16,K=131,F=170,U=171,Q=21,j=36,q=20,Y=68,z=40,J=23,X=52,Z=90,$=97,tt=254,et=98,at=101,nt=176,rt=156,it=113,ct=120,ot=28,st=30,ut=99,ht=136,lt=137,gt=138,dt=58,St=37,yt=38,Dt=107,ft=57,vt={GetDeviceTime:"get_device_time",GetPersonalInfo:"get_personal_info",GetDeviceInfo:"get_device_info",RealTimeStep:"real_time_step",GetStepGoal:"get_step_goal",GetDeviceBatteryLevel:"get_device_battery_level",GetDeviceMacAddress:"get_device_mac_address",GetDeviceVersion:"get_device_version",CMD_Reset:"cmd_reset",CMD_MCUReset:"cmd_mcu_reset",Notify:"notify",GetDeviceName:"get_device_name",SetAlarmClockWithAllClock:"set_alarm_clock_with_all_clock",Gps:"GPS",GetPPIData:"GetPPIData",GetHrvTimeValue:"GetHrvTimeValue",CloseDevices:"CloseDevices",GetOffCheckStatus:"GetOffCheckStatus",GetAutomaticHRMonitoring:"GetAutomaticHRMonitoring",GetSedentaryReminder:"GetSedentaryReminder",GetTotalActivityData:"GetTotalActivityData",GetDetailActivityData:"GetDetailActivityData",GetDetailSleepData:"GetDetailSleepData",AutoBloodOxygen:"AutoBloodOxygen",GetDynamicHR:"GetDynamicHR",ECGdata:"ECGdata",GetWomenHealth:"GetWomenHealth",CMD_Set_TemperatureCorrection:"CMD_Set_TemperatureCorrection",GetStaticHR:"GetStaticHR",Blood_oxygen:"Blood_oxygen",GetHRVData:"GetHRVData",GetAxillaryTemperatureDataWithMode:"GetAxillaryTemperatureDataWithMode",EnterQrCode:"EnterQrCode",QrCodeBandBack:"QrCodeBandBack",ExitQrCode:"ExitQrCode",Temperature_history:"Temperature_history",GetActivityModeData:"GetActivityModeData",EnterActivityMode:"EnterActivityMode",SetDeviceTime:"SetDeviceTime",GetAlarmClock:"GetAlarmClock",EcgppGstatus:"EcgppGstatus",GetEcgPpgStatus:"GetEcgPpgStatus",ENTERECG:"ENTERECG",MeasurementHrvCallback:"MeasurementHrvCallback",MeasurementHeartCallback:"MeasurementHeartCallback",MeasurementOxygenCallback:"MeasurementOxygenCallback",MeasurementTempCallback:"MeasurementTempCallback",StopMeasurementHrvCallback:"StopMeasurementHrvCallback",StopMeasurementHeartCallback:"StopMeasurementHeartCallback",StopMeasurementOxygenCallback:"StopMeasurementOxygenCallback",StopMeasurementTempCallback:"StopMeasurementTempCallback",MeasurementECGCallback:"MeasurementECGCallback",Braceletdial:"Braceletdial",Braceletdialok:"Braceletdialok",GetSportMode:"GetSportMode",GPSControlCommand:"GPSControlCommand",SocialdistanceGetting:"SocialdistanceGetting",EcgppG:"EcgppG",DeviceSendDataToAPP:"DeviceSendDataToAPP",SetNewDeviceInfo:"SetNewDeviceInfo",GetNewDeviceInfo:"GetNewDeviceInfo",BoolsugarStatus:"BoolsugarStatus",BoolsugarValue:"BoolsugarValue",GetPregnancyCycle:"GetPregnancyCycle",SetStepGoal:"SetStepGoal",SetPersonalInfo:"SetPersonalInfo",SetMotorVibrationWithTimes:"SetMotorVibrationWithTimes",SetDeviceInfo:"SetDeviceInfo",SetAutomaticHRMonitoring:"SetAutomaticHRMonitoring",SetSedentaryReminder:"SetSedentaryReminder",EnterPhotoMode:"EnterPhotoMode",BackHomeView:"BackHomeView",Weather:"Weather",SportMode:"SportMode",Clear_Bracelet_data:"Clear_Bracelet_data",SocialdistanceSetting:"SocialdistanceSetting",Sos:"Sos",SetPregnancyCycle:"SetPregnancyCycle",DeleteECGdata:"DeleteECGdata",ECG:"ECG",SetWomenHealth:"SetWomenHealth",ppgStartSucessed:"ppgStartSucessed",ppgResult:"ppgResult",ppgStop:"ppgStop",ppgMeasurementProgress:"ppgMeasurementProgress",ppgQuit:"ppgQuit",ppgStartFailed:"ppgStartFailed",CMD_Set_Mac:"CMD_Set_Mac",CloseECG:"CloseECG",GetAlarmClock_V4:"GetAlarmClock_V4",DeleteAllAlarmClock_V4:"DeleteAllAlarmClock_V4",SetAlarmClock_V4:"SetAlarmClock_V4",GetSedentaryReminder_V4:"GetSedentaryReminder_V4",SetSedentaryReminder_V4:"SetSedentaryReminder_V4",GetRealTimeTemperatureCorrection:"GetRealTimeTemperatureCorrection",PPGRealtime:"PPGRealtime"},pt={DeviceTime:"device_time",GPSTime:"gps_time",DataType:"data_type",End:"end",Data:"data",Gender:"gender",Age:"age",Height:"height",Weight:"weight",Stride:"stride",KUserDeviceId:"k_user_device_id",KClockLast:"k_clock_last",Step:"step",Calories:"calories",Distance:"distance",ExerciseMinutes:"exercise_minutes",HeartRate:"heart_rate",ActiveMinutes:"active_minutes",TempData:"temp_data",Blood_oxygen:"blood_oxygen",StepGoal:"step_goal",DistanceGoal:"distance_goal",CalorieGoal:"calorie_goal",SleepTimeGoal:"sleep_time_goal",BatteryLevel:"battery_level",MacAddress:"mac_address",DeviceVersion:"device_version",DeviceName:"device_name",Date:"date",Latitude:"latitude",Longitude:"longitude",TOTAL_ID:"totalId",PPI_ID:"ppiId",PPI_LIST:"ppiList",PPI_NUM:"ppiNum",PPI_UNIT:"ppiUnit",HRV_TIME_MODE:"hrvTimeMode",HRV_TIME_Value:"hrvTimeValue",RESULT:"result",GET_OFF_TAG:"getOffTag",GET_OFF_STATE:"getOffState",DistanceUnit:"distance_unit",TimeUnit:"time_unit",StatusOfTheRaisedHandOnscreen:"status_of_the_raised_hand_onscreen",TempUnit:"temp_unit",NightMode:"night_mode",ANCSMode:"ANCS_mode",ANCSSubStatus:"ANCS_sub_status",KBaseHeart:"k_base_heart",ScreenBrightness:"screen_brightness",Dialinterface:"dial_interface",SocialDistancedwitch:"social_distance_switch",ChineseOrEnglish:"chinese_or_english",WorkMode:"work_mode",StartTime:"start_time",KHeartStartMinter:"kheart_start_minter",EndTime:"end_time",KHeartEndMinter:"kheart_end_minter",Weeks:"weeks",IntervalTime:"interval_time",StartTimeHour:"StartTimeHour",StartTimeMin:"StartTimeMin",EndTimeHour:"EndTimeHour",EndTimeMin:"EndTimeMin",LeastSteps:"LeastSteps",Week:"week",Goal:"Goal",KDetailMinterStep:"KDetailMinterStep",ArraySteps:"ArraySteps",ArraySleep:"ArraySleep",ActivityArray:"ActivityArray",sleepUnitLength:"sleepUnitLength",StaticHR:"StaticHR",WomenHealthPeriod:"WomenHealthPeriod",WomenHealthLength:"WomenHealthLength",TemperatureCorrectionValue:"TemperatureCorrectionValue",HRV:"HRV",ECGPointCount:"ECGPointCount",ECGMoodValue:"ECGMoodValue",ECGValue:"ECGValue",ArrayDynamicHR:"ArrayDynamicHR",KAlarmId:"KAlarmId",OpenOrClose:"OpenOrClose",ClockType:"ClockType",ClockTime:"ClockTime",KAlarmMinter:"KAlarmMinter",KAlarmContent:"KAlarmContent",KAlarmLength:"KAlarmLength",KAlarmTotal:"KAlarmTotal",KAlarmIndex:"KAlarmIndex",axillaryTemperature:"axillaryTemperature",Band:"Band",temperature:"temperature",ActivityMode:"ActivityMode",Pace:"Pace",KPhoneDataLength:"KPhoneDataLength",VascularAging:"VascularAging",Stress:"Stress",highBP:"highBP",lowBP:"lowBP",EcgStatus:"ecgStatus",PPGValue:"ppgValue",ECGHrvValue:"ecgHrvValue",ECGAvBlockValue:"ecgAvBlockValue",ECGHrValue:"ecgHrValue",ECGStreesValue:"ecgStressValue",ECGhighBpValue:"ecgHighBpValue",ECGLowBpValue:"ecgLowBpValue",ECGBreathValue:"ecgBreathValue",KActivityLocationTime:"activityLocationTime",KActivityLocationLatitude:"activityLocationLatitude",KActivityLocationLongitude:"activityLocationLongitude",KActivityLocationCount:"activityLocationCount",DayOfWeek:"dayOfWeek",Text:"text",TextLength:"textLength",IsDeleteData:"isDeleteData",SportEnable:"SportEnable",HeartEnable:"HeartEnable",HeartDayEnable:"HeartDayEnable",highestTemp:"highestTemp",displayTemp:"displayTemp",ntcTemps:"ntcTemps",ECGId:"ECGId"},mt={CALL:1,SMS:2,WECHAT:4,FACEBOOK:8,INSTAGRAM:16,SKYPE:32,TELEGRAM:64,TWITTER:128,VK:256,WHATSAPP:512,QQ:1024,LINKEDIN:2048,ENABLE_FLAG:16384},It=function(){function t(){}return t.hexByte2Int=function(t,e){return(255&t)*Math.pow(256,e)},t.bcd2String=function(t){var e=15&t;return"".concat((240&t)>>4).concat(e)},t.intList2String=function(t){return t.map(function(t){return t.toString(16).padStart(2,"0").toUpperCase()}).join(" ")},t.intList3String=function(t){return t.map(function(t){return t.toString(16).padStart(2,"0").toLowerCase()}).join(" ")},t.setMacSuccessful=function(){var t;return(t={})[pt.DataType]=vt.CMD_Set_Mac,t[pt.End]=!0,t[pt.Data]={},t},t.intBitToDouble=function(t){var e=new ArrayBuffer(8),a=new DataView(e);return a.setInt32(0,t,!1),a.getFloat32(0,!1)},t.getDeviceTime=function(t){var e,a,n="20".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2]),"-").concat(this.bcd2String(t[3])," ").concat(this.bcd2String(t[4]),":").concat(this.bcd2String(t[5]),":").concat(this.bcd2String(t[6])),r="".concat(this.bcd2String(t[9]),".").concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]));return(e={})[pt.DataType]=vt.GetDeviceTime,e[pt.End]=!0,e[pt.Data]=((a={})[pt.DeviceTime]=n,a[pt.GPSTime]=r,a),e},t.int2Ascll=function(t){if(t<0||t>255)throw new Error("Value must be between 0 and 255");return String.fromCharCode(t)},t.getGpsTime=function(t){return"".concat(this.bcd2String(t[9]),".").concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]))},t.getUserInfo=function(t){for(var e,a,n=new Array(6).fill(0),r=0;r<5;r++)n[r]=this.hexByte2Int(t[r+1],0);var i="";for(r=6;r<12;r++)0!==t[r]&&(i+=String.fromCharCode(this.hexByte2Int(t[r],0)));return(e={})[pt.DataType]=vt.GetPersonalInfo,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Gender]=n[0],a[pt.Age]=n[1],a[pt.Height]=n[2],a[pt.Weight]=n[3],a[pt.Stride]=n[4],a[pt.KUserDeviceId]=i,a),e},t.getDeviceInfo=function(t,e){var a,n,r,i,c,o;switch(void 0===e&&(e="2208"),e){case"2025":var s=t[8]<<8|t[7],u={enableFlag:Boolean(s&mt.ENABLE_FLAG),call:Boolean(s&mt.CALL),sms:Boolean(s&mt.SMS),wechat:Boolean(s&mt.WECHAT),facebook:Boolean(s&mt.FACEBOOK),instagram:Boolean(s&mt.INSTAGRAM),skype:Boolean(s&mt.SKYPE),telegram:Boolean(s&mt.TELEGRAM),twitter:Boolean(s&mt.TWITTER),vk:Boolean(s&mt.VK),whatsapp:Boolean(s&mt.WHATSAPP),qq:Boolean(s&mt.QQ),linkedin:Boolean(s&mt.LINKEDIN)};return(a={})[pt.DataType]=vt.GetDeviceInfo,a[pt.End]=!0,a[pt.Data]=((n={})[pt.DistanceUnit]=this.hexByte2Int(t[1],0).toString(),n[pt.TimeUnit]=this.hexByte2Int(t[2],0).toString(),n[pt.StatusOfTheRaisedHandOnscreen]=this.hexByte2Int(t[3],0).toString(),n[pt.TempUnit]=this.hexByte2Int(t[4],0).toString(),n[pt.NightMode]=this.hexByte2Int(t[5],0).toString(),n[pt.ANCSMode]=this.hexByte2Int(t[6],0).toString(),n[pt.ANCSSubStatus]=u,n[pt.KBaseHeart]=this.hexByte2Int(t[9],0).toString(),n[pt.ScreenBrightness]=this.hexByte2Int(t[11],0).toString(),n[pt.Dialinterface]=this.hexByte2Int(t[12],0).toString(),n[pt.SocialDistancedwitch]=this.hexByte2Int(t[13],0).toString(),n[pt.ChineseOrEnglish]=this.hexByte2Int(t[14],0).toString(),n),a;case"V5":return(r={})[pt.DataType]=vt.GetDeviceInfo,r[pt.End]=!0,r[pt.Data]=((i={})[pt.SportEnable]=this.hexByte2Int(t[5],0).toString(),i[pt.HeartEnable]=this.hexByte2Int(t[6],0).toString(),i[pt.HeartDayEnable]=this.hexByte2Int(t[14],0).toString(),i),r;default:return(c={})[pt.DataType]=vt.GetDeviceInfo,c[pt.End]=!0,c[pt.Data]=((o={})[pt.DistanceUnit]=this.hexByte2Int(t[1],0).toString(),o[pt.TimeUnit]=this.hexByte2Int(t[2],0).toString(),o[pt.StatusOfTheRaisedHandOnscreen]=this.hexByte2Int(t[3],0).toString(),o[pt.TempUnit]=this.hexByte2Int(t[4],0).toString(),o[pt.NightMode]=this.hexByte2Int(t[5],0).toString(),o[pt.ANCSMode]=this.hexByte2Int(t[6],0).toString(),o[pt.KBaseHeart]=this.hexByte2Int(t[9],0).toString(),o[pt.ScreenBrightness]=this.hexByte2Int(t[11],0).toString(),o[pt.Dialinterface]=this.hexByte2Int(t[12],0).toString(),o[pt.SocialDistancedwitch]=this.hexByte2Int(t[13],0).toString(),o[pt.ChineseOrEnglish]=this.hexByte2Int(t[14],0).toString(),o),c}},t.getActivityData=function(t){for(var e,a,n=0,r=0,i=0,c=0,o=0,s=1;s<5;s++)n+=this.hexByte2Int(t[s],s-1);for(s=5;s<9;s++)r+=this.hexByte2Int(t[s],s-5);for(s=9;s<13;s++)i+=this.hexByte2Int(t[s],s-9);for(s=13;s<17;s++)c+=this.hexByte2Int(t[s],s-13);for(s=17;s<21;s++)o+=this.hexByte2Int(t[s],s-17);var 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={})[pt.DataType]=vt.RealTimeStep,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Step]=n.toString(),a[pt.Calories]=(r/100).toFixed(1),a[pt.Distance]=(i/100).toFixed(1),a[pt.ExerciseMinutes]=(c/60).toString(),a[pt.HeartRate]=u.toString(),a[pt.ActiveMinutes]=o.toString(),a[pt.TempData]=h.toFixed(1),a[pt.Blood_oxygen]=l.toString(),a),e},t.getGoal=function(t){for(var e,a,n=0,r=0,i=0,c=0,o=0;o<4;o++)n+=this.hexByte2Int(t[o+1],o);for(o=0;o<=1;o++)r+=this.hexByte2Int(t[o+7],o);for(o=0;o<=1;o++)i+=this.hexByte2Int(t[o+9],o);for(o=0;o<=1;o++)c+=this.hexByte2Int(t[o+11],o);return(e={})[pt.DataType]=vt.GetStepGoal,e[pt.End]=!0,e[pt.Data]=((a={})[pt.StepGoal]=n.toString(),a[pt.DistanceGoal]=r.toString(),a[pt.CalorieGoal]=i.toString(),a[pt.SleepTimeGoal]=c.toString(),a),e},t.getDeviceBattery=function(t){var e,a,n=this.hexByte2Int(t[1],0);return(e={})[pt.DataType]=vt.GetDeviceBatteryLevel,e[pt.End]=!0,e[pt.Data]=((a={})[pt.BatteryLevel]=n.toString(),a),e},t.getDeviceAddress=function(t){var e,a;if(0===t.length)return{};for(var n=[],r=1;r<7;r++){var i=t[r].toString(16).padStart(2,"0");n.push(i)}var c=n.join(":");return(e={})[pt.DataType]=vt.GetDeviceMacAddress,e[pt.End]=!0,e[pt.Data]=((a={})[pt.MacAddress]=c,a),e},t.getDeviceVersion=function(t){var e,a;if(0===t.length)return{};for(var n=[],r=1;r<5;r++)n.push(t[r].toString(16));var i=n.join(".");return(e={})[pt.DataType]=vt.GetDeviceVersion,e[pt.End]=!0,e[pt.Data]=((a={})[pt.DeviceVersion]=i,a),e},t.reset=function(){var t;return(t={})[pt.DataType]=vt.CMD_Reset,t[pt.End]=!0,t},t.mcuReset=function(){var t;return(t={})[pt.DataType]=vt.CMD_MCUReset,t[pt.End]=!0,t},t.notify=function(){var t;return(t={})[pt.DataType]=vt.Notify,t[pt.End]=!0,t},t.getDeviceName=function(t){for(var e,a,n="",r=1;r<15;r++){var i=this.hexByte2Int(t[r],0);0===i||i>127||(n+=String.fromCharCode(i))}return(e={})[pt.DataType]=vt.GetDeviceName,e[pt.End]=!0,e[pt.Data]=((a={})[pt.DeviceName]=n,a),e},t.getAutoHeart=function(t){var e,a,n=this.hexByte2Int(t[7],0)+this.hexByte2Int(t[8],1);return(e={})[pt.DataType]=vt.GetAutomaticHRMonitoring,e[pt.End]=!0,e[pt.Data]=((a={})[pt.WorkMode]=this.hexByte2Int(t[1],0).toString(),a[pt.StartTime]=this.bcd2String(t[2]),a[pt.KHeartStartMinter]=this.bcd2String(t[3]),a[pt.EndTime]=this.bcd2String(t[4]),a[pt.KHeartEndMinter]=this.bcd2String(t[5]),a[pt.Weeks]=this.getByteString(t[6]),a[pt.IntervalTime]=n.toString(),a),e},t.getWeekInt=function(t){for(var e=0,a=0;a<t.length;a++)1===t[a]&&(e+=Math.pow(2,a));return e},t.getByteString=function(t){for(var e=new Array(8).fill(0),a=[],n=0;n<=6;n++)e[n]=1&t,t>>=1,a.push(e[n].toString());return a.join("-")},t.getByteArray=function(t){for(var e=new Array(8).fill(0),a="",n=0;n<=7;n++)e[n]=1&t,t>>=1,a+=e[n];return a},t._hexByte2Int=function(t,e){return t<<8*e},t._bcd2String=function(t){var e=15&t;return"".concat(t>>4&15).concat(e)},t.getActivityAlarm=function(t){var e,a,n=((e={})[pt.StartTimeHour]=this._bcd2String(t[1]),e[pt.StartTimeMin]=this._bcd2String(t[2]),e[pt.EndTimeHour]=this._bcd2String(t[3]),e[pt.EndTimeMin]=this._bcd2String(t[4]),e[pt.Week]=this.getByteString(t[5]),e[pt.IntervalTime]=this._hexByte2Int(t[6],0).toString(),e[pt.LeastSteps]=this._hexByte2Int(t[7],0).toString(),e[pt.OpenOrClose]=this._hexByte2Int(t[8],0).toString(),e);return(a={})[pt.DataType]=vt.GetSedentaryReminder,a[pt.End]=!0,a[pt.Data]=n,a},t.getTotalStepData=function(t){var e,a;console.log("total:",t);var n=((e={})[pt.DataType]=vt.GetTotalActivityData,e[pt.End]=!1,e[pt.Data]=[],e),r=this.getStepCount(t),i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){var s=1+(o+1)*r;s<i&&255===t[s]&&(n[pt.End]=!0);for(var 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[pt.Data].push(((a={})[pt.Date]=u,a[pt.Step]=h.toString(),a[pt.ExerciseMinutes]=g.toString(),a[pt.Calories]=(S/100).toFixed(1),a[pt.Distance]=(d/100).toFixed(1),a[pt.Goal]=y.toString(),a[pt.ActiveMinutes]=D,a))}return n},t.getDetailData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetDetailActivityData,e[pt.End]=!1,e[pt.Data]=[],e),r=t.length,i=Math.floor(r/25);if(0===i)return n[pt.End]=!0,n;for(var c=0;c<i;c++){255===t[r-1]&&(n[pt.End]=!0);for(var o="20".concat(this._bcd2String(t[3+25*c]),".").concat(this._bcd2String(t[4+25*c]),".").concat(this._bcd2String(t[5+25*c])," ").concat(this._bcd2String(t[6+25*c]),":").concat(this._bcd2String(t[7+25*c]),":").concat(this._bcd2String(t[8+25*c])),s=0,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[pt.Data].push(((a={})[pt.Date]=o,a[pt.KDetailMinterStep]=s.toString(),a[pt.Calories]=(h/100).toFixed(2),a[pt.Distance]=(l/100).toFixed(2),a[pt.ArraySteps]=g.join(" "),a))}return n},t.getSleepData=function(t){var e,a,n,r=t.length,i=((e={})[pt.DataType]=vt.GetDetailSleepData,e[pt.End]=!1,e[pt.Data]=[],e),c=255===t[t.length-1]&&t[t.length-2]===V;if(c&&(i[pt.End]=!0),130===r||c&&132===r){for(var o="20".concat(this._bcd2String(t[3]),"-").concat(this._bcd2String(t[4]),"-").concat(this._bcd2String(t[5])," ").concat(this._bcd2String(t[6]),":").concat(this._bcd2String(t[7]),":").concat(this._bcd2String(t[8])),s=this._hexByte2Int(t[9],0),u=[],h=0;h<s;h++)u.push(this._hexByte2Int(t[10+h],0).toString());i[pt.Data].push(((a={})[pt.Date]=o,a[pt.ArraySleep]=u.join(" "),a[pt.sleepUnitLength]="1",a))}else{var l=Math.floor(r/34);if(0===l)return i[pt.End]=!0,i;for(var g=0;g<l;g++){for(o="20".concat(this._bcd2String(t[3+34*g]),"-").concat(this._bcd2String(t[4+34*g]),"-").concat(this._bcd2String(t[5+34*g])," ").concat(this._bcd2String(t[6+34*g]),":").concat(this._bcd2String(t[7+34*g]),":").concat(this._bcd2String(t[8+34*g])),s=this._hexByte2Int(t[9+34*g],0),u=[],h=0;h<s;h++)u.push(this._hexByte2Int(t[10+h+34*g],0).toString());i[pt.Data].push(((n={})[pt.Date]=o,n[pt.ArraySleep]=u.join(" "),n[pt.sleepUnitLength]="5",n))}}return i},t.getSleepActivityLevelsData=function(t){var e,a=t.length,n=((e={})[pt.DataType]=vt.GetRealTimeTemperatureCorrection,e),r=[];n[pt.Data]=r;var i=255===t[t.length-1]&&t[t.length-2]===Dt;if(i&&(n[pt.End]=!0),130===a||i&&132===a){var c={},o="20".concat(this._bcd2String(t[3]),"-").concat(this._bcd2String(t[4]),"-").concat(this._bcd2String(t[5])," ").concat(this._bcd2String(t[6]),":").concat(this._bcd2String(t[7]),":").concat(this._bcd2String(t[8]));c[pt.Date]=o;for(var s=this._hexByte2Int(t[9],0),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[pt.ArraySleep]=D,c[pt.ActivityArray]=S,c[pt.sleepUnitLength]="1",r.push(c)}return n},t.getAutoBloodOxygen=function(t){var e,a,n=((e={})[pt.DataType]=vt.AutoBloodOxygen,e[pt.End]=!1,e[pt.Data]=[],e),r=10,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),u=this._hexByte2Int(t[9+10*o],0).toString();n[pt.Data].push(((a={})[pt.Date]=s,a[pt.Blood_oxygen]=u,a))}return n},t.getBloodoxygen=function(t){var e,a,n=((e={})[pt.DataType]=vt.Blood_oxygen,e[pt.End]=!1,e[pt.Data]=[],e),r=10,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),u=this._hexByte2Int(t[9+10*o],0).toString();n[pt.Data].push(((a={})[pt.Date]=s,a[pt.Blood_oxygen]=u,a))}return n},t.getHeartData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetDynamicHR,e[pt.End]=!1,e[pt.Data]=[],e),r=24,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);for(var s="20".concat(this._bcd2String(t[3+o*r]),".").concat(this._bcd2String(t[4+o*r]),".").concat(this._bcd2String(t[5+o*r])," ").concat(this._bcd2String(t[6+o*r]),":").concat(this._bcd2String(t[7+o*r]),":").concat(this._bcd2String(t[8+o*r])),u=[],h=0;h<15;h++)u.push(this._hexByte2Int(t[9+h+o*r],0).toString());n[pt.Data].push(((a={})[pt.Date]=s,a[pt.ArrayDynamicHR]=u.join(" "),a))}return n},t.getOnceHeartData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetStaticHR,e[pt.End]=!1,e[pt.Data]=[],e),r=t.length,i=Math.floor(r/10);if(0===i||1===i&&153===t[1])return n[pt.End]=!0,n;for(var c=0;c<i;c++){255===t[r-1]&&(n[pt.End]=!0);var o="20".concat(this._bcd2String(t[3+10*c]),".").concat(this._bcd2String(t[4+10*c]),".").concat(this._bcd2String(t[5+10*c])," ").concat(this._bcd2String(t[6+10*c]),":").concat(this._bcd2String(t[7+10*c]),":").concat(this._bcd2String(t[8+10*c])),s=this._hexByte2Int(t[9+10*c],0).toString();n[pt.Data].push(((a={})[pt.Date]=o,a[pt.StaticHR]=s,a))}return n},t.getHrvTestData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetHRVData,e[pt.End]=!1,e[pt.Data]=[],e),r=15,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;255===t[t.length-1]&&(n[pt.End]=!0);for(var o=0;o<c;o++){var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),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[pt.Data].push(((a={})[pt.Date]=s,a[pt.HRV]=u,a[pt.VascularAging]=h,a[pt.HeartRate]=l,a[pt.Stress]=g,a[pt.highBP]=d,a[pt.lowBP]=S,a))}return n},t.getClockData=function(t){var e,a;console.log("getClockData:",t);var n=((e={})[pt.DataType]=vt.GetAlarmClock,e[pt.End]=!1,e[pt.Data]=[],e),r=41,i=t.length,c=!1,o=Math.floor(i/r);if(0===o)return n[pt.End]=!0,n;153==t[1]&&16==i&&(c=!0),n[pt.IsDeleteData]=c;for(var s=0;s<o;s++){var u=1+(s+1)*r;u<i&&255===t[u]&&(n[pt.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="",v=0;v<D;v++){var p=t[11+v+s*r];0!==p&&(f+=this.int2Ascll(this.hexByte2Int(p,0)))}n[pt.Data].push(((a={})[pt.KAlarmId]=h,a[pt.OpenOrClose]=l,a[pt.ClockType]=g,a[pt.ClockTime]=d,a[pt.KAlarmMinter]=S,a[pt.Week]=y,a[pt.KAlarmContent]=f,a[pt.KAlarmLength]=D.toString(),a))}return n},t.getTempDataer=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetAxillaryTemperatureDataWithMode,e[pt.End]=!1,e[pt.Data]=[],e),r=11,i=t.length,c=Math.floor(i/r);if(0===c||255===t[i-1])return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),u=this.hexByte2Int(t[9+o*r],0)+this.hexByte2Int(t[10+o*r],1);n[pt.Data].push(((a={})[pt.Date]=s,a[pt.axillaryTemperature]=(.1*u).toFixed(1),a))}return n},t.getQrCode=function(t,e){var a,n,r,i;return e?((a={})[pt.DataType]=vt.EnterQrCode,a[pt.End]=!0,a[pt.Data]={},a):128===t[1]||129===t[1]?((n={})[pt.DataType]=vt.QrCodeBandBack,n[pt.End]=!0,n[pt.Data]=((r={})[pt.Band]=129===t[1]?"1":"0",r),n):((i={})[pt.DataType]=vt.ExitQrCode,i[pt.End]=!0,i[pt.Data]={},i)},t.getTempData=function(t){var e,a,n=((e={})[pt.DataType]=vt.Temperature_history,e[pt.End]=!1,e[pt.Data]=[],e),r=11,i=t.length,c=Math.floor(i/r);if(0===c||255===t[i-1]||1===c&&153===t[1])return n[pt.End]=!0,n;for(var o=0;o<c;o++){255===t[i-1]&&(n[pt.End]=!0);var s="20".concat(this.bcd2String(t[3+o*r]),".").concat(this.bcd2String(t[4+o*r]),".").concat(this.bcd2String(t[5+o*r])," ").concat(this.bcd2String(t[6+o*r]),":").concat(this.bcd2String(t[7+o*r]),":").concat(this.bcd2String(t[8+o*r])),u=this.hexByte2Int(t[9+o*r],0)+this.hexByte2Int(t[10+o*r],1);n[pt.Data].push(((a={})[pt.Date]=s,a[pt.temperature]=(.1*u).toFixed(1),a))}return n},t.getExerciseData=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetActivityModeData,e[pt.End]=!1,e[pt.Data]=[],e),r=25,i=t.length,c=Math.floor(i/r);if(0===c)return n[pt.End]=!0,n;for(var o=0;o<c;o++){var s=1+(o+1)*r;s<i&&o===c-1&&255===t[s]&&(n[pt.End]=!0);for(var 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 v=new Array(4).fill(0);for(f=0;f<4;f++)v[3-f]=t[21+f+o*r];var p=this.getFloat(D,0),m=this.getFloat(v,0);n[pt.Data].push(((a={})[pt.Date]=u,a[pt.ActivityMode]=h,a[pt.HeartRate]=l,a[pt.ActiveMinutes]=g.toString(),a[pt.Step]=d.toString(),a[pt.Pace]="".concat(S.toString(16),"'").concat(y.toString(16)),a[pt.Distance]=m.toFixed(2),a[pt.Calories]=p.toFixed(1),a))}return n},t.getActivityExerciseData=function(t){for(var e,a,n=0,r=0,i=new Array(4).fill(0),c=0;c<4;c++)n+=this.hexByte2Int(t[c+2],c),i[3-c]=t[c+6],r+=this.hexByte2Int(t[c+10],c);var o=this.hexByte2Int(t[1],0),s=this.getFloat(i,0),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={})[pt.DataType]=vt.EnterActivityMode,e[pt.End]=!0,e[pt.Data]=((a={})[pt.HeartRate]=o.toString(),a[pt.Step]=n.toString(),a[pt.Calories]=s.toFixed(1),a[pt.Distance]=u.toFixed(1),a[pt.ActiveMinutes]=r.toString(),a),e},t.setTimeSuccessful=function(t){var e,a;return(e={})[pt.DataType]=vt.SetDeviceTime,e[pt.End]=!0,e[pt.Data]=((a={})[pt.KPhoneDataLength]=this.hexByte2Int(t[1],0).toString(),a),e},t.getData=function(t,e,a){for(var n=0,r=0;r<t;r++)n+=this.hexByte2Int(a[r+e],r);return n},t.getFloat=function(t,e){return this.intBitToDouble(this.getInt(t,e))},t.getInt=function(t,e){return(255&t[e])<<24|(255&t[e+1])<<16|(255&t[e+2])<<8|255&t[e+3]},t.setMethodSuccessful=function(t){var e;return(e={})[pt.DataType]=t,e[pt.End]=!0,e[pt.Data]={},e},t.getRealTimeTemperatureValue=function(t){var e,a=((e={})[pt.DataType]=vt.GetRealTimeTemperatureCorrection,e[pt.End]=!0,e),n={};a[pt.Data]=n;var r=t[1],i=t[2],c=t[3],o=t[4],s=t[5],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,v=this._leToInt(g,d)/10;return n[pt.highestTemp]=S,n[pt.displayTemp]=y,n[pt.ntcTemps]=[D,f,v],a},t._leToInt=function(t,e){return e<<8|t},t.getEcgHistoryData=function(t){var e,a=((e={})[pt.DataType]=vt.ECGdata,e[pt.End]=!1,e[pt.Data]={},e),n=t.length;if(n>=3&&113===t[0]&&255===t[1]&&255===t[2])return a[pt.End]=!0,a;if(113!==t[0]||n<3)return a;var r=this.hexByte2Int(t[1],0)+this.hexByte2Int(t[2],1);a[pt.Data][pt.ECGId]=r.toString();var i=3;if(n>=27){var c="20".concat(this.bcd2String(t[i]),"-")+"".concat(this.bcd2String(t[i+1]),"-")+"".concat(this.bcd2String(t[i+2])," ")+"".concat(this.bcd2String(t[i+3]),":")+"".concat(this.bcd2String(t[i+4]),":")+"".concat(this.bcd2String(t[i+5]));a[pt.Data][pt.Date]=c,i+=6;var o=this.hexByte2Int(t[i],0)+this.hexByte2Int(t[i+1],1);a[pt.Data][pt.ECGPointCount]=o.toString(),i+=2,a[pt.Data][pt.HRV]=this.hexByte2Int(t[i++],0).toString(),a[pt.Data][pt.HeartRate]=this.hexByte2Int(t[i++],0).toString(),a[pt.Data][pt.ECGMoodValue]=this.hexByte2Int(t[i++],0).toString(),i+=13}for(var s=[];i+1<n;){var u=this.hexByte2Int(t[i],0)+this.hexByte2Int(t[i+1],1);s.push(u),i+=2}return a[pt.Data][pt.ECGValue]=s,a},t.getEcgDataString=function(t){for(var e=[],a=Math.floor(t.length/2)-1,n=0;n<a;n++){var r=this.hexByte2Int(t[2*n+1],1)+this.hexByte2Int(t[2*n+2],0);r>=32768&&(r-=65536),e.push(r.toString())}return e.join(",")},t.ecgData=function(t){var e,a,n=this.hexByte2Int(t[1],0);return(e={})[pt.DataType]=vt.EcgppGstatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.EcgStatus]=n.toString(),a),e},t.ppgData=function(t){var e,a;return(e={})[pt.DataType]=vt.EcgppGstatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.PPGValue]=t,a),e},t.ecgResult=function(t){var e,a,n=((e={})[pt.DataType]=vt.GetEcgPpgStatus,e[pt.End]=!0,e[pt.Data]={},e);if(3===this.hexByte2Int(t[1],0)){var r="20".concat(this.bcd2String(t[10]),".").concat(this.bcd2String(t[11]),".").concat(this.bcd2String(t[12])," ").concat(this.bcd2String(t[13]),":").concat(this.bcd2String(t[14]),":").concat(this.bcd2String(t[15]));n[pt.Data]=((a={})[pt.Date]=r,a[pt.ECGHrvValue]=this.hexByte2Int(t[2],0).toString(),a[pt.ECGAvBlockValue]=this.hexByte2Int(t[3],0).toString(),a[pt.ECGHrValue]=this.hexByte2Int(t[4],0).toString(),a[pt.ECGStreesValue]=this.hexByte2Int(t[5],0).toString(),a[pt.ECGhighBpValue]=this.hexByte2Int(t[6],0).toString(),a[pt.ECGLowBpValue]=this.hexByte2Int(t[7],0).toString(),a[pt.ECGMoodValue]=this.hexByte2Int(t[8],0).toString(),a[pt.ECGBreathValue]=this.hexByte2Int(t[9],0).toString(),a)}return n},t.enterEcg=function(t){var e;return(e={})[pt.DataType]=vt.ENTERECG,e[pt.End]=!0,e[pt.Data]={},e},t.measurementWithType=function(t,e){var a,n,r,i,c,o,s,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={})[pt.DataType]=vt.MeasurementHrvCallback,a[pt.End]=!0,a[pt.Data]=((n={})[pt.HRV]=this.hexByte2Int(e[4],0),n[pt.highBP]=h,n[pt.lowBP]=l,n),a;case 2:return(r={})[pt.DataType]=vt.MeasurementHeartCallback,r[pt.End]=!0,r[pt.Data]=((i={})[pt.HeartRate]=this.hexByte2Int(e[2],0),i),r;case 3:return(c={})[pt.DataType]=vt.MeasurementOxygenCallback,c[pt.End]=!0,c[pt.Data]=((o={})[pt.Blood_oxygen]=this.hexByte2Int(e[3],0),o),c;case 4:var g=this.hexByte2Int(e[8],0)+this.hexByte2Int(e[9],1);return(s={})[pt.DataType]=vt.MeasurementTempCallback,s[pt.End]=!0,s[pt.Data]=((u={})[pt.temperature]=(.1*g).toFixed(1),u),s}else{var d={1:vt.StopMeasurementHrvCallback,2:vt.StopMeasurementHeartCallback,3:vt.StopMeasurementOxygenCallback,4:vt.StopMeasurementTempCallback};if(d[e[1]])return this.setMethodSuccessful(d[e[1]])}return{}},t.measurementWithTypeV8=function(t,e){var a,n,r,i,c,o,s;if(t)switch(e[1]){case 1:var u=this.hexByte2Int(e[6],0).toString(),h=this.hexByte2Int(e[7],0).toString();return(a={})[pt.DataType]=vt.MeasurementHrvCallback,a[pt.End]=!0,a[pt.Data]=((n={})[pt.HRV]=this.hexByte2Int(e[4],0),n[pt.highBP]=u,n[pt.lowBP]=h,n),a;case 2:return(r={})[pt.DataType]=vt.MeasurementHeartCallback,r[pt.End]=!0,r[pt.Data]=((i={})[pt.HeartRate]=this.hexByte2Int(e[2],0),i),r;case 3:return(c={})[pt.DataType]=vt.MeasurementOxygenCallback,c[pt.End]=!0,c[pt.Data]=((o={})[pt.Blood_oxygen]=this.hexByte2Int(e[3],0),o),c;case 4:return(s={})[pt.DataType]=vt.MeasurementECGCallback,s[pt.End]=!0,s[pt.Data]={},s}else{var l={1:vt.StopMeasurementHrvCallback,2:vt.StopMeasurementHeartCallback,3:vt.StopMeasurementOxygenCallback,4:vt.MeasurementECGCallback};if(l[e[1]])return this.setMethodSuccessful(l[e[1]])}return{}},t.measurementWithTypeV5=function(t,e){if(t)switch(e[1]){case 1:return this.setMethodSuccessful(vt.MeasurementHrvCallback);case 2:return this.setMethodSuccessful(vt.MeasurementHeartCallback);case 3:return this.setMethodSuccessful(vt.MeasurementOxygenCallback)}else switch(e[1]){case 1:return this.setMethodSuccessful(vt.StopMeasurementHrvCallback);case 2:return this.setMethodSuccessful(vt.StopMeasurementHeartCallback);case 3:return this.setMethodSuccessful(vt.StopMeasurementOxygenCallback)}return{}},t.measurementWithTypeV4=function(t,e){if(t)switch(e[1]){case 1:var a={},n={};return a[pt.DataType]=vt.MeasurementHrvCallback,a[pt.End]=!0,a[pt.Data]=n,n[pt.HRV]=this.hexByte2Int(e[4],0),n[pt.Stress]=this.hexByte2Int(e[5],0),n[pt.highBP]=this.hexByte2Int(e[6],0),n[pt.lowBP]=this.hexByte2Int(e[7],0),a;case 2:var r={},i={};return r[pt.DataType]=vt.MeasurementHeartCallback,r[pt.End]=!0,r[pt.Data]=i,i[pt.HeartRate]=this.hexByte2Int(e[2],0),r;case 3:var c={},o={};return c[pt.DataType]=vt.MeasurementOxygenCallback,c[pt.End]=!0,c[pt.Data]=o,o[pt.Blood_oxygen]=this.hexByte2Int(e[3],0),c}else switch(e[1]){case 1:return this.setMethodSuccessful(vt.StopMeasurementHrvCallback);case 2:return this.setMethodSuccessful(vt.StopMeasurementHeartCallback);case 3:return this.setMethodSuccessful(vt.StopMeasurementOxygenCallback);case 4:return this.setMethodSuccessful(vt.StopMeasurementTempCallback)}return{}},t.braceletdial=function(t,e){var a,n;return t?((a={})[pt.DataType]=vt.Braceletdial,a[pt.End]=!0,a):((n={})[pt.DataType]=vt.Braceletdialok,n[pt.End]=!0,n[pt.Data]={index:e[1].toString()},n)},t.getSportMode=function(t){for(var e,a=this.hexByte2Int(t[1],0),n=[],r=0;r<a;r++)n.push(this.hexByte2Int(t[r+2],0).toString());return(e={})[pt.DataType]=vt.GetSportMode,e[pt.End]=!0,e[pt.Data]=n.join(","),e},t.gPSControlCommand=function(t){for(var e,a,n="20".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2]),"-").concat(this.bcd2String(t[3])," ").concat(this.bcd2String(t[4]),":").concat(this.bcd2String(t[5]),":").concat(this.bcd2String(t[6])),r=new Array(4).fill(0),i=new Array(4).fill(0),c=0;c<4;c++)r[3-c]=t[9+c],i[3-c]=t[14+c];var o=this.getFloat(r,0).toString(),s=this.getFloat(i,0).toString(),u=this.hexByte2Int(t[18],0);return(e={})[pt.DataType]=vt.GPSControlCommand,e[pt.End]=!0,e[pt.Data]=((a={})[pt.KActivityLocationTime]=n,a[pt.KActivityLocationLatitude]=o,a[pt.KActivityLocationLongitude]=s,a[pt.KActivityLocationCount]=u.toString(),a),e},t.setSocial=function(t){var e;return(e={})[pt.DataType]=vt.SocialdistanceGetting,e[pt.End]=!0,e[pt.Data]={scanInterval:this.hexByte2Int(t[2],0).toString(),scanTime:this.hexByte2Int(t[3],0).toString(),signalStrength:t[4].toString()},e},t.ecgQuality=function(t){var e;return(e={})[pt.DataType]=vt.EcgppG,e[pt.End]=!0,e[pt.Data]={heartValue:this.hexByte2Int(t[1],0).toString(),hrvValue:this.hexByte2Int(t[2],0).toString(),Quality:this.hexByte2Int(t[3],0).toString()},e},t.enterPhotoModeback=function(t){var e,a="";switch(t[1]){case 1:a=0===t[2]?"0":"1";break;case 2:a="2";break;case 3:switch(t[2]){case 1:a="3";break;case 2:a="4";break;case 3:a="5";break;case 4:a="6";break;case 5:a="7"}break;case 4:a="8"}return(e={})[pt.DataType]=vt.DeviceSendDataToAPP,e[pt.End]=!0,e[pt.Data]={type:a},e},t.setNewDeviceInfo=function(t){var e;return(e={})[pt.DataType]=vt.SetNewDeviceInfo,e[pt.End]=!0,e[pt.Data]={},e},t.getNewDeviceInfo=function(t){var e;return(e={})[pt.DataType]=vt.GetNewDeviceInfo,e[pt.End]=!0,e[pt.Data]={KEcg:this.hexByte2Int(t[1],0).toString()},e},t.updateClockSuccessful=function(t){var e,a;return console.log("updateClockSuccessful:",t),(e={})[pt.DataType]=vt.SetAlarmClockWithAllClock,e[pt.End]=!0,e[pt.Data]=((a={})[pt.KClockLast]=this.hexByte2Int(t[t.length-1],0).toString(),a),e},t.setBoolSugarStatus=function(t){var e,a;return(e={})[pt.DataType]=vt.BoolsugarStatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.EcgStatus]=this.hexByte2Int(t[2],0),a),e},t.setBoolSugarValue=function(t){for(var e,a=t.slice(3),n=[],r=0;r<Math.floor(a.length/3);r++){var i=this.hexByte2Int(a[3*r],2)+this.hexByte2Int(a[3*r+1],1)+this.hexByte2Int(a[3*r+2],0);n.push(i)}return(e={})[pt.DataType]=vt.BoolsugarValue,e[pt.End]=!0,e[pt.Data]={timestamp:Math.floor(Date.now()/1e3),ppg:n},e},t.setMethodError=function(t){var e;return(e={})[pt.DataType]=t,e[pt.End]=!1,e[pt.Data]={},e},t.readPregnancyCycle=function(t){var e,a;return(e={})[pt.DataType]=vt.GetPregnancyCycle,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Date]="20".concat(this.bcd2String(t[3]),"-").concat(this.bcd2String(t[4]),"-").concat(this.bcd2String(t[5])),a[pt.Week]=this.hexByte2Int(t[1],0),a[pt.DayOfWeek]=this.hexByte2Int(t[2],0),a),e},t.readWomenHealth=function(t){var e,a;return(e={})[pt.DataType]=vt.GetWomenHealth,e[pt.End]=!0,e[pt.Data]=((a={})[pt.Date]="".concat(this.bcd2String(t[1]),"-").concat(this.bcd2String(t[2])),a[pt.WomenHealthPeriod]=this.hexByte2Int(t[3],0),a[pt.WomenHealthLength]=this.hexByte2Int(t[4],0),a),e},t.getTemperatureCorrectionValue=function(t){var e,a,n=[t[3],t[2]],r=this.byteArrayToInt(n);return(e={})[pt.DataType]=vt.CMD_Set_TemperatureCorrection,e[pt.End]=!0,e[pt.Data]=((a={})[pt.TemperatureCorrectionValue]=r.toString(),a),e},t.byteArrayToInt=function(t){return t[0]<<8&65280|255&t[1]},t.getHistoryGpsData=function(t){var e,a=[],n=((e={})[pt.DataType]=vt.Gps,e[pt.End]=!1,e),r=59,i=t.length,c=Math.floor(i/r);if(0===c)return n;255===t[t.length-1]&&90===t[t.length-2]&&(n[pt.End]=!0);for(var o=0;o<c;o++){for(var s={},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[pt.Date]=17===u.length?u:"2019.01.01 00:00:00",s[pt.Latitude]=h.join(","),s[pt.Longitude]=l.join(","),a.push(s)}return n[pt.Data]=a,n},t.getPPITestData=function(t){var e,a=((e={})[pt.DataType]=vt.GetPPIData,e[pt.End]=!1,e[pt.Data]=[],e),n=123,r=t.length,i=Math.floor(r/n);if(0===i)return a[pt.End]=!0,a;255===t[t.length-1]&&(a[pt.End]=!0);for(var c=0;c<i;c++){for(var o={},s=new Array(2).fill(0),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),v=0;v<2;v++)f[1-v]=t[D+v+c*n];var p=this.getFloat(f,0);if(0===p)break;S.push(p)}o[pt.TOTAL_ID]=g.toString(),o[pt.PPI_ID]=d,o[pt.DeviceTime]=l,o[pt.PPI_LIST]=S,o[pt.PPI_NUM]=h,a[pt.Data].push(o)}return a},t.getPPIV5Data=function(t){var e,a,n=t.length,r=((e={})[pt.DataType]=vt.GetPPIData,e[pt.End]=!1,e),i=[];r[pt.Data]=i,t.length>1&&255===t[t.length-1]&&t[t.length-2]===ut&&(r[pt.End]=!0);for(var c=0;c<Math.floor(n/123);c++){for(var o=123*c,s="20".concat(this.bcd2String(t[o+3]),".").concat(this.bcd2String(t[o+4]),".").concat(this.bcd2String(t[o+5])," ").concat(this.bcd2String(t[o+6]),":").concat(this.bcd2String(t[o+7]),":").concat(this.bcd2String(t[o+8])),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={})[pt.Date]=s,a[pt.PPI_LIST]=l,a[pt.PPI_UNIT]="ms",a[pt.PPI_NUM]=u,a[pt.PPI_ID]=h,a))}return r},t.getHrvTimeData=function(t){var e,a;return(e={})[pt.DataType]=vt.GetHrvTimeValue,e[pt.End]=!0,e[pt.Data]=((a={})[pt.HRV_TIME_MODE]=this.hexByte2Int(t[1],0),a[pt.HRV_TIME_Value]=this.hexByte2Int(t[2],0),a),e},t.closeDevices=function(t){var e,a;return(e={})[pt.DataType]=vt.CloseDevices,e[pt.End]=!0,e[pt.Data]=((a={})[pt.RESULT]=!0,a),e},t.getOffCheckStatus=function(t){var e,a;return(e={})[pt.DataType]=vt.GetOffCheckStatus,e[pt.End]=!0,e[pt.Data]=((a={})[pt.GET_OFF_TAG]=this.hexByte2Int(t[1],0),a[pt.GET_OFF_STATE]=this.hexByte2Int(t[2],0),a),e},t.getStepCount=function(t){var e=27,a=t.length;return 2!==a&&(a%26==0?e=26:a%27==0?e=27:(a-2)%26==0?e=26:(a-2)%27==0&&(e=27)),e},t.getPPGWaveformData=function(t){var e,a=((e={})[pt.DataType]=vt.PPGRealtime,e[pt.End]=!1,e[pt.Data]=[],e);if(!t||t.length<4)return a;if(57!==t[0])return a;for(var n=2,r=[];n+1<t.length;){var i=this.hexByte2Int(t[n],0)+this.hexByte2Int(t[n+1],1);r.push(i),n+=2}return a[pt.Data]=r,a},t.startDeviceMeasurementWithType=!1,t}();"function"==typeof SuppressedError&&SuppressedError;var Tt=function(){function pt(){}return pt.generateValue=function(t){return new Array(t).fill(0)},pt.hexByte2Int=function(t,e){return(255&t)*Math.pow(256,e)},pt.generateInitValue=function(){return this.generateValue(16)},pt.arrayCopy=function(t,e,a,n,r){for(var i=0;i<r;i++)a[n+i]=t[e+i]},pt.crcValue=function(t){for(var e=0,a=0;a<t.length-1;a++)e+=t[a];t[t.length-1]=255&e},pt.crcDynamicValue=function(t){for(var e=0,a=0,n=t;a<n.length;a++){e+=n[a]}t[t.length-1]=255&e},pt.getBcdValue=function(t){return 16*Math.floor(t/10)+t%10},pt.dataParsingWithData=function(P,J){if(void 0===J&&(J="2208"),!P||0===P.length)return It.setMethodError("Empty data");switch(P[0]){case s:return It.setMethodSuccessful(vt.SetStepGoal);case a:return It.setMethodSuccessful(vt.SetPersonalInfo);case D:break;case y:return It.setMethodSuccessful(vt.SetMotorVibrationWithTimes);case r:return It.setMethodSuccessful(vt.SetDeviceInfo);case v:return It.setMethodSuccessful(vt.SetAutomaticHRMonitoring);case St:return It.setMethodSuccessful(vt.SetSedentaryReminder);case c:return It.setMacSuccessful();case k:return It.setMethodSuccessful(vt.EnterActivityMode);case R:return 0!==P[2]&&0!==P[3]?It.getTemperatureCorrectionValue(P):It.setMethodSuccessful(vt.CMD_Set_TemperatureCorrection);case H:return It.getActivityExerciseData(P);case t:return It.setTimeSuccessful(P);case b:return It.getExerciseData(P);case e:return It.getDeviceTime(P);case n:return It.getUserInfo(P);case i:return It.getDeviceInfo(P,J);case o:return It.getActivityData(P);case u:return It.getGoal(P);case h:return It.getDeviceBattery(P);case l:return It.getDeviceAddress(P);case g:return It.getDeviceVersion(P);case f:return It.getDeviceName(P);case p:return It.getAutoHeart(P);case d:return It.reset();case S:return It.mcuReset();case I:return It.notify();case yt:return It.getActivityAlarm(P);case T:return It.getTotalStepData(P);case B:return It.getDetailData(P);case V:return It.getSleepData(P);case E:return It.getHeartData(P);case x:return It.getOnceHeartData(P);case A:return It.getHrvTestData(P);case C:return It.getClockData(P);case m:return It.updateClockSuccessful(P);case w:return It.setNewDeviceInfo(P);case W:return It.getNewDeviceInfo(P);case O:return It.enterPhotoModeback(P);case L:return It.setMethodSuccessful(vt.EnterPhotoMode);case N:return It.setMethodSuccessful(vt.BackHomeView);case K:return It.ecgQuality(P);case F:case U:break;case Q:return It.setMethodSuccessful(vt.Weather);case j:return It.braceletdial(!1,P);case q:return"V4"===J||"V5"===J?It.getRealTimeTemperatureValue(P):It.setMethodSuccessful(vt.SportMode);case Y:return It.getSportMode(P);case z:return"V4"===J?It.measurementWithTypeV4(this.StartDeviceMeasurementWithType,P):"V5"===J||"2025"===J?It.measurementWithTypeV5(this.StartDeviceMeasurementWithType,P):"V8"===J?It.measurementWithTypeV8(this.StartDeviceMeasurementWithType,P):It.measurementWithType(this.StartDeviceMeasurementWithType,P);case X:return It.gPSControlCommand(P);case Z:return It.getHistoryGpsData(P);case $:return It.setMethodSuccessful(vt.Clear_Bracelet_data);case _:return It.getAutoBloodOxygen(P);case M:return It.getBloodoxygen(P);case G:if(this.isSettingSocial)return It.setMethodSuccessful(vt.SocialdistanceSetting);It.setSocial(P);case tt:return It.setMethodSuccessful(vt.Sos);case et:return It.getTempData(P);case at:return It.getTempDataer(P);case nt:return It.getQrCode(P,!1);case dt:return It.setBoolSugarValue(P);case rt:return It.ecgResult(P);case st:return It.readPregnancyCycle(P);case it:return It.getEcgHistoryData(P);case ot:return 0===P[1]?It.setMethodSuccessful(vt.SetWomenHealth):It.readWomenHealth(P);case ct:var pt=this.hexByte2Int(P[1],0),mt=this.hexByte2Int(P[2],0);if(0!==pt)return It.setMethodSuccessful(vt.ppgStartFailed);switch(mt){case 1:return It.setMethodSuccessful(vt.ppgStartSucessed);case 2:return It.setMethodSuccessful(vt.ppgResult);case 3:return It.setMethodSuccessful(vt.ppgStop);case 4:return It.setMethodSuccessful(vt.ppgMeasurementProgress);case 5:return It.setMethodSuccessful(vt.ppgQuit);default:return It.setMethodSuccessful(vt.ppgStartFailed)}case ut:return"V4"===J||"V5"===J?It.getPPIV5Data(P):It.getPPITestData(P);case ht:return It.getHrvTimeData(P);case lt:return It.closeDevices(P);case gt:return It.getOffCheckStatus(P);case Dt:return It.getSleepActivityLevelsData(P);case ft:return It.getPPGWaveformData(P)}return It.setMethodError(this.getBcdValue(P[0]).toString())},pt.bloodsugarWithMode=function(t,e){var a=this.generateInitValue();return a[0]=ct,a[1]=t,2!==t&&4!==t||(a[2]=e),this.crcValue(a),a},pt.getDetailSleepDataWithMode=function(t){var e=this.generateInitValue();return e[0]=V,e[1]=99===t?153:t,this.crcValue(e),e},pt.insertDateValue=function(t,e){if(e&&!(e.length<=0)){var a=e.split(" "),n=a[0],r=a[1],i=n.split("-").map(Number),c=i[0],o=i[1],s=i[2],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)}},pt.getHRVDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=A,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},pt.getPPIDDataWithMode=function(t){var e=this.generateInitValue();return e[0]=ut,e[1]=99===t?153:0===t?0:1===t?1:2,this.crcValue(e),e},pt.getHrvTestTime=function(){var t=this.generateInitValue();return t[0]=ht,t[1]=0,this.crcValue(t),t},pt.setHrvTestTime=function(t){var e=this.generateInitValue();return e[0]=ht,e[1]=1,e[2]=t,this.crcValue(e),e},pt.closeBlueDevice=function(){var t=this.generateInitValue();return t[0]=lt,this.crcValue(t),t},pt.startBloodSugar=function(){var t=this.generateInitValue();return t[0]=ct,t[1]=1,this.crcValue(t),t},pt.progressBloodSugar=function(t){var e=this.generateInitValue();return e[0]=ct,e[1]=4,e[2]=t,this.crcValue(e),e},pt.endBloodSugar=function(){var t=this.generateInitValue();return t[0]=ct,t[1]=3,this.crcValue(t),t},pt.getTotalActivityDataWithMode=function(t){var e=this.generateInitValue();return e[0]=T,e[1]=99===t?153:0===t?0:1===t?1:2,this.crcValue(e),e},pt.getTotalActivityDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=T,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},pt.getDetailSleepDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=V,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getDetailActivityDataWithModeForTime=function(t,e){var a=this.generateInitValue();return a[0]=B,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getTemperature_historyDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=et,a[1]=99===t?153:t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getAxillaryTemperatureDataWithMode=function(t,e){var a=this.generateInitValue();return a[0]=at,a[1]=99===t?153:0===t?0:1===t?1:2,this.insertDateValue(a,e),this.crcValue(a),a},pt.enterActivityMode=function(t,e){var a=this.generateInitValue();return a[0]=k,a[1]=e,a[2]=t,this.crcValue(a),a},pt.sendHeartPackage=function(t,e,a){var n=this.generateInitValue(),r=255&Math.floor(e/60),i=e%60&255,c=new ArrayBuffer(4);new DataView(c).setFloat32(0,t,!0);var o=Array.from(new Uint8Array(c));return n[0]=J,this.arrayCopy(o,0,n,1,o.length),n[5]=r,n[6]=i,n[7]=255&a,this.crcValue(n),n},pt.realTimeStep=function(t,e){var a=this.generateInitValue();return a[0]=o,a[1]=t?1:0,a[2]=e?1:0,this.crcValue(a),a},pt.stopGo=function(){var t=this.generateInitValue();return t[0]=o,t[1]=0,this.crcValue(t),t},pt.setPersonalInfo=function(t){var e=this.generateInitValue();return e[0]=a,e[1]=t.sex,e[2]=t.age,e[3]=t.height,e[4]=t.weight,t.stepLength&&(e[5]=t.stepLength),this.crcValue(e),e},pt.getPersonalInfo=function(){var t=this.generateInitValue();return t[0]=n,this.crcValue(t),t},pt.enterOTA=function(){var t=this.generateInitValue();return t[0]=P,this.crcValue(t),t},pt.getDeviceVersion=function(){var t=this.generateInitValue();return t[0]=g,this.crcValue(t),t},pt.reset=function(){var t=this.generateInitValue();return t[0]=d,this.crcValue(t),t},pt.getDeviceMacAddress=function(){var t=this.generateInitValue();return t[0]=l,this.crcValue(t),t},pt.getDeviceBatteryLevel=function(){var t=this.generateInitValue();return t[0]=h,this.crcValue(t),t},pt.mcuReset=function(){var t=this.generateInitValue();return t[0]=S,this.crcValue(t),t},pt.setDeviceName=function(t){var e=this.generateInitValue(),a=Math.min(t.length,14);e[0]=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},pt.getDeviceName=function(){var t=this.generateInitValue();t[0]=f;for(var e=1;e<6;e++)t[e]=0;return this.crcValue(t),t},pt.setDeviceTime=function(e){var a=this.generateInitValue(),n=e.getFullYear()%100,r=e.getMonth()+1,i=e.getDate(),c=e.getHours(),o=e.getMinutes(),s=e.getSeconds();return a[0]=t,a[1]=this.getBcdValue(n),a[2]=this.getBcdValue(r),a[3]=this.getBcdValue(i),a[4]=this.getBcdValue(c),a[5]=this.getBcdValue(o),a[6]=this.getBcdValue(s),this.crcValue(a),a},pt.getDeviceTime=function(){var t=this.generateInitValue();return t[0]=e,this.crcValue(t),t},pt.setDeviceInfo=function(t){var e=this.generateInitValue();return e[0]=r,e[1]=t.distanceUnit?129:128,e[2]=t.is12Hour?129:128,e[3]=t.handUpLightScreenSwitch?129:128,e[4]=t.fahrenheit?128:129,e[5]=t.nightMode?129:128,e[6]=t.ancs?129:128,e[7]=255&t.ancsMask,e[8]=t.ancsMask>>8&255,e[9]=128|t.baseHeart,e[11]=128+t.screenBrightness,e[12]=128+t.indexDial,e[13]=t.socialDistance?129:128,e[14]=128+t.languages,this.crcValue(e),e},pt.setDeviceInfoV5=function(t,e,a){var n=this.generateInitValue();return n[0]=r,n[6]=t?129:128,n[5]=e?129:128,n[14]=a?129:128,this.crcValue(n),n},pt.setDeviceID=function(t){var e=this.generateInitValue();if(e[0]=c,t.length>=6)for(var a=0;a<6;a++)e[1+a]=t[a];return this.crcValue(e),e},pt.reminderCommand=function(t,e,a){var n=this.generateValue(80);n[0]=I,n[1]=255&t;var r=new TextEncoder,i=Array.from(r.encode(e)).slice(0,60);n[2]=i.length;for(var c=0;c<i.length;c++)n[3+c]=i[c];var o=Array.from(r.encode(a)).slice(0,15);n[63]=o.length;for(c=0;c<o.length;c++)n[64+c]=o[c];return n},pt.updateWeather=function(t){var e=this.generateValue(41);e[0]=Q,e[1]=255&t.weatherCode,e[2]=255&t.currentTemp,e[3]=255&t.maxTemp,e[4]=255&t.minTemp,e[5]=255&t.aqi,e[6]=t.aqi>>8&255;var a=new TextEncoder,n=Array.from(a.encode(t.address)).slice(0,32);e[7]=n.length;for(var r=0;r<n.length;r++)e[8+r]=n[r];return e},pt.mapWeatherCode=function(t){var e=Number(t);return Number.isNaN(e)?153:e>=0&&e<=38?e:153},pt.healthMeasurementWithDataType=function(t,e,a){this.StartDeviceMeasurementWithType=e;var n=this.generateInitValue();return n[0]=z,n[1]=t,n[2]=e?1:0,!a||a<=0?(n[4]=255,n[5]=255):(n[4]=255&a,n[5]=a>>8&255),this.crcValue(n),n},pt.realECGWave=function(t){var e=this.generateInitValue();return e[0]=W,e[1]=t?1:0,this.crcValue(e),e},pt.setBraceletdial=function(t){this.isRuning=!0;var e=this.generateInitValue();return e[0]=j,e[1]=t,this.crcValue(e),e},pt.setAutomaticHRMonitoring=function(t){var e=this.generateInitValue(),a=t.time;return e[0]=v,e[1]=t.open,e[2]=this.getBcdValue(t.startHour),e[3]=this.getBcdValue(t.startMinute),e[4]=this.getBcdValue(t.endHour),e[5]=this.getBcdValue(t.endMinute),e[6]=t.week,e[7]=255&a,e[8]=a>>8&255,e[9]=t.type,this.crcValue(e),e},pt.getAutomaticHRMonitoring=function(t){var e=this.generateInitValue();return e[0]=p,e[1]=t,this.crcValue(e),e},pt.getActivityModeDataWithMode=function(t){var e=this.generateInitValue();return e[0]=b,e[1]=t,this.crcValue(e),e},pt.getStaticHRWithMode=function(t,e){var a=this.generateInitValue();return a[0]=x,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getDynamicHRWithMode=function(t,e){var a=this.generateInitValue();return a[0]=E,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getBloodOxygen=function(t,e){var a=this.generateInitValue();return a[0]=M,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.getAutoBloodOxygen=function(t,e){var a=this.generateInitValue();return a[0]=_,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.setStepGoal=function(t,e,a,n,r){var i=this.generateInitValue();return i[0]=s,i[4]=t>>24&255,i[3]=t>>16&255,i[2]=t>>8&255,i[1]=255&t,i[6]=e>>8&255,i[5]=255&e,i[8]=a>>8&255,i[7]=255&a,i[10]=n>>8&255,i[9]=255&n,i[12]=r>>8&255,i[11]=255&r,this.crcValue(i),i},pt.GetStepGoal=function(){var t=this.generateInitValue();return t[0]=u,this.crcValue(t),t},pt.getDeviceInfo=function(){var t=this.generateInitValue();return t[0]=i,this.crcValue(t),t},pt.sendHex=function(t,e){var a=function(t,e,a){if(a||2===arguments.length)for(var n,r=0,i=e.length;r<i;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}([],t,!0);return e&&this.crcDynamicValue(a),a},pt.getAlarmClock=function(){var t=this.generateInitValue();return t[0]=C,this.crcValue(t),t},pt.deleteAllAlarmClock=function(){var t=this.generateInitValue();return t[0]=C,t[1]=153,this.crcValue(t),t},pt.setAlarmClock=function(t){var e,a=this,n=[],r=39*t.length+2;if(r>128)for(var i=Math.floor(128/39),c=Math.ceil(t.length/i),o=0;o<c;o++){for(var s=o===c-1,u=s?t.length-i*o:i,h=new Array(39*u+(s?2:0)).fill(0),l=0;l<u;l++){var g=t[i*o+l],d=g.openOrClose,S=g.clockType,y=g.clockTime,D=g.week,f=g.text,v=39*l;h[v]=35,h[v+1]=t.length,h[v+2]=i*o+l,h[v+3]=d,h[v+4]=S,h[v+5]=this.getBcdValue(y.substring(0,2)),h[v+6]=this.getBcdValue(y.substring(3,5)),h[v+7]=D;var p=this.textToUtf8BytesSafe(f),m=Math.min(p.length,30);h[v+8]=m;for(var I=0;I<m;I++)h[v+9+I]=null!==(e=p[I])&&void 0!==e?e:0}s&&(h[h.length-2]=35,h[h.length-1]=255),n.push(h)}else{var T=new Array(r).fill(0);t.forEach(function(e,n){var r,i=e.openOrClose,c=e.clockType,o=e.clockTime,s=e.week,u=e.text,h=39*n;T[h]=35,T[h+1]=t.length,T[h+2]=n,T[h+3]=i,T[h+4]=c,T[h+5]=a.getBcdValue(o.substring(0,2)),T[h+6]=a.getBcdValue(o.substring(3,5)),T[h+7]=s;var l=a.textToUtf8BytesSafe(u),g=Math.min(l.length,30);T[h+8]=g;for(var d=0;d<g;d++)T[h+9+d]=null!==(r=l[d])&&void 0!==r?r:0}),T[r-2]=35,T[r-1]=255,n.push(T)}return n},pt.textToUtf8BytesSafe=function(t,e){void 0===e&&(e=30);for(var a=[],n=0,r=0;r<t.length;r++){var i=t[r],c=this.utf8EncodeChar(i);if(n+c.length>e)break;a.push.apply(a,c),n+=c.length}for(;a.length<e;)a.push(0);return a},pt.utf8EncodeChar=function(t){var e=t.codePointAt(0);return void 0===e?[]:e<=127?[e]:e<=2047?[192|e>>6,128|63&e]:e<=65535?[224|e>>12,128|e>>6&63,128|63&e]:[240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e]},pt.getSedentaryReminder=function(){var t=this.generateInitValue();return t[0]=yt,this.crcValue(t),t},pt.setSedentaryReminder=function(t){var e=this.generateInitValue();e[0]=St,e[1]=this.getBcdValue(t.startTime_Hour),e[2]=this.getBcdValue(t.startTime_Minutes),e[3]=this.getBcdValue(t.endTime_Hour),e[4]=this.getBcdValue(t.endTime_Minutes);var a=(t.weeks.sunday?1:0)+(t.weeks.monday?2:0)+(t.weeks.tuesday?4:0)+(t.weeks.wednesday?8:0)+(t.weeks.thursday?16:0)+(t.weeks.friday?32:0)+(t.weeks.saturday?64:0);return e[5]=a,e[6]=t.intervalTime,e[7]=t.leastSteps,e[8]=t.mode,this.crcValue(e),e},pt.getRealTimeSleepDataWithMode=function(t){var e=this.generateInitValue();return e[0]=Dt,e[1]=t,this.crcValue(e),e},pt.enterTakePhoto=function(){var t=this.generateInitValue();return t[0]=L,this.crcValue(t),t},pt.enterSOS=function(){var t=this.generateInitValue();return t[0]=tt,this.crcValue(t),t},pt.clearBraceletData=function(){var t=this.generateInitValue();return t[0]=$,this.crcValue(t),t},pt.startPPGRealtime=function(t){var e=this.generateInitValue();return e[0]=ft,e[1]=t?1:0,this.crcValue(e),e},pt.confirmUnbind=function(t){var e=this.generateInitValue();return e[0]=nt,e[1]=t?129:128,this.crcValue(e),e},pt.setSocialSetting=function(t,e,a){this.isSettingSocial=!0;var n=this.generateInitValue();return n[0]=G,n[1]=1,n[2]=t,n[3]=e,n[4]=a,this.crcValue(n),n},pt.getSocialSetting=function(){this.isSettingSocial=!1;var t=this.generateInitValue();return t[0]=G,t[1]=0,this.crcValue(t),t},pt.getEcgHistory=function(t,e){var a=this.generateInitValue();return a[0]=it,a[1]=t,this.insertDateValue(a,e),this.crcValue(a),a},pt.deleteAllEcgHistory=function(){var t=this.generateInitValue();return t[0]=it,this.crcValue(t),t},pt.DATA_READ_START=0,pt.DATA_READ_CONTINUE=2,pt.DATA_DELETE=99,pt.DistanceMode_MILE=129,pt.DistanceMode_KM=128,pt.TimeMode_12h=129,pt.TimeMode_24h=128,pt.WristOn_Enable=129,pt.WristOn_DisEnable=128,pt.TempUnit_C=128,pt.TempUnit_F=129,pt.TAG="BleSDK",pt.isRuning=!1,pt.ecgopen=!1,pt.read=!1,pt.pregnancyCycleRead=!1,pt.isSettingSocial=!1,pt.StartDeviceMeasurementWithType=!1,pt}();export{mt as ANCS_MASK,vt as BleConst,Tt as BleSDK,pt as DeviceKey,It as ResolveUtil};
2
2
  //# sourceMappingURL=index.esm.js.map