jkyy_yiyun_yuyue_bp_sdk 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: jkyy_yiyun_yuyue_bp_sdk
3
- * version: v1.1.4
3
+ * version: v1.1.5
4
4
  * author: haotengfei
5
5
  */
6
6
 
@@ -290,46 +290,49 @@ class BTManager extends jkyy_wx_bluetooth.Bluetooth {
290
290
  console.log('注册特征值改变回调===================', resArr);
291
291
  let reportDate = {};
292
292
 
293
- if (resArr.toString() !== "06,00,01,01") {
294
- // 收缩压
295
- let sbp = _.num16to10D(resArr[1] + resArr[2]); // 舒张压
293
+ if (this.isHistory == true) {
294
+ this.getHistoryDataCallback(resArr);
295
+ } else {
296
+ if (resArr.toString() !== "06,00,01,01") {
297
+ // 收缩压
298
+ let sbp = _.num16to10D(resArr[1] + resArr[2]); // 舒张压
296
299
 
297
300
 
298
- let dbp = _.num16to10D(resArr[3] + resArr[4]); // 心率(脉搏 )
301
+ let dbp = _.num16to10D(resArr[3] + resArr[4]); // 心率(脉搏 )
299
302
 
300
303
 
301
- let heartRate = _.num16to10D(resArr[14] + resArr[15]); // 时间
304
+ let heartRate = _.num16to10D(resArr[14] + resArr[15]); // 时间
302
305
 
303
306
 
304
- let time = `${_.num16to10D(resArr[7] + resArr[8])}-${_.num16to10(resArr[9])}-${_.num16to10(resArr[10])} ${_.num16to10(resArr[11])}:${_.num16to10(resArr[12])}:${_.num16to10(resArr[13])}`;
305
- let arrhythmia = 0;
307
+ let time = `${_.num16to10D(resArr[7] + resArr[8])}-${_.num16to10(resArr[9])}-${_.num16to10(resArr[10])} ${_.num16to10(resArr[11])}:${_.num16to10(resArr[12])}:${_.num16to10(resArr[13])}`;
308
+ let arrhythmia = 0;
306
309
 
307
- if (resArr[17] + resArr[18] !== '0000') {
308
- let isArrhythmia = _.num16to10D(resArr[17] + resArr[18]).toString(2);
310
+ if (resArr[17] + resArr[18] !== '0000') {
311
+ let isArrhythmia = _.num16to10D(resArr[17] + resArr[18]).toString(2);
309
312
 
310
- if (isArrhythmia.length > 2) {
311
- arrhythmia = isArrhythmia[3] == 0 ? 0 : 1;
313
+ if (isArrhythmia.length > 2) {
314
+ arrhythmia = isArrhythmia[3] == 0 ? 0 : 1;
315
+ }
312
316
  }
313
- }
314
317
 
315
- reportDate.userId = this.userId;
316
- reportDate.deviceSn = this._connect_device.deviceSn;
317
- reportDate.heartRate = heartRate;
318
- reportDate.arrhythmia = arrhythmia;
319
- reportDate.detectionTime = new Date(time).getTime() ? new Date(time).getTime() : new Date(time.replace(/-/g, "/")).getTime();
320
- reportDate.sbp = sbp;
321
- reportDate.dbp = dbp;
322
- console.log(time);
323
- }
324
-
325
- console.log(reportDate);
326
- this.api_yuyue_save_fuc(reportDate, res.value);
318
+ reportDate.userId = this.userId;
319
+ reportDate.deviceSn = this._connect_device.deviceSn;
320
+ reportDate.heartRate = heartRate;
321
+ reportDate.arrhythmia = arrhythmia;
322
+ reportDate.detectionTime = new Date(time).getTime() ? new Date(time).getTime() : new Date(time.replace(/-/g, "/")).getTime();
323
+ reportDate.sbp = sbp;
324
+ reportDate.dbp = dbp;
325
+ console.log(time);
326
+ }
327
327
 
328
- if (this.isHistory == true) {
329
- this.getHistoryDataCallback(res.value);
330
- } else {
328
+ console.log(reportDate);
331
329
  this.api_yuyue_save_fuc(reportDate, res.value);
332
- }
330
+ } // if (this.isHistory == true) {
331
+ // this.getHistoryDataCallback(res.value)
332
+ // }else {
333
+ // this.api_yuyue_save_fuc(reportDate, res.value)
334
+ // }
335
+
333
336
  });
334
337
  }
335
338
  /**
@@ -413,7 +416,6 @@ class BTManager extends jkyy_wx_bluetooth.Bluetooth {
413
416
 
414
417
  getHistoryData(cb, lastTimeP) {
415
418
  if (typeof cb !== "function") throw new TypeError("arguments callback expect function");
416
- this.getHistoryDataCallback = cb;
417
419
  this.isHistory = true;
418
420
  this.historyList = [];
419
421
 
@@ -427,6 +429,8 @@ class BTManager extends jkyy_wx_bluetooth.Bluetooth {
427
429
  value: ["01", "01"]
428
430
  });
429
431
  }
432
+
433
+ this.getHistoryDataCallback = cb;
430
434
  }
431
435
  /**
432
436
  * @des 获取当前测量结果回调
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: jkyy_yiyun_yuyue_bp_sdk
3
- * version: v1.1.4
3
+ * version: v1.1.5
4
4
  * author: haotengfei
5
5
  */
6
6
 
@@ -286,46 +286,49 @@ class BTManager extends Bluetooth {
286
286
  console.log('注册特征值改变回调===================', resArr);
287
287
  let reportDate = {};
288
288
 
289
- if (resArr.toString() !== "06,00,01,01") {
290
- // 收缩压
291
- let sbp = _.num16to10D(resArr[1] + resArr[2]); // 舒张压
289
+ if (this.isHistory == true) {
290
+ this.getHistoryDataCallback(resArr);
291
+ } else {
292
+ if (resArr.toString() !== "06,00,01,01") {
293
+ // 收缩压
294
+ let sbp = _.num16to10D(resArr[1] + resArr[2]); // 舒张压
292
295
 
293
296
 
294
- let dbp = _.num16to10D(resArr[3] + resArr[4]); // 心率(脉搏 )
297
+ let dbp = _.num16to10D(resArr[3] + resArr[4]); // 心率(脉搏 )
295
298
 
296
299
 
297
- let heartRate = _.num16to10D(resArr[14] + resArr[15]); // 时间
300
+ let heartRate = _.num16to10D(resArr[14] + resArr[15]); // 时间
298
301
 
299
302
 
300
- let time = `${_.num16to10D(resArr[7] + resArr[8])}-${_.num16to10(resArr[9])}-${_.num16to10(resArr[10])} ${_.num16to10(resArr[11])}:${_.num16to10(resArr[12])}:${_.num16to10(resArr[13])}`;
301
- let arrhythmia = 0;
303
+ let time = `${_.num16to10D(resArr[7] + resArr[8])}-${_.num16to10(resArr[9])}-${_.num16to10(resArr[10])} ${_.num16to10(resArr[11])}:${_.num16to10(resArr[12])}:${_.num16to10(resArr[13])}`;
304
+ let arrhythmia = 0;
302
305
 
303
- if (resArr[17] + resArr[18] !== '0000') {
304
- let isArrhythmia = _.num16to10D(resArr[17] + resArr[18]).toString(2);
306
+ if (resArr[17] + resArr[18] !== '0000') {
307
+ let isArrhythmia = _.num16to10D(resArr[17] + resArr[18]).toString(2);
305
308
 
306
- if (isArrhythmia.length > 2) {
307
- arrhythmia = isArrhythmia[3] == 0 ? 0 : 1;
309
+ if (isArrhythmia.length > 2) {
310
+ arrhythmia = isArrhythmia[3] == 0 ? 0 : 1;
311
+ }
308
312
  }
309
- }
310
313
 
311
- reportDate.userId = this.userId;
312
- reportDate.deviceSn = this._connect_device.deviceSn;
313
- reportDate.heartRate = heartRate;
314
- reportDate.arrhythmia = arrhythmia;
315
- reportDate.detectionTime = new Date(time).getTime() ? new Date(time).getTime() : new Date(time.replace(/-/g, "/")).getTime();
316
- reportDate.sbp = sbp;
317
- reportDate.dbp = dbp;
318
- console.log(time);
319
- }
320
-
321
- console.log(reportDate);
322
- this.api_yuyue_save_fuc(reportDate, res.value);
314
+ reportDate.userId = this.userId;
315
+ reportDate.deviceSn = this._connect_device.deviceSn;
316
+ reportDate.heartRate = heartRate;
317
+ reportDate.arrhythmia = arrhythmia;
318
+ reportDate.detectionTime = new Date(time).getTime() ? new Date(time).getTime() : new Date(time.replace(/-/g, "/")).getTime();
319
+ reportDate.sbp = sbp;
320
+ reportDate.dbp = dbp;
321
+ console.log(time);
322
+ }
323
323
 
324
- if (this.isHistory == true) {
325
- this.getHistoryDataCallback(res.value);
326
- } else {
324
+ console.log(reportDate);
327
325
  this.api_yuyue_save_fuc(reportDate, res.value);
328
- }
326
+ } // if (this.isHistory == true) {
327
+ // this.getHistoryDataCallback(res.value)
328
+ // }else {
329
+ // this.api_yuyue_save_fuc(reportDate, res.value)
330
+ // }
331
+
329
332
  });
330
333
  }
331
334
  /**
@@ -409,7 +412,6 @@ class BTManager extends Bluetooth {
409
412
 
410
413
  getHistoryData(cb, lastTimeP) {
411
414
  if (typeof cb !== "function") throw new TypeError("arguments callback expect function");
412
- this.getHistoryDataCallback = cb;
413
415
  this.isHistory = true;
414
416
  this.historyList = [];
415
417
 
@@ -423,6 +425,8 @@ class BTManager extends Bluetooth {
423
425
  value: ["01", "01"]
424
426
  });
425
427
  }
428
+
429
+ this.getHistoryDataCallback = cb;
426
430
  }
427
431
  /**
428
432
  * @des 获取当前测量结果回调
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: jkyy_yiyun_yuyue_bp_sdk
3
- * version: v1.1.4
3
+ * version: v1.1.5
4
4
  * author: haotengfei
5
5
  */
6
6
 
@@ -290,46 +290,49 @@
290
290
  console.log('注册特征值改变回调===================', resArr);
291
291
  let reportDate = {};
292
292
 
293
- if (resArr.toString() !== "06,00,01,01") {
294
- // 收缩压
295
- let sbp = _.num16to10D(resArr[1] + resArr[2]); // 舒张压
293
+ if (this.isHistory == true) {
294
+ this.getHistoryDataCallback(resArr);
295
+ } else {
296
+ if (resArr.toString() !== "06,00,01,01") {
297
+ // 收缩压
298
+ let sbp = _.num16to10D(resArr[1] + resArr[2]); // 舒张压
296
299
 
297
300
 
298
- let dbp = _.num16to10D(resArr[3] + resArr[4]); // 心率(脉搏 )
301
+ let dbp = _.num16to10D(resArr[3] + resArr[4]); // 心率(脉搏 )
299
302
 
300
303
 
301
- let heartRate = _.num16to10D(resArr[14] + resArr[15]); // 时间
304
+ let heartRate = _.num16to10D(resArr[14] + resArr[15]); // 时间
302
305
 
303
306
 
304
- let time = `${_.num16to10D(resArr[7] + resArr[8])}-${_.num16to10(resArr[9])}-${_.num16to10(resArr[10])} ${_.num16to10(resArr[11])}:${_.num16to10(resArr[12])}:${_.num16to10(resArr[13])}`;
305
- let arrhythmia = 0;
307
+ let time = `${_.num16to10D(resArr[7] + resArr[8])}-${_.num16to10(resArr[9])}-${_.num16to10(resArr[10])} ${_.num16to10(resArr[11])}:${_.num16to10(resArr[12])}:${_.num16to10(resArr[13])}`;
308
+ let arrhythmia = 0;
306
309
 
307
- if (resArr[17] + resArr[18] !== '0000') {
308
- let isArrhythmia = _.num16to10D(resArr[17] + resArr[18]).toString(2);
310
+ if (resArr[17] + resArr[18] !== '0000') {
311
+ let isArrhythmia = _.num16to10D(resArr[17] + resArr[18]).toString(2);
309
312
 
310
- if (isArrhythmia.length > 2) {
311
- arrhythmia = isArrhythmia[3] == 0 ? 0 : 1;
313
+ if (isArrhythmia.length > 2) {
314
+ arrhythmia = isArrhythmia[3] == 0 ? 0 : 1;
315
+ }
312
316
  }
313
- }
314
317
 
315
- reportDate.userId = this.userId;
316
- reportDate.deviceSn = this._connect_device.deviceSn;
317
- reportDate.heartRate = heartRate;
318
- reportDate.arrhythmia = arrhythmia;
319
- reportDate.detectionTime = new Date(time).getTime() ? new Date(time).getTime() : new Date(time.replace(/-/g, "/")).getTime();
320
- reportDate.sbp = sbp;
321
- reportDate.dbp = dbp;
322
- console.log(time);
323
- }
324
-
325
- console.log(reportDate);
326
- this.api_yuyue_save_fuc(reportDate, res.value);
318
+ reportDate.userId = this.userId;
319
+ reportDate.deviceSn = this._connect_device.deviceSn;
320
+ reportDate.heartRate = heartRate;
321
+ reportDate.arrhythmia = arrhythmia;
322
+ reportDate.detectionTime = new Date(time).getTime() ? new Date(time).getTime() : new Date(time.replace(/-/g, "/")).getTime();
323
+ reportDate.sbp = sbp;
324
+ reportDate.dbp = dbp;
325
+ console.log(time);
326
+ }
327
327
 
328
- if (this.isHistory == true) {
329
- this.getHistoryDataCallback(res.value);
330
- } else {
328
+ console.log(reportDate);
331
329
  this.api_yuyue_save_fuc(reportDate, res.value);
332
- }
330
+ } // if (this.isHistory == true) {
331
+ // this.getHistoryDataCallback(res.value)
332
+ // }else {
333
+ // this.api_yuyue_save_fuc(reportDate, res.value)
334
+ // }
335
+
333
336
  });
334
337
  }
335
338
  /**
@@ -413,7 +416,6 @@
413
416
 
414
417
  getHistoryData(cb, lastTimeP) {
415
418
  if (typeof cb !== "function") throw new TypeError("arguments callback expect function");
416
- this.getHistoryDataCallback = cb;
417
419
  this.isHistory = true;
418
420
  this.historyList = [];
419
421
 
@@ -427,6 +429,8 @@
427
429
  value: ["01", "01"]
428
430
  });
429
431
  }
432
+
433
+ this.getHistoryDataCallback = cb;
430
434
  }
431
435
  /**
432
436
  * @des 获取当前测量结果回调
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jkyy_yiyun_yuyue_bp_sdk",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "files": [
5
5
  "dist",
6
6
  "README.md",