summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/doc/nt13b.md
blob: 6fd45eebbdda2fcdc39e9f3ca0dc3f5ff16b960e (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
# NT13B Workflow

## Import NT13B Module

```js
import {
  NT13BModule,
  NT13BProfileModule
} from '@ihealth/ihealthlibrary-react-native';
```

## APIs

### Add and remove listener

```js
// add
notifyListener = DeviceEventEmitter.addListener(NT13BModule.Event_Notify,  (event) => {
    console.log(event);
});

// remove
notifyListener.remove();
```

### set measurement listener

```js
NT13BModule.measure(mac);

// response
notifyListener = DeviceEventEmitter.addListener(NT13BModule.Event_Notify,  (event) => {
    if (event.action === NT13BProfileModule.ACTION_MEASUREMENT_RESULT) {
        console.log(event[NT13BProfileModule.RESULT]);
        console.log(event[NT13BProfileModule.UNIT_FLAG]);
    } 
});
```