jkyy_yiyun_yuyue_bp_sdk 1.2.9 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -68,6 +68,7 @@ this.YUYUEBP.getHistoryData((__) => __)
68
68
  | 参数 | 类型 | 是否必填 | 描述 |
69
69
  | :----------: | :-----: | :------: | :------------------------------: |
70
70
  | debug | Boolean | 否 | 开启 debug 模式,默认 false |
71
+ | automaticUnbinding | Boolean | 否 | 是否自动解绑,默认 false |
71
72
  | tokenUrl | String | 是 | 由健康有益提供 |
72
73
  | bizType | String | 是 | 由健康有益提供 |
73
74
  | appId | String | 是 | 由健康有益提供 |
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("jkyy_wx_bluetooth");const t=e.tools;class i extends e.Bluetooth{constructor(e={}){super(e),this.bindList={},this.updateUserInfo(),this.isHistory=!1,this.historyList=[],this.serviceId="00001810-0000-1000-8000-00805F9B34FB",this.timeServiceId="00001805-0000-1000-8000-00805F9B34FB",this.serviceIdArr=["00001810-0000-1000-8000-00805F9B34FB","00001805-0000-1000-8000-00805F9B34FB"],this.timeWriteId="00002A2B-0000-1000-8000-00805F9B34FB",this.writeId="00002A52-0000-1000-8000-00805F9B34FB",this.notifyId="00002A35-0000-1000-8000-00805F9B34FB"}updateUserInfo(){this.apiUserSave("",this.userId,["nickname","userImageUrl","mobileNo","gender"],this.nickname,this.userImageUrl,this.mobileNo,this.gender)}scan(e={}){var{services:t=[this.serviceId],allowDuplicatesKey:i=!0,powerLevel:s="medium",interval:r=0,timeout:a=6e4,deviceName:n="",containName:e="BP-YE650A"}=e;return this.scanCallback({services:t,allowDuplicatesKey:i,powerLevel:s,interval:r,timeout:a,deviceName:n,containName:e})}stopScan(){return this.stopScanCallback()}async connect(s,r){if(!s)throw new Error("device is undefiend");var e=await this.apiBindList(this.userId,"DESC");if(this.bindList=e&&e.length?e[0]:{},this.bindList.deviceId){if(!this.bindList.deviceExtra&&"ios"===t.getSystemInfoSync().platform){let e={};e.uuid=s.deviceId,await this.apiBindDevice(this.userId,s.name,this.bindList.deviceId,JSON.stringify(e),!0)}if(this.bindList.deviceExtra=JSON.parse(this.bindList.deviceExtra)?JSON.parse(this.bindList.deviceExtra):this.bindList.deviceExtra,this.bindList.deviceId===s.deviceId||this.bindList.deviceExtra.uuid===s.deviceId)return this._connect_device=JSON.stringify(s),console.log("当前连接的设备信息存起来",s,s.deviceId,this._connect_device),this.connectCallback(s,r);throw new Error("解绑原设备后再绑定新设备")}{let e=s.deviceId,i={uuid:""};return"ios"===t.getSystemInfoSync().platform?(console.log(s),e=s.deviceId,i=s.deviceExtra):s.deviceId=s.deviceId,await this.apiBindDevice(this.userId,s.name,e,JSON.stringify(i),!0),this._connect_device=JSON.stringify(s),console.log(3333,s,r),this.connectCallback(s,r)}}disconnect(){return this.disconnectCallback()}registerDidUpdateConnectStatus(e){if("function"!=typeof e)throw new TypeError("connectStatus callback expect function");this.registerDidUpdateConnectStatusCallback(e)}registerDidDiscoverDevice(e){if("function"!=typeof e)throw new TypeError("discoverDevice callback expect function");this.registerDidDiscoverDeviceCallback(e)}read(e={suuid:"",cuuid:""}){return this.readCallback(e)}write(e={}){let{suuid:t=this.serviceId,cuuid:i=this.writeId,value:s}=e;return s=s.join(""),this.writeCallback({suuid:t,cuuid:i,value:s})}notify(e={}){const{suuid:t=this.serviceId,cuuid:i=this.notifyId,state:s=!0}=e;this.notifyCallback({suuid:t,cuuid:i,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(i)}),this.notifyCallback({suuid:t,cuuid:this.writeId,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(this.writeId)})}registerDidUpdateValueForCharacteristic(s){this.registerDidUpdateValueForCharacteristicCallback(n=>{this.log(`notify: characteristic(${s})`,n.value);const c=n.value;console.log("注册\b特征值改变回调===================",c);let o={},e=JSON.parse(this._connect_device);if("06,00,01,01"!==c.toString()){let e=t.num16to10D(c[1]+c[2]),i=t.num16to10D(c[3]+c[4]),s=t.num16to10D(c[14]+c[15]),r=`${t.num16to10D(c[7]+c[8])}-${t.num16to10(c[9])}-${t.num16to10(c[10])} ${t.num16to10(c[11])}:${t.num16to10(c[12])}:${t.num16to10(c[13])}`,a=0;c[17]+c[18]==="0000"||2<(n=t.num16to10D(c[17]+c[18]).toString(2)).length&&(a=0==n[3]?0:1),o.heartRate=s,o.arrhythmia=a,o.detectionTime=(new Date(r).getTime()?new Date(r):new Date(r.replace(/-/g,"/"))).getTime(),o.sbp=e,o.dbp=i}console.log(o);let i=[];this.isHistory?"06,00,01,01"!==c.toString()?(this.historyList.push(o),console.log(this.historyList)):(this.isHistory=!1,this.apiSaveBP(e.deviceId,this.historyList).then(()=>{this.historyList=[],this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"}))})):"06,00,01,01"!==c.toString()&&(i.push(o),this.apiSaveBP(e.deviceId,i).then(()=>{this.getCurrentDataCallback(this._setSuccessReturn({value:"获取测量结果结束"}))}))})}_setSuccessReturn(e){return{code:0,data:e,message:"成功"}}_setErrorReturn(e){return{code:1,data:e,message:"失败"}}setDeviceTime(e,t){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.setDeviceTimeCallback=e;t=t||new Date,t=this.getDateCode(t,5);return this.write({suuid:this.timeServiceId,cuuid:this.timeWriteId,value:[...t,"00","00","00"]}),this.setDeviceTimeCallback(this._setSuccessReturn({value:"写入成功"}))}getHistoryData(e){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.getHistoryDataCallback=e,this.isHistory=!0,this.historyList=[],this.write({value:["01","01"]})}getCurrentData(e){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.getCurrentDataCallback=e}getDateCode(e,i){const s=t.num10to16D(e.getFullYear()),r=t.num10to16D(e.getMonth()+1),a=t.num10to16D(e.getDate()),n=t.num10to16D(e.getHours()),c=t.num10to16D(e.getMinutes()),o=t.num10to16D(e.getSeconds());let d=[];return[s,r,a,n,c,o].slice(0,i).forEach(e=>{d.push(...e)}),d}}exports.YUYUEBP=class extends i{constructor(e){super(e)}apiUserSave(e,t,i,s,r,a,n,c=!1){return this.HTTP.request("/iot-data/v1/api/user/save",{parentId:e,userId:t,fields:i,nickName:s,imageUrl:r,mobileNo:a,gender:n},{isLoading:c})}apiBindList(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind/list",{userId:e,sort:t},{isLoading:i})}apiBindStatus(e,t=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind-info",{deviceId:e},{isLoading:t})}apiBindDevice(e,t,i,s,r,a=!1){return this.HTTP.request("/iot-data/v1/api/device/user/binding",{userId:e,deviceName:t,deviceId:i,deviceExtra:s,forcedUnbinding:r},{isLoading:a})}apiDeviceUnbind(e,t,i=!1){return this.disconnect(),this.HTTP.request("/iot-data/v1/api/device/user/unbind",{userId:e,deviceId:t},{isLoading:i})}apiSaveBP(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/blood/pressure/record",{deviceId:e,dataList:t},{isLoading:i})}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("jkyy_wx_bluetooth");const t=e.tools;class i extends e.Bluetooth{constructor(t={}){super(t),this.bindList={},this.updateUserInfo(),this.isHistory=!1,this.historyList=[],this.serviceId="00001810-0000-1000-8000-00805F9B34FB",this.timeServiceId="00001805-0000-1000-8000-00805F9B34FB",this.serviceIdArr=["00001810-0000-1000-8000-00805F9B34FB","00001805-0000-1000-8000-00805F9B34FB"],this.timeWriteId="00002A2B-0000-1000-8000-00805F9B34FB",this.writeId="00002A52-0000-1000-8000-00805F9B34FB",this.notifyId="00002A35-0000-1000-8000-00805F9B34FB"}updateUserInfo(){this.apiUserSave("",this.userId,["nickname","userImageUrl","mobileNo","gender"],this.nickname,this.userImageUrl,this.mobileNo,this.gender)}scan(t={}){var{services:e=[this.serviceId],allowDuplicatesKey:i=!0,powerLevel:s="medium",interval:a=0,timeout:r=6e4,deviceName:n="",containName:t="BP-YE650A"}=t;return this.scanCallback({services:e,allowDuplicatesKey:i,powerLevel:s,interval:a,timeout:r,deviceName:n,containName:t})}stopScan(){return this.stopScanCallback()}async connect(s,a){if(!s)throw new Error("device is undefiend");var e=await this.apiBindList(this.userId,"DESC");if(this.bindList=e&&e.length?e[0]:{},this.bindList.deviceId){if(!this.bindList.deviceExtra&&"ios"===t.getSystemInfoSync().platform){let t={};t.uuid=s.deviceId,await this.apiBindDevice(this.userId,s.name,this.bindList.deviceId,JSON.stringify(t),!0)}if(this.bindList.deviceExtra=JSON.parse(this.bindList.deviceExtra)?JSON.parse(this.bindList.deviceExtra):this.bindList.deviceExtra,this.bindList.deviceId===s.deviceId||this.bindList.deviceExtra.uuid===s.deviceId)return this._connect_device=JSON.stringify(s),console.log("当前连接的设备信息存起来",s,s.deviceId,this._connect_device),this.connectCallback(s,a);throw new Error("解绑原设备后再绑定新设备")}{let e=s.deviceId,i={uuid:""};return"ios"===t.getSystemInfoSync().platform?(console.log(s),e=s.deviceId,i=s.deviceExtra):s.deviceId=s.deviceId,await this.apiBindDevice(this.userId,s.name,e,JSON.stringify(i),!0),this._connect_device=JSON.stringify(s),console.log(3333,s,a),this.connectCallback(s,a)}}disconnect(){return this.disconnectCallback()}registerDidUpdateConnectStatus(t){if("function"!=typeof t)throw new TypeError("connectStatus callback expect function");this.registerDidUpdateConnectStatusCallback(t)}registerDidDiscoverDevice(t){if("function"!=typeof t)throw new TypeError("discoverDevice callback expect function");this.registerDidDiscoverDeviceCallback(t)}read(t={suuid:"",cuuid:""}){return this.readCallback(t)}write(t={}){let{suuid:e=this.serviceId,cuuid:i=this.writeId,value:s}=t;return s=s.join(""),this.writeCallback({suuid:e,cuuid:i,value:s})}notify(t={}){const{suuid:e=this.serviceId,cuuid:i=this.notifyId,state:s=!0}=t;this.notifyCallback({suuid:e,cuuid:i,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(i)}),this.notifyCallback({suuid:e,cuuid:this.writeId,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(this.writeId)})}registerDidUpdateValueForCharacteristic(s){this.registerDidUpdateValueForCharacteristicCallback(n=>{this.log(`notify: characteristic(${s})`,n.value);const c=n.value;console.log("注册\b特征值改变回调===================",c);let o={},e=JSON.parse(this._connect_device);if("06,00,01,01"!==c.toString()){let e=t.num16to10D(c[1]+c[2]),i=t.num16to10D(c[3]+c[4]),s=t.num16to10D(c[14]+c[15]),a=`${t.num16to10D(c[7]+c[8])}-${t.num16to10(c[9])}-${t.num16to10(c[10])} ${t.num16to10(c[11])}:${t.num16to10(c[12])}:${t.num16to10(c[13])}`,r=0;c[17]+c[18]==="0000"||2<(n=t.num16to10D(c[17]+c[18]).toString(2)).length&&(r=0==n[3]?0:1),o.heartRate=s,o.arrhythmia=r,o.detectionTime=(new Date(a).getTime()?new Date(a):new Date(a.replace(/-/g,"/"))).getTime(),o.sbp=e,o.dbp=i}console.log(o);let i=[];this.isHistory?"06,00,01,01"!==c.toString()?(console.log("这块走判断时间是否插入"),this._setSteps_lastTime?(new Date(`${t.num16to10D(c[7]+c[8])}-${t.num16to10(c[9])}-${t.num16to10(c[10])}`),console.log("this._setSteps_lastTime",o.detectionTime,new Date(this._setSteps_lastTime).getTime()),o.detectionTime>new Date(this._setSteps_lastTime).getTime()?(console.log("此时在最后一次时间之后就push进去"),this.historyList.push(o)):(this.isHistory=!1,this.historyList.length?this.apiSaveBP(e.deviceId,this.historyList).then(()=>{this.historyList=[],this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"}))}):this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"})),this.notify({state:!1}))):this.historyList.push(o)):(this.isHistory=!1,this.apiSaveBP(e.deviceId,this.historyList).then(()=>{this.historyList=[],this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"}))})):"06,00,01,01"!==c.toString()&&(i.push(o),this.apiSaveBP(e.deviceId,i).then(()=>{this.getCurrentDataCallback(this._setSuccessReturn({value:"获取测量结果结束"}))}))})}_setSuccessReturn(t){return{code:0,data:t,message:"成功"}}_setErrorReturn(t){return{code:1,data:t,message:"失败"}}setDeviceTime(t,e){if("function"!=typeof t)throw new TypeError("arguments callback expect function");this.notify({state:!0}),this.setDeviceTimeCallback=t;e=e||new Date,e=this.getDateCode(e,5);return this.write({suuid:this.timeServiceId,cuuid:this.timeWriteId,value:[...e,"00","00","00"]}),this.setDeviceTimeCallback(this._setSuccessReturn({value:"写入成功"}))}getHistoryData(t,e){if("function"!=typeof t)throw new TypeError("arguments callback expect function");this.notify({state:!0}),this.getHistoryDataCallback=t;let i=0;e&&(i=new Date(e.replace(/-/g,"/"))),this.isHistory=!0,this.historyList=[],this.write({value:["01","01"]}),this._setSteps_lastTime=i,console.log("this._setSteps_lastTime",this._setSteps_lastTime)}getCurrentData(t){if("function"!=typeof t)throw new TypeError("arguments callback expect function");this.getCurrentDataCallback=t}getDateCode(e,i){const s=t.num10to16D(e.getFullYear()),a=t.num10to16D(e.getMonth()+1),r=t.num10to16D(e.getDate()),n=t.num10to16D(e.getHours()),c=t.num10to16D(e.getMinutes()),o=t.num10to16D(e.getSeconds());let d=[];return[s,a,r,n,c,o].slice(0,i).forEach(t=>{d.push(...t)}),d}}exports.YUYUEBP=class extends i{constructor(t){super(t)}apiUserSave(t,e,i,s,a,r,n,c=!1){return this.HTTP.request("/iot-data/v1/api/user/save",{parentId:t,userId:e,fields:i,nickName:s,imageUrl:a,mobileNo:r,gender:n},{isLoading:c})}apiBindList(t,e,i=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind/list",{userId:t,sort:e},{isLoading:i})}apiBindStatus(t,e=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind-info",{deviceId:t},{isLoading:e})}apiBindDevice(t,e,i,s,a,r=!1){return this.HTTP.request("/iot-data/v1/api/device/user/binding",{userId:t,deviceName:e,deviceId:i,deviceExtra:s,forcedUnbinding:a},{isLoading:r})}apiDeviceUnbind(t,e,i=!1){return this.disconnect(),this.HTTP.request("/iot-data/v1/api/device/user/unbind",{userId:t,deviceId:e},{isLoading:i})}apiSaveBP(t,e,i=!1){return this.HTTP.request("/iot-data/v1/api/blood/pressure/record",{deviceId:t,dataList:e},{isLoading:i})}};
@@ -1 +1 @@
1
- import{Bluetooth as e,tools as t}from"jkyy_wx_bluetooth";const i=t;class s extends e{constructor(e={}){super(e),this.bindList={},this.updateUserInfo(),this.isHistory=!1,this.historyList=[],this.serviceId="00001810-0000-1000-8000-00805F9B34FB",this.timeServiceId="00001805-0000-1000-8000-00805F9B34FB",this.serviceIdArr=["00001810-0000-1000-8000-00805F9B34FB","00001805-0000-1000-8000-00805F9B34FB"],this.timeWriteId="00002A2B-0000-1000-8000-00805F9B34FB",this.writeId="00002A52-0000-1000-8000-00805F9B34FB",this.notifyId="00002A35-0000-1000-8000-00805F9B34FB"}updateUserInfo(){this.apiUserSave("",this.userId,["nickname","userImageUrl","mobileNo","gender"],this.nickname,this.userImageUrl,this.mobileNo,this.gender)}scan(e={}){var{services:t=[this.serviceId],allowDuplicatesKey:i=!0,powerLevel:s="medium",interval:r=0,timeout:a=6e4,deviceName:n="",containName:e="BP-YE650A"}=e;return this.scanCallback({services:t,allowDuplicatesKey:i,powerLevel:s,interval:r,timeout:a,deviceName:n,containName:e})}stopScan(){return this.stopScanCallback()}async connect(s,r){if(!s)throw new Error("device is undefiend");var e=await this.apiBindList(this.userId,"DESC");if(this.bindList=e&&e.length?e[0]:{},this.bindList.deviceId){if(!this.bindList.deviceExtra&&"ios"===i.getSystemInfoSync().platform){let e={};e.uuid=s.deviceId,await this.apiBindDevice(this.userId,s.name,this.bindList.deviceId,JSON.stringify(e),!0)}if(this.bindList.deviceExtra=JSON.parse(this.bindList.deviceExtra)?JSON.parse(this.bindList.deviceExtra):this.bindList.deviceExtra,this.bindList.deviceId===s.deviceId||this.bindList.deviceExtra.uuid===s.deviceId)return this._connect_device=JSON.stringify(s),console.log("当前连接的设备信息存起来",s,s.deviceId,this._connect_device),this.connectCallback(s,r);throw new Error("解绑原设备后再绑定新设备")}{let e=s.deviceId,t={uuid:""};return"ios"===i.getSystemInfoSync().platform?(console.log(s),e=s.deviceId,t=s.deviceExtra):s.deviceId=s.deviceId,await this.apiBindDevice(this.userId,s.name,e,JSON.stringify(t),!0),this._connect_device=JSON.stringify(s),console.log(3333,s,r),this.connectCallback(s,r)}}disconnect(){return this.disconnectCallback()}registerDidUpdateConnectStatus(e){if("function"!=typeof e)throw new TypeError("connectStatus callback expect function");this.registerDidUpdateConnectStatusCallback(e)}registerDidDiscoverDevice(e){if("function"!=typeof e)throw new TypeError("discoverDevice callback expect function");this.registerDidDiscoverDeviceCallback(e)}read(e={suuid:"",cuuid:""}){return this.readCallback(e)}write(e={}){let{suuid:t=this.serviceId,cuuid:i=this.writeId,value:s}=e;return s=s.join(""),this.writeCallback({suuid:t,cuuid:i,value:s})}notify(e={}){const{suuid:t=this.serviceId,cuuid:i=this.notifyId,state:s=!0}=e;this.notifyCallback({suuid:t,cuuid:i,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(i)}),this.notifyCallback({suuid:t,cuuid:this.writeId,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(this.writeId)})}registerDidUpdateValueForCharacteristic(s){this.registerDidUpdateValueForCharacteristicCallback(n=>{this.log(`notify: characteristic(${s})`,n.value);const c=n.value;console.log("注册\b特征值改变回调===================",c);let o={},e=JSON.parse(this._connect_device);if("06,00,01,01"!==c.toString()){let e=i.num16to10D(c[1]+c[2]),t=i.num16to10D(c[3]+c[4]),s=i.num16to10D(c[14]+c[15]),r=`${i.num16to10D(c[7]+c[8])}-${i.num16to10(c[9])}-${i.num16to10(c[10])} ${i.num16to10(c[11])}:${i.num16to10(c[12])}:${i.num16to10(c[13])}`,a=0;c[17]+c[18]==="0000"||2<(n=i.num16to10D(c[17]+c[18]).toString(2)).length&&(a=0==n[3]?0:1),o.heartRate=s,o.arrhythmia=a,o.detectionTime=(new Date(r).getTime()?new Date(r):new Date(r.replace(/-/g,"/"))).getTime(),o.sbp=e,o.dbp=t}console.log(o);let t=[];this.isHistory?"06,00,01,01"!==c.toString()?(this.historyList.push(o),console.log(this.historyList)):(this.isHistory=!1,this.apiSaveBP(e.deviceId,this.historyList).then(()=>{this.historyList=[],this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"}))})):"06,00,01,01"!==c.toString()&&(t.push(o),this.apiSaveBP(e.deviceId,t).then(()=>{this.getCurrentDataCallback(this._setSuccessReturn({value:"获取测量结果结束"}))}))})}_setSuccessReturn(e){return{code:0,data:e,message:"成功"}}_setErrorReturn(e){return{code:1,data:e,message:"失败"}}setDeviceTime(e,t){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.setDeviceTimeCallback=e;t=t||new Date,t=this.getDateCode(t,5);return this.write({suuid:this.timeServiceId,cuuid:this.timeWriteId,value:[...t,"00","00","00"]}),this.setDeviceTimeCallback(this._setSuccessReturn({value:"写入成功"}))}getHistoryData(e){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.getHistoryDataCallback=e,this.isHistory=!0,this.historyList=[],this.write({value:["01","01"]})}getCurrentData(e){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.getCurrentDataCallback=e}getDateCode(e,t){const s=i.num10to16D(e.getFullYear()),r=i.num10to16D(e.getMonth()+1),a=i.num10to16D(e.getDate()),n=i.num10to16D(e.getHours()),c=i.num10to16D(e.getMinutes()),o=i.num10to16D(e.getSeconds());let d=[];return[s,r,a,n,c,o].slice(0,t).forEach(e=>{d.push(...e)}),d}}class r extends s{constructor(e){super(e)}apiUserSave(e,t,i,s,r,a,n,c=!1){return this.HTTP.request("/iot-data/v1/api/user/save",{parentId:e,userId:t,fields:i,nickName:s,imageUrl:r,mobileNo:a,gender:n},{isLoading:c})}apiBindList(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind/list",{userId:e,sort:t},{isLoading:i})}apiBindStatus(e,t=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind-info",{deviceId:e},{isLoading:t})}apiBindDevice(e,t,i,s,r,a=!1){return this.HTTP.request("/iot-data/v1/api/device/user/binding",{userId:e,deviceName:t,deviceId:i,deviceExtra:s,forcedUnbinding:r},{isLoading:a})}apiDeviceUnbind(e,t,i=!1){return this.disconnect(),this.HTTP.request("/iot-data/v1/api/device/user/unbind",{userId:e,deviceId:t},{isLoading:i})}apiSaveBP(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/blood/pressure/record",{deviceId:e,dataList:t},{isLoading:i})}}export{r as YUYUEBP};
1
+ import{Bluetooth as e,tools as t}from"jkyy_wx_bluetooth";const i=t;class s extends e{constructor(e={}){super(e),this.bindList={},this.updateUserInfo(),this.isHistory=!1,this.historyList=[],this.serviceId="00001810-0000-1000-8000-00805F9B34FB",this.timeServiceId="00001805-0000-1000-8000-00805F9B34FB",this.serviceIdArr=["00001810-0000-1000-8000-00805F9B34FB","00001805-0000-1000-8000-00805F9B34FB"],this.timeWriteId="00002A2B-0000-1000-8000-00805F9B34FB",this.writeId="00002A52-0000-1000-8000-00805F9B34FB",this.notifyId="00002A35-0000-1000-8000-00805F9B34FB"}updateUserInfo(){this.apiUserSave("",this.userId,["nickname","userImageUrl","mobileNo","gender"],this.nickname,this.userImageUrl,this.mobileNo,this.gender)}scan(e={}){var{services:t=[this.serviceId],allowDuplicatesKey:i=!0,powerLevel:s="medium",interval:a=0,timeout:r=6e4,deviceName:n="",containName:e="BP-YE650A"}=e;return this.scanCallback({services:t,allowDuplicatesKey:i,powerLevel:s,interval:a,timeout:r,deviceName:n,containName:e})}stopScan(){return this.stopScanCallback()}async connect(s,a){if(!s)throw new Error("device is undefiend");var e=await this.apiBindList(this.userId,"DESC");if(this.bindList=e&&e.length?e[0]:{},this.bindList.deviceId){if(!this.bindList.deviceExtra&&"ios"===i.getSystemInfoSync().platform){let e={};e.uuid=s.deviceId,await this.apiBindDevice(this.userId,s.name,this.bindList.deviceId,JSON.stringify(e),!0)}if(this.bindList.deviceExtra=JSON.parse(this.bindList.deviceExtra)?JSON.parse(this.bindList.deviceExtra):this.bindList.deviceExtra,this.bindList.deviceId===s.deviceId||this.bindList.deviceExtra.uuid===s.deviceId)return this._connect_device=JSON.stringify(s),console.log("当前连接的设备信息存起来",s,s.deviceId,this._connect_device),this.connectCallback(s,a);throw new Error("解绑原设备后再绑定新设备")}{let e=s.deviceId,t={uuid:""};return"ios"===i.getSystemInfoSync().platform?(console.log(s),e=s.deviceId,t=s.deviceExtra):s.deviceId=s.deviceId,await this.apiBindDevice(this.userId,s.name,e,JSON.stringify(t),!0),this._connect_device=JSON.stringify(s),console.log(3333,s,a),this.connectCallback(s,a)}}disconnect(){return this.disconnectCallback()}registerDidUpdateConnectStatus(e){if("function"!=typeof e)throw new TypeError("connectStatus callback expect function");this.registerDidUpdateConnectStatusCallback(e)}registerDidDiscoverDevice(e){if("function"!=typeof e)throw new TypeError("discoverDevice callback expect function");this.registerDidDiscoverDeviceCallback(e)}read(e={suuid:"",cuuid:""}){return this.readCallback(e)}write(e={}){let{suuid:t=this.serviceId,cuuid:i=this.writeId,value:s}=e;return s=s.join(""),this.writeCallback({suuid:t,cuuid:i,value:s})}notify(e={}){const{suuid:t=this.serviceId,cuuid:i=this.notifyId,state:s=!0}=e;this.notifyCallback({suuid:t,cuuid:i,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(i)}),this.notifyCallback({suuid:t,cuuid:this.writeId,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(this.writeId)})}registerDidUpdateValueForCharacteristic(s){this.registerDidUpdateValueForCharacteristicCallback(n=>{this.log(`notify: characteristic(${s})`,n.value);const c=n.value;console.log("注册\b特征值改变回调===================",c);let o={},e=JSON.parse(this._connect_device);if("06,00,01,01"!==c.toString()){let e=i.num16to10D(c[1]+c[2]),t=i.num16to10D(c[3]+c[4]),s=i.num16to10D(c[14]+c[15]),a=`${i.num16to10D(c[7]+c[8])}-${i.num16to10(c[9])}-${i.num16to10(c[10])} ${i.num16to10(c[11])}:${i.num16to10(c[12])}:${i.num16to10(c[13])}`,r=0;c[17]+c[18]==="0000"||2<(n=i.num16to10D(c[17]+c[18]).toString(2)).length&&(r=0==n[3]?0:1),o.heartRate=s,o.arrhythmia=r,o.detectionTime=(new Date(a).getTime()?new Date(a):new Date(a.replace(/-/g,"/"))).getTime(),o.sbp=e,o.dbp=t}console.log(o);let t=[];this.isHistory?"06,00,01,01"!==c.toString()?(console.log("这块走判断时间是否插入"),this._setSteps_lastTime?(new Date(`${i.num16to10D(c[7]+c[8])}-${i.num16to10(c[9])}-${i.num16to10(c[10])}`),console.log("this._setSteps_lastTime",o.detectionTime,new Date(this._setSteps_lastTime).getTime()),o.detectionTime>new Date(this._setSteps_lastTime).getTime()?(console.log("此时在最后一次时间之后就push进去"),this.historyList.push(o)):(this.isHistory=!1,this.historyList.length?this.apiSaveBP(e.deviceId,this.historyList).then(()=>{this.historyList=[],this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"}))}):this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"})),this.notify({state:!1}))):this.historyList.push(o)):(this.isHistory=!1,this.apiSaveBP(e.deviceId,this.historyList).then(()=>{this.historyList=[],this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"}))})):"06,00,01,01"!==c.toString()&&(t.push(o),this.apiSaveBP(e.deviceId,t).then(()=>{this.getCurrentDataCallback(this._setSuccessReturn({value:"获取测量结果结束"}))}))})}_setSuccessReturn(e){return{code:0,data:e,message:"成功"}}_setErrorReturn(e){return{code:1,data:e,message:"失败"}}setDeviceTime(e,t){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.notify({state:!0}),this.setDeviceTimeCallback=e;t=t||new Date,t=this.getDateCode(t,5);return this.write({suuid:this.timeServiceId,cuuid:this.timeWriteId,value:[...t,"00","00","00"]}),this.setDeviceTimeCallback(this._setSuccessReturn({value:"写入成功"}))}getHistoryData(e,t){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.notify({state:!0}),this.getHistoryDataCallback=e;let i=0;t&&(i=new Date(t.replace(/-/g,"/"))),this.isHistory=!0,this.historyList=[],this.write({value:["01","01"]}),this._setSteps_lastTime=i,console.log("this._setSteps_lastTime",this._setSteps_lastTime)}getCurrentData(e){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.getCurrentDataCallback=e}getDateCode(e,t){const s=i.num10to16D(e.getFullYear()),a=i.num10to16D(e.getMonth()+1),r=i.num10to16D(e.getDate()),n=i.num10to16D(e.getHours()),c=i.num10to16D(e.getMinutes()),o=i.num10to16D(e.getSeconds());let d=[];return[s,a,r,n,c,o].slice(0,t).forEach(e=>{d.push(...e)}),d}}class a extends s{constructor(e){super(e)}apiUserSave(e,t,i,s,a,r,n,c=!1){return this.HTTP.request("/iot-data/v1/api/user/save",{parentId:e,userId:t,fields:i,nickName:s,imageUrl:a,mobileNo:r,gender:n},{isLoading:c})}apiBindList(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind/list",{userId:e,sort:t},{isLoading:i})}apiBindStatus(e,t=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind-info",{deviceId:e},{isLoading:t})}apiBindDevice(e,t,i,s,a,r=!1){return this.HTTP.request("/iot-data/v1/api/device/user/binding",{userId:e,deviceName:t,deviceId:i,deviceExtra:s,forcedUnbinding:a},{isLoading:r})}apiDeviceUnbind(e,t,i=!1){return this.disconnect(),this.HTTP.request("/iot-data/v1/api/device/user/unbind",{userId:e,deviceId:t},{isLoading:i})}apiSaveBP(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/blood/pressure/record",{deviceId:e,dataList:t},{isLoading:i})}}export{a as YUYUEBP};
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jkyy_wx_bluetooth")):"function"==typeof define&&define.amd?define(["exports","jkyy_wx_bluetooth"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jkyy_yiyun_yuyue_bp_sdk={},e.jkyy_wx_bluetooth)}(this,function(e,t){"use strict";const d=t.tools;class i extends t.Bluetooth{constructor(e={}){super(e),this.bindList={},this.updateUserInfo(),this.isHistory=!1,this.historyList=[],this.serviceId="00001810-0000-1000-8000-00805F9B34FB",this.timeServiceId="00001805-0000-1000-8000-00805F9B34FB",this.serviceIdArr=["00001810-0000-1000-8000-00805F9B34FB","00001805-0000-1000-8000-00805F9B34FB"],this.timeWriteId="00002A2B-0000-1000-8000-00805F9B34FB",this.writeId="00002A52-0000-1000-8000-00805F9B34FB",this.notifyId="00002A35-0000-1000-8000-00805F9B34FB"}updateUserInfo(){this.apiUserSave("",this.userId,["nickname","userImageUrl","mobileNo","gender"],this.nickname,this.userImageUrl,this.mobileNo,this.gender)}scan(e={}){var{services:t=[this.serviceId],allowDuplicatesKey:i=!0,powerLevel:s="medium",interval:r=0,timeout:n=6e4,deviceName:a="",containName:e="BP-YE650A"}=e;return this.scanCallback({services:t,allowDuplicatesKey:i,powerLevel:s,interval:r,timeout:n,deviceName:a,containName:e})}stopScan(){return this.stopScanCallback()}async connect(i,s){if(!i)throw new Error("device is undefiend");var e=await this.apiBindList(this.userId,"DESC");if(this.bindList=e&&e.length?e[0]:{},this.bindList.deviceId){if(!this.bindList.deviceExtra&&"ios"===d.getSystemInfoSync().platform){let e={};e.uuid=i.deviceId,await this.apiBindDevice(this.userId,i.name,this.bindList.deviceId,JSON.stringify(e),!0)}if(this.bindList.deviceExtra=JSON.parse(this.bindList.deviceExtra)?JSON.parse(this.bindList.deviceExtra):this.bindList.deviceExtra,this.bindList.deviceId===i.deviceId||this.bindList.deviceExtra.uuid===i.deviceId)return this._connect_device=JSON.stringify(i),console.log("当前连接的设备信息存起来",i,i.deviceId,this._connect_device),this.connectCallback(i,s);throw new Error("解绑原设备后再绑定新设备")}{let e=i.deviceId,t={uuid:""};return"ios"===d.getSystemInfoSync().platform?(console.log(i),e=i.deviceId,t=i.deviceExtra):i.deviceId=i.deviceId,await this.apiBindDevice(this.userId,i.name,e,JSON.stringify(t),!0),this._connect_device=JSON.stringify(i),console.log(3333,i,s),this.connectCallback(i,s)}}disconnect(){return this.disconnectCallback()}registerDidUpdateConnectStatus(e){if("function"!=typeof e)throw new TypeError("connectStatus callback expect function");this.registerDidUpdateConnectStatusCallback(e)}registerDidDiscoverDevice(e){if("function"!=typeof e)throw new TypeError("discoverDevice callback expect function");this.registerDidDiscoverDeviceCallback(e)}read(e={suuid:"",cuuid:""}){return this.readCallback(e)}write(e={}){let{suuid:t=this.serviceId,cuuid:i=this.writeId,value:s}=e;return s=s.join(""),this.writeCallback({suuid:t,cuuid:i,value:s})}notify(e={}){const{suuid:t=this.serviceId,cuuid:i=this.notifyId,state:s=!0}=e;this.notifyCallback({suuid:t,cuuid:i,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(i)}),this.notifyCallback({suuid:t,cuuid:this.writeId,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(this.writeId)})}registerDidUpdateValueForCharacteristic(i){this.registerDidUpdateValueForCharacteristicCallback(n=>{this.log(`notify: characteristic(${i})`,n.value);const a=n.value;console.log("注册\b特征值改变回调===================",a);let c={},e=JSON.parse(this._connect_device);if("06,00,01,01"!==a.toString()){let e=d.num16to10D(a[1]+a[2]),t=d.num16to10D(a[3]+a[4]),i=d.num16to10D(a[14]+a[15]),s=`${d.num16to10D(a[7]+a[8])}-${d.num16to10(a[9])}-${d.num16to10(a[10])} ${d.num16to10(a[11])}:${d.num16to10(a[12])}:${d.num16to10(a[13])}`,r=0;a[17]+a[18]==="0000"||2<(n=d.num16to10D(a[17]+a[18]).toString(2)).length&&(r=0==n[3]?0:1),c.heartRate=i,c.arrhythmia=r,c.detectionTime=(new Date(s).getTime()?new Date(s):new Date(s.replace(/-/g,"/"))).getTime(),c.sbp=e,c.dbp=t}console.log(c);let t=[];this.isHistory?"06,00,01,01"!==a.toString()?(this.historyList.push(c),console.log(this.historyList)):(this.isHistory=!1,this.apiSaveBP(e.deviceId,this.historyList).then(()=>{this.historyList=[],this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"}))})):"06,00,01,01"!==a.toString()&&(t.push(c),this.apiSaveBP(e.deviceId,t).then(()=>{this.getCurrentDataCallback(this._setSuccessReturn({value:"获取测量结果结束"}))}))})}_setSuccessReturn(e){return{code:0,data:e,message:"成功"}}_setErrorReturn(e){return{code:1,data:e,message:"失败"}}setDeviceTime(e,t){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.setDeviceTimeCallback=e;t=t||new Date,t=this.getDateCode(t,5);return this.write({suuid:this.timeServiceId,cuuid:this.timeWriteId,value:[...t,"00","00","00"]}),this.setDeviceTimeCallback(this._setSuccessReturn({value:"写入成功"}))}getHistoryData(e){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.getHistoryDataCallback=e,this.isHistory=!0,this.historyList=[],this.write({value:["01","01"]})}getCurrentData(e){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.getCurrentDataCallback=e}getDateCode(e,t){const i=d.num10to16D(e.getFullYear()),s=d.num10to16D(e.getMonth()+1),r=d.num10to16D(e.getDate()),n=d.num10to16D(e.getHours()),a=d.num10to16D(e.getMinutes()),c=d.num10to16D(e.getSeconds());let o=[];return[i,s,r,n,a,c].slice(0,t).forEach(e=>{o.push(...e)}),o}}e.YUYUEBP=class extends i{constructor(e){super(e)}apiUserSave(e,t,i,s,r,n,a,c=!1){return this.HTTP.request("/iot-data/v1/api/user/save",{parentId:e,userId:t,fields:i,nickName:s,imageUrl:r,mobileNo:n,gender:a},{isLoading:c})}apiBindList(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind/list",{userId:e,sort:t},{isLoading:i})}apiBindStatus(e,t=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind-info",{deviceId:e},{isLoading:t})}apiBindDevice(e,t,i,s,r,n=!1){return this.HTTP.request("/iot-data/v1/api/device/user/binding",{userId:e,deviceName:t,deviceId:i,deviceExtra:s,forcedUnbinding:r},{isLoading:n})}apiDeviceUnbind(e,t,i=!1){return this.disconnect(),this.HTTP.request("/iot-data/v1/api/device/user/unbind",{userId:e,deviceId:t},{isLoading:i})}apiSaveBP(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/blood/pressure/record",{deviceId:e,dataList:t},{isLoading:i})}},Object.defineProperty(e,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("jkyy_wx_bluetooth")):"function"==typeof define&&define.amd?define(["exports","jkyy_wx_bluetooth"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jkyy_yiyun_yuyue_bp_sdk={},e.jkyy_wx_bluetooth)}(this,function(e,t){"use strict";const d=t.tools;class i extends t.Bluetooth{constructor(e={}){super(e),this.bindList={},this.updateUserInfo(),this.isHistory=!1,this.historyList=[],this.serviceId="00001810-0000-1000-8000-00805F9B34FB",this.timeServiceId="00001805-0000-1000-8000-00805F9B34FB",this.serviceIdArr=["00001810-0000-1000-8000-00805F9B34FB","00001805-0000-1000-8000-00805F9B34FB"],this.timeWriteId="00002A2B-0000-1000-8000-00805F9B34FB",this.writeId="00002A52-0000-1000-8000-00805F9B34FB",this.notifyId="00002A35-0000-1000-8000-00805F9B34FB"}updateUserInfo(){this.apiUserSave("",this.userId,["nickname","userImageUrl","mobileNo","gender"],this.nickname,this.userImageUrl,this.mobileNo,this.gender)}scan(e={}){var{services:t=[this.serviceId],allowDuplicatesKey:i=!0,powerLevel:s="medium",interval:a=0,timeout:r=6e4,deviceName:n="",containName:e="BP-YE650A"}=e;return this.scanCallback({services:t,allowDuplicatesKey:i,powerLevel:s,interval:a,timeout:r,deviceName:n,containName:e})}stopScan(){return this.stopScanCallback()}async connect(i,s){if(!i)throw new Error("device is undefiend");var e=await this.apiBindList(this.userId,"DESC");if(this.bindList=e&&e.length?e[0]:{},this.bindList.deviceId){if(!this.bindList.deviceExtra&&"ios"===d.getSystemInfoSync().platform){let e={};e.uuid=i.deviceId,await this.apiBindDevice(this.userId,i.name,this.bindList.deviceId,JSON.stringify(e),!0)}if(this.bindList.deviceExtra=JSON.parse(this.bindList.deviceExtra)?JSON.parse(this.bindList.deviceExtra):this.bindList.deviceExtra,this.bindList.deviceId===i.deviceId||this.bindList.deviceExtra.uuid===i.deviceId)return this._connect_device=JSON.stringify(i),console.log("当前连接的设备信息存起来",i,i.deviceId,this._connect_device),this.connectCallback(i,s);throw new Error("解绑原设备后再绑定新设备")}{let e=i.deviceId,t={uuid:""};return"ios"===d.getSystemInfoSync().platform?(console.log(i),e=i.deviceId,t=i.deviceExtra):i.deviceId=i.deviceId,await this.apiBindDevice(this.userId,i.name,e,JSON.stringify(t),!0),this._connect_device=JSON.stringify(i),console.log(3333,i,s),this.connectCallback(i,s)}}disconnect(){return this.disconnectCallback()}registerDidUpdateConnectStatus(e){if("function"!=typeof e)throw new TypeError("connectStatus callback expect function");this.registerDidUpdateConnectStatusCallback(e)}registerDidDiscoverDevice(e){if("function"!=typeof e)throw new TypeError("discoverDevice callback expect function");this.registerDidDiscoverDeviceCallback(e)}read(e={suuid:"",cuuid:""}){return this.readCallback(e)}write(e={}){let{suuid:t=this.serviceId,cuuid:i=this.writeId,value:s}=e;return s=s.join(""),this.writeCallback({suuid:t,cuuid:i,value:s})}notify(e={}){const{suuid:t=this.serviceId,cuuid:i=this.notifyId,state:s=!0}=e;this.notifyCallback({suuid:t,cuuid:i,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(i)}),this.notifyCallback({suuid:t,cuuid:this.writeId,state:s}).then(()=>{this.registerDidUpdateValueForCharacteristic(this.writeId)})}registerDidUpdateValueForCharacteristic(i){this.registerDidUpdateValueForCharacteristicCallback(r=>{this.log(`notify: characteristic(${i})`,r.value);const n=r.value;console.log("注册\b特征值改变回调===================",n);let o={},e=JSON.parse(this._connect_device);if("06,00,01,01"!==n.toString()){let e=d.num16to10D(n[1]+n[2]),t=d.num16to10D(n[3]+n[4]),i=d.num16to10D(n[14]+n[15]),s=`${d.num16to10D(n[7]+n[8])}-${d.num16to10(n[9])}-${d.num16to10(n[10])} ${d.num16to10(n[11])}:${d.num16to10(n[12])}:${d.num16to10(n[13])}`,a=0;n[17]+n[18]==="0000"||2<(r=d.num16to10D(n[17]+n[18]).toString(2)).length&&(a=0==r[3]?0:1),o.heartRate=i,o.arrhythmia=a,o.detectionTime=(new Date(s).getTime()?new Date(s):new Date(s.replace(/-/g,"/"))).getTime(),o.sbp=e,o.dbp=t}console.log(o);let t=[];this.isHistory?"06,00,01,01"!==n.toString()?(console.log("这块走判断时间是否插入"),this._setSteps_lastTime?(new Date(`${d.num16to10D(n[7]+n[8])}-${d.num16to10(n[9])}-${d.num16to10(n[10])}`),console.log("this._setSteps_lastTime",o.detectionTime,new Date(this._setSteps_lastTime).getTime()),o.detectionTime>new Date(this._setSteps_lastTime).getTime()?(console.log("此时在最后一次时间之后就push进去"),this.historyList.push(o)):(this.isHistory=!1,this.historyList.length?this.apiSaveBP(e.deviceId,this.historyList).then(()=>{this.historyList=[],this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"}))}):this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"})),this.notify({state:!1}))):this.historyList.push(o)):(this.isHistory=!1,this.apiSaveBP(e.deviceId,this.historyList).then(()=>{this.historyList=[],this.getHistoryDataCallback(this._setSuccessReturn({value:"获取历史结果结束"}))})):"06,00,01,01"!==n.toString()&&(t.push(o),this.apiSaveBP(e.deviceId,t).then(()=>{this.getCurrentDataCallback(this._setSuccessReturn({value:"获取测量结果结束"}))}))})}_setSuccessReturn(e){return{code:0,data:e,message:"成功"}}_setErrorReturn(e){return{code:1,data:e,message:"失败"}}setDeviceTime(e,t){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.notify({state:!0}),this.setDeviceTimeCallback=e;t=t||new Date,t=this.getDateCode(t,5);return this.write({suuid:this.timeServiceId,cuuid:this.timeWriteId,value:[...t,"00","00","00"]}),this.setDeviceTimeCallback(this._setSuccessReturn({value:"写入成功"}))}getHistoryData(e,t){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.notify({state:!0}),this.getHistoryDataCallback=e;let i=0;t&&(i=new Date(t.replace(/-/g,"/"))),this.isHistory=!0,this.historyList=[],this.write({value:["01","01"]}),this._setSteps_lastTime=i,console.log("this._setSteps_lastTime",this._setSteps_lastTime)}getCurrentData(e){if("function"!=typeof e)throw new TypeError("arguments callback expect function");this.getCurrentDataCallback=e}getDateCode(e,t){const i=d.num10to16D(e.getFullYear()),s=d.num10to16D(e.getMonth()+1),a=d.num10to16D(e.getDate()),r=d.num10to16D(e.getHours()),n=d.num10to16D(e.getMinutes()),o=d.num10to16D(e.getSeconds());let c=[];return[i,s,a,r,n,o].slice(0,t).forEach(e=>{c.push(...e)}),c}}e.YUYUEBP=class extends i{constructor(e){super(e)}apiUserSave(e,t,i,s,a,r,n,o=!1){return this.HTTP.request("/iot-data/v1/api/user/save",{parentId:e,userId:t,fields:i,nickName:s,imageUrl:a,mobileNo:r,gender:n},{isLoading:o})}apiBindList(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind/list",{userId:e,sort:t},{isLoading:i})}apiBindStatus(e,t=!1){return this.HTTP.request("/iot-data/v1/api/device/user/bind-info",{deviceId:e},{isLoading:t})}apiBindDevice(e,t,i,s,a,r=!1){return this.HTTP.request("/iot-data/v1/api/device/user/binding",{userId:e,deviceName:t,deviceId:i,deviceExtra:s,forcedUnbinding:a},{isLoading:r})}apiDeviceUnbind(e,t,i=!1){return this.disconnect(),this.HTTP.request("/iot-data/v1/api/device/user/unbind",{userId:e,deviceId:t},{isLoading:i})}apiSaveBP(e,t,i=!1){return this.HTTP.request("/iot-data/v1/api/blood/pressure/record",{deviceId:e,dataList:t},{isLoading:i})}},Object.defineProperty(e,"__esModule",{value:!0})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jkyy_yiyun_yuyue_bp_sdk",
3
- "version": "1.2.9",
3
+ "version": "1.3.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "README.md",