diff options
Diffstat (limited to 'libs/ihealth-sdk/module/BTMModule.js')
| -rwxr-xr-x | libs/ihealth-sdk/module/BTMModule.js | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/BTMModule.js b/libs/ihealth-sdk/module/BTMModule.js new file mode 100755 index 0000000..d7601d5 --- /dev/null +++ b/libs/ihealth-sdk/module/BTMModule.js | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | /** | ||
| 2 | * Created by lixuesong on 11/11/2016. | ||
| 3 | */ | ||
| 4 | 'use strict'; | ||
| 5 | |||
| 6 | var {NativeModules} = require('react-native'); | ||
| 7 | |||
| 8 | var RCTModule = NativeModules.BTMModule | ||
| 9 | |||
| 10 | /** | ||
| 11 | * @module BTMModule | ||
| 12 | */ | ||
| 13 | module.exports = { | ||
| 14 | |||
| 15 | Event_Notify: RCTModule.Event_Notify, | ||
| 16 | |||
| 17 | /** | ||
| 18 | * Get the BTM battery status. | ||
| 19 | * @param {string} mac Device's mac address | ||
| 20 | */ | ||
| 21 | getBattery: function (mac) { | ||
| 22 | RCTModule.getBattery(mac) | ||
| 23 | }, | ||
| 24 | |||
| 25 | /** | ||
| 26 | * Get the value of historical data in the BTM. | ||
| 27 | * @param {string} mac Device's mac address | ||
| 28 | */ | ||
| 29 | getMemoryData: function (mac) { | ||
| 30 | RCTModule.getMemoryData(mac) | ||
| 31 | }, | ||
| 32 | |||
| 33 | /** | ||
| 34 | * Set the standby time | ||
| 35 | * @param {string} mac Device's mac address | ||
| 36 | * @param {number} hour Standby time hours [0, 23] | ||
| 37 | * @param {number} minute Standby time minute [0, 59] | ||
| 38 | * @param {number} second Standby time second [0, 59] | ||
| 39 | */ | ||
| 40 | setStandbyTime: function (mac, hour, minute, second) { | ||
| 41 | RCTModule.setStandbyTime(mac, hour, minute, second) | ||
| 42 | }, | ||
| 43 | |||
| 44 | /** | ||
| 45 | * Set the temperature unit | ||
| 46 | * @param {string} mac Device's mac address | ||
| 47 | * @param {number} unit temperature unit<br/> | ||
| 48 | * <b>The unit of:</b> BtmControl.TEMPERATURE_UNIT_C or BtmControl.TEMPERATURE_UNIT_F | ||
| 49 | */ | ||
| 50 | setTemperatureUnit: function (mac, unit) { | ||
| 51 | RCTModule.setTemperatureUnit(mac, unit) | ||
| 52 | }, | ||
| 53 | |||
| 54 | /** | ||
| 55 | * Set the measuring target | ||
| 56 | * @param {string} mac Device's mac address | ||
| 57 | * @param {number} measuring target | ||
| 58 | */ | ||
| 59 | setMeasuringTarget: function (mac, target) { | ||
| 60 | RCTModule.setMeasuringTarget(mac, target) | ||
| 61 | }, | ||
| 62 | |||
| 63 | /** | ||
| 64 | * Set the offline target | ||
| 65 | * @param {string} mac Device's mac address | ||
| 66 | * @param {number} measuring target | ||
| 67 | */ | ||
| 68 | setOfflineTarget: function (mac, target) { | ||
| 69 | RCTModule.setOfflineTarget(mac, target) | ||
| 70 | }, | ||
| 71 | |||
| 72 | /** | ||
| 73 | * Disconnect the BTM | ||
| 74 | * @param mac The mac address for BTM | ||
| 75 | */ | ||
| 76 | disconnect: function (mac) { | ||
| 77 | RCTModule.disconnect(mac) | ||
| 78 | }, | ||
| 79 | |||
| 80 | /** | ||
| 81 | * Get all connected BTM device | ||
| 82 | * | ||
| 83 | * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} | ||
| 84 | */ | ||
| 85 | getAllConnectedDevices: function () { | ||
| 86 | RCTModule.getAllConnectedDevices() | ||
| 87 | } | ||
| 88 | } | ||
