diff options
Diffstat (limited to 'libs/ihealth-sdk/doc')
28 files changed, 3575 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/doc/README.md b/libs/ihealth-sdk/doc/README.md new file mode 100755 index 0000000..a862013 --- /dev/null +++ b/libs/ihealth-sdk/doc/README.md | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | # iHealth device sdk | ||
| 2 | |||
| 3 | ## Installation | ||
| 4 | |||
| 5 | ### Using npm | ||
| 6 | |||
| 7 | ```shell | ||
| 8 | npm install --save @ihealth/ihealthlibrary-react-native | ||
| 9 | ``` | ||
| 10 | |||
| 11 | ### Using yarn | ||
| 12 | |||
| 13 | ```shell | ||
| 14 | yarn add @ihealth/ihealthlibrary-react-native | ||
| 15 | ``` | ||
| 16 | |||
| 17 | ## Usage | ||
| 18 | |||
| 19 | ### Authentication | ||
| 20 | |||
| 21 | #### Download license file | ||
| 22 | |||
| 23 | 1. Sign up iHealth developer webside. [Please sign up here](https://dev.ihealthlabs.com) | ||
| 24 | 2. Press "Add New App" button, fill in your information of your app. We will get email and active the license for your app. | ||
| 25 | 3. Download license file, as shown below. | ||
| 26 |  | ||
| 27 | |||
| 28 | #### Integrate license file | ||
| 29 | |||
| 30 | For iOS | ||
| 31 | As shown below, Add your license file to your iOS project. | ||
| 32 |  | ||
| 33 | |||
| 34 | For Android | ||
| 35 | As show below, Add your license file to your asserts folder. | ||
| 36 |  | ||
| 37 | |||
| 38 | #### Using license file | ||
| 39 | |||
| 40 | ```js | ||
| 41 | import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native'; | ||
| 42 | |||
| 43 | // your license file | ||
| 44 | const filename = 'license.pem'; | ||
| 45 | iHealthDeviceManagerModule.sdkAuthWithLicense(filename); | ||
| 46 | ``` | ||
| 47 | |||
| 48 | ### Troubleshooting | ||
| 49 | |||
| 50 | #### For Android | ||
| 51 | |||
| 52 | 1. Check settings.gradle file in your android project and node_modules, make sure input the correct module path. | ||
| 53 | |||
| 54 | ```gradle | ||
| 55 | include ':ihealthlibrary-react-native' | ||
| 56 | project(':ihealthlibrary-react-native').projectDir = new File(rootProject.projectDir,'../node_modules/@ihealth/ihealthlibrary-react-native/android') | ||
| 57 | ``` | ||
| 58 | |||
| 59 | 2. Check build.gradle file in your android project, make sure the ihealth module is integrated | ||
| 60 | |||
| 61 | ```gradle | ||
| 62 | compile project(':@ihealth_ihealthlibrary-react-native') | ||
| 63 | ``` | ||
| 64 | |||
| 65 | 3. Import iHealth module in your MainActivity.java | ||
| 66 | |||
| 67 | ```java | ||
| 68 | protected List<ReactPackage> getPackages() { | ||
| 69 | return Arrays.<ReactPackage>asList( | ||
| 70 | new MainReactPackage(), | ||
| 71 | new iHealthDeviceManagerPackage() | ||
| 72 | ); | ||
| 73 | } | ||
| 74 | ``` | ||
| 75 | |||
| 76 | 4. Location permission(in AndroidManifest.xml) | ||
| 77 | |||
| 78 | ```xml | ||
| 79 | <!-- Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in Android API 23+ --> | ||
| 80 | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
| 81 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
| 82 | ``` | ||
| 83 | |||
| 84 | #### For iOS | ||
| 85 | |||
| 86 | 1. Open your iOS project, add node_modules/@ihealth/ihealthlibrary-react-native/ios/ReactNativeIOSLibrary.xcodeproj to libraries | ||
| 87 | 2. Under 'Build Phases' -- 'Link Binary With Libraries', add libReactNativeIOSLibrary.a | ||
| 88 | |||
| 89 | ### Example | ||
| 90 | |||
| 91 | iHealth SDK module is based on DeviceEventEmitter, So call add listener while the component is loaded, and call remove listener while the component is unloaded, As show as below. If you want more detail information, Please the example code. | ||
| 92 | |||
| 93 | ```js | ||
| 94 | componentDidMount() { | ||
| 95 | iHealthAPI.addListener(); | ||
| 96 | } | ||
| 97 | |||
| 98 | componentWillUnmount() { | ||
| 99 | iHealthAPI.removeListener(); | ||
| 100 | } | ||
| 101 | ``` | ||
| 102 | |||
| 103 | #### For bluetooth LE or regular bluetooth device | ||
| 104 | |||
| 105 | ##### search device | ||
| 106 | |||
| 107 | ```js | ||
| 108 | import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native'; | ||
| 109 | const type = 'BP5'; // AM3S, AM4, BG5, BG5S, BP3L, BP5, BP5S, BP7S, HS2, HS4S, PO3,HS2S,BG1S | ||
| 110 | iHealthDeviceManagerModule.startDiscovery(type); | ||
| 111 | ``` | ||
| 112 | |||
| 113 | ##### connect device | ||
| 114 | |||
| 115 | ```js | ||
| 116 | import { iHealthDeviceManagerModule } from '@ihealth/ihealthlibrary-react-native'; | ||
| 117 | const mac = 'xxxxxxxxxxxxxx'; | ||
| 118 | const type = 'BP5'; // AM3S, AM4, BG5, BG5S, BP3L, BP5, BP5S, BP7S, HS2, HS4S, PO3,HS2S,BG1S | ||
| 119 | iHealthDeviceManagerModule.connectDevice(mac, type); | ||
| 120 | ``` | ||
| 121 | |||
| 122 | ##### device workflow | ||
| 123 | |||
| 124 | [AM3S workflow](./doc/am3s.md) | ||
| 125 | [AM4 workflow](./doc/am4.md) | ||
| 126 | [BG1 workflow](./doc/bg1.md) | ||
| 127 | [BG5 workflow](./doc/bg5.md) | ||
| 128 | [BG5S workflow](./doc/bg5s.md) | ||
| 129 | [BP3L workflow](./doc/bp3l.md) | ||
| 130 | [BP5 workflow](./doc/bp5.md) | ||
| 131 | [BP5S workflow](./doc/bp5s.md) | ||
| 132 | [BP7S workflow](./doc/bp7s.md) | ||
| 133 | [HS2 workflow](./doc/hs2.md) | ||
| 134 | [HS4S workflow](./doc/hs4s.md) | ||
| 135 | [HS6 workflow](./doc/hs6.md) | ||
| 136 | [PO3 workflow](./doc/po3.md) | ||
| 137 | [HS2S workflow](./doc/hs2s.md) | ||
| 138 | [BG1S workflow](./doc/bg1s.md) | ||
diff --git a/libs/ihealth-sdk/doc/am3s.md b/libs/ihealth-sdk/doc/am3s.md new file mode 100644 index 0000000..e9446de --- /dev/null +++ b/libs/ihealth-sdk/doc/am3s.md | |||
| @@ -0,0 +1,388 @@ | |||
| 1 | # AM3S Workflow | ||
| 2 | |||
| 3 | ## Import AM3S Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | AM3SModule, | ||
| 8 | AMProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get all connected am3s devices | ||
| 27 | |||
| 28 | ```js | ||
| 29 | AM3SModule.getAllConnectedDevices(); | ||
| 30 | ``` | ||
| 31 | |||
| 32 | ### disconnect a am3s devices | ||
| 33 | |||
| 34 | ```js | ||
| 35 | AM3SModule.disconnect(mac); | ||
| 36 | ``` | ||
| 37 | |||
| 38 | ### erase am3s memory | ||
| 39 | |||
| 40 | ```js | ||
| 41 | AM3SModule.reset(mac); | ||
| 42 | |||
| 43 | // response | ||
| 44 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 45 | if (event.action === AMProfileModule.ACTION_RESET_AM) { | ||
| 46 | if (0 === event[AMProfileModule.RESET_AM]) { | ||
| 47 | console.log('reset fail'); | ||
| 48 | } else if (1 === event[AMProfileModule.RESET_AM]) { | ||
| 49 | console.log('reset success'); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | }); | ||
| 53 | ``` | ||
| 54 | |||
| 55 | ### get the user id bound to the device | ||
| 56 | |||
| 57 | ```js | ||
| 58 | AM3SModule.getUserId(mac); | ||
| 59 | |||
| 60 | // response | ||
| 61 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 62 | if (event.action === AMProfileModule.ACTION_USERID_AM) { | ||
| 63 | console.log(event[AMProfileModule.USERID_AM]); | ||
| 64 | } | ||
| 65 | }); | ||
| 66 | ``` | ||
| 67 | |||
| 68 | ### set the user id to the device | ||
| 69 | |||
| 70 | ```js | ||
| 71 | // id: user id, the range is 0~0x7fffffff | ||
| 72 | AM3SModule.setUserId(mac, id); | ||
| 73 | |||
| 74 | // response | ||
| 75 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 76 | if (event.action === AMProfileModule.ACTION_SET_USERID_SUCCESS_AM) { | ||
| 77 | console.log('set success'); | ||
| 78 | } | ||
| 79 | }); | ||
| 80 | ``` | ||
| 81 | |||
| 82 | ### setAlarmClock | ||
| 83 | |||
| 84 | ```js | ||
| 85 | |||
| 86 | /** | ||
| 87 | * id: alarm clock id, you can set up to 3 alarm clocks | ||
| 88 | * hour: clock hour | ||
| 89 | * min: clock minates | ||
| 90 | * isRepeat: one time or repeat | ||
| 91 | * weeks: available on the day of the week | ||
| 92 | * isOn: open or close | ||
| 93 | */ | ||
| 94 | |||
| 95 | AM3SModule.setAlarmClock(mac, 1, 12, 0, true, [1, 1, 1, 1, 1, 0, 0], false); | ||
| 96 | |||
| 97 | // response | ||
| 98 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 99 | if (event.action === AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM) { | ||
| 100 | console.log('set success'); | ||
| 101 | } | ||
| 102 | }); | ||
| 103 | ``` | ||
| 104 | |||
| 105 | ### get alarm clock ids | ||
| 106 | |||
| 107 | ```js | ||
| 108 | AM3SModule.getAlarmClockNum(mac); | ||
| 109 | |||
| 110 | // response | ||
| 111 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 112 | if (event.action === AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM) { | ||
| 113 | console.log(event[AMProfileModule.GET_ALARMNUM_AM]); // e.g. 3 | ||
| 114 | console.log(event[AMProfileModule.GET_ALARMNUM_ID_AM]); // e.g. [1, 2, 3] | ||
| 115 | } | ||
| 116 | }); | ||
| 117 | ``` | ||
| 118 | |||
| 119 | ### get alarm clock detail | ||
| 120 | |||
| 121 | ```js | ||
| 122 | AM3SModule.getAlarmClockDetail(mac, [1, 3, 2]); | ||
| 123 | |||
| 124 | // response | ||
| 125 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 126 | if (event.action === AMProfileModule.ACTION_GET_ALARMINFO_AM) { | ||
| 127 | let dataArray = event[BPProfileModule.GET_ALARM_CLOCK_DETAIL]; | ||
| 128 | if (dataArray == undefined) { | ||
| 129 | result = "There is not offline data in device" | ||
| 130 | }else { | ||
| 131 | for (let i = 0; i < dataArray.length; i++) { | ||
| 132 | let offlineData = dataArray[i]; | ||
| 133 | console.log(offlineData[AMProfileModule.GET_ALARM_ID_AM]); | ||
| 134 | console.log(offlineData[AMProfileModule.GET_ALARM_TIME_AM]); | ||
| 135 | console.log(offlineData[AMProfileModule.GET_ALARM_ISREPEAT_AM]); | ||
| 136 | console.log(offlineData[AMProfileModule.GET_ALARM_WEEK_AM]); | ||
| 137 | console.log(offlineData[AMProfileModule.GET_ALARM_ISON_AM]); | ||
| 138 | } | ||
| 139 | } | ||
| 140 | } | ||
| 141 | }); | ||
| 142 | ``` | ||
| 143 | |||
| 144 | ### delete alarm clock by id | ||
| 145 | |||
| 146 | ```js | ||
| 147 | AM3SModule.deleteAlarmClock(mac, 1); | ||
| 148 | |||
| 149 | // response | ||
| 150 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 151 | if (event.action === AMProfileModule.ACTION_DELETE_ALARM_SUCCESS_AM) { | ||
| 152 | console.log('delete success'); | ||
| 153 | } | ||
| 154 | }); | ||
| 155 | ``` | ||
| 156 | |||
| 157 | ### set activity reminder interval | ||
| 158 | |||
| 159 | ```js | ||
| 160 | /** | ||
| 161 | * hour | ||
| 162 | * min | ||
| 163 | * isOn: open or close | ||
| 164 | */ | ||
| 165 | AM3SModule.setActivityRemind(mac, 0, 30, false); | ||
| 166 | |||
| 167 | // response | ||
| 168 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 169 | if (event.action === AMProfileModule.ACTION_SET_ACTIVITYREMIND_SUCCESS_AM) { | ||
| 170 | console.log('set success'); | ||
| 171 | } | ||
| 172 | }); | ||
| 173 | ``` | ||
| 174 | |||
| 175 | ### get activity reminder interval | ||
| 176 | |||
| 177 | ```js | ||
| 178 | AM3SModule.getActivityRemind(mac); | ||
| 179 | |||
| 180 | // response | ||
| 181 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 182 | if (event.action === AMProfileModule.ACTION_GET_ACTIVITY_REMIND_AM) { | ||
| 183 | console.log('get success'); | ||
| 184 | } | ||
| 185 | }); | ||
| 186 | ``` | ||
| 187 | |||
| 188 | ### get am3s information | ||
| 189 | |||
| 190 | ```js | ||
| 191 | AM3SModule.queryAMState(mac); | ||
| 192 | |||
| 193 | // response | ||
| 194 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 195 | if (event.action === AMProfileModule.ACTION_QUERY_STATE_AM) { | ||
| 196 | // 0 indicates waist | ||
| 197 | // 1 indicates wrist | ||
| 198 | // 2 indicates sleep | ||
| 199 | console.log(event[AMProfileModule.QUERY_STATE_AM]); | ||
| 200 | // battery level 0~10 | ||
| 201 | console.log(event[AMProfileModule.QUERY_BATTERY_AM]); | ||
| 202 | } | ||
| 203 | }); | ||
| 204 | ``` | ||
| 205 | |||
| 206 | ### set user id to the am3s device | ||
| 207 | |||
| 208 | ```js | ||
| 209 | // The user id range is from 0 to 0x7fffffff | ||
| 210 | AM3SModule.setUserId(mac, 8); | ||
| 211 | |||
| 212 | // response | ||
| 213 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 214 | if (event.action === AMProfileModule.ACTION_SET_USERID_SUCCESS_AM) { | ||
| 215 | console.log('set success'); | ||
| 216 | } | ||
| 217 | }); | ||
| 218 | ``` | ||
| 219 | |||
| 220 | ### set user information to the am3s device | ||
| 221 | |||
| 222 | ```js | ||
| 223 | /** | ||
| 224 | * age | ||
| 225 | * height(cm) | ||
| 226 | * weight(lbs) | ||
| 227 | * gender 0: female, 1: male | ||
| 228 | * unit 0: miles, 1: kilometre | ||
| 229 | * target the goal of steps, the range is from 4 ~ 65535 | ||
| 230 | * activityLevel 1: sedentary, 2: active, 3: very active | ||
| 231 | */ | ||
| 232 | AM3SModule.setUserInfo(mac, 25, 183, 80, AMProfileModule.AM_SET_MALE, AMProfileModule.AM_SET_UNIT_METRIC, 10000, 1, 30); | ||
| 233 | |||
| 234 | // response | ||
| 235 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 236 | if (event.action === AMProfileModule.ACTION_SET_USERINFO_SUCCESS_AM) { | ||
| 237 | console.log('set success'); | ||
| 238 | } | ||
| 239 | }); | ||
| 240 | ``` | ||
| 241 | |||
| 242 | ### get user information stored in the am3s device | ||
| 243 | |||
| 244 | ```js | ||
| 245 | AM3SModule.getUserInfo(mac); | ||
| 246 | |||
| 247 | // response | ||
| 248 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 249 | if (event.action === AMProfileModule.ACTION_GET_USERINFO_AM) { | ||
| 250 | console.log(event[AMProfileModule.GET_USER_AGE_AM]); | ||
| 251 | console.log(event[AMProfileModule.GET_USER_STEP_AM]); | ||
| 252 | console.log(event[AMProfileModule.GET_USER_HEIGHT_AM]); | ||
| 253 | console.log(event[AMProfileModule.GET_USER_SEX_AM]); | ||
| 254 | console.log(event[AMProfileModule.GET_USER_WEIGHT_AM]); | ||
| 255 | console.log(event[AMProfileModule.GET_USER_UNIT_AM]); | ||
| 256 | console.log(event[AMProfileModule.GET_USER_AGE_AM]); | ||
| 257 | console.log(event[AMProfileModule.GET_USER_TARGET1_AM]); | ||
| 258 | console.log(event[AMProfileModule.GET_USER_TARGET2_AM]); | ||
| 259 | console.log(event[AMProfileModule.GET_USER_TARGET3_AM]); | ||
| 260 | } | ||
| 261 | }); | ||
| 262 | ``` | ||
| 263 | |||
| 264 | ### set bmr to the am3s device | ||
| 265 | |||
| 266 | ```js | ||
| 267 | // bmr Basal Metabolic Rate | ||
| 268 | AM3SModule.setUserBmr(mac, 2000); | ||
| 269 | |||
| 270 | // response | ||
| 271 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 272 | if (event.action === AMProfileModule.ACTION_SET_BMR_SUCCESS_AM) { | ||
| 273 | console.log('set success'); | ||
| 274 | } | ||
| 275 | }); | ||
| 276 | ``` | ||
| 277 | |||
| 278 | ### get activity steps | ||
| 279 | |||
| 280 | ```js | ||
| 281 | AM3SModule.syncActivityData(mac); | ||
| 282 | |||
| 283 | // response | ||
| 284 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 285 | if (event.action === AMProfileModule.ACTION_SYNC_ACTIVITY_DATA_AM) { | ||
| 286 | let dataArray = event[AMProfileModule.SYNC_ACTIVITY_EACH_DATA_AM]; | ||
| 287 | if (dataArray == undefined) { | ||
| 288 | result = "There is not offline data in device" | ||
| 289 | }else { | ||
| 290 | for (let i = 0; i < dataArray.length; i++) { | ||
| 291 | let offlineData = dataArray[i]; | ||
| 292 | console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_TIME_AM]); | ||
| 293 | console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_AM]); | ||
| 294 | console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_CALORIE_AM]); | ||
| 295 | console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_LENGTH_AM]); | ||
| 296 | console.log(offlineData[AMProfileModule.DATAID]); | ||
| 297 | } | ||
| 298 | } | ||
| 299 | } | ||
| 300 | }); | ||
| 301 | ``` | ||
| 302 | |||
| 303 | ### get current activity steps | ||
| 304 | |||
| 305 | ```js | ||
| 306 | AM3SModule.syncRealData(mac); | ||
| 307 | |||
| 308 | // response | ||
| 309 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 310 | if (event.action === AMProfileModule.ACTION_SYNC_REAL_DATA_AM) { | ||
| 311 | console.log(offlineData[AMProfileModule.SYNC_REAL_STEP_AM]); | ||
| 312 | console.log(offlineData[AMProfileModule.SYNC_REAL_CALORIE_AM]); | ||
| 313 | console.log(offlineData[AMProfileModule.SYNC_REAL_TOTALCALORIE_AM]); | ||
| 314 | } | ||
| 315 | }); | ||
| 316 | ``` | ||
| 317 | |||
| 318 | ### set current time to am3s device | ||
| 319 | |||
| 320 | ```js | ||
| 321 | AM3SModule.syncRealData(mac); | ||
| 322 | |||
| 323 | // response | ||
| 324 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 325 | if (event.action === AMProfileModule.ACTION_SYNC_TIME_SUCCESS_AM) { | ||
| 326 | console.log('set success'); | ||
| 327 | } | ||
| 328 | }); | ||
| 329 | ``` | ||
| 330 | |||
| 331 | ### set hour mode (12 or 24) to am3s device | ||
| 332 | |||
| 333 | ```js | ||
| 334 | /** | ||
| 335 | * AMProfileModule.AM_SET_12_HOUR_MODE(0) | ||
| 336 | * AMProfileModule.AM_SET_24_HOUR_MODE(1) | ||
| 337 | * AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE(2) | ||
| 338 | * AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE(3) | ||
| 339 | * AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE(4) | ||
| 340 | * AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE | ||
| 341 | **/ | ||
| 342 | AM3SModule.setHourMode(mac, AMProfileModule.AM_SET_24_HOUR_MODE); | ||
| 343 | |||
| 344 | // response | ||
| 345 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 346 | if (event.action === AMProfileModule.ACTION_SET_HOUR_MODE_SUCCESS_AM) { | ||
| 347 | console.log('set success'); | ||
| 348 | } | ||
| 349 | }); | ||
| 350 | ``` | ||
| 351 | |||
| 352 | ### get hour mode (12 or 24) from am3s device | ||
| 353 | |||
| 354 | |||
| 355 | ```js | ||
| 356 | AM3SModule.getHourMode(mac); | ||
| 357 | |||
| 358 | // response | ||
| 359 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 360 | if (event.action === AMProfileModule.ACTION_GET_HOUR_MODE_AM) { | ||
| 361 | console.log(event[AMProfileModule.GET_HOUR_MODE_AM]); | ||
| 362 | } | ||
| 363 | }); | ||
| 364 | ``` | ||
| 365 | |||
| 366 | ### get sleep data stored in the am3s | ||
| 367 | |||
| 368 | ```js | ||
| 369 | AM3SModule.syncSleepData(mac); | ||
| 370 | |||
| 371 | // response | ||
| 372 | notifyListener = DeviceEventEmitter.addListener(AM3SModule.Event_Notify, (event) => { | ||
| 373 | if (event.action === AMProfileModule.ACTION_SYNC_SLEEP_DATA_AM) { | ||
| 374 | let dataArray = event[AMProfileModule.SYNC_SLEEP_DATA_AM]; | ||
| 375 | if (dataArray == undefined) { | ||
| 376 | result = "There is not offline data in device" | ||
| 377 | }else { | ||
| 378 | for (let i = 0; i < dataArray.length; i++) { | ||
| 379 | let offlineData = dataArray[i]; | ||
| 380 | console.log(offlineData[AMProfileModule.SYNC_SLEEP_EACH_DATA_AM]); | ||
| 381 | console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_TIME_AM]); | ||
| 382 | console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_LEVEL_AM]); | ||
| 383 | console.log(offlineData[AMProfileModule.DATAID]); | ||
| 384 | } | ||
| 385 | } | ||
| 386 | } | ||
| 387 | }); | ||
| 388 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/am4.md b/libs/ihealth-sdk/doc/am4.md new file mode 100644 index 0000000..4646f49 --- /dev/null +++ b/libs/ihealth-sdk/doc/am4.md | |||
| @@ -0,0 +1,388 @@ | |||
| 1 | # AM4 Workflow | ||
| 2 | |||
| 3 | ## Import AM4 Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | AM4Module, | ||
| 8 | AMProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get all connected am4 devices | ||
| 27 | |||
| 28 | ```js | ||
| 29 | AM4Module.getAllConnectedDevices(); | ||
| 30 | ``` | ||
| 31 | |||
| 32 | ### disconnect a am4 devices | ||
| 33 | |||
| 34 | ```js | ||
| 35 | AM4Module.disconnect(mac); | ||
| 36 | ``` | ||
| 37 | |||
| 38 | ### erase am4 memory | ||
| 39 | |||
| 40 | ```js | ||
| 41 | AM4Module.reset(mac); | ||
| 42 | |||
| 43 | // response | ||
| 44 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 45 | if (event.action === AMProfileModule.ACTION_RESET_AM) { | ||
| 46 | if (0 === event[AMProfileModule.RESET_AM]) { | ||
| 47 | console.log('reset fail'); | ||
| 48 | } else if (1 === event[AMProfileModule.RESET_AM]) { | ||
| 49 | console.log('reset success'); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | }); | ||
| 53 | ``` | ||
| 54 | |||
| 55 | ### get the user id bound to the device | ||
| 56 | |||
| 57 | ```js | ||
| 58 | AM4Module.getUserId(mac); | ||
| 59 | |||
| 60 | // response | ||
| 61 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 62 | if (event.action === AMProfileModule.ACTION_USERID_AM) { | ||
| 63 | console.log(event[AMProfileModule.USERID_AM]); | ||
| 64 | } | ||
| 65 | }); | ||
| 66 | ``` | ||
| 67 | |||
| 68 | ### set the user id to the device | ||
| 69 | |||
| 70 | ```js | ||
| 71 | // id: user id, the range is 0~0x7fffffff | ||
| 72 | AM4Module.setUserId(mac, id); | ||
| 73 | |||
| 74 | // response | ||
| 75 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 76 | if (event.action === AMProfileModule.ACTION_SET_USERID_SUCCESS_AM) { | ||
| 77 | console.log('set success'); | ||
| 78 | } | ||
| 79 | }); | ||
| 80 | ``` | ||
| 81 | |||
| 82 | ### setAlarmClock | ||
| 83 | |||
| 84 | ```js | ||
| 85 | |||
| 86 | /** | ||
| 87 | * id: alarm clock id, you can set up to 3 alarm clocks | ||
| 88 | * hour: clock hour | ||
| 89 | * min: clock minates | ||
| 90 | * isRepeat: one time or repeat | ||
| 91 | * weeks: available on the day of the week | ||
| 92 | * isOn: open or close | ||
| 93 | */ | ||
| 94 | |||
| 95 | AM4Module.setAlarmClock(mac, 1, 12, 0, true, [1, 1, 1, 1, 1, 0, 0], false); | ||
| 96 | |||
| 97 | // response | ||
| 98 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 99 | if (event.action === AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM) { | ||
| 100 | console.log('set success'); | ||
| 101 | } | ||
| 102 | }); | ||
| 103 | ``` | ||
| 104 | |||
| 105 | ### get alarm clock ids | ||
| 106 | |||
| 107 | ```js | ||
| 108 | AM4Module.getAlarmClockNum(mac); | ||
| 109 | |||
| 110 | // response | ||
| 111 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 112 | if (event.action === AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM) { | ||
| 113 | console.log(event[AMProfileModule.GET_ALARMNUM_AM]); // e.g. 3 | ||
| 114 | console.log(event[AMProfileModule.GET_ALARMNUM_ID_AM]); // e.g. [1, 2, 3] | ||
| 115 | } | ||
| 116 | }); | ||
| 117 | ``` | ||
| 118 | |||
| 119 | ### get alarm clock detail | ||
| 120 | |||
| 121 | ```js | ||
| 122 | AM4Module.getAlarmClockDetail(mac, [1, 3, 2]); | ||
| 123 | |||
| 124 | // response | ||
| 125 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 126 | if (event.action === AMProfileModule.ACTION_GET_ALARMINFO_AM) { | ||
| 127 | let dataArray = event[BPProfileModule.GET_ALARM_CLOCK_DETAIL]; | ||
| 128 | if (dataArray == undefined) { | ||
| 129 | result = "There is not offline data in device" | ||
| 130 | }else { | ||
| 131 | for (let i = 0; i < dataArray.length; i++) { | ||
| 132 | let offlineData = dataArray[i]; | ||
| 133 | console.log(offlineData[AMProfileModule.GET_ALARM_ID_AM]); | ||
| 134 | console.log(offlineData[AMProfileModule.GET_ALARM_TIME_AM]); | ||
| 135 | console.log(offlineData[AMProfileModule.GET_ALARM_ISREPEAT_AM]); | ||
| 136 | console.log(offlineData[AMProfileModule.GET_ALARM_WEEK_AM]); | ||
| 137 | console.log(offlineData[AMProfileModule.GET_ALARM_ISON_AM]); | ||
| 138 | } | ||
| 139 | } | ||
| 140 | } | ||
| 141 | }); | ||
| 142 | ``` | ||
| 143 | |||
| 144 | ### delete alarm clock by id | ||
| 145 | |||
| 146 | ```js | ||
| 147 | AM4Module.deleteAlarmClock(mac, 1); | ||
| 148 | |||
| 149 | // response | ||
| 150 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 151 | if (event.action === AMProfileModule.ACTION_DELETE_ALARM_SUCCESS_AM) { | ||
| 152 | console.log('delete success'); | ||
| 153 | } | ||
| 154 | }); | ||
| 155 | ``` | ||
| 156 | |||
| 157 | ### set activity reminder interval | ||
| 158 | |||
| 159 | ```js | ||
| 160 | /** | ||
| 161 | * hour | ||
| 162 | * min | ||
| 163 | * isOn: open or close | ||
| 164 | */ | ||
| 165 | AM4Module.setActivityRemind(mac, 0, 30, false); | ||
| 166 | |||
| 167 | // response | ||
| 168 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 169 | if (event.action === AMProfileModule.ACTION_SET_ACTIVITYREMIND_SUCCESS_AM) { | ||
| 170 | console.log('set success'); | ||
| 171 | } | ||
| 172 | }); | ||
| 173 | ``` | ||
| 174 | |||
| 175 | ### get activity reminder interval | ||
| 176 | |||
| 177 | ```js | ||
| 178 | AM4Module.getActivityRemind(mac); | ||
| 179 | |||
| 180 | // response | ||
| 181 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 182 | if (event.action === AMProfileModule.ACTION_GET_ACTIVITY_REMIND_AM) { | ||
| 183 | console.log('get success'); | ||
| 184 | } | ||
| 185 | }); | ||
| 186 | ``` | ||
| 187 | |||
| 188 | ### get am4 information | ||
| 189 | |||
| 190 | ```js | ||
| 191 | AM4Module.queryAMState(mac); | ||
| 192 | |||
| 193 | // response | ||
| 194 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 195 | if (event.action === AMProfileModule.ACTION_QUERY_STATE_AM) { | ||
| 196 | // 0 indicates waist | ||
| 197 | // 1 indicates wrist | ||
| 198 | // 2 indicates sleep | ||
| 199 | console.log(event[AMProfileModule.QUERY_STATE_AM]); | ||
| 200 | // battery level 0~10 | ||
| 201 | console.log(event[AMProfileModule.QUERY_BATTERY_AM]); | ||
| 202 | } | ||
| 203 | }); | ||
| 204 | ``` | ||
| 205 | |||
| 206 | ### set user id to the am4 device | ||
| 207 | |||
| 208 | ```js | ||
| 209 | // The user id range is from 0 to 0x7fffffff | ||
| 210 | AM4Module.setUserId(mac, 8); | ||
| 211 | |||
| 212 | // response | ||
| 213 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 214 | if (event.action === AMProfileModule.ACTION_SET_USERID_SUCCESS_AM) { | ||
| 215 | console.log('set success'); | ||
| 216 | } | ||
| 217 | }); | ||
| 218 | ``` | ||
| 219 | |||
| 220 | ### set user information to the am4 device | ||
| 221 | |||
| 222 | ```js | ||
| 223 | /** | ||
| 224 | * age | ||
| 225 | * height(cm) | ||
| 226 | * weight(lbs) | ||
| 227 | * gender 0: female, 1: male | ||
| 228 | * unit 0: miles, 1: kilometre | ||
| 229 | * target the goal of steps, the range is from 4 ~ 65535 | ||
| 230 | * activityLevel 1: sedentary, 2: active, 3: very active | ||
| 231 | */ | ||
| 232 | AM4Module.setUserInfo(mac, 25, 183, 80, AMProfileModule.AM_SET_MALE, AMProfileModule.AM_SET_UNIT_METRIC, 10000, 1, 30); | ||
| 233 | |||
| 234 | // response | ||
| 235 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 236 | if (event.action === AMProfileModule.ACTION_SET_USERINFO_SUCCESS_AM) { | ||
| 237 | console.log('set success'); | ||
| 238 | } | ||
| 239 | }); | ||
| 240 | ``` | ||
| 241 | |||
| 242 | ### get user information stored in the am4 device | ||
| 243 | |||
| 244 | ```js | ||
| 245 | AM4Module.getUserInfo(mac); | ||
| 246 | |||
| 247 | // response | ||
| 248 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 249 | if (event.action === AMProfileModule.ACTION_GET_USERINFO_AM) { | ||
| 250 | console.log(event[AMProfileModule.GET_USER_AGE_AM]); | ||
| 251 | console.log(event[AMProfileModule.GET_USER_STEP_AM]); | ||
| 252 | console.log(event[AMProfileModule.GET_USER_HEIGHT_AM]); | ||
| 253 | console.log(event[AMProfileModule.GET_USER_SEX_AM]); | ||
| 254 | console.log(event[AMProfileModule.GET_USER_WEIGHT_AM]); | ||
| 255 | console.log(event[AMProfileModule.GET_USER_UNIT_AM]); | ||
| 256 | console.log(event[AMProfileModule.GET_USER_AGE_AM]); | ||
| 257 | console.log(event[AMProfileModule.GET_USER_TARGET1_AM]); | ||
| 258 | console.log(event[AMProfileModule.GET_USER_TARGET2_AM]); | ||
| 259 | console.log(event[AMProfileModule.GET_USER_TARGET3_AM]); | ||
| 260 | } | ||
| 261 | }); | ||
| 262 | ``` | ||
| 263 | |||
| 264 | ### set bmr to the am4 device | ||
| 265 | |||
| 266 | ```js | ||
| 267 | // bmr Basal Metabolic Rate | ||
| 268 | AM4Module.setUserBmr(mac, 2000); | ||
| 269 | |||
| 270 | // response | ||
| 271 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 272 | if (event.action === AMProfileModule.ACTION_SET_BMR_SUCCESS_AM) { | ||
| 273 | console.log('set success'); | ||
| 274 | } | ||
| 275 | }); | ||
| 276 | ``` | ||
| 277 | |||
| 278 | ### get activity steps | ||
| 279 | |||
| 280 | ```js | ||
| 281 | AM4Module.syncActivityData(mac); | ||
| 282 | |||
| 283 | // response | ||
| 284 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 285 | if (event.action === AMProfileModule.ACTION_SYNC_ACTIVITY_DATA_AM) { | ||
| 286 | let dataArray = event[AMProfileModule.SYNC_ACTIVITY_EACH_DATA_AM]; | ||
| 287 | if (dataArray == undefined) { | ||
| 288 | result = "There is not offline data in device" | ||
| 289 | }else { | ||
| 290 | for (let i = 0; i < dataArray.length; i++) { | ||
| 291 | let offlineData = dataArray[i]; | ||
| 292 | console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_TIME_AM]); | ||
| 293 | console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_AM]); | ||
| 294 | console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_CALORIE_AM]); | ||
| 295 | console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_LENGTH_AM]); | ||
| 296 | console.log(offlineData[AMProfileModule.DATAID]); | ||
| 297 | } | ||
| 298 | } | ||
| 299 | } | ||
| 300 | }); | ||
| 301 | ``` | ||
| 302 | |||
| 303 | ### get current activity steps | ||
| 304 | |||
| 305 | ```js | ||
| 306 | AM4Module.syncRealData(mac); | ||
| 307 | |||
| 308 | // response | ||
| 309 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 310 | if (event.action === AMProfileModule.ACTION_SYNC_REAL_DATA_AM) { | ||
| 311 | console.log(offlineData[AMProfileModule.SYNC_REAL_STEP_AM]); | ||
| 312 | console.log(offlineData[AMProfileModule.SYNC_REAL_CALORIE_AM]); | ||
| 313 | console.log(offlineData[AMProfileModule.SYNC_REAL_TOTALCALORIE_AM]); | ||
| 314 | } | ||
| 315 | }); | ||
| 316 | ``` | ||
| 317 | |||
| 318 | ### set current time to am4 device | ||
| 319 | |||
| 320 | ```js | ||
| 321 | AM4Module.syncRealData(mac); | ||
| 322 | |||
| 323 | // response | ||
| 324 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 325 | if (event.action === AMProfileModule.ACTION_SYNC_TIME_SUCCESS_AM) { | ||
| 326 | console.log('set success'); | ||
| 327 | } | ||
| 328 | }); | ||
| 329 | ``` | ||
| 330 | |||
| 331 | ### set hour mode (12 or 24) to am4 device | ||
| 332 | |||
| 333 | ```js | ||
| 334 | /** | ||
| 335 | * AMProfileModule.AM_SET_12_HOUR_MODE(0) | ||
| 336 | * AMProfileModule.AM_SET_24_HOUR_MODE(1) | ||
| 337 | * AMProfileModule.AM_SET_EXCEPT_EUROPE_12_HOUR_MODE(2) | ||
| 338 | * AMProfileModule.AM_SET_EUROPE_12_HOUR_MODE(3) | ||
| 339 | * AMProfileModule.AM_SET_EXCEPT_EUROPE_24_HOUR_MODE(4) | ||
| 340 | * AMProfileModule.AM_SET_EUROPE_24_HOUR_MODE | ||
| 341 | **/ | ||
| 342 | AM4Module.setHourMode(mac, AMProfileModule.AM_SET_24_HOUR_MODE); | ||
| 343 | |||
| 344 | // response | ||
| 345 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 346 | if (event.action === AMProfileModule.ACTION_SET_HOUR_MODE_SUCCESS_AM) { | ||
| 347 | console.log('set success'); | ||
| 348 | } | ||
| 349 | }); | ||
| 350 | ``` | ||
| 351 | |||
| 352 | ### get hour mode (12 or 24) from am4 device | ||
| 353 | |||
| 354 | |||
| 355 | ```js | ||
| 356 | AM4Module.getHourMode(mac); | ||
| 357 | |||
| 358 | // response | ||
| 359 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 360 | if (event.action === AMProfileModule.ACTION_GET_HOUR_MODE_AM) { | ||
| 361 | console.log(event[AMProfileModule.GET_HOUR_MODE_AM]); | ||
| 362 | } | ||
| 363 | }); | ||
| 364 | ``` | ||
| 365 | |||
| 366 | ### get sleep data stored in the am4 | ||
| 367 | |||
| 368 | ```js | ||
| 369 | AM4Module.syncSleepData(mac); | ||
| 370 | |||
| 371 | // response | ||
| 372 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 373 | if (event.action === AMProfileModule.ACTION_SYNC_SLEEP_DATA_AM) { | ||
| 374 | let dataArray = event[AMProfileModule.SYNC_SLEEP_DATA_AM]; | ||
| 375 | if (dataArray == undefined) { | ||
| 376 | result = "There is not offline data in device" | ||
| 377 | }else { | ||
| 378 | for (let i = 0; i < dataArray.length; i++) { | ||
| 379 | let offlineData = dataArray[i]; | ||
| 380 | console.log(offlineData[AMProfileModule.SYNC_SLEEP_EACH_DATA_AM]); | ||
| 381 | console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_TIME_AM]); | ||
| 382 | console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_LEVEL_AM]); | ||
| 383 | console.log(offlineData[AMProfileModule.DATAID]); | ||
| 384 | } | ||
| 385 | } | ||
| 386 | } | ||
| 387 | }); | ||
| 388 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/am5.md b/libs/ihealth-sdk/doc/am5.md new file mode 100644 index 0000000..4465b35 --- /dev/null +++ b/libs/ihealth-sdk/doc/am5.md | |||
| @@ -0,0 +1,215 @@ | |||
| 1 | # AM4 Workflow | ||
| 2 | |||
| 3 | ## Import AM5 Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | AM5Module, | ||
| 8 | AM5ProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get all connected am5 devices | ||
| 27 | |||
| 28 | ```js | ||
| 29 | AM5Module.getAllConnectedDevices(); | ||
| 30 | |||
| 31 | // {"action": "action_get_all_connected_devices", "devices": ["DD4173E7F41E"]} | ||
| 32 | ``` | ||
| 33 | |||
| 34 | ### disconnect a am5 devices | ||
| 35 | |||
| 36 | ```js | ||
| 37 | AM5Module.disconnect(mac); | ||
| 38 | ``` | ||
| 39 | |||
| 40 | ### Binding apps and devices | ||
| 41 | |||
| 42 | ```js | ||
| 43 | AM5Module.bindDevice(mac); | ||
| 44 | |||
| 45 | // response | ||
| 46 | // {"action": "action_user_bind", "description": "no error", "mac": "DD4173E7F41E", "status": 3, "type": "AM5"} | ||
| 47 | notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { | ||
| 48 | if (event.action === AM5ProfileModule.ACTION_USER_BIND) { | ||
| 49 | if (3 === event[AM5ProfileModule.OPERATION_STATUS]) { | ||
| 50 | console.log('bind success'); | ||
| 51 | } else if (4 === event[AM5ProfileModule.OPERATION_STATUS]) { | ||
| 52 | console.log('bind fail'); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | }); | ||
| 56 | ``` | ||
| 57 | |||
| 58 | ### UnBind apps and devices | ||
| 59 | |||
| 60 | ```js | ||
| 61 | AM5Module.unBindDevice(mac); | ||
| 62 | |||
| 63 | // response | ||
| 64 | // {"action": "action_user_unbind", "description": "no error", "mac": "DD4173E7F41E", "status": 3, "type": "AM5"} | ||
| 65 | notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { | ||
| 66 | if (event.action === AM5ProfileModule.ACTION_USER_UNBIND) { | ||
| 67 | if (3 === event[AM5ProfileModule.OPERATION_STATUS]) { | ||
| 68 | console.log('unbind success'); | ||
| 69 | } else if (4 === event[AM5ProfileModule.OPERATION_STATUS]) { | ||
| 70 | console.log('unbind fail'); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | }); | ||
| 74 | ``` | ||
| 75 | |||
| 76 | ### Get information of the device | ||
| 77 | |||
| 78 | ```js | ||
| 79 | AM5Module.getBasicInfo(mac); | ||
| 80 | |||
| 81 | // response | ||
| 82 | // {"action": "action_basic_info", "battStatus": 0, "bind_confirm_method": 0, "bind_confirm_timeout": 0, "deivceId": 7041, "energe": 63, "firmwareVersion": 40, "mac": "DD4173E7F41E", "mode": 1, "pairFlag": 0, "reboot": 0, "type": "AM5"} | ||
| 83 | notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { | ||
| 84 | if (event.action === AM5ProfileModule.ACTION_BASIC_INFO) { | ||
| 85 | console.log(AM5ProfileModule.BASIC_ENERGE); | ||
| 86 | } | ||
| 87 | }); | ||
| 88 | ``` | ||
| 89 | |||
| 90 | ### Set current time of the device | ||
| 91 | |||
| 92 | ```js | ||
| 93 | AM5Module.setTime(mac); | ||
| 94 | |||
| 95 | // response | ||
| 96 | // {"action": "TIME", "mac": "DD4173E7F41E", "result": true, "type": "AM5"} | ||
| 97 | notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { | ||
| 98 | if (event.action === "TIME") { | ||
| 99 | console.log('set success'); | ||
| 100 | } | ||
| 101 | }); | ||
| 102 | ``` | ||
| 103 | |||
| 104 | ### Set user info | ||
| 105 | |||
| 106 | ```js | ||
| 107 | /** | ||
| 108 | * @param year Year of birth | ||
| 109 | * @param month Month of birth | ||
| 110 | * @param day Day of birth | ||
| 111 | * @param weight weight | ||
| 112 | * @param height height | ||
| 113 | * @param gender gender male: 1, female: 2 | ||
| 114 | */ | ||
| 115 | AM5Module.setUserInfo(mac, 1990, 1, 1, 75, 176, 1); | ||
| 116 | |||
| 117 | // response | ||
| 118 | // {"action": "USER_INFO", "mac": "DD4173E7F41E", "result": true, "type": "AM5"} | ||
| 119 | notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { | ||
| 120 | if (event.action === "USER_INFO") { | ||
| 121 | console.log('set success'); | ||
| 122 | } | ||
| 123 | }); | ||
| 124 | ``` | ||
| 125 | |||
| 126 | ### Set unit | ||
| 127 | |||
| 128 | ```js | ||
| 129 | /** | ||
| 130 | * When you never set them, treat them as defaults | ||
| 131 | * @param {string} mac Device's mac address | ||
| 132 | * @param type 0: Distance unit unit: 0 default ; 1 KM ; 2 MI | ||
| 133 | * @param type 1: Wight unit unit: 0 default ; 1 KG ; 2 LB ; 3 ST | ||
| 134 | * @param type 2: Temperature unit unit: 0 default ; 1 °C ; 2 °F | ||
| 135 | * @param type 3: Distance at each step unit: distance (cm) (default 0cm) | ||
| 136 | * @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 | ||
| 137 | * @param type 5: Time Mode unit: 0 default ; 1 24 hour system ; 2 12 hour system | ||
| 138 | * @param type 6: Distance at each step of run unit: distance (cm) (default 0cm) | ||
| 139 | * @param type 7: GPS calibration switch unit: 0 default ; 1 open ; 2 close | ||
| 140 | */ | ||
| 141 | AM5Module.setUnit(mac, [1, 3, 2]); | ||
| 142 | |||
| 143 | // response | ||
| 144 | // {"action": "UNIT", "mac": "DD4173E7F41E", "result": true, "type": "AM5"} | ||
| 145 | notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { | ||
| 146 | if (event.action === "UNIT") { | ||
| 147 | console.log('set success'); | ||
| 148 | } | ||
| 149 | }); | ||
| 150 | ``` | ||
| 151 | |||
| 152 | ### Set Hand Wear Mode | ||
| 153 | |||
| 154 | ```js | ||
| 155 | /** | ||
| 156 | * @param {string} mac Device's mac address | ||
| 157 | * @param mode 0 left-hand 1 right-hand | ||
| 158 | */ | ||
| 159 | AM5Module.setHandWearMode(mac, 1); | ||
| 160 | |||
| 161 | // response | ||
| 162 | // {"action": "HAND_MODE", "mac": "DD4173E7F41E", "result": true, "type": "AM5"} | ||
| 163 | notifyListener = DeviceEventEmitter.addListener(AM4Module.Event_Notify, (event) => { | ||
| 164 | if (event.action === "HAND_MODE") { | ||
| 165 | console.log('set success'); | ||
| 166 | } | ||
| 167 | }); | ||
| 168 | ``` | ||
| 169 | |||
| 170 | ### Get the live data of the device | ||
| 171 | |||
| 172 | ```js | ||
| 173 | /** | ||
| 174 | * @param {string} mac Device's mac address | ||
| 175 | */ | ||
| 176 | AM5Module.getLiveData(mac); | ||
| 177 | |||
| 178 | // response | ||
| 179 | // {"action": "action_live_data", "dbp": 0, "heartRate": 0, "mac": "DD4173E7F41E", "sbp": 0, "totalActiveTime": 0, "totalCalories": 0, "totalDistances": 0, "totalStep": 0, "type": "AM5"} | ||
| 180 | notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { | ||
| 181 | if (event.action === AM5ProfileModule.ACTION_LIVE_DATA) { | ||
| 182 | console.log('set success'); | ||
| 183 | } | ||
| 184 | }); | ||
| 185 | ``` | ||
| 186 | |||
| 187 | ### Sync health data from device | ||
| 188 | |||
| 189 | ```js | ||
| 190 | /** | ||
| 191 | * @param {string} mac Device's mac address | ||
| 192 | */ | ||
| 193 | AM5Module.syncHealthData(mac); | ||
| 194 | |||
| 195 | // response | ||
| 196 | |||
| 197 | // 1. {"action": "action_sync_health_data", "mac": "DD4173E7F41E", "status": 0, "type": "AM5"} | ||
| 198 | // 2. {"action": "action_sync_health_data", "mac": "DD4173E7F41E", "progress": 2, "status": 2, "type": "AM5"} | ||
| 199 | |||
| 200 | // 3. {"action": "action_sync_health_data_sport", "dId": 7041, "date": "Aug 16, 2021 12:00:00 AM", "day": 16, "items": [ {"activeTime": 0, "calory": 0, "dId": 7041, "date": "Aug 16, 2021 12:00:00 AM", "day": 16, "distance": 0, "month": 8, "sportDataId": 1, "stepCount": 0, "year": 2021}], "mac": "DD4173E7F41E", "month": 8, "sportDataId": 3, "startTime": 0, "timeSpace": 15, "totalActiveTime": 473, "totalCalory": 40, "totalDistance": 718, "totalStepCount": 998, "type": "AM5", "year": 2021} | ||
| 201 | |||
| 202 | // 4. {"action": "action_sync_health_data_sleep", "awakeCount": 2, "dId": 7041, "date": "Aug 27, 2021 12:00:00 AM", "day": 27,"deepSleepCount": 7, "deepSleepMinutes": 157, "items": | ||
| 203 | // [{"dId": 7041, "date": "Aug 27, 2021 12:00:00 AM", "day": 27, "month": 8, "offsetMinute": 19, "sleepDataId": 2, "sleepStatus": 2, "year": 2021}, | ||
| 204 | // {"dId": 7041, "date": "Aug 27, 2021 12:00:00 AM", "day": 27, "month": 8, "offsetMinute": 28, "sleepDataId": 3, "sleepStatus": 3, "year": 2021}, {"dId": 7041, "date": "Aug 27, 2021 12:00:00 AM", "day": 27, "month": 8, "offsetMinute": 56, "sleepDataId": 4, "sleepStatus": 2, "year": 2021}], "lightSleepCount": 9, "lightSleepMinutes": 327, "mac": "DD4173E7F41E", "month": 8, "sleepDataId": 1, "sleepEndedTimeH": 9, "sleepEndedTimeM": 10, "totalSleepMinutes": 533, "type": "AM5", "year": 2021} | ||
| 205 | |||
| 206 | // 5. {"action": "action_sync_health_data_heart_rate", "dId": 7041, "date": "Aug 16, 2021 12:00:00 AM", "day": 16, "items": [ {"activeTime": 0, "calory": 0, "dId": 7041, "date": "Aug 16, 2021 12:00:00 AM", "day": 16, "distance": 0, "month": 8, "sportDataId": 1, "stepCount": 0, "year": 2021}]} | ||
| 207 | |||
| 208 | // 6. {"action": "action_sync_health_data", "mac": "DD4173E7F41E", "progress": 100, "status": 3, "type": "AM5"} | ||
| 209 | |||
| 210 | notifyListener = DeviceEventEmitter.addListener(AM5Module.Event_Notify, (event) => { | ||
| 211 | if (event.action === AM5ProfileModule.ACTION_SYNC_HEALTH_DATA) { | ||
| 212 | console.log('get success'); | ||
| 213 | } | ||
| 214 | }); | ||
| 215 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/bg1.md b/libs/ihealth-sdk/doc/bg1.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libs/ihealth-sdk/doc/bg1.md | |||
diff --git a/libs/ihealth-sdk/doc/bg1s.md b/libs/ihealth-sdk/doc/bg1s.md new file mode 100644 index 0000000..9622f29 --- /dev/null +++ b/libs/ihealth-sdk/doc/bg1s.md | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | # BG1S Workflow | ||
| 2 | |||
| 3 | ## Import BG1S Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BG1SModule, | ||
| 8 | BG1SProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get function | ||
| 27 | |||
| 28 | Set current time to BG1S and return battery level, bg1s code version. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | BG1SModule.getFunction(mac); | ||
| 32 | |||
| 33 | // response | ||
| 34 | // {"action": "action_get_device_info", "battery": 100, "info_version_code_blood_bg1s": 1, "info_version_code_ctl_bg1s": 2, "mac": "F65FF0CBA330", "type": "BG1S"} | ||
| 35 | notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => { | ||
| 36 | if (event.action === BG1SProfileModule.ACTION_CODE_ANALYSIS) { | ||
| 37 | console.log(event[BG1SProfileModule.INFO_BATTERY_BG1S]); | ||
| 38 | console.log(event[BG1SProfileModule.INFO_VERSION_CODE_BLOOD_BG1S]); | ||
| 39 | console.log(event[BG1SProfileModule.INFO_VERSION_CODE_CTL_BG1S]); | ||
| 40 | } | ||
| 41 | }); | ||
| 42 | ``` | ||
| 43 | |||
| 44 | ### start a measurement | ||
| 45 | |||
| 46 | ```js | ||
| 47 | // measureMode 0: measure with real blood, 1: measure with control solution | ||
| 48 | BG1SModule.measure(mac, 1); | ||
| 49 | |||
| 50 | // response | ||
| 51 | notifyListener = DeviceEventEmitter.addListener(BG1SModule.Event_Notify, (event) => { | ||
| 52 | if (event.action === BG1SProfileModule.ACTION_STRIP_INSERTION_STATUS) { | ||
| 53 | // {"action": "action_strip_insertion_status", "describe": "strip in", "insertion_status": 1, "mac": "F65FF0CBA330", "type": "BG1S"} | ||
| 54 | console.log("strip in"); | ||
| 55 | |||
| 56 | } else if (event.action === BG1SProfileModule.ACTION_GET_BLOOD) { | ||
| 57 | // {"action": "action_get_blood", "describe": "get blood", "mac": "F65FF0CBA330", "type": "BG1S"} | ||
| 58 | console.log("blood"); | ||
| 59 | |||
| 60 | } else if (event.action === BG1SProfileModule.ACTION_MEASURE_RESULT) { | ||
| 61 | // {"action": "action_measure_result", "mac": "F65FF0CBA330", "measure_mode": 0, "measure_result": 0, "type": "BG1S"} | ||
| 62 | console.log(event[BG1SProfileModule.MEASURE_MODE]); | ||
| 63 | console.log(event[BG1SProfileModule.MEASURE_RESULT]); | ||
| 64 | } | ||
| 65 | }); | ||
| 66 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/bg5.md b/libs/ihealth-sdk/doc/bg5.md new file mode 100644 index 0000000..38493ad --- /dev/null +++ b/libs/ihealth-sdk/doc/bg5.md | |||
| @@ -0,0 +1,195 @@ | |||
| 1 | # BG5 Workflow | ||
| 2 | |||
| 3 | ## Import BG5 Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BG5Module, | ||
| 8 | BGProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### set time | ||
| 27 | |||
| 28 | If you use new bg5 or it has not been used for a long time. You should sync current time with bg5. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | BG5Module.setTime(mac); | ||
| 32 | |||
| 33 | // response | ||
| 34 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 35 | if (event.action === BGProfileModule.ACTION_SET_TIME) { | ||
| 36 | console.log("set time"); | ||
| 37 | } | ||
| 38 | }); | ||
| 39 | ``` | ||
| 40 | |||
| 41 | ### set unit | ||
| 42 | |||
| 43 | The API can change the unit of the bg5 display. | ||
| 44 | |||
| 45 | ```js | ||
| 46 | // 1: mmol/L 2: mg/dL | ||
| 47 | BG5Module.setUnit(mac, 1); | ||
| 48 | |||
| 49 | // response | ||
| 50 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 51 | if (event.action === BGProfileModule.ACTION_SET_UNIT) { | ||
| 52 | console.log("set unit"); | ||
| 53 | } | ||
| 54 | }); | ||
| 55 | ``` | ||
| 56 | |||
| 57 | ### get bottle information from barcode | ||
| 58 | |||
| 59 | When you scan the barcode at the top of bottle, you can get a string. Pass the string to this API, you can get bottle id, Number of the strips and expire day. | ||
| 60 | |||
| 61 | ```js | ||
| 62 | BG5Module.getBottleInfoFromQR(QRCode); | ||
| 63 | |||
| 64 | // response | ||
| 65 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 66 | if (event.action === BGProfileModule.ACTION_CODE_ANALYSIS) { | ||
| 67 | console.log(event[BGProfileModule.STRIP_NUM_BG]); | ||
| 68 | console.log(event[BGProfileModule.STRIP_EXPIRETIME_BG]); | ||
| 69 | console.log(event[BGProfileModule.BOTTLEID_BG]); | ||
| 70 | } | ||
| 71 | }); | ||
| 72 | ``` | ||
| 73 | |||
| 74 | ### set bottle id | ||
| 75 | |||
| 76 | ```js | ||
| 77 | BG5Module.getBottleInfoFromQR(QRCode); | ||
| 78 | |||
| 79 | // response | ||
| 80 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 81 | if (event.action === BGProfileModule.ACTION_SET_BOTTLEID) { | ||
| 82 | console.log("Set bottleID"); | ||
| 83 | } | ||
| 84 | }); | ||
| 85 | ``` | ||
| 86 | |||
| 87 | ### get bottle id | ||
| 88 | |||
| 89 | ```js | ||
| 90 | BG5Module.getBottleInfoFromQR(QRCode); | ||
| 91 | |||
| 92 | // response | ||
| 93 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 94 | if (event.action === BGProfileModule.ACTION_GET_BOTTLEID) { | ||
| 95 | console.log(event[BGProfileModule.GET_BOTTLEID]); | ||
| 96 | } | ||
| 97 | }); | ||
| 98 | ``` | ||
| 99 | |||
| 100 | ### Set bottle message | ||
| 101 | |||
| 102 | When you use a new bg5 device or you open a new strip bottle, must set bottle message to bg5 device. | ||
| 103 | |||
| 104 | ```js | ||
| 105 | /** | ||
| 106 | * mac device mac address | ||
| 107 | * stripType 1: GOD, 2: GDH | ||
| 108 | * measureType 1: measure with real blood, 2: measure with control solution | ||
| 109 | * barcode for GOD strip, you can scan barcode at top of the bottle. for GDH strip, set null. | ||
| 110 | * unusedStrip unused strip. | ||
| 111 | * expireDay check the expire day on the bottle, and stirp is expired after opening for 90 days. | ||
| 112 | */ | ||
| 113 | BG5Module.setBottleMessage(mac, 1, 1, QRCode, 25, "2027-07-15"); | ||
| 114 | |||
| 115 | // response | ||
| 116 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 117 | if (event.action === BGProfileModule.ACTION_SET_BOTTLEMESSAGE) { | ||
| 118 | console.log("set bottle message success"); | ||
| 119 | } | ||
| 120 | }); | ||
| 121 | ``` | ||
| 122 | |||
| 123 | ### get bottle message | ||
| 124 | |||
| 125 | ```js | ||
| 126 | BG5Module.getBottleMessage(mac); | ||
| 127 | |||
| 128 | // response | ||
| 129 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 130 | if (event.action === BGProfileModule.ACTION_GET_BOTTLEMESSAGE) { | ||
| 131 | console.log(event[BGProfileModule.GET_EXPIRECTIME]); | ||
| 132 | console.log(event[BGProfileModule.GET_USENUM]); | ||
| 133 | } | ||
| 134 | }); | ||
| 135 | ``` | ||
| 136 | |||
| 137 | ### start a measurement | ||
| 138 | |||
| 139 | ```js | ||
| 140 | // * measureType 1: measure with real blood, 2: measure with control solution | ||
| 141 | BG5Module.startMeasure(mac, 1); | ||
| 142 | |||
| 143 | // response | ||
| 144 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 145 | if (event.action === BGProfileModule.ACTION_STRIP_IN) { | ||
| 146 | console.log("strip in"); | ||
| 147 | |||
| 148 | } else if (event.action === BGProfileModule.ACTION_STRIP_OUT) { | ||
| 149 | console.log("strip out"); | ||
| 150 | |||
| 151 | } else if (event.action === BGProfileModule.ACTION_GET_BLOOD) { | ||
| 152 | console.log("analysis blood"); | ||
| 153 | |||
| 154 | } else if (event.action === BGProfileModule.ACTION_ONLINE_RESULT_BG) { | ||
| 155 | console.log(event[BGProfileModule.ONLINE_RESULT_BG]); | ||
| 156 | console.log(event[BGProfileModule.DATA_ID]); | ||
| 157 | } | ||
| 158 | }); | ||
| 159 | ``` | ||
| 160 | |||
| 161 | ### get data stored in the bg5 device | ||
| 162 | |||
| 163 | ```js | ||
| 164 | BG5Module.getOfflineData(mac); | ||
| 165 | |||
| 166 | // response | ||
| 167 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 168 | if (event.action === BGProfileModule.ACTION_GET_OFFLINEDATA_COUNT) { | ||
| 169 | console.log(event[BGProfileModule.GET_OFFLINEDATA_COUNT]); | ||
| 170 | console.log(event[BGProfileModule.GET_OFFLINEDATA]); | ||
| 171 | } | ||
| 172 | }); | ||
| 173 | ``` | ||
| 174 | |||
| 175 | ### delete the data stored in the bg5 device | ||
| 176 | |||
| 177 | ```js | ||
| 178 | BG5Module.deleteOfflineData(mac); | ||
| 179 | |||
| 180 | // response | ||
| 181 | notifyListener = DeviceEventEmitter.addListener(BG5Module.Event_Notify, (event) => { | ||
| 182 | if (event.action === BGProfileModule.ACTION_DELETE_OFFLINEDATA) { | ||
| 183 | console.log("delete data"); | ||
| 184 | } | ||
| 185 | }); | ||
| 186 | ``` | ||
| 187 | |||
| 188 | ### keep link with phone | ||
| 189 | |||
| 190 | The BG5 use regular bluetooth communicate with phone. For save the power, if there is no communication, bg5 will turn off. | ||
| 191 | The api is used to keep link with phone. | ||
| 192 | |||
| 193 | ```js | ||
| 194 | BG5Module.holdLink(mac); | ||
| 195 | ``` \ No newline at end of file | ||
diff --git a/libs/ihealth-sdk/doc/bg5s.md b/libs/ihealth-sdk/doc/bg5s.md new file mode 100644 index 0000000..06bc6d4 --- /dev/null +++ b/libs/ihealth-sdk/doc/bg5s.md | |||
| @@ -0,0 +1,176 @@ | |||
| 1 | # BG5S Workflow | ||
| 2 | |||
| 3 | ## Import BG5S Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BG5SModule, | ||
| 8 | BG5SProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### Set time | ||
| 27 | |||
| 28 | If you use new bg5 or it has not been used for a long time. You should sync current time with bg5. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | BG5SModule.setTime(mac); | ||
| 32 | |||
| 33 | // response | ||
| 34 | // {"type":"BG5S","mac":"5C0272267365","action":"action_set_time"} | ||
| 35 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 36 | if (event.action === BG5SProfileModule.ACTION_SET_TIME) { | ||
| 37 | console.log("set time"); | ||
| 38 | } | ||
| 39 | }); | ||
| 40 | ``` | ||
| 41 | |||
| 42 | ### Set Unit | ||
| 43 | |||
| 44 | The API can change the unit of the bg5 display. | ||
| 45 | |||
| 46 | ```js | ||
| 47 | // 1: mmol/L 2: mg/dL | ||
| 48 | BG5SModule.setUnit(mac, 1); | ||
| 49 | |||
| 50 | // response | ||
| 51 | // {"type":"BG5S","mac":"5C0272267365","action":"action_set_unit"} | ||
| 52 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 53 | if (event.action === BG5SProfileModule.ACTION_SET_UNIT) { | ||
| 54 | console.log("set Unit"); | ||
| 55 | } | ||
| 56 | }); | ||
| 57 | ``` | ||
| 58 | |||
| 59 | ### get bg5s status information | ||
| 60 | |||
| 61 | ```js | ||
| 62 | BG5SModule.getStatusInfo(mac); | ||
| 63 | |||
| 64 | // response | ||
| 65 | // {"info_unit":2,"info_code_version_ctl":3,"info_code_version_blood":3,"info_offline_data_num":0,"info_used_strip":0,////"info_timezone":8,"info_time":"2017-01-01 00:40:37","info_battery_level":71,"type":"BG5S","mac":"5C0272267365","action":"action_get_status_info"} | ||
| 66 | |||
| 67 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 68 | if (event.action === BG5SProfileModule.ACTION_GET_STATUS_INFO) { | ||
| 69 | console.log(event[BG5SProfileModule.INFO_BATTERY_LEVEL]); | ||
| 70 | console.log(event[BG5SProfileModule.INFO_TIME]); | ||
| 71 | console.log(event[BG5SProfileModule.INFO_TIMEZONE]); | ||
| 72 | console.log(event[BG5SProfileModule.INFO_USED_STRIP]); | ||
| 73 | console.log(event[BG5SProfileModule.INFO_OFFLINE_DATA_NUM]); | ||
| 74 | console.log(event[BG5SProfileModule.INFO_CODE_VERSION_BLOOD]); | ||
| 75 | console.log(event[BG5SProfileModule.INFO_CODE_VERSION_CTL]); | ||
| 76 | console.log(event[BG5SProfileModule.INFO_UNIT]); | ||
| 77 | } | ||
| 78 | }); | ||
| 79 | ``` | ||
| 80 | |||
| 81 | ### delete userd strip | ||
| 82 | |||
| 83 | ```js | ||
| 84 | BG5SModule.deleteUsedStrip(QRCode); | ||
| 85 | |||
| 86 | // response | ||
| 87 | // {"type":"BG5S","mac":"5C0272267365","action":"action_delete_used_strip"} | ||
| 88 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 89 | if (event.action === BG5SProfileModule.ACTION_DELETE_USED_STRIP) { | ||
| 90 | |||
| 91 | } | ||
| 92 | }); | ||
| 93 | ``` | ||
| 94 | |||
| 95 | ### delete offline data | ||
| 96 | |||
| 97 | ```js | ||
| 98 | BG5SModule.deleteOfflineData(QRCode); | ||
| 99 | |||
| 100 | // response | ||
| 101 | // {"type":"BG5S","mac":"5C0272267365","action":"action_delete_offline_data"} | ||
| 102 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 103 | if (event.action === BG5SProfileModule.ACTION_DELETE_OFFLINE_DATA) { | ||
| 104 | |||
| 105 | } | ||
| 106 | }); | ||
| 107 | ``` | ||
| 108 | |||
| 109 | ### get offline data | ||
| 110 | |||
| 111 | ```js | ||
| 112 | BG5SModule.getOfflineData(mac); | ||
| 113 | |||
| 114 | // response | ||
| 115 | // {"offline_data":[{"dataID":"D8615BFEB73C3928D83131894D68E87B","data_measure_timezone":8,"data_measure_time":"2019-04-22 01:31:47","data_value":1023,"data_time_proof":false}],"type":"BG5S","mac":"5C0272267365","action":"action_get_offline_data"} | ||
| 116 | |||
| 117 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 118 | if (event.action === BG5SProfileModule.ACTION_GET_OFFLINE_DATA) { | ||
| 119 | console.log(event[BG5SProfileModule.OFFLINE_DATA]); | ||
| 120 | } | ||
| 121 | }); | ||
| 122 | ``` | ||
| 123 | |||
| 124 | ### adjust offline data | ||
| 125 | |||
| 126 | ```js | ||
| 127 | BG5SModule.adjustOfflineData(mac); | ||
| 128 | |||
| 129 | // response | ||
| 130 | // {"offline_data":[{"dataID":"D8615BFEB73C3928D83131894D68E87B","data_measure_timezone":8,"data_measure_time":"2019-04-22 01:31:47","data_value":1023,"data_time_proof":false}],"type":"BG5S","mac":"5C0272267365","action":"action_get_offline_data"} | ||
| 131 | |||
| 132 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 133 | if (event.action === "action_adjust_offline_data") { | ||
| 134 | console.log(event[BG5SProfileModule.OFFLINE_DATA]); | ||
| 135 | } | ||
| 136 | }); | ||
| 137 | ``` | ||
| 138 | |||
| 139 | ### start a measurement | ||
| 140 | |||
| 141 | ```js | ||
| 142 | // * measureType 1: measure with real blood, 2: measure with control solution | ||
| 143 | BG5SModule.startMeasure(mac, 1); | ||
| 144 | |||
| 145 | // response | ||
| 146 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 147 | if (event.action === BG5SProfileModule.ACTION_STRIP_IN) { | ||
| 148 | console.log("strip in"); | ||
| 149 | |||
| 150 | } else if (event.action === BG5SProfileModule.ACTION_STRIP_OUT) { | ||
| 151 | console.log("strip out"); | ||
| 152 | |||
| 153 | } else if (event.action === BG5SProfileModule.ACTION_GET_BLOOD) { | ||
| 154 | console.log("analysis blood"); | ||
| 155 | |||
| 156 | } else if (event.action === BG5SProfileModule.ACTION_RESULT) { | ||
| 157 | // {"dataID":"FCB4230B3F081306DCC0404090861A36","result_value":84,"type":"BG5S","mac":"5C0272267365","action":"action_result"} | ||
| 158 | console.log(event[BG5SProfileModule.RESULT_VALUE]); | ||
| 159 | console.log(event[BG5SProfileModule.DATA_ID]); | ||
| 160 | } | ||
| 161 | }); | ||
| 162 | ``` | ||
| 163 | |||
| 164 | ### get data stored in the bg5 device | ||
| 165 | |||
| 166 | ```js | ||
| 167 | BG5SModule.setOfflineModel(mac, true); | ||
| 168 | |||
| 169 | // response | ||
| 170 | // // {"type":"BG5S","mac":"5C0272267365","action":"action_delete_offline_data"} | ||
| 171 | notifyListener = DeviceEventEmitter.addListener(BG5SModule.Event_Notify, (event) => { | ||
| 172 | if (event.action === BG5SProfileModule.ACTION_SET_OFFLINE_MEASUREMENT_MODE) { | ||
| 173 | |||
| 174 | } | ||
| 175 | }); | ||
| 176 | ``` \ No newline at end of file | ||
diff --git a/libs/ihealth-sdk/doc/bp3l.md b/libs/ihealth-sdk/doc/bp3l.md new file mode 100644 index 0000000..37e51ed --- /dev/null +++ b/libs/ihealth-sdk/doc/bp3l.md | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | # BP3L Workflow | ||
| 2 | |||
| 3 | ## import BP3L module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BP3LModule, | ||
| 8 | BPProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### start a measurement | ||
| 27 | |||
| 28 | The API is asyn function. It will return message until finish measurement. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | BP3LModule.startMeasure(mac); | ||
| 32 | |||
| 33 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 34 | if (event.action === BPProfileModule.ACTION_ZOREING_BP) { | ||
| 35 | console.log("zero adjustment"); | ||
| 36 | |||
| 37 | } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) { | ||
| 38 | console.log("zero adjustment is done"); | ||
| 39 | |||
| 40 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) { | ||
| 41 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 42 | |||
| 43 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) { | ||
| 44 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 45 | console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]); | ||
| 46 | console.log(event[BPProfileModule.PULSEWAVE_BP]); | ||
| 47 | |||
| 48 | } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) { | ||
| 49 | console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 50 | console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 51 | console.log(event[BPProfileModule.PULSE_BP]); | ||
| 52 | console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 53 | console.log(event[BPProfileModule.DATAID]); | ||
| 54 | |||
| 55 | } else if (event.action === BPProfileModule.ACTION_ERROR_BP) { | ||
| 56 | console.log(event[BPProfileModule.ERROR_NUM_BP]); | ||
| 57 | console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]); | ||
| 58 | } | ||
| 59 | }); | ||
| 60 | ``` | ||
| 61 | |||
| 62 | ### cancel current measurement | ||
| 63 | |||
| 64 | ```js | ||
| 65 | BP3LModule.stopMeasure(mac); | ||
| 66 | ``` | ||
| 67 | |||
| 68 | ### get battery | ||
| 69 | |||
| 70 | ```js | ||
| 71 | BP3LModule.getBattery(mac); | ||
| 72 | |||
| 73 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 74 | if (event.action === BPProfileModule.ACTION_BATTERY_BP) { | ||
| 75 | console.log(event[BPProfileModule.BATTERY_BP]); | ||
| 76 | } | ||
| 77 | }); | ||
| 78 | ``` | ||
| 79 | |||
| 80 | ### enable offline mode | ||
| 81 | |||
| 82 | ```js | ||
| 83 | BP3LModule.enbleOffline(mac); | ||
| 84 | ``` | ||
| 85 | |||
| 86 | ### disable offline mode | ||
| 87 | |||
| 88 | ```js | ||
| 89 | BP3LModule.disableOffline(mac); | ||
| 90 | ``` | ||
| 91 | |||
| 92 | ### is enable offline mode | ||
| 93 | |||
| 94 | ```js | ||
| 95 | BP3LModule.isEnableOffline(mac); | ||
| 96 | |||
| 97 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 98 | if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) { | ||
| 99 | console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]); | ||
| 100 | } | ||
| 101 | }); | ||
| 102 | ``` | ||
| 103 | |||
| 104 | ### get quantity of data stored in the bp5 device | ||
| 105 | |||
| 106 | ```js | ||
| 107 | BP3LModule.getOfflineNum(mac); | ||
| 108 | |||
| 109 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 110 | if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { | ||
| 111 | console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); | ||
| 112 | } | ||
| 113 | }); | ||
| 114 | ``` | ||
| 115 | |||
| 116 | ### get data stored in the bp5 device | ||
| 117 | |||
| 118 | ```js | ||
| 119 | BP3LModule.getOfflineData(mac); | ||
| 120 | |||
| 121 | notifyListener = DeviceEventEmitter.addListener(BP3LModule.Event_Notify, (event) => { | ||
| 122 | if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { | ||
| 123 | let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; | ||
| 124 | if (dataArray == undefined) { | ||
| 125 | result = "There is not offline data in device" | ||
| 126 | }else { | ||
| 127 | for (let i = 0; i < dataArray.length; i++) { | ||
| 128 | let offlineData = dataArray[i]; | ||
| 129 | |||
| 130 | console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); | ||
| 131 | console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 132 | console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 133 | console.log(offlineData[BPProfileModule.PULSE_BP]); | ||
| 134 | console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 135 | console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); | ||
| 136 | console.log(offlineData[BPProfileModule.DATAID]); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | } | ||
| 140 | }); | ||
| 141 | ``` | ||
| 142 | |||
| 143 | ### disconnect device | ||
| 144 | |||
| 145 | ```js | ||
| 146 | BP3LModule.disConnect(mac); | ||
| 147 | ``` | ||
| 148 | |||
| 149 | ### get device information | ||
| 150 | |||
| 151 | ```js | ||
| 152 | iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => { | ||
| 153 | console.info(event); | ||
| 154 | }) | ||
| 155 | ``` | ||
| 156 | |||
| 157 | ### get all connected devices | ||
| 158 | |||
| 159 | ```js | ||
| 160 | BP3LModule.getAllConnectedDevices(); | ||
| 161 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/bp5.md b/libs/ihealth-sdk/doc/bp5.md new file mode 100644 index 0000000..9829b05 --- /dev/null +++ b/libs/ihealth-sdk/doc/bp5.md | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | # BP5 Workflow | ||
| 2 | |||
| 3 | ## import BP5 module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BP5Module, | ||
| 8 | BPProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### start a measurement | ||
| 27 | |||
| 28 | The API is asyn function. It will return message until finish measurement. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | BP5Module.startMeasure(mac); | ||
| 32 | |||
| 33 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 34 | if (event.action === BPProfileModule.ACTION_ZOREING_BP) { | ||
| 35 | console.log("zero adjustment"); | ||
| 36 | |||
| 37 | } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) { | ||
| 38 | console.log("zero adjustment is done"); | ||
| 39 | |||
| 40 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) { | ||
| 41 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 42 | |||
| 43 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) { | ||
| 44 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 45 | console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]); | ||
| 46 | console.log(event[BPProfileModule.PULSEWAVE_BP]); | ||
| 47 | |||
| 48 | } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) { | ||
| 49 | console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 50 | console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 51 | console.log(event[BPProfileModule.PULSE_BP]); | ||
| 52 | console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 53 | console.log(event[BPProfileModule.DATAID]); | ||
| 54 | |||
| 55 | } else if (event.action === BPProfileModule.ACTION_ERROR_BP) { | ||
| 56 | console.log(event[BPProfileModule.ERROR_NUM_BP]); | ||
| 57 | console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]); | ||
| 58 | } | ||
| 59 | }); | ||
| 60 | ``` | ||
| 61 | |||
| 62 | ### cancel current measurement | ||
| 63 | |||
| 64 | ```js | ||
| 65 | BP5Module.stopMeasure(mac); | ||
| 66 | ``` | ||
| 67 | |||
| 68 | ### get battery | ||
| 69 | |||
| 70 | ```js | ||
| 71 | BP5Module.getBattery(mac); | ||
| 72 | |||
| 73 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 74 | if (event.action === BPProfileModule.ACTION_BATTERY_BP) { | ||
| 75 | console.log(event[BPProfileModule.BATTERY_BP]); | ||
| 76 | } | ||
| 77 | }); | ||
| 78 | ``` | ||
| 79 | |||
| 80 | ### enable offline mode | ||
| 81 | |||
| 82 | ```js | ||
| 83 | BP5Module.enbleOffline(mac); | ||
| 84 | ``` | ||
| 85 | |||
| 86 | ### disable offline mode | ||
| 87 | |||
| 88 | ```js | ||
| 89 | BP5Module.disableOffline(mac); | ||
| 90 | ``` | ||
| 91 | |||
| 92 | ### is enable offline mode | ||
| 93 | |||
| 94 | ```js | ||
| 95 | BP5Module.isEnableOffline(mac); | ||
| 96 | |||
| 97 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 98 | if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) { | ||
| 99 | console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]); | ||
| 100 | } | ||
| 101 | }); | ||
| 102 | ``` | ||
| 103 | |||
| 104 | ### get quantity of data stored in the bp5 device | ||
| 105 | |||
| 106 | ```js | ||
| 107 | BP5Module.getOfflineNum(mac); | ||
| 108 | |||
| 109 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 110 | if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { | ||
| 111 | console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); | ||
| 112 | } | ||
| 113 | }); | ||
| 114 | ``` | ||
| 115 | |||
| 116 | ### get data stored in the bp5 device | ||
| 117 | |||
| 118 | ```js | ||
| 119 | BP5Module.getOfflineData(mac); | ||
| 120 | |||
| 121 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 122 | if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { | ||
| 123 | let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; | ||
| 124 | if (dataArray == undefined) { | ||
| 125 | result = "There is not offline data in device" | ||
| 126 | }else { | ||
| 127 | for (let i = 0; i < dataArray.length; i++) { | ||
| 128 | let offlineData = dataArray[i]; | ||
| 129 | |||
| 130 | console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); | ||
| 131 | console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 132 | console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 133 | console.log(offlineData[BPProfileModule.PULSE_BP]); | ||
| 134 | console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 135 | console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); | ||
| 136 | console.log(offlineData[BPProfileModule.DATAID]); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | } | ||
| 140 | }); | ||
| 141 | ``` | ||
| 142 | |||
| 143 | ### disconnect device | ||
| 144 | |||
| 145 | ```js | ||
| 146 | BP5Module.disConnect(mac); | ||
| 147 | ``` | ||
| 148 | |||
| 149 | ### get device information | ||
| 150 | |||
| 151 | ```js | ||
| 152 | iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => { | ||
| 153 | console.info(event); | ||
| 154 | }) | ||
| 155 | ``` | ||
| 156 | |||
| 157 | ### get all connected devices | ||
| 158 | |||
| 159 | ```js | ||
| 160 | BP5Module.getAllConnectedDevices(); | ||
| 161 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/bp5s.md b/libs/ihealth-sdk/doc/bp5s.md new file mode 100644 index 0000000..f6aa39d --- /dev/null +++ b/libs/ihealth-sdk/doc/bp5s.md | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | # BP5S Workflow | ||
| 2 | |||
| 3 | ## Import BP5S Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BP5SModule, | ||
| 8 | BPProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### start a measurement | ||
| 27 | |||
| 28 | The API is asyn function. It will return message until finish measurement. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | BP5SModule.startMeasure(mac); | ||
| 32 | |||
| 33 | notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { | ||
| 34 | if (event.action === BPProfileModule.ACTION_ZOREING_BP) { | ||
| 35 | console.log("zero adjustment"); | ||
| 36 | |||
| 37 | } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) { | ||
| 38 | console.log("zero adjustment is done"); | ||
| 39 | |||
| 40 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) { | ||
| 41 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 42 | |||
| 43 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) { | ||
| 44 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 45 | console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]); | ||
| 46 | console.log(event[BPProfileModule.PULSEWAVE_BP]); | ||
| 47 | |||
| 48 | } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) { | ||
| 49 | console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 50 | console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 51 | console.log(event[BPProfileModule.PULSE_BP]); | ||
| 52 | console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 53 | console.log(event[BPProfileModule.DATAID]); | ||
| 54 | |||
| 55 | } else if (event.action === BPProfileModule.ACTION_ERROR_BP) { | ||
| 56 | console.log(event[BPProfileModule.ERROR_NUM_BP]); | ||
| 57 | console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]); | ||
| 58 | } | ||
| 59 | }); | ||
| 60 | ``` | ||
| 61 | |||
| 62 | ### cancel current measurement | ||
| 63 | |||
| 64 | ```js | ||
| 65 | BP5SModule.stopMeasure(mac); | ||
| 66 | ``` | ||
| 67 | |||
| 68 | ### get battery | ||
| 69 | |||
| 70 | ```js | ||
| 71 | BP5SModule.getBattery(mac); | ||
| 72 | |||
| 73 | notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { | ||
| 74 | if (event.action === BPProfileModule.ACTION_BATTERY_BP) { | ||
| 75 | console.log(event[BPProfileModule.BATTERY_BP]); | ||
| 76 | } | ||
| 77 | }); | ||
| 78 | ``` | ||
| 79 | |||
| 80 | ### enable offline mode | ||
| 81 | |||
| 82 | ```js | ||
| 83 | BP5SModule.enbleOffline(mac); | ||
| 84 | ``` | ||
| 85 | |||
| 86 | ### disable offline mode | ||
| 87 | |||
| 88 | ```js | ||
| 89 | BP5SModule.disableOffline(mac); | ||
| 90 | ``` | ||
| 91 | |||
| 92 | ### is enable offline mode | ||
| 93 | |||
| 94 | ```js | ||
| 95 | BP5SModule.isEnableOffline(mac); | ||
| 96 | |||
| 97 | notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { | ||
| 98 | if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) { | ||
| 99 | console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]); | ||
| 100 | } | ||
| 101 | }); | ||
| 102 | ``` | ||
| 103 | |||
| 104 | ### get quantity of data stored in the bp5 device | ||
| 105 | |||
| 106 | ```js | ||
| 107 | BP5SModule.getOfflineNum(mac); | ||
| 108 | |||
| 109 | notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { | ||
| 110 | if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { | ||
| 111 | console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); | ||
| 112 | } | ||
| 113 | }); | ||
| 114 | ``` | ||
| 115 | |||
| 116 | ### get data stored in the bp5 device | ||
| 117 | |||
| 118 | ```js | ||
| 119 | BP5SModule.getOfflineData(mac); | ||
| 120 | |||
| 121 | notifyListener = DeviceEventEmitter.addListener(BP5SModule.Event_Notify, (event) => { | ||
| 122 | if (e.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { | ||
| 123 | let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; | ||
| 124 | if (dataArray == undefined) { | ||
| 125 | result = "There is not offline data in device" | ||
| 126 | }else { | ||
| 127 | for (let i = 0; i < dataArray.length; i++) { | ||
| 128 | let offlineData = dataArray[i]; | ||
| 129 | |||
| 130 | console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); | ||
| 131 | console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 132 | console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 133 | console.log(offlineData[BPProfileModule.PULSE_BP]); | ||
| 134 | console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 135 | console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); | ||
| 136 | console.log(offlineData[BPProfileModule.DATAID]); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | } | ||
| 140 | }); | ||
| 141 | ``` | ||
| 142 | |||
| 143 | ### disconnect device | ||
| 144 | |||
| 145 | ```js | ||
| 146 | BP5SModule.disConnect(mac); | ||
| 147 | ``` | ||
| 148 | |||
| 149 | ### get all connected devices | ||
| 150 | |||
| 151 | ```js | ||
| 152 | BP5SModule.getAllConnectedDevices(); | ||
| 153 | ``` \ No newline at end of file | ||
diff --git a/libs/ihealth-sdk/doc/bp7.md b/libs/ihealth-sdk/doc/bp7.md new file mode 100644 index 0000000..1e03e68 --- /dev/null +++ b/libs/ihealth-sdk/doc/bp7.md | |||
| @@ -0,0 +1,175 @@ | |||
| 1 | # BP7 Workflow | ||
| 2 | |||
| 3 | ## import BP7 module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BP7Module, | ||
| 8 | BPProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(BP7Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### start a measurement | ||
| 27 | |||
| 28 | The API is asyn function. It will return message until finish measurement. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | // When you start a measurement, need call startMeasure function firstly, you will get angle of BP7 | ||
| 32 | // make sure your angle is below the 30 degree, then call conformAngle function, the BP7 will start a measurement. | ||
| 33 | BP5Module.startMeasure(mac); | ||
| 34 | |||
| 35 | BP5Module.conformAngle(mac); | ||
| 36 | |||
| 37 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 38 | if (event.action === BPProfileModule.ACTION_ANGLE_BP) { | ||
| 39 | // {"which_arm":0,"value":22} | ||
| 40 | console.log(event[BPProfileModule.WHICH_ARM]); | ||
| 41 | console.log(event[BPProfileModule.ANGLE_BP]); | ||
| 42 | |||
| 43 | } else if (event.action === BPProfileModule.ACTION_ZOREING_BP) { | ||
| 44 | console.log("zero adjustment"); | ||
| 45 | |||
| 46 | } else if (event.action === BPProfileModule.ACTION_ZOREOVER_BP) { | ||
| 47 | console.log("zero adjustment is done"); | ||
| 48 | |||
| 49 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PRESSURE_BP) { | ||
| 50 | // {"pressure":3} | ||
| 51 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 52 | |||
| 53 | } else if (event.action === BPProfileModule.ACTION_ONLINE_PULSEWAVE_BP) { | ||
| 54 | // {"pressure":31,"heartbeat":false,"wave":"[15,15,15,15,15,15,15,15]"} | ||
| 55 | console.log(event[BPProfileModule.BLOOD_PRESSURE_BP]); | ||
| 56 | console.log(event[BPProfileModule.FLAG_HEARTBEAT_BP]); | ||
| 57 | console.log(event[BPProfileModule.PULSEWAVE_BP]); | ||
| 58 | |||
| 59 | } else if (event.action === BPProfileModule.ACTION_ONLINE_RESULT_BP) { | ||
| 60 | // {"sys":122,"dia":87,"heartRate":75,"arrhythmia":false,"hsd":false,"dataID":"E3FC99C20A7FA7F7B7F8FC4B9DD059DF"} | ||
| 61 | console.log(event[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 62 | console.log(event[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 63 | console.log(event[BPProfileModule.PULSE_BP]); | ||
| 64 | console.log(event[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 65 | console.log(event[BPProfileModule.DATAID]); | ||
| 66 | |||
| 67 | } else if (event.action === BPProfileModule.ACTION_ERROR_BP) { | ||
| 68 | console.log(event[BPProfileModule.ERROR_NUM_BP]); | ||
| 69 | console.log(event[BPProfileModule.ERROR_DESCRIPTION_BP]); | ||
| 70 | } | ||
| 71 | }); | ||
| 72 | ``` | ||
| 73 | |||
| 74 | ### cancel current measurement | ||
| 75 | |||
| 76 | ```js | ||
| 77 | BP5Module.stopMeasure(mac); | ||
| 78 | ``` | ||
| 79 | |||
| 80 | ### get battery | ||
| 81 | |||
| 82 | ```js | ||
| 83 | BP5Module.getBattery(mac); | ||
| 84 | |||
| 85 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 86 | if (event.action === BPProfileModule.ACTION_BATTERY_BP) { | ||
| 87 | console.log(event[BPProfileModule.BATTERY_BP]); | ||
| 88 | } | ||
| 89 | }); | ||
| 90 | ``` | ||
| 91 | |||
| 92 | ### enable offline mode | ||
| 93 | |||
| 94 | ```js | ||
| 95 | BP5Module.enbleOffline(mac); | ||
| 96 | ``` | ||
| 97 | |||
| 98 | ### disable offline mode | ||
| 99 | |||
| 100 | ```js | ||
| 101 | BP5Module.disableOffline(mac); | ||
| 102 | ``` | ||
| 103 | |||
| 104 | ### is enable offline mode | ||
| 105 | |||
| 106 | ```js | ||
| 107 | BP5Module.isEnableOffline(mac); | ||
| 108 | |||
| 109 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 110 | if (e.action === BPProfileModule.ACTION_IS_ENABLE_OFFLINE) { | ||
| 111 | console.log(event[BPProfileModule.IS_ENABLE_OFFLINE]); | ||
| 112 | } | ||
| 113 | }); | ||
| 114 | ``` | ||
| 115 | |||
| 116 | ### get quantity of data stored in the bp5 device | ||
| 117 | |||
| 118 | ```js | ||
| 119 | BP5Module.getOfflineNum(mac); | ||
| 120 | |||
| 121 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 122 | if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { | ||
| 123 | // {"offlinenum":2} | ||
| 124 | console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); | ||
| 125 | } | ||
| 126 | }); | ||
| 127 | ``` | ||
| 128 | |||
| 129 | ### get data stored in the bp5 device | ||
| 130 | |||
| 131 | ```js | ||
| 132 | BP5Module.getOfflineData(mac); | ||
| 133 | |||
| 134 | notifyListener = DeviceEventEmitter.addListener(BP5Module.Event_Notify, (event) => { | ||
| 135 | // {"data":[{"time":"2009-01-02 15:12:00","sys":120,"dia":72,"heartRate":71,"arrhythmia":false,"hsd":false,"dataID":"F77B50204315322FAB3B31548E6CDC4E"},{"time":"2009-01-02 15:13:00","sys":115,"dia":73,"heartRate":68,"arrhythmia":false,"hsd":false,"dataID":"F75BC53C3E43ACC3BA3DE1343B317398"}]} | ||
| 136 | if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { | ||
| 137 | let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; | ||
| 138 | if (dataArray == undefined) { | ||
| 139 | result = "There is not offline data in device" | ||
| 140 | }else { | ||
| 141 | for (let i = 0; i < dataArray.length; i++) { | ||
| 142 | let offlineData = dataArray[i]; | ||
| 143 | |||
| 144 | console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); | ||
| 145 | console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 146 | console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 147 | console.log(offlineData[BPProfileModule.PULSE_BP]); | ||
| 148 | console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 149 | console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); | ||
| 150 | console.log(offlineData[BPProfileModule.DATAID]); | ||
| 151 | } | ||
| 152 | } | ||
| 153 | } | ||
| 154 | }); | ||
| 155 | ``` | ||
| 156 | |||
| 157 | ### disconnect device | ||
| 158 | |||
| 159 | ```js | ||
| 160 | BP5Module.disConnect(mac); | ||
| 161 | ``` | ||
| 162 | |||
| 163 | ### get device information | ||
| 164 | |||
| 165 | ```js | ||
| 166 | iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => { | ||
| 167 | console.info(event); | ||
| 168 | }) | ||
| 169 | ``` | ||
| 170 | |||
| 171 | ### get all connected devices | ||
| 172 | |||
| 173 | ```js | ||
| 174 | BP5Module.getAllConnectedDevices(); | ||
| 175 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/bp7s.md b/libs/ihealth-sdk/doc/bp7s.md new file mode 100644 index 0000000..178b5e1 --- /dev/null +++ b/libs/ihealth-sdk/doc/bp7s.md | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | # BP7S Workflow | ||
| 2 | |||
| 3 | ## Import BP7S Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BP7SModule, | ||
| 8 | BPProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get battery | ||
| 27 | |||
| 28 | ```js | ||
| 29 | BP7SModule.getBattery(mac); | ||
| 30 | |||
| 31 | notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { | ||
| 32 | if (event.action === BPProfileModule.ACTION_BATTERY_BP) { | ||
| 33 | console.log(event[BPProfileModule.BATTERY_BP]); | ||
| 34 | } | ||
| 35 | }); | ||
| 36 | ``` | ||
| 37 | |||
| 38 | ### set unit | ||
| 39 | |||
| 40 | The API can change the unit of the bg5 display. | ||
| 41 | |||
| 42 | ```js | ||
| 43 | // unit :0 mmHg;1 kPa | ||
| 44 | BP7SModule.setUnit(mac, 1); | ||
| 45 | |||
| 46 | // response | ||
| 47 | notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { | ||
| 48 | if (event.action === BPProfileModule.ACTION_SET_UNIT_SUCCESS_BP) { | ||
| 49 | console.log("set Unit"); | ||
| 50 | } | ||
| 51 | }); | ||
| 52 | ``` | ||
| 53 | |||
| 54 | ### get quantity of data stored in the bp5 device | ||
| 55 | |||
| 56 | ```js | ||
| 57 | BP7SModule.getOfflineNum(mac); | ||
| 58 | |||
| 59 | // response | ||
| 60 | notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { | ||
| 61 | if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { | ||
| 62 | console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); | ||
| 63 | } | ||
| 64 | }); | ||
| 65 | ``` | ||
| 66 | |||
| 67 | ### get data stored in the bp5 device | ||
| 68 | |||
| 69 | ```js | ||
| 70 | BP7SModule.getOfflineData(mac); | ||
| 71 | |||
| 72 | notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { | ||
| 73 | if (e.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { | ||
| 74 | let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; | ||
| 75 | if (dataArray == undefined) { | ||
| 76 | result = "There is not offline data in device" | ||
| 77 | }else { | ||
| 78 | for (let i = 0; i < dataArray.length; i++) { | ||
| 79 | let offlineData = dataArray[i]; | ||
| 80 | |||
| 81 | console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); | ||
| 82 | console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 83 | console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 84 | console.log(offlineData[BPProfileModule.PULSE_BP]); | ||
| 85 | console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 86 | console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); | ||
| 87 | console.log(offlineData[BPProfileModule.DATAID]); | ||
| 88 | } | ||
| 89 | } | ||
| 90 | } | ||
| 91 | }); | ||
| 92 | ``` | ||
| 93 | |||
| 94 | ### disconnect device | ||
| 95 | |||
| 96 | ```js | ||
| 97 | BP7SModule.disConnect(mac); | ||
| 98 | ``` | ||
| 99 | |||
| 100 | ### set angle range | ||
| 101 | |||
| 102 | ```js | ||
| 103 | /** | ||
| 104 | * leftHigh the maximum measure angle of left hand, the maximum value must less than 90 | ||
| 105 | * leftLow the minimum measure angle of left hand, the minimum value must more than 0, and less than leftUpper | ||
| 106 | * rightHigh the maximum measure angle of right hand, the maximum value must less than 90 | ||
| 107 | * leftLow the minimum measure angle of right hand, the minimum value must more than 0, and less than rightUpper | ||
| 108 | */ | ||
| 109 | BP7SModule.angleSet(mac, 80, 30, 80, 30); | ||
| 110 | |||
| 111 | // response | ||
| 112 | notifyListener = DeviceEventEmitter.addListener(BP7SModule.Event_Notify, (event) => { | ||
| 113 | if (e.action === BPProfileModule.ACTION_SET_ANGLE_SUCCESS_BP) { | ||
| 114 | console.log("set angle"); | ||
| 115 | } | ||
| 116 | }); | ||
| 117 | ``` | ||
| 118 | |||
| 119 | ### get bp7s device information | ||
| 120 | |||
| 121 | ```js | ||
| 122 | BP7SModule.getFunctionInfo(mac); | ||
| 123 | ``` | ||
| 124 | |||
| 125 | ### get all connected devices | ||
| 126 | |||
| 127 | ```js | ||
| 128 | BP7SModule.getAllConnectedDevices(); | ||
| 129 | ``` \ No newline at end of file | ||
diff --git a/libs/ihealth-sdk/doc/download.png b/libs/ihealth-sdk/doc/download.png new file mode 100644 index 0000000..e12b973 --- /dev/null +++ b/libs/ihealth-sdk/doc/download.png | |||
| Binary files differ | |||
diff --git a/libs/ihealth-sdk/doc/ecg.md b/libs/ihealth-sdk/doc/ecg.md new file mode 100644 index 0000000..2dbba6a --- /dev/null +++ b/libs/ihealth-sdk/doc/ecg.md | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # ECG3 Workflow | ||
| 2 | |||
| 3 | ## import ECG3 module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | ECGModule, | ||
| 8 | ECGProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get all connected devices | ||
| 27 | |||
| 28 | ```js | ||
| 29 | ECGModule.getAllConnectedDevices(); | ||
| 30 | ``` | ||
| 31 | |||
| 32 | ### start a measurement | ||
| 33 | |||
| 34 | ```js | ||
| 35 | ECGModule.startMeasure(mac); | ||
| 36 | |||
| 37 | // response | ||
| 38 | notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { | ||
| 39 | if (event.action === ECGModule.ACTION_ELECTRODE_STATUS) { | ||
| 40 | console.log(event[ECGProfileModule.ELECTRODE_STATUS]); | ||
| 41 | console.log(event[ECGProfileModule.ERROR_DESCRIPTION_ECG]); | ||
| 42 | } | ||
| 43 | }); | ||
| 44 | ``` | ||
| 45 | |||
| 46 | ### cancel a measurement | ||
| 47 | |||
| 48 | ```js | ||
| 49 | ECGModule.stopMeasure(mac); | ||
| 50 | ``` | ||
| 51 | |||
| 52 | ### get battery | ||
| 53 | |||
| 54 | ```js | ||
| 55 | ECGModule.getBattery(mac); | ||
| 56 | |||
| 57 | // response | ||
| 58 | notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { | ||
| 59 | if (event.action === ECGModule.ACTION_BATTERY_ECG) { | ||
| 60 | console.log(event[ECGProfileModule.BATTERY_ECG]) | ||
| 61 | } | ||
| 62 | }); | ||
| 63 | ``` | ||
| 64 | |||
| 65 | ### set current time to device | ||
| 66 | |||
| 67 | ```js | ||
| 68 | ECGModule.sysTime(mac); | ||
| 69 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/ecgusb.md b/libs/ihealth-sdk/doc/ecgusb.md new file mode 100644 index 0000000..7fe7b10 --- /dev/null +++ b/libs/ihealth-sdk/doc/ecgusb.md | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | # ECG3 Workflow | ||
| 2 | |||
| 3 | ## import ECG3 module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | ECGModule, | ||
| 8 | ECGProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get device information | ||
| 27 | |||
| 28 | ```js | ||
| 29 | ECGUSBModule.getIdps() | ||
| 30 | ``` | ||
| 31 | |||
| 32 | ### get all connected devices | ||
| 33 | |||
| 34 | ```js | ||
| 35 | ECGUSBModule.getAllConnectedDevices(); | ||
| 36 | ``` | ||
| 37 | |||
| 38 | ### get data stored in the ecg3 device | ||
| 39 | |||
| 40 | ```js | ||
| 41 | ECGUSBModule.syncData(); | ||
| 42 | ``` | ||
| 43 | |||
| 44 | ### delete data stored in the ecg3 device | ||
| 45 | |||
| 46 | ```js | ||
| 47 | ECGUSBModule.deleteData(); | ||
| 48 | ``` | ||
| 49 | |||
| 50 | ### splice data | ||
| 51 | |||
| 52 | ```js | ||
| 53 | ECGUSBModule.spliceData(["ECGSDK_20160420025256", | ||
| 54 | "ECGSDK_20160420025453", | ||
| 55 | "ECGSDK_20160420030824", | ||
| 56 | "ECGSDK_20160420082435"]); | ||
| 57 | ``` | ||
| 58 | |||
| 59 | ### get cache | ||
| 60 | |||
| 61 | ```js | ||
| 62 | ECGUSBModule.getCache(); | ||
| 63 | ``` | ||
| 64 | |||
| 65 | ### delete cache data | ||
| 66 | |||
| 67 | ```js | ||
| 68 | ECGUSBModule.deleteCacheData(); | ||
| 69 | ``` | ||
| 70 | |||
| 71 | ### get filter data | ||
| 72 | |||
| 73 | ```js | ||
| 74 | ECGUSBModule.getFilterDataByFileName("ECG_Total_Data_20160420025256.dat","ECG_Total_Mark_20160420025256.txt"); | ||
| 75 | ``` | ||
| 76 | |||
diff --git a/libs/ihealth-sdk/doc/hs2.md b/libs/ihealth-sdk/doc/hs2.md new file mode 100644 index 0000000..c393577 --- /dev/null +++ b/libs/ihealth-sdk/doc/hs2.md | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | # HS2 Workflow | ||
| 2 | |||
| 3 | ## import HS2 module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | HS2Module, | ||
| 8 | HSProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(HS2Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### start a measurement | ||
| 27 | |||
| 28 | The API is asyn function. It will return message until finish measurement. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | HS2Module.startMeasure(mac); | ||
| 32 | |||
| 33 | notifyListener = DeviceEventEmitter.addListener(HS2Module.Event_Notify, (event) => { | ||
| 34 | if (event.action === HSProfileModule.ACTION_ONLINE_RESULT_HS) { | ||
| 35 | console.log(event[HSProfileModule.DATAID]); | ||
| 36 | console.log(event[HSProfileModule.WEIGHT_HS]); | ||
| 37 | console.log(event[HSProfileModule.FAT_HS]); | ||
| 38 | console.log(event[HSProfileModule.WATER_HS]); | ||
| 39 | console.log(event[HSProfileModule.MUSCLE_HS]); | ||
| 40 | console.log(event[HSProfileModule.SKELETON_HS]); | ||
| 41 | console.log(event[HSProfileModule.FATELEVEL_HS]); | ||
| 42 | console.log(event[HSProfileModule.DCI_HS]); | ||
| 43 | } | ||
| 44 | }); | ||
| 45 | ``` | ||
| 46 | |||
| 47 | ### get data stored in the HS2 device | ||
| 48 | |||
| 49 | ```js | ||
| 50 | HS2Module.getOfflineData(mac); | ||
| 51 | |||
| 52 | notifyListener = DeviceEventEmitter.addListener(HS2Module.Event_Notify, (event) => { | ||
| 53 | if (event.action === HSProfileModule.ACTION_HISTORICAL_DATA_HS) { | ||
| 54 | let dataArray = event[HSProfileModule.HISTORDATA_HS]; | ||
| 55 | if (dataArray == undefined) { | ||
| 56 | result = "There is not offline data in device" | ||
| 57 | }else { | ||
| 58 | for (let i = 0; i < dataArray.length; i++) { | ||
| 59 | let offlineData = dataArray[i]; | ||
| 60 | console.log(offlineData[HSProfileModule.MEASUREMENT_DATE_HS]); | ||
| 61 | console.log(offlineData[HSProfileModule.WEIGHT_HS]); | ||
| 62 | console.log(offlineData[HSProfileModule.FAT_HS]); | ||
| 63 | console.log(offlineData[HSProfileModule.WATER_HS]); | ||
| 64 | console.log(offlineData[HSProfileModule.MUSCLE_HS]); | ||
| 65 | console.log(offlineData[HSProfileModule.SKELETON_HS]); | ||
| 66 | console.log(offlineData[HSProfileModule.FATELEVEL_HS]); | ||
| 67 | console.log(offlineData[HSProfileModule.DATAID]); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | } | ||
| 71 | }); | ||
| 72 | ``` | ||
| 73 | |||
| 74 | ### disconnect device | ||
| 75 | |||
| 76 | ```js | ||
| 77 | BP3LModule.disConnect(mac); | ||
| 78 | ``` | ||
| 79 | |||
| 80 | ### get all connected devices | ||
| 81 | |||
| 82 | ```js | ||
| 83 | BP3LModule.getAllConnectedDevices(); | ||
| 84 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/hs2s.md b/libs/ihealth-sdk/doc/hs2s.md new file mode 100644 index 0000000..b72995a --- /dev/null +++ b/libs/ihealth-sdk/doc/hs2s.md | |||
| @@ -0,0 +1,307 @@ | |||
| 1 | # HS2S Workflow | ||
| 2 | |||
| 3 | ## import HS2S module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | HS2SModule, | ||
| 8 | HS2SProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get device information | ||
| 27 | |||
| 28 | ```js | ||
| 29 | HS2SModule.getDeviceInfo(mac); | ||
| 30 | |||
| 31 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 32 | if (event.action === "action_get_device_info") { | ||
| 33 | console.log(event["battery"]); | ||
| 34 | console.log(event["unit_current"]); | ||
| 35 | console.log(event["user_count"]); | ||
| 36 | } | ||
| 37 | } | ||
| 38 | ``` | ||
| 39 | |||
| 40 | ### get device battery | ||
| 41 | |||
| 42 | ```js | ||
| 43 | HS2SModule.getBattery(mac); | ||
| 44 | |||
| 45 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 46 | if (event.action === "action_get_battery_hs") { | ||
| 47 | console.log(event["battery_hs"]); | ||
| 48 | } | ||
| 49 | } | ||
| 50 | ``` | ||
| 51 | |||
| 52 | ### set Unit | ||
| 53 | |||
| 54 | ```js | ||
| 55 | HS2SModule.setUnit(mac); | ||
| 56 | |||
| 57 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 58 | if (event.action === "action_set_unit") { | ||
| 59 | console.log(event["result"]); | ||
| 60 | } | ||
| 61 | } | ||
| 62 | ``` | ||
| 63 | |||
| 64 | ### get user information | ||
| 65 | |||
| 66 | ```js | ||
| 67 | HS2SModule.getUserInfo(mac); | ||
| 68 | |||
| 69 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 70 | if (event.action === "action_get_user_info") { | ||
| 71 | console.log(event["user_info-count"]); | ||
| 72 | let array = event["user_info_array"]; | ||
| 73 | console.log(array["body_building"]); | ||
| 74 | console.log(array["impedance"]); | ||
| 75 | console.log(array["height"]); | ||
| 76 | console.log(array["age"]); | ||
| 77 | console.log(array["gender"]); | ||
| 78 | console.log(array["weight"]); | ||
| 79 | console.log(array["create_time"]); | ||
| 80 | console.log(array["user_id"]); | ||
| 81 | } | ||
| 82 | } | ||
| 83 | ``` | ||
| 84 | |||
| 85 | ### create user | ||
| 86 | |||
| 87 | ```js | ||
| 88 | HS2SModule.updateUserInfo(mac); | ||
| 89 | |||
| 90 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 91 | if (event.action === "action_create_or_update_user_info") { | ||
| 92 | console.log(event["result"]); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | ``` | ||
| 96 | |||
| 97 | ### delete user | ||
| 98 | |||
| 99 | ```js | ||
| 100 | HS2SModule.deleteUser(mac, userId); | ||
| 101 | |||
| 102 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 103 | if (event.action === "action_delete_user_info") { | ||
| 104 | console.log(event["result"]); | ||
| 105 | } | ||
| 106 | } | ||
| 107 | ``` | ||
| 108 | |||
| 109 | ### get the number of offline data | ||
| 110 | |||
| 111 | ```js | ||
| 112 | HS2SModule.getMemoryDataCount(mac, userId); | ||
| 113 | |||
| 114 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 115 | if (event.action === "action_history_data_num") { | ||
| 116 | console.log(event["history_data_count"]); | ||
| 117 | } | ||
| 118 | } | ||
| 119 | ``` | ||
| 120 | |||
| 121 | ### get offline data | ||
| 122 | |||
| 123 | ```js | ||
| 124 | HS2SModule.getMemoryData(mac, userId); | ||
| 125 | |||
| 126 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 127 | if (event.action === "action_history_data") { | ||
| 128 | let arr = event["history_data"]; | ||
| 129 | arr.forEach(function(result) { | ||
| 130 | console.log(result["fat_weight"]); | ||
| 131 | console.log(result["fat_control"]; | ||
| 132 | console.log(result["weight_control"]; | ||
| 133 | console.log(result["standard_weight"]; | ||
| 134 | console.log(result["skeletal_muscle_mass"]; | ||
| 135 | console.log(result["body_water_rate"]; | ||
| 136 | console.log(result["muscle_mas"]; | ||
| 137 | console.log(result["instruction_type"]; | ||
| 138 | console.log(result["body_building"]; | ||
| 139 | console.log(result["height"]; | ||
| 140 | console.log(result["gender"]; | ||
| 141 | console.log(result["muscle_control"]; | ||
| 142 | console.log(result["physical_age"]; | ||
| 143 | console.log(result["visceral_fat_grade"]; | ||
| 144 | console.log(result["protein_rate"]; | ||
| 145 | console.log(result["bone_salt_content"]; | ||
| 146 | console.log(result["visceral_fat_grade"]; | ||
| 147 | console.log(result["measure_time"]; | ||
| 148 | console.log(result["age"]; | ||
| 149 | console.log(result["impedance"]; | ||
| 150 | console.log(result["weight"]; | ||
| 151 | }) | ||
| 152 | } | ||
| 153 | } | ||
| 154 | ``` | ||
| 155 | |||
| 156 | ### delete offline data by user id | ||
| 157 | |||
| 158 | ```js | ||
| 159 | HS2SModule.deleteMemoryData(mac, userId); | ||
| 160 | |||
| 161 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 162 | if (event.action === "action_delete_history_data") { | ||
| 163 | console.log(event["result"]); | ||
| 164 | } | ||
| 165 | } | ||
| 166 | ``` | ||
| 167 | |||
| 168 | ### get the number of anonymous offline data | ||
| 169 | |||
| 170 | ```js | ||
| 171 | HS2SModule.getAnonymousMemoryDataCount(mac); | ||
| 172 | |||
| 173 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 174 | if (event.action === "action_anonymous_data_num") { | ||
| 175 | console.log(event["anonymous_data_count"]); | ||
| 176 | } | ||
| 177 | } | ||
| 178 | ``` | ||
| 179 | |||
| 180 | ### get anonymous offline data | ||
| 181 | |||
| 182 | ```js | ||
| 183 | HS2SModule.getAnonymousMemoryData(mac); | ||
| 184 | |||
| 185 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 186 | if (event.action === "action_anonymous_data") { | ||
| 187 | let arr = event["history_data"]; | ||
| 188 | arr.forEach(function(result) { | ||
| 189 | console.log(result["instruction_type"]; | ||
| 190 | console.log(result["body_building"]; | ||
| 191 | console.log(result["height"]; | ||
| 192 | console.log(result["gender"]; | ||
| 193 | console.log(result["measure_time"]; | ||
| 194 | console.log(result["age"]; | ||
| 195 | console.log(result["impedance"]; | ||
| 196 | console.log(result["weight"]; | ||
| 197 | }) | ||
| 198 | } | ||
| 199 | } | ||
| 200 | ``` | ||
| 201 | |||
| 202 | ### delete anonymous offline data | ||
| 203 | |||
| 204 | ```js | ||
| 205 | HS2SModule.deleteAnonymousMemoryData(mac); | ||
| 206 | |||
| 207 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 208 | if (event.action === "action_delete_anonymous_data") { | ||
| 209 | console.log(event["result"]); | ||
| 210 | } | ||
| 211 | } | ||
| 212 | ``` | ||
| 213 | |||
| 214 | ### start a online measurement | ||
| 215 | |||
| 216 | The API is asyn function. It will return message until finish measurement. | ||
| 217 | |||
| 218 | ```js | ||
| 219 | HS2SModule.measure(mac); | ||
| 220 | |||
| 221 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 222 | if (event.action === "action_specify_users") { | ||
| 223 | console.log(event["result"]); | ||
| 224 | // 1: success, 0: failure | ||
| 225 | |||
| 226 | } else if (event.action === "action_online_real_time_weight") { | ||
| 227 | console.log(event["weight"]); | ||
| 228 | |||
| 229 | } else if (event.action === "action_online_result") { | ||
| 230 | console.log(event["weight"]); | ||
| 231 | |||
| 232 | } else if (event.action === "action_body_fat_result") { | ||
| 233 | let bodyFat = event["data_body_fat_result"]; | ||
| 234 | let fat_weight = bodyFat["fat_weight"]; | ||
| 235 | let fat_control = bodyFat["fat_control"]; | ||
| 236 | let weight_control = bodyFat["weight_control"]; | ||
| 237 | let standard_weight = bodyFat["standard_weight"]; | ||
| 238 | let skeletal_muscle_mass = bodyFat["skeletal_muscle_mass"]; | ||
| 239 | let body_water_rate = bodyFat["body_water_rate"]; | ||
| 240 | let muscle_mas = bodyFat["muscle_mas"]; | ||
| 241 | let instruction_type = bodyFat["instruction_type"]; | ||
| 242 | let body_building = bodyFat["body_building"]; | ||
| 243 | let height = bodyFat["height"]; | ||
| 244 | let gender = bodyFat["gender"]; | ||
| 245 | let muscle_control = bodyFat["muscle_control"]; | ||
| 246 | let physical_age = bodyFat["physical_age"]; | ||
| 247 | let visceral_fat_grade = bodyFat["visceral_fat_grade"]; | ||
| 248 | let protein_rate = bodyFat["protein_rate"]; | ||
| 249 | let bone_salt_content = bodyFat["bone_salt_content"]; | ||
| 250 | let visceral_fat_grade = bodyFat["visceral_fat_grade"]; | ||
| 251 | let measure_time = bodyFat["measure_time"]; | ||
| 252 | let age = bodyFat["age"]; | ||
| 253 | let impedance = bodyFat["impedance"]; | ||
| 254 | let weight = bodyFat["weight"]; | ||
| 255 | |||
| 256 | } else if (event.action === "action_measure_finish_at_critical") { } | ||
| 257 | }); | ||
| 258 | ``` | ||
| 259 | |||
| 260 | ### start heart rate measurement mode | ||
| 261 | |||
| 262 | ```js | ||
| 263 | HS2SModule.resetDevice(mac); | ||
| 264 | |||
| 265 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 266 | if (event.action === HS2SProfileModule.ACTION_HS2S_MEASURE_HEARTRATE) { | ||
| 267 | |||
| 268 | } | ||
| 269 | } | ||
| 270 | ``` | ||
| 271 | |||
| 272 | ### stop heart rate measurement mode | ||
| 273 | |||
| 274 | ```js | ||
| 275 | HS2SModule.resetDevice(mac); | ||
| 276 | |||
| 277 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 278 | if (event.action === HS2SProfileModule.ACTION_HS2S_EXIT_MEASURE_HEARTRATE_STATUS) { | ||
| 279 | // {"status":0,"heartrate":78} | ||
| 280 | console.log(event.message); | ||
| 281 | } | ||
| 282 | } | ||
| 283 | ``` | ||
| 284 | |||
| 285 | ### reset device | ||
| 286 | |||
| 287 | ```js | ||
| 288 | HS2SModule.resetDevice(mac); | ||
| 289 | |||
| 290 | notifyListener = DeviceEventEmitter.addListener(HS2SModule.Event_Notify, (event) => { | ||
| 291 | if (event.action === "action_restore_factory_settings") { | ||
| 292 | console.log(event["result"]); | ||
| 293 | } | ||
| 294 | } | ||
| 295 | ``` | ||
| 296 | |||
| 297 | ### disconnect device | ||
| 298 | |||
| 299 | ```js | ||
| 300 | HS2SModule.disConnect(mac); | ||
| 301 | ``` | ||
| 302 | |||
| 303 | ### get all connected devices | ||
| 304 | |||
| 305 | ```js | ||
| 306 | HS2SModule.getAllConnectedDevices(); | ||
| 307 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/hs4s.md b/libs/ihealth-sdk/doc/hs4s.md new file mode 100644 index 0000000..5cc7446 --- /dev/null +++ b/libs/ihealth-sdk/doc/hs4s.md | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | # HS4S Workflow | ||
| 2 | |||
| 3 | ## import HS4S module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | HS4SModule, | ||
| 8 | HSProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(HS4SModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### start a measurement | ||
| 27 | |||
| 28 | The API is asyn function. It will return message until finish measurement. | ||
| 29 | |||
| 30 | ```js | ||
| 31 | HS4SModule.startMeasure(mac); | ||
| 32 | |||
| 33 | notifyListener = DeviceEventEmitter.addListener(HS4SModule.Event_Notify, (event) => { | ||
| 34 | if (event.action === HSProfileModule.ACTION_ONLINE_RESULT_HS) { | ||
| 35 | console.log(event[HSProfileModule.DATAID]); | ||
| 36 | console.log(event[HSProfileModule.WEIGHT_HS]); | ||
| 37 | console.log(event[HSProfileModule.FAT_HS]); | ||
| 38 | console.log(event[HSProfileModule.WATER_HS]); | ||
| 39 | console.log(event[HSProfileModule.MUSCLE_HS]); | ||
| 40 | console.log(event[HSProfileModule.SKELETON_HS]); | ||
| 41 | console.log(event[HSProfileModule.FATELEVEL_HS]); | ||
| 42 | console.log(event[HSProfileModule.DCI_HS]); | ||
| 43 | } | ||
| 44 | }); | ||
| 45 | ``` | ||
| 46 | |||
| 47 | ### get data stored in the HS4S device | ||
| 48 | |||
| 49 | ```js | ||
| 50 | HS4SModule.getOfflineData(mac); | ||
| 51 | |||
| 52 | notifyListener = DeviceEventEmitter.addListener(HS4SModule.Event_Notify, (event) => { | ||
| 53 | if (event.action === HSProfileModule.ACTION_HISTORICAL_DATA_HS) { | ||
| 54 | let dataArray = event[HSProfileModule.HISTORDATA_HS]; | ||
| 55 | if (dataArray == undefined) { | ||
| 56 | result = "There is not offline data in device" | ||
| 57 | }else { | ||
| 58 | for (let i = 0; i < dataArray.length; i++) { | ||
| 59 | let offlineData = dataArray[i]; | ||
| 60 | console.log(offlineData[HSProfileModule.MEASUREMENT_DATE_HS]); | ||
| 61 | console.log(offlineData[HSProfileModule.WEIGHT_HS]); | ||
| 62 | console.log(offlineData[HSProfileModule.FAT_HS]); | ||
| 63 | console.log(offlineData[HSProfileModule.WATER_HS]); | ||
| 64 | console.log(offlineData[HSProfileModule.MUSCLE_HS]); | ||
| 65 | console.log(offlineData[HSProfileModule.SKELETON_HS]); | ||
| 66 | console.log(offlineData[HSProfileModule.FATELEVEL_HS]); | ||
| 67 | console.log(offlineData[HSProfileModule.DATAID]); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | } | ||
| 71 | }); | ||
| 72 | ``` | ||
| 73 | |||
| 74 | ### disconnect device | ||
| 75 | |||
| 76 | ```js | ||
| 77 | BP3LModule.disConnect(mac); | ||
| 78 | ``` | ||
| 79 | |||
| 80 | ### get all connected devices | ||
| 81 | |||
| 82 | ```js | ||
| 83 | BP3LModule.getAllConnectedDevices(); | ||
| 84 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/hs6.md b/libs/ihealth-sdk/doc/hs6.md new file mode 100644 index 0000000..c951baa --- /dev/null +++ b/libs/ihealth-sdk/doc/hs6.md | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | # HS6 Workflow | ||
| 2 | |||
| 3 | ## import HS6 module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | HS6Module, | ||
| 8 | HS6ProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### init hs6 | ||
| 27 | |||
| 28 | ```js | ||
| 29 | // need the ihealth account, apply from ihealth developer website | ||
| 30 | HS6Module.init("xxx.xxx@xxx.com"); | ||
| 31 | ``` | ||
| 32 | |||
| 33 | ### set wifi for hs6 | ||
| 34 | |||
| 35 | The api only support the 2.4G wifi. | ||
| 36 | |||
| 37 | ```js | ||
| 38 | HS6Module.setWifi("xxxx", "1234567890"); | ||
| 39 | |||
| 40 | // response | ||
| 41 | notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { | ||
| 42 | if (event.action === HS6ProfileModule.ACTION_HS6_SETWIFI) { | ||
| 43 | console.log(event[HS6ProfileModule.SETWIFI_RESULT]); | ||
| 44 | } | ||
| 45 | }); | ||
| 46 | ``` | ||
| 47 | |||
| 48 | ### bind user with hs6 | ||
| 49 | |||
| 50 | ```js | ||
| 51 | /** | ||
| 52 | * birthday | ||
| 53 | * weight(kg) | ||
| 54 | * height(cm) | ||
| 55 | * isSporter | ||
| 56 | * gender | ||
| 57 | * serialNumber | ||
| 58 | */ | ||
| 59 | HS6Module.bindDeviceHS6("1979-02-26 12:20:10", 85.0, 180, 2, 1, "ACCF2337A952"); | ||
| 60 | |||
| 61 | // response | ||
| 62 | notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { | ||
| 63 | if (event.action === HS6ProfileModule.ACTION_HS6_BIND) { | ||
| 64 | console.log(event[HS6ProfileModule.HS6_BIND_EXTRA]); | ||
| 65 | // 1: bind success, 2: the scale has no empty position, 3: bind fail | ||
| 66 | console.log(event[HS6ProfileModule.BIND_HS6_RESULT]); | ||
| 67 | console.log(event[HS6ProfileModule.HS6_MODEL]); | ||
| 68 | // The range is from 1~10 | ||
| 69 | console.log(event[HS6ProfileModule.HS6_POSITION]); | ||
| 70 | // 1: setted, 0: not | ||
| 71 | console.log(event[HS6ProfileModule.HS6_SETTED_WIFI]); | ||
| 72 | } | ||
| 73 | }); | ||
| 74 | ``` | ||
| 75 | |||
| 76 | ### unbind hs6 | ||
| 77 | |||
| 78 | ```js | ||
| 79 | HS6Module.unBindDeviceHS6("ACCF2337A952"); | ||
| 80 | |||
| 81 | // response | ||
| 82 | notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { | ||
| 83 | if (event.action === HS6ProfileModule.ACTION_HS6_UNBIND) { | ||
| 84 | console.log(event[HS6ProfileModule.HS6_UNBIND_RESULT]); | ||
| 85 | } | ||
| 86 | }); | ||
| 87 | ``` | ||
| 88 | |||
| 89 | ### get token | ||
| 90 | |||
| 91 | ```js | ||
| 92 | /** | ||
| 93 | * clientId, | ||
| 94 | * clientSecret, | ||
| 95 | * username, | ||
| 96 | * clientPara | ||
| 97 | `*/ | ||
| 98 | HS6Module.getToken("xxx", "xxx", "xxx.xxx@xxx.com", "random_str"); | ||
| 99 | |||
| 100 | // response | ||
| 101 | notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { | ||
| 102 | if (event.action === HS6ProfileModule.ACTION_HS6_GET_TOKEN) { | ||
| 103 | console.log(event[HS6ProfileModule.GET_TOKEN_RESULT]); | ||
| 104 | } | ||
| 105 | }); | ||
| 106 | ``` | ||
| 107 | |||
| 108 | ### set unit | ||
| 109 | |||
| 110 | ```js | ||
| 111 | /** | ||
| 112 | * username | ||
| 113 | * unitType 0: Kg 1: lbs 2: st | ||
| 114 | `*/ | ||
| 115 | HS6Module.setUnit("xxx.xxx@xxx.com", 0); | ||
| 116 | |||
| 117 | // response | ||
| 118 | notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { | ||
| 119 | if (event.action === HS6ProfileModule.ACTION_HS6_SET_UNIT) { | ||
| 120 | console.log(event[HS6ProfileModule.SET_UNIT_RESULT]); | ||
| 121 | } | ||
| 122 | }); | ||
| 123 | ``` | ||
| 124 | |||
| 125 | ### get data stored in cloud | ||
| 126 | |||
| 127 | ```js | ||
| 128 | HS6Module.getCloudData("xxx", "xxx", "xxx.xxx@xxx.com", 0, 10); | ||
| 129 | |||
| 130 | // response | ||
| 131 | notifyListener = DeviceEventEmitter.addListener(HS6Module.Event_Notify, (event) => { | ||
| 132 | if (event.action === HSProfileModule.ACTION_HS6_GET_CLOUDDATA) { | ||
| 133 | |||
| 134 | } | ||
| 135 | }); | ||
| 136 | ``` | ||
| 137 | |||
diff --git a/libs/ihealth-sdk/doc/integrate-android.png b/libs/ihealth-sdk/doc/integrate-android.png new file mode 100644 index 0000000..c10ea67 --- /dev/null +++ b/libs/ihealth-sdk/doc/integrate-android.png | |||
| Binary files differ | |||
diff --git a/libs/ihealth-sdk/doc/integrate-ios.png b/libs/ihealth-sdk/doc/integrate-ios.png new file mode 100644 index 0000000..9087e02 --- /dev/null +++ b/libs/ihealth-sdk/doc/integrate-ios.png | |||
| Binary files differ | |||
diff --git a/libs/ihealth-sdk/doc/kn550.md b/libs/ihealth-sdk/doc/kn550.md new file mode 100644 index 0000000..f6e8bad --- /dev/null +++ b/libs/ihealth-sdk/doc/kn550.md | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | # KN550 Workflow | ||
| 2 | |||
| 3 | ## import KN550 module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | BP550BTModule, | ||
| 8 | BPProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get battery | ||
| 27 | |||
| 28 | ```js | ||
| 29 | BP550BTModule.getBattery(mac); | ||
| 30 | |||
| 31 | notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { | ||
| 32 | if (event.action === BPProfileModule.ACTION_BATTERY_BP) { | ||
| 33 | console.log(event[BPProfileModule.BATTERY_BP]); | ||
| 34 | } | ||
| 35 | }); | ||
| 36 | ``` | ||
| 37 | |||
| 38 | ### get KN550 function | ||
| 39 | |||
| 40 | ```js | ||
| 41 | BP550BTModule.getFunctionInfo(mac); | ||
| 42 | |||
| 43 | notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { | ||
| 44 | if (event.action === BPProfileModule.ACTION_FUNCTION_INFORMATION_BP) { | ||
| 45 | console.log(event[BPProfileModule.FUNCTION_IS_UPAIR_MEASURE]); | ||
| 46 | console.log(event[BPProfileModule.FUNCTION_IS_ARM_MEASURE]); | ||
| 47 | console.log(event[BPProfileModule.FUNCTION_HAVE_ANGLE_SENSOR]); | ||
| 48 | console.log(event[BPProfileModule.FUNCTION_HAVE_OFFLINE]); | ||
| 49 | console.log(event[BPProfileModule.FUNCTION_HAVE_HSD]); | ||
| 50 | console.log(event[BPProfileModule.FUNCTION_HAVE_ANGLE_SETTING]); | ||
| 51 | console.log(event[BPProfileModule.FUNCTION_IS_MULTI_UPLOAD]); | ||
| 52 | console.log(event[BPProfileModule.FUNCTION_HAVE_SELF_UPDATE]); | ||
| 53 | } | ||
| 54 | }); | ||
| 55 | ``` | ||
| 56 | |||
| 57 | ### get quantity of data stored in the KN550 device | ||
| 58 | |||
| 59 | ```js | ||
| 60 | BP550BTModule.getOfflineNum(mac); | ||
| 61 | |||
| 62 | notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { | ||
| 63 | if (e.action === BPProfileModule.ACTION_HISTORICAL_NUM_BP) { | ||
| 64 | console.log(event[BPProfileModule.HISTORICAL_NUM_BP]); | ||
| 65 | } | ||
| 66 | }); | ||
| 67 | ``` | ||
| 68 | |||
| 69 | ### get data stored in the KN550 device | ||
| 70 | |||
| 71 | ```js | ||
| 72 | BP550BTModule.getOfflineData(mac); | ||
| 73 | |||
| 74 | notifyListener = DeviceEventEmitter.addListener(BP550BTModule.Event_Notify, (event) => { | ||
| 75 | if (event.action === BPProfileModule.ACTION_HISTORICAL_DATA_BP) { | ||
| 76 | let dataArray = event[BPProfileModule.HISTORICAL_DATA_BP]; | ||
| 77 | if (dataArray == undefined) { | ||
| 78 | result = "There is not offline data in device" | ||
| 79 | }else { | ||
| 80 | for (let i = 0; i < dataArray.length; i++) { | ||
| 81 | let offlineData = dataArray[i]; | ||
| 82 | |||
| 83 | console.log(offlineData[BPProfileModule.MEASUREMENT_DATE_BP]); | ||
| 84 | console.log(offlineData[BPProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 85 | console.log(offlineData[BPProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 86 | console.log(offlineData[BPProfileModule.PULSE_BP]); | ||
| 87 | console.log(offlineData[BPProfileModule.MEASUREMENT_AHR_BP]); | ||
| 88 | console.log(offlineData[BPProfileModule.MEASUREMENT_HSD_BP]); | ||
| 89 | console.log(offlineData[BPProfileModule.DATAID]); | ||
| 90 | } | ||
| 91 | } | ||
| 92 | } | ||
| 93 | }); | ||
| 94 | ``` | ||
| 95 | |||
| 96 | ### disconnect device | ||
| 97 | |||
| 98 | ```js | ||
| 99 | BP550BTModule.disconnect(mac); | ||
| 100 | ``` | ||
| 101 | |||
| 102 | ### get device information | ||
| 103 | |||
| 104 | ```js | ||
| 105 | iHealthDeviceManagerModule.getDevicesIDPS(mac, (event) => { | ||
| 106 | console.info(event); | ||
| 107 | }) | ||
| 108 | ``` | ||
| 109 | |||
| 110 | ### get all connected devices | ||
| 111 | |||
| 112 | ```js | ||
| 113 | BP550BTModule.getAllConnectedDevices(); | ||
| 114 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/nt13b.md b/libs/ihealth-sdk/doc/nt13b.md new file mode 100644 index 0000000..6fd45ee --- /dev/null +++ b/libs/ihealth-sdk/doc/nt13b.md | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | # NT13B Workflow | ||
| 2 | |||
| 3 | ## Import NT13B Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | NT13BModule, | ||
| 8 | NT13BProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(NT13BModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### set measurement listener | ||
| 27 | |||
| 28 | ```js | ||
| 29 | NT13BModule.measure(mac); | ||
| 30 | |||
| 31 | // response | ||
| 32 | notifyListener = DeviceEventEmitter.addListener(NT13BModule.Event_Notify, (event) => { | ||
| 33 | if (event.action === NT13BProfileModule.ACTION_MEASUREMENT_RESULT) { | ||
| 34 | console.log(event[NT13BProfileModule.RESULT]); | ||
| 35 | console.log(event[NT13BProfileModule.UNIT_FLAG]); | ||
| 36 | } | ||
| 37 | }); | ||
| 38 | ``` \ No newline at end of file | ||
diff --git a/libs/ihealth-sdk/doc/po1.md b/libs/ihealth-sdk/doc/po1.md new file mode 100644 index 0000000..27f7e2a --- /dev/null +++ b/libs/ihealth-sdk/doc/po1.md | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | # PO1 Workflow | ||
| 2 | |||
| 3 | ## Import PO1 Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | PO1Module, | ||
| 8 | PO1ProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(PO1Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get battery | ||
| 27 | |||
| 28 | ```js | ||
| 29 | PO1Module.getBattery(mac); | ||
| 30 | |||
| 31 | // response | ||
| 32 | // {battery: 32, type: "PO1", mac: "004D320C41BE", action: "action_get_battery"} | ||
| 33 | notifyListener = DeviceEventEmitter.addListener(PO1Module.Event_Notify, (event) => { | ||
| 34 | if (event.action === PO1ProfileModule.ACTION_GET_BATTERY) { | ||
| 35 | console.log(event[PO1ProfileModule.BATTERY]); | ||
| 36 | } | ||
| 37 | }); | ||
| 38 | ``` | ||
| 39 | |||
| 40 | ### online measurement | ||
| 41 | |||
| 42 | ```js | ||
| 43 | // response | ||
| 44 | // {type: "PO1", mac: "004D320C41BE", action: "action_bo_measurement", "po1_blood_oxygen":97,"po1_pulse":61,"po1_pulse_force":7.800000190734863,"po1_pi":3,"po1_wave":[42,69,95,95,78]} | ||
| 45 | notifyListener = DeviceEventEmitter.addListener(PO1Module.Event_Notify, (event) => { | ||
| 46 | if (event.action === PO1ProfileModule.ACTION_BO_MEASUREMENT) { | ||
| 47 | console.log(event[PO1ProfileModule.PO1_BLOOD_OXYGEN]); | ||
| 48 | console.log(event[PO1ProfileModule.PO1_PULSE]); | ||
| 49 | console.log(event[PO1ProfileModule.PO1_PULSE_FORCE]); | ||
| 50 | console.log(event[PO1ProfileModule.PO1_PI]); | ||
| 51 | console.log(event[PO1ProfileModule.PO1_WAVE]); | ||
| 52 | } | ||
| 53 | }); | ||
| 54 | ``` \ No newline at end of file | ||
diff --git a/libs/ihealth-sdk/doc/po3.md b/libs/ihealth-sdk/doc/po3.md new file mode 100644 index 0000000..1a11df1 --- /dev/null +++ b/libs/ihealth-sdk/doc/po3.md | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | # PO3 Workflow | ||
| 2 | |||
| 3 | ## Import PO3 Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | PO3Module, | ||
| 8 | POProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### get battery | ||
| 27 | |||
| 28 | ```js | ||
| 29 | PO3Module.getBattery(mac); | ||
| 30 | |||
| 31 | // response | ||
| 32 | notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { | ||
| 33 | if (event.action === POProfileModule.ACTION_BATTERY_PO) { | ||
| 34 | console.log(event[POProfileModule.BATTERY_PO]); | ||
| 35 | } | ||
| 36 | }); | ||
| 37 | ``` | ||
| 38 | |||
| 39 | ### start a measurement with app | ||
| 40 | |||
| 41 | ```js | ||
| 42 | PO3Module.startMeasure(mac); | ||
| 43 | |||
| 44 | // response | ||
| 45 | notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { | ||
| 46 | if (event.action === POProfileModule.ACTION_LIVEDA_PO) { | ||
| 47 | console.log(event[POProfileModule.PULSE_WAVE_PO]); | ||
| 48 | console.log(event[POProfileModule.PI_PO]); | ||
| 49 | console.log(event[POProfileModule.PULSE_STRENGTH_PO]); | ||
| 50 | console.log(event[POProfileModule.BLOOD_OXYGEN_PO]); | ||
| 51 | console.log(event[POProfileModule.PULSE_RATE_PO]); | ||
| 52 | } else if(){ | ||
| 53 | // final result | ||
| 54 | console.log(event[POProfileModule.PULSE_WAVE_PO]); | ||
| 55 | console.log(event[POProfileModule]); | ||
| 56 | console.log(event[POProfileModule.PI_PO]); | ||
| 57 | console.log(event[POProfileModule.PULSE_STRENGTH_PO]); | ||
| 58 | console.log(event[POProfileModule.BLOOD_OXYGEN_PO]); | ||
| 59 | console.log(event[POProfileModule.PULSE_RATE_PO]); | ||
| 60 | } | ||
| 61 | }); | ||
| 62 | ``` | ||
| 63 | |||
| 64 | ### get data stored in the po3 device | ||
| 65 | |||
| 66 | ```js | ||
| 67 | PO3Module.getHistoryData(mac); | ||
| 68 | |||
| 69 | // response | ||
| 70 | notifyListener = DeviceEventEmitter.addListener(PO3Module.Event_Notify, (event) => { | ||
| 71 | if (event.action === POProfileModule.ACTION_NO_OFFLINEDATA_PO) { | ||
| 72 | console.log("There is no more data stored in the po3 device."); | ||
| 73 | } else if (event.action === POProfileModule.ACTION_OFFLINEDATA_PO) { | ||
| 74 | const dataArray = event[POProfileModule.OFFLINEDATA_PO]; | ||
| 75 | for (let i = 0; i < dataArray.length; i++) { | ||
| 76 | let offlineData = dataArray[i]; | ||
| 77 | console.log(offlineData[POProfileModule.MEASUREMENT_DATE_BP]); | ||
| 78 | console.log(offlineData[POProfileModule.HIGH_BLOOD_PRESSURE_BP]); | ||
| 79 | console.log(offlineData[POProfileModule.LOW_BLOOD_PRESSURE_BP]); | ||
| 80 | console.log(offlineData[POProfileModule.PULSE_BP]); | ||
| 81 | console.log(offlineData[POProfileModule.MEASUREMENT_AHR_BP]); | ||
| 82 | console.log(offlineData[POProfileModule.MEASUREMENT_HSD_BP]); | ||
| 83 | console.log(offlineData[POProfileModule.DATAID]); | ||
| 84 | } | ||
| 85 | } | ||
| 86 | }); | ||
| 87 | ``` \ No newline at end of file | ||
diff --git a/libs/ihealth-sdk/doc/pt3sbt.md b/libs/ihealth-sdk/doc/pt3sbt.md new file mode 100644 index 0000000..97f2296 --- /dev/null +++ b/libs/ihealth-sdk/doc/pt3sbt.md | |||
| @@ -0,0 +1,142 @@ | |||
| 1 | # PT3SBT Workflow | ||
| 2 | |||
| 3 | ## Import PT3SBT Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | PT3SBTModule, | ||
| 8 | PT3SBTProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### set time | ||
| 27 | |||
| 28 | ```js | ||
| 29 | PT3SBTModule.setTime(mac); | ||
| 30 | |||
| 31 | // response | ||
| 32 | // {status: "success", type: "PT3SBT", mac: "004D320C41BE", action: "action_set_time"} | ||
| 33 | notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { | ||
| 34 | if (event.action === PT3SBTProfileModule.ACTION_SET_TIME) { | ||
| 35 | console.log(event[NT13BProfileModule.STATUS]); | ||
| 36 | } | ||
| 37 | }); | ||
| 38 | ``` | ||
| 39 | |||
| 40 | ### get battery | ||
| 41 | |||
| 42 | ```js | ||
| 43 | PT3SBTModule.getBattery(mac); | ||
| 44 | |||
| 45 | // response | ||
| 46 | // { battery: 70, type: "PT3SBT", mac: "004D320C41BE", action: "action_get_battery"} | ||
| 47 | notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { | ||
| 48 | if (event.action === PT3SBTProfileModule.ACTION_GET_BATTERY) { | ||
| 49 | console.log(event[PT3SBTProfileModule.BATTERY]); | ||
| 50 | } | ||
| 51 | }); | ||
| 52 | ``` | ||
| 53 | |||
| 54 | ### set unit | ||
| 55 | |||
| 56 | ```js | ||
| 57 | // 1: centigrade, 2: fahrenheit | ||
| 58 | PT3SBTModule.setUnit(mac, unit); | ||
| 59 | |||
| 60 | // response | ||
| 61 | // {status: "success", type: "PT3SBT", mac: "004D320C41BE", action: "action_set_unit"} | ||
| 62 | notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { | ||
| 63 | if (event.action === PT3SBTProfileModule.ACTION_SET_UNIT) { | ||
| 64 | console.log(event[PT3SBTProfileModule.STATUS]); | ||
| 65 | } | ||
| 66 | }); | ||
| 67 | ``` | ||
| 68 | |||
| 69 | ### get unit | ||
| 70 | |||
| 71 | ```js | ||
| 72 | PT3SBTModule.getUnit(mac); | ||
| 73 | |||
| 74 | // response | ||
| 75 | // {unit: 2, type: "PT3SBT", mac: "004D320C41BE", action: "action_get_unit"} | ||
| 76 | notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { | ||
| 77 | if (event.action === PT3SBTProfileModule.ACTION_GET_UNIT) { | ||
| 78 | console.log(event[PT3SBTProfileModule.UNIT]); | ||
| 79 | } | ||
| 80 | }); | ||
| 81 | ``` | ||
| 82 | |||
| 83 | ### get history data count | ||
| 84 | |||
| 85 | ```js | ||
| 86 | PT3SBTModule.getHistoryCount(mac); | ||
| 87 | |||
| 88 | // response | ||
| 89 | // {count: 37, type: "PT3SBT", mac: "004D320C41BE", action: "action_get_history_count"} | ||
| 90 | notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { | ||
| 91 | if (event.action === PT3SBTProfileModule.ACTION_GET_HISTORY_COUNT) { | ||
| 92 | console.log(event[PT3SBTProfileModule.COUNT]); | ||
| 93 | } | ||
| 94 | }); | ||
| 95 | ``` | ||
| 96 | |||
| 97 | ### get history data | ||
| 98 | |||
| 99 | **Note: After call get history data, must to delele history data. If don't, the PT3SBT will keep on offline mode.** | ||
| 100 | |||
| 101 | ```js | ||
| 102 | PT3SBTModule.getHistoryData(mac); | ||
| 103 | |||
| 104 | // response | ||
| 105 | // {history: Array, type: "PT3SBT", mac: "004D320C41BE", action: "action_get_history_data"} | ||
| 106 | notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { | ||
| 107 | if (event.action === PT3SBTProfileModule.ACTION_GET_HISTORY_DATA) { | ||
| 108 | const arr = event[PT3SBTProfileModule.HISTORY]; | ||
| 109 | arr.foreach(item => { | ||
| 110 | console.log(item[PT3SBTProfileModule.TEMPERATURE]); | ||
| 111 | console.log(item[PT3SBTProfileModule.TS]); | ||
| 112 | }) | ||
| 113 | } | ||
| 114 | }); | ||
| 115 | ``` | ||
| 116 | |||
| 117 | ### delete history data | ||
| 118 | |||
| 119 | ```js | ||
| 120 | PT3SBTModule.deleteHistoryData(mac); | ||
| 121 | |||
| 122 | // response | ||
| 123 | // {status: "success", type: "PT3SBT", mac: "004D320C41BE", action: "action_delete_history_data"} | ||
| 124 | notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { | ||
| 125 | if (event.action === PT3SBTProfileModule.ACTION_DELETE_HISTORY_DATA) { | ||
| 126 | console.log(event[PT3SBTProfileModule.STATUS]); | ||
| 127 | } | ||
| 128 | }); | ||
| 129 | ``` | ||
| 130 | |||
| 131 | ### online measurement | ||
| 132 | |||
| 133 | ```js | ||
| 134 | // response | ||
| 135 | // {Tbody: 3845", type: "PT3SBT", mac: "004D320C41BE", action: "action_temperature_measurement"} | ||
| 136 | // the real temperature is Tbody / 100, this is centigrade | ||
| 137 | notifyListener = DeviceEventEmitter.addListener(PT3SBTModule.Event_Notify, (event) => { | ||
| 138 | if (event.action === PT3SBTProfileModule.ACTION_TEMPERATURE_MEASUREMENT) { | ||
| 139 | console.log(event[PT3SBTProfileModule.TEMPERATURE]); | ||
| 140 | } | ||
| 141 | }); | ||
| 142 | ``` | ||
diff --git a/libs/ihealth-sdk/doc/ts28b.md b/libs/ihealth-sdk/doc/ts28b.md new file mode 100644 index 0000000..0b1a5ac --- /dev/null +++ b/libs/ihealth-sdk/doc/ts28b.md | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | # TS28B Workflow | ||
| 2 | |||
| 3 | ## Import TS28B Module | ||
| 4 | |||
| 5 | ```js | ||
| 6 | import { | ||
| 7 | TS28BModule, | ||
| 8 | TS28BProfileModule | ||
| 9 | } from '@ihealth/ihealthlibrary-react-native'; | ||
| 10 | ``` | ||
| 11 | |||
| 12 | ## APIs | ||
| 13 | |||
| 14 | ### Add and remove listener | ||
| 15 | |||
| 16 | ```js | ||
| 17 | // add | ||
| 18 | notifyListener = DeviceEventEmitter.addListener(TS28BModule.Event_Notify, (event) => { | ||
| 19 | console.log(event); | ||
| 20 | }); | ||
| 21 | |||
| 22 | // remove | ||
| 23 | notifyListener.remove(); | ||
| 24 | ``` | ||
| 25 | |||
| 26 | ### set measurement listener | ||
| 27 | |||
| 28 | ```js | ||
| 29 | TS28BModule.measure(mac); | ||
| 30 | |||
| 31 | // response | ||
| 32 | notifyListener = DeviceEventEmitter.addListener(TS28BModule.Event_Notify, (event) => { | ||
| 33 | if (event.action === TS28BProfileModule.ACTION_MEASUREMENT_RESULT) { | ||
| 34 | console.log(event[TS28BProfileModule.RESULT]); | ||
| 35 | console.log(event[TS28BProfileModule.UNIT_FLAG]); | ||
| 36 | } | ||
| 37 | }); | ||
| 38 | ``` \ No newline at end of file | ||
