diff options
Diffstat (limited to 'libs/ihealth-sdk/module/BP550BTModule.js')
| -rwxr-xr-x | libs/ihealth-sdk/module/BP550BTModule.js | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/BP550BTModule.js b/libs/ihealth-sdk/module/BP550BTModule.js new file mode 100755 index 0000000..126e245 --- /dev/null +++ b/libs/ihealth-sdk/module/BP550BTModule.js | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | /** | ||
| 2 | * Created by zhangxu on 16/11/20. | ||
| 3 | */ | ||
| 4 | 'use strict'; | ||
| 5 | |||
| 6 | |||
| 7 | var { NativeModules } = require('react-native'); | ||
| 8 | |||
| 9 | var RCTModule = NativeModules.BP550BTModule; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * @module BP550BTModule | ||
| 13 | */ | ||
| 14 | |||
| 15 | module.exports = { | ||
| 16 | |||
| 17 | Event_Notify: RCTModule.Event_Notify, | ||
| 18 | |||
| 19 | /** | ||
| 20 | * Get the BP550BT device's battery. | ||
| 21 | * @param {string} mac Device's mac address | ||
| 22 | */ | ||
| 23 | getBattery: function (mac) { | ||
| 24 | if (RCTModule != null) { | ||
| 25 | RCTModule.getBattery(mac); | ||
| 26 | }else { | ||
| 27 | console.log('~~~~~ RCTModule is null') | ||
| 28 | } | ||
| 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 | * Get the KN-550BT device's functionInfo. | ||
| 58 | * @param {string} mac Device's mac address | ||
| 59 | */ | ||
| 60 | getFunctionInfo: function (mac) { | ||
| 61 | if (RCTModule != null) { | ||
| 62 | RCTModule.getFunctionInfo(mac); | ||
| 63 | }else { | ||
| 64 | console.log('~~~~~ RCTModule is null') | ||
| 65 | } | ||
| 66 | }, | ||
| 67 | |||
| 68 | /** | ||
| 69 | * Disconnect the KN-550BT | ||
| 70 | * | ||
| 71 | * @param {string} mac Device's mac address | ||
| 72 | */ | ||
| 73 | disconnect: function (mac) { | ||
| 74 | if (RCTModule != null) { | ||
| 75 | RCTModule.disconnect(mac); | ||
| 76 | }else { | ||
| 77 | console.log('~~~~~ RCTModule is null') | ||
| 78 | } | ||
| 79 | }, | ||
| 80 | |||
| 81 | /** | ||
| 82 | * Get all connected BP550BT device | ||
| 83 | * | ||
| 84 | * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} | ||
| 85 | */ | ||
| 86 | getAllConnectedDevices: function () { | ||
| 87 | RCTModule.getAllConnectedDevices() | ||
| 88 | } | ||
| 89 | } | ||
| 90 | |||
