Introduction
@cutos/device-bp-monitor is a JavaScript library that can receive data from cutos blood pressure monitor driver Developers can use this interface to handle blood pressure data when receive
DeviceBpMonitor SDK
Installation
npm install @cutos/device-bp-monitor
Import dependencies
import {DeviceBpMonitor} from '@cutos/device-bp-monitor';
DeviceBpMonitor
Constructor, create DeviceBpMonitor instance
let devBpMonitor = new DeviceBpMonitor();
DeviceBpMonitor.init
blood pressure device initialization
devBpMonitor.init(callback);
- callback: callback function
Example:
devBpMonitor.init((result, error) => {
if (!error) {
console.log('init BpMonitor', result)
} else {
console.log(error)
}
});
DeviceBpMonitor.connect
Connect the device
devBpMonitor.connect(path, callback);
- path: device port
- callback: callback function
Example:
devBpMonitor.connect('/ttyS1', (response) => {
console.log(response)
})
- Return result example:
{
"status": true,
"msg": {
"path": "/ttyS1",
"baudRate": 9600,
"stopBit": 1
}
}
DeviceBpMonitor.onData
listen data from the driver
devBpMonitor.onData(listener);
listener: data process function
Return data example:
{
"type": "result",
"data": {
"bps": 105,
"bpd": 75,
"hr": 85
}
}