Skip to main content

ECG3

API Reference

Import ECG3 module

import {
ECGModule,
ECGProfileModule
} from '@ihealth/ihealthlibrary-react-native';

Add and remove listener

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

// remove
notifyListener.remove();

get all connected devices

ECGModule.getAllConnectedDevices();

start a measurement

ECGModule.startMeasure(mac);

// response
notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => {
if (event.action === ECGModule.ACTION_ELECTRODE_STATUS) {
console.log(event[ECGProfileModule.ELECTRODE_STATUS]);
console.log(event[ECGProfileModule.ERROR_DESCRIPTION_ECG]);
}
});

cancel a measurement

ECGModule.stopMeasure(mac);

get battery

ECGModule.getBattery(mac);

// response
notifyListener = DeviceEventEmitter.addListener(ECGModule.Event_Notify, (event) => {
if (event.action === ECGModule.ACTION_BATTERY_ECG) {
console.log(event[ECGProfileModule.BATTERY_ECG])
}
});

set current time to device

ECGModule.sysTime(mac);