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