diff options
Diffstat (limited to 'libs/ihealth-sdk/module/BP3LModule.js')
| -rwxr-xr-x | libs/ihealth-sdk/module/BP3LModule.js | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/BP3LModule.js b/libs/ihealth-sdk/module/BP3LModule.js new file mode 100755 index 0000000..27bca9a --- /dev/null +++ b/libs/ihealth-sdk/module/BP3LModule.js | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | /** | ||
| 2 | * Created by zhangxu on 16/11/14. | ||
| 3 | */ | ||
| 4 | 'use strict'; | ||
| 5 | |||
| 6 | |||
| 7 | var {NativeModules} = require('react-native'); | ||
| 8 | |||
| 9 | var RCTModule = NativeModules.BP3LModule; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * @module BP3LModule | ||
| 13 | */ | ||
| 14 | module.exports = { | ||
| 15 | |||
| 16 | Event_Notify: RCTModule.Event_Notify, | ||
| 17 | |||
| 18 | /** | ||
| 19 | * Start measure blood pressure monitor | ||
| 20 | * @param {string} mac Device's mac address | ||
| 21 | */ | ||
| 22 | startMeasure: function (mac) { | ||
| 23 | if (RCTModule != null) { | ||
| 24 | RCTModule.startMeasure(mac); | ||
| 25 | } else { | ||
| 26 | console.log('~~~~~ RCTModule is null') | ||
| 27 | } | ||
| 28 | }, | ||
| 29 | |||
| 30 | |||
| 31 | /** | ||
| 32 | * Cancel the measuring process immediately if device is in measuring state. | ||
| 33 | * @param {string} mac Device's mac address | ||
| 34 | */ | ||
| 35 | stopMeasure: function (mac) { | ||
| 36 | if (RCTModule != null) { | ||
| 37 | RCTModule.stopMeasure(mac); | ||
| 38 | } else { | ||
| 39 | console.log('~~~~~ RCTModule is null') | ||
| 40 | } | ||
| 41 | }, | ||
| 42 | |||
| 43 | /** | ||
| 44 | * Get the BP3L device's battery. | ||
| 45 | * @param {string} mac Device's mac address | ||
| 46 | */ | ||
| 47 | getBattery: function (mac) { | ||
| 48 | if (RCTModule != null) { | ||
| 49 | RCTModule.getBattery(mac); | ||
| 50 | } else { | ||
| 51 | console.log('~~~~~ RCTModule is null') | ||
| 52 | } | ||
| 53 | }, | ||
| 54 | |||
| 55 | /** | ||
| 56 | * Disconnect the BP3L | ||
| 57 | * @param {string} mac Device's mac address | ||
| 58 | */ | ||
| 59 | disconnect: function (mac) { | ||
| 60 | if (RCTModule != null) { | ||
| 61 | RCTModule.disconnect(mac); | ||
| 62 | } else { | ||
| 63 | console.log('~~~~~ RCTModule is null') | ||
| 64 | } | ||
| 65 | }, | ||
| 66 | |||
| 67 | /** | ||
| 68 | * Get all connected AM3S device | ||
| 69 | * | ||
| 70 | * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} | ||
| 71 | */ | ||
| 72 | getAllConnectedDevices: function () { | ||
| 73 | RCTModule.getAllConnectedDevices() | ||
| 74 | } | ||
| 75 | } | ||
