diff options
Diffstat (limited to 'libs/ihealth-sdk/doc/ts28b.md')
| -rw-r--r-- | libs/ihealth-sdk/doc/ts28b.md | 38 |
1 files changed, 38 insertions, 0 deletions
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 | ||
