diff options
Diffstat (limited to 'libs/ihealth-sdk/module/BP7SModule.js')
| -rwxr-xr-x | libs/ihealth-sdk/module/BP7SModule.js | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/BP7SModule.js b/libs/ihealth-sdk/module/BP7SModule.js new file mode 100755 index 0000000..e2be830 --- /dev/null +++ b/libs/ihealth-sdk/module/BP7SModule.js | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | /** | ||
| 2 | * Created by zhangxu on 16/11/20. | ||
| 3 | */ | ||
| 4 | |||
| 5 | 'use strict'; | ||
| 6 | |||
| 7 | |||
| 8 | var { NativeModules } = require('react-native'); | ||
| 9 | |||
| 10 | var RCTModule = NativeModules.BP7SModule; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @module BP7SModule | ||
| 14 | */ | ||
| 15 | |||
| 16 | module.exports = { | ||
| 17 | |||
| 18 | Event_Notify: RCTModule.Event_Notify, | ||
| 19 | |||
| 20 | /** | ||
| 21 | * Get the BP7S device's battery. | ||
| 22 | * @param {string} mac Device's mac address | ||
| 23 | */ | ||
| 24 | getBattery: function (mac) { | ||
| 25 | if (RCTModule != null) { | ||
| 26 | RCTModule.getBattery(mac); | ||
| 27 | }else { | ||
| 28 | console.log('~~~~~ RCTModule is null') | ||
| 29 | } | ||
| 30 | }, | ||
| 31 | |||
| 32 | /** | ||
| 33 | * get offline data number. | ||
| 34 | * @param {string} mac Device's mac address | ||
| 35 | */ | ||
| 36 | getOffLineNum:function (mac) { | ||
| 37 | if (RCTModule != null) { | ||
| 38 | RCTModule.getOffLineNum(mac); | ||
| 39 | }else { | ||
| 40 | console.log('~~~~~ RCTModule is null') | ||
| 41 | } | ||
| 42 | }, | ||
| 43 | |||
| 44 | /** | ||
| 45 | * get offline data number. | ||
| 46 | * @param {string} mac Device's mac address | ||
| 47 | */ | ||
| 48 | getOffLineData:function (mac) { | ||
| 49 | if (RCTModule != null) { | ||
| 50 | RCTModule.getOffLineData(mac); | ||
| 51 | }else { | ||
| 52 | console.log('~~~~~ RCTModule is null') | ||
| 53 | } | ||
| 54 | }, | ||
| 55 | |||
| 56 | /** | ||
| 57 | * Set BP7S device unit. | ||
| 58 | * @param {string} mac Device's mac address | ||
| 59 | * @param {int} unit 0:mmHg,1:kPa | ||
| 60 | */ | ||
| 61 | setUnit:function (mac, unit){ | ||
| 62 | if (RCTModule != null) { | ||
| 63 | RCTModule.setUnit(mac,unit); | ||
| 64 | }else { | ||
| 65 | console.log('~~~~~ RCTModule is null') | ||
| 66 | } | ||
| 67 | }, | ||
| 68 | |||
| 69 | /** | ||
| 70 | * Set BP7S device angle. | ||
| 71 | * @param {string} mac Device's mac address | ||
| 72 | * @param {int} leftUpper the maximum measure angle of left hand, the maximum value must less than 90. | ||
| 73 | * @param {int} leftLows the minimum measure angle of left hand, the minimum value must more than 0, and less than leftUpper. | ||
| 74 | * @param {int} rightUpper the maximum measure angle of right hand, the maximum value must less than 90. | ||
| 75 | * @param {int} rightLow the minimum measure angle of right hand, the minimum value must more than 0, and less than rightUpper. | ||
| 76 | * | ||
| 77 | */ | ||
| 78 | angleSet:function (mac, leftUpper, leftLows, rightUpper, rightLow) { | ||
| 79 | if (RCTModule != null) { | ||
| 80 | RCTModule.angleSet(mac,leftUpper,leftLows,rightUpper,rightLow); | ||
| 81 | }else { | ||
| 82 | console.log('~~~~~ RCTModule is null') | ||
| 83 | } | ||
| 84 | }, | ||
| 85 | |||
| 86 | /** | ||
| 87 | * Get the BP7S device's functionInfo. | ||
| 88 | * @param {string} mac Device's mac address | ||
| 89 | */ | ||
| 90 | getFunctionInfo:function (mac) { | ||
| 91 | if (RCTModule != null) { | ||
| 92 | RCTModule.getFunctionInfo(mac); | ||
| 93 | }else { | ||
| 94 | sconsole.log('~~~~~ RCTModule is null') | ||
| 95 | } | ||
| 96 | }, | ||
| 97 | |||
| 98 | /** | ||
| 99 | * Disconnect the BP7S | ||
| 100 | * | ||
| 101 | * @param {string} mac Device's mac address | ||
| 102 | */ | ||
| 103 | |||
| 104 | disconnect: function (mac) { | ||
| 105 | |||
| 106 | if (RCTModule != null) { | ||
| 107 | RCTModule.disconnect(mac); | ||
| 108 | }else { | ||
| 109 | console.log('~~~~~ RCTModule is null') | ||
| 110 | } | ||
| 111 | }, | ||
| 112 | |||
| 113 | /** | ||
| 114 | * Get all connected BP7S device | ||
| 115 | * | ||
| 116 | * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} | ||
| 117 | */ | ||
| 118 | getAllConnectedDevices: function () { | ||
| 119 | RCTModule.getAllConnectedDevices() | ||
| 120 | } | ||
| 121 | }; | ||
