@cutos/device-height-weight-scale is a JavaScript library that provides a unified interface for interacting with medical-grade height and weight measurement devices.
npm install @cutos/device-height-weight-scale@cutos/device-height-weight-scale is a JavaScript library that provides a unified interface for interacting with
medical-grade height and weight measurement devices.
npm install @cutos/core
npm install @cutos/device-height-weight-scale
``js`
import {CoreAPI} from '@cutos/core';
import {DeviceHeightWeightScale} from '@cutos/device-height-weight-scale';
Constructor, create height weight scale device instance
`js`
let devHeightWeightScale = new DeviceHeightWeightScale(name);
* name: Height weight scale device name
##### Example:
`js`
devHeightWeightScale = new DeviceHeightWeightScale('device-height-weight-scale');
Height weight scale device initialization
`js`
devHeightWeightScale.init(callback);
* callback: callback function
##### Example:
`js`
devHeightWeightScale.init((result, error) => {
if (!error) {
console.log('onDeviceCreate', result)
} else {
console.log(error)
}
});
Connect height weight scale
`js`
devHeightWeightScale.connect(path, callback);
* path: height weight scale port
* callback: callback function
##### Example:
`js`
devHeightWeightScale.connect('/ttyS1', (response) => {
console.log(response)
});
- Return response example:
`json`
{
"status": true,
"msg": "already connected"
}
Get height weight data
`js`
devHeightWeightScale.getHeightWeight(callback)
* callback: callback function
Switch on device
`js`
devHeightWeightScale.switchOn(callback)
* callback: callback function
Switch off device
`js``
devHeightWeightScale.switchOff(callback)
* callback: callback function