Cutos 设备 SDK
该 SDK 提供了与多种医疗设备的接口,包括身份证读卡器、温度计、身高/体重秤、血压监测仪和打印机。以下是初始化和使用这些设备的步骤和函数说明。
前提条件
需要在本地安装cutos客户端,详情可参考:https://sharing8.yuque.com/sharing8/mc3wxx/yrfxsy71pd0p9gs8
使用方法
$3
await initCoreApi(host, devicesPortConfig);
host: cutos本地客户端的地址, 实机上面是null。
devicesPortConfig: 一个对象,映射设备类型到其对应的 COM 端口。
#### devicesPortConfig参数说明:
temp: 温度计所使用的 COM 端口编号,通常是一个整数,例如 4。
heightWeight: 身高体重秤所使用的 COM 端口编号,通常是一个整数,例如 2。
bp: 血压监测仪所使用的 COM 端口编号,通常是一个整数,例如 10。
$3
1. 身份证读卡器:
``
js
import { readCard } from 'cutos-SDK'
readCard((cardinfo) => {
console.log(cardinfo, 'cardinfo')
})
`
2. 温度计:
`
js
import { fetchTempData } from 'cutos-SDK'
fetchTempData()
.then((res) => {
console.log(res, 'res')
})
.catch((err) => {
console.log(err, 'err')
})
`
3. 身高体重秤:
`
js
import { fetchHeightWeightData } from 'cutos-SDK'
fetchHeightWeightData()
.then((res) => {
console.log(res, 'res')
})
.catch((err) => {
console.log(err, 'err')
})
`
4. 血压监测仪:
`
js
import { fetchBpData } from 'cutos-SDK'
fetchBpData()
.then((res) => {
console.log(res, 'res')
})
.catch((err) => {
console.log(err, 'err')
})
`
5. 打印机:
`
js
import { toPrint } from 'cutos-SDK'
toPrint('打印文件url', '打印机名称', '打印成功回调函数', '打印失败回调函数')
`
6. 设置接口代理
`
js
import { setProxy } from 'cutos-SDK'
setProxy('apiProxy', 'http://127.0.0.1:8888')
`
7. 获取二维码扫描结果
`
js
import { getQrCodeData } from 'cutos-SDK'
getQrCodeData().then((res) => {
console.log('res', res)
})
``