diff options
Diffstat (limited to 'libs/ihealth-sdk/module/BP5Module.js')
| -rwxr-xr-x | libs/ihealth-sdk/module/BP5Module.js | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/BP5Module.js b/libs/ihealth-sdk/module/BP5Module.js new file mode 100755 index 0000000..1dbc7ff --- /dev/null +++ b/libs/ihealth-sdk/module/BP5Module.js | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | 'use strict'; | ||
| 2 | |||
| 3 | |||
| 4 | var {NativeModules} = require('react-native'); | ||
| 5 | |||
| 6 | var RCTModule = NativeModules.BP5Module | ||
| 7 | |||
| 8 | /** | ||
| 9 | * @module BP5Module | ||
| 10 | */ | ||
| 11 | module.exports = { | ||
| 12 | |||
| 13 | Event_Notify: RCTModule.Event_Notify, | ||
| 14 | |||
| 15 | /** | ||
| 16 | * Start measure blood pressure monitor | ||
| 17 | * @param {string} mac Device's mac address | ||
| 18 | */ | ||
| 19 | |||
| 20 | startMeasure: function (mac) { | ||
| 21 | RCTModule.startMeasure(mac) | ||
| 22 | }, | ||
| 23 | |||
| 24 | /** | ||
| 25 | * Cancel the measuring process immediately if device is in measuring state. | ||
| 26 | * @param {string} mac Device's mac address | ||
| 27 | */ | ||
| 28 | stopMeasure: function (mac) { | ||
| 29 | RCTModule.stopMeasure(mac) | ||
| 30 | }, | ||
| 31 | |||
| 32 | /** | ||
| 33 | * Get the BP5 device's battery. | ||
| 34 | * @param {string} mac Device's mac address | ||
| 35 | */ | ||
| 36 | getBattery: function (mac) { | ||
| 37 | if (RCTModule != null) { | ||
| 38 | RCTModule.getBattery(mac); | ||
| 39 | } else { | ||
| 40 | console.log('~~~~~ RCTModule is null') | ||
| 41 | } | ||
| 42 | }, | ||
| 43 | |||
| 44 | /** | ||
| 45 | * Enable device can measure offline . | ||
| 46 | * @param {string} mac Device's mac address | ||
| 47 | */ | ||
| 48 | enbleOffline: function (mac) { | ||
| 49 | if (RCTModule != null) { | ||
| 50 | RCTModule.enbleOffline(mac); | ||
| 51 | } else { | ||
| 52 | console.log('~~~~~ RCTModule is null') | ||
| 53 | } | ||
| 54 | }, | ||
| 55 | |||
| 56 | /** | ||
| 57 | * Enable device can't measure offline . | ||
| 58 | * @param {string} mac Device's mac address | ||
| 59 | */ | ||
| 60 | disableOffline: function (mac) { | ||
| 61 | if (RCTModule != null) { | ||
| 62 | RCTModule.disableOffline(mac); | ||
| 63 | } else { | ||
| 64 | console.log('~~~~~ RCTModule is null') | ||
| 65 | } | ||
| 66 | }, | ||
| 67 | |||
| 68 | /** | ||
| 69 | * Enable device can't measure offline. | ||
| 70 | * @param {string} mac Device's mac address | ||
| 71 | */ | ||
| 72 | isEnableOffline: function (mac) { | ||
| 73 | if (RCTModule != null) { | ||
| 74 | RCTModule.isEnableOffline(mac); | ||
| 75 | } else { | ||
| 76 | console.log('~~~~~ RCTModule is null') | ||
| 77 | } | ||
| 78 | }, | ||
| 79 | |||
| 80 | /** | ||
| 81 | * get offline data number. (iOS not support) | ||
| 82 | * @param {string} mac Device's mac address | ||
| 83 | */ | ||
| 84 | getOfflineNum: function (mac) { | ||
| 85 | if (RCTModule != null) { | ||
| 86 | RCTModule.getOfflineNum(mac); | ||
| 87 | } else { | ||
| 88 | console.log('~~~~~ RCTModule is null') | ||
| 89 | } | ||
| 90 | }, | ||
| 91 | |||
| 92 | /** | ||
| 93 | * get offline data. | ||
| 94 | * @param {string} mac Device's mac address | ||
| 95 | */ | ||
| 96 | getOfflineData: function (mac) { | ||
| 97 | if (RCTModule != null) { | ||
| 98 | RCTModule.getOfflineData(mac); | ||
| 99 | } else { | ||
| 100 | console.log('~~~~~ RCTModule is null') | ||
| 101 | } | ||
| 102 | }, | ||
| 103 | |||
| 104 | /** | ||
| 105 | * Disconnect the BP5 (iOS not support) | ||
| 106 | * | ||
| 107 | * @param {string} mac Device's mac address | ||
| 108 | */ | ||
| 109 | disconnect: function (mac) { | ||
| 110 | if (RCTModule != null) { | ||
| 111 | RCTModule.disconnect(mac); | ||
| 112 | } else { | ||
| 113 | console.log('~~~~~ RCTModule is null') | ||
| 114 | } | ||
| 115 | }, | ||
| 116 | |||
| 117 | /** | ||
| 118 | * Get all connected BP5 device | ||
| 119 | * | ||
| 120 | * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} | ||
| 121 | */ | ||
| 122 | getAllConnectedDevices: function () { | ||
| 123 | RCTModule.getAllConnectedDevices() | ||
| 124 | } | ||
| 125 | } | ||
