summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/module/BP7SModule.js
blob: e2be83027699cf6ede580dc2ae1d0425397db233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/**
 * Created by zhangxu on 16/11/20.
 */

'use strict';


var { NativeModules } = require('react-native');

var RCTModule = NativeModules.BP7SModule;

/**
 * @module BP7SModule
 */

module.exports = {

  Event_Notify: RCTModule.Event_Notify,

  /**
   * Get the BP7S device's battery.
   * @param {string} mac Device's mac address
   */
  getBattery: function (mac) {
    if (RCTModule != null) {
      RCTModule.getBattery(mac);
    }else {
      console.log('~~~~~ RCTModule is null')
    }
  },

  /**
   * get offline data number.
   * @param {string} mac Device's mac address
   */
  getOffLineNum:function (mac) {
    if (RCTModule != null) {
      RCTModule.getOffLineNum(mac);
    }else {
      console.log('~~~~~ RCTModule is null')
    }
  },

  /**
   * get offline data number.
   * @param {string} mac Device's mac address
   */
  getOffLineData:function (mac) {
    if (RCTModule != null) {
      RCTModule.getOffLineData(mac);
    }else {
      console.log('~~~~~ RCTModule is null')
    }
  },

  /**
   * Set BP7S device unit.
   * @param {string} mac Device's mac address
   * @param {int} unit 0:mmHg,1:kPa
   */
  setUnit:function (mac, unit){
    if (RCTModule != null) {
      RCTModule.setUnit(mac,unit);
    }else {
      console.log('~~~~~ RCTModule is null')
    }
  },

  /**
   * Set BP7S device angle.
   * @param {string} mac Device's mac address
   * @param {int} leftUpper the maximum measure angle of left hand, the maximum value must less than 90.
   * @param {int} leftLows the minimum measure angle of left hand, the minimum value must more than 0, and less than leftUpper.
   * @param {int} rightUpper the maximum measure angle of right hand, the maximum value must less than 90.
   * @param {int} rightLow the minimum measure angle of right hand, the minimum value must more than 0, and less than rightUpper.
   *
   */
  angleSet:function (mac, leftUpper, leftLows, rightUpper, rightLow) {
    if (RCTModule != null) {
      RCTModule.angleSet(mac,leftUpper,leftLows,rightUpper,rightLow);
    }else {
      console.log('~~~~~ RCTModule is null')
    }
  },

  /**
   * Get the BP7S device's functionInfo.
   * @param {string} mac Device's mac address
   */
  getFunctionInfo:function (mac) {
    if (RCTModule != null) {
      RCTModule.getFunctionInfo(mac);
    }else {
      sconsole.log('~~~~~ RCTModule is null')
    }
  },

  /**
   * Disconnect the BP7S
   *
   * @param {string} mac Device's mac address
   */

  disconnect: function (mac) {

      if (RCTModule != null) {
          RCTModule.disconnect(mac);
      }else {
          console.log('~~~~~ RCTModule is null')
      }
  },

  /**
   * Get all connected BP7S device
   *
   * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]}
   */
  getAllConnectedDevices: function () {
      RCTModule.getAllConnectedDevices()
  }
};