diff options
Diffstat (limited to 'libs/ihealth-sdk/module/AM5Module.js')
| -rwxr-xr-x | libs/ihealth-sdk/module/AM5Module.js | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/AM5Module.js b/libs/ihealth-sdk/module/AM5Module.js new file mode 100755 index 0000000..ab9f0ae --- /dev/null +++ b/libs/ihealth-sdk/module/AM5Module.js | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | 'use strict'; | ||
| 2 | |||
| 3 | |||
| 4 | var { | ||
| 5 | NativeModules, | ||
| 6 | DeviceEventEmitter | ||
| 7 | } = require('react-native'); | ||
| 8 | |||
| 9 | var AM5ProfileModule = require('./AM5ProfileModule.js'); | ||
| 10 | |||
| 11 | var RCTModule = NativeModules.AM5Module | ||
| 12 | |||
| 13 | /** | ||
| 14 | * @module AM5Module | ||
| 15 | */ | ||
| 16 | module.exports = { | ||
| 17 | |||
| 18 | Event_Notify: RCTModule.Event_Notify, | ||
| 19 | |||
| 20 | /** | ||
| 21 | * Binding apps and devices. | ||
| 22 | * AM5 devices must be bound one-to-one. If you want to use other devices, you must unbind them first and then bind them to other devices. | ||
| 23 | * @param {string} mac Device's mac address | ||
| 24 | */ | ||
| 25 | bindDevice: function (mac) { | ||
| 26 | RCTModule.bindDevice(mac) | ||
| 27 | }, | ||
| 28 | |||
| 29 | /** | ||
| 30 | * UnBind apps and devices. | ||
| 31 | * @param {string} mac Device's mac address | ||
| 32 | */ | ||
| 33 | unBindDevice: function (mac) { | ||
| 34 | RCTModule.unBindDevice(mac) | ||
| 35 | }, | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Get information of the device | ||
| 39 | * @param {string} mac Device's mac address | ||
| 40 | */ | ||
| 41 | getBasicInfo: function (mac) { | ||
| 42 | RCTModule.getBasicInfo(mac) | ||
| 43 | }, | ||
| 44 | |||
| 45 | // /** | ||
| 46 | // * Set time of the device | ||
| 47 | // * @param year year | ||
| 48 | // * @param month month | ||
| 49 | // * @param day day | ||
| 50 | // * @param hour hour | ||
| 51 | // * @param minute minute | ||
| 52 | // * @param second second | ||
| 53 | // * @param week What day is today? Effective Value 1-7 | ||
| 54 | // */ | ||
| 55 | // setTime: function (mac, year, month, day, minute, second, week) { | ||
| 56 | // RCTModule.setTime(mac, year, month, day, minute, second, week) | ||
| 57 | // }, | ||
| 58 | |||
| 59 | /** | ||
| 60 | * Set current time of the device | ||
| 61 | */ | ||
| 62 | setTime: function (mac) { | ||
| 63 | RCTModule.setTime(mac) | ||
| 64 | }, | ||
| 65 | |||
| 66 | /** | ||
| 67 | * Get the live data of the device | ||
| 68 | * @param {string} mac Device's mac address | ||
| 69 | * @param year Year of birth | ||
| 70 | * @param month Month of birth | ||
| 71 | * @param day Day of birth | ||
| 72 | * @param weight weight | ||
| 73 | * @param height height | ||
| 74 | * @param gander gender male: 1, female: 2 | ||
| 75 | */ | ||
| 76 | setUserInfo: function (mac, year, month, day, weight, height, gander) { | ||
| 77 | RCTModule.setUserInfo(mac, year, month, day, weight, height, gander) | ||
| 78 | }, | ||
| 79 | |||
| 80 | /** | ||
| 81 | * Set unit | ||
| 82 | * When you never set them, treat them as defaults | ||
| 83 | * @param {string} mac Device's mac address | ||
| 84 | * @param type 0: Distance unit unit: 0 default ; 1 KM ; 2 MI | ||
| 85 | * @param type 1: Wight unit unit: 0 default ; 1 KG ; 2 LB ; 3 ST | ||
| 86 | * @param type 2: Temperature unit unit: 0 default ; 1 °C ; 2 °F | ||
| 87 | * @param type 3: Distance at each step unit: distance (cm) (default 0cm) | ||
| 88 | * @param type 4: Language unit: 0 default ; 1 zh ; 2 en ; 3 fr ; 4 de ; 5 it ; 6 es ; 7 ja ; 8 po ; 9 cz | ||
| 89 | * @param type 5: Time Mode unit: 0 default ; 1 24 hour system ; 2 12 hour system | ||
| 90 | * @param type 6: Distance at each step of run unit: distance (cm) (default 0cm) | ||
| 91 | * @param type 7: GPS calibration switch unit: 0 default ; 1 open ; 2 close | ||
| 92 | */ | ||
| 93 | setUnit: function (mac, type, unit) { | ||
| 94 | RCTModule.setUnit(mac, type, unit) | ||
| 95 | }, | ||
| 96 | |||
| 97 | /** | ||
| 98 | * Reboot the device | ||
| 99 | * @param {string} mac Device's mac address | ||
| 100 | */ | ||
| 101 | reboot: function (mac) { | ||
| 102 | RCTModule.reboot(mac) | ||
| 103 | }, | ||
| 104 | |||
| 105 | /** | ||
| 106 | * Set Hand Wear Mode | ||
| 107 | * @param {string} mac Device's mac address | ||
| 108 | * @param mode 0 left-hand 1 right-hand | ||
| 109 | */ | ||
| 110 | setHandWearMode: function (mac, mode) { | ||
| 111 | RCTModule.setHandWearMode(mac, mode) | ||
| 112 | }, | ||
| 113 | |||
| 114 | /** | ||
| 115 | * Get the live data of the device | ||
| 116 | * @param {string} mac Device's mac address | ||
| 117 | */ | ||
| 118 | getLiveData: function (mac) { | ||
| 119 | RCTModule.getLiveData(mac) | ||
| 120 | }, | ||
| 121 | |||
| 122 | /** | ||
| 123 | * Sync health data from device | ||
| 124 | * @param {string} mac Device's mac address | ||
| 125 | */ | ||
| 126 | syncHealthData: function (mac) { | ||
| 127 | RCTModule.syncHealthData(mac) | ||
| 128 | }, | ||
| 129 | |||
| 130 | /** | ||
| 131 | * Stop sync health data from device | ||
| 132 | * @param {string} mac Device's mac address | ||
| 133 | */ | ||
| 134 | stopSyncHealthData: function (mac) { | ||
| 135 | RCTModule.stopSyncHealthData(mac) | ||
| 136 | }, | ||
| 137 | |||
| 138 | /** | ||
| 139 | * Get all connected AM4 device | ||
| 140 | * | ||
| 141 | * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]} | ||
| 142 | */ | ||
| 143 | getAllConnectedDevices: function () { | ||
| 144 | RCTModule.getAllConnectedDevices() | ||
| 145 | }, | ||
| 146 | |||
| 147 | disconnect: function (mac) { | ||
| 148 | RCTModule.disconnect(mac) | ||
| 149 | }, | ||
| 150 | } | ||
