blob: 0b1a5accd3c3f424ecc9215a2a40e6d0e37fb7d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# TS28B Workflow
## Import TS28B Module
```js
import {
TS28BModule,
TS28BProfileModule
} from '@ihealth/ihealthlibrary-react-native';
```
## APIs
### Add and remove listener
```js
// add
notifyListener = DeviceEventEmitter.addListener(TS28BModule.Event_Notify, (event) => {
console.log(event);
});
// remove
notifyListener.remove();
```
### set measurement listener
```js
TS28BModule.measure(mac);
// response
notifyListener = DeviceEventEmitter.addListener(TS28BModule.Event_Notify, (event) => {
if (event.action === TS28BProfileModule.ACTION_MEASUREMENT_RESULT) {
console.log(event[TS28BProfileModule.RESULT]);
console.log(event[TS28BProfileModule.UNIT_FLAG]);
}
});
```
|