2.0.5 • Published 9 months ago

cutos-sdk v2.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Cutos 设备 SDK

该 SDK 提供了与多种医疗设备的接口,包括身份证读卡器、温度计、身高/体重秤、血压监测仪和打印机。以下是初始化和使用这些设备的步骤和函数说明。

前提条件

需要在本地安装cutos客户端,详情可参考:https://sharing8.yuque.com/sharing8/mc3wxx/yrfxsy71pd0p9gs8

使用方法

1. 初始化

await initCoreApi(host, devicesPortConfig); host: cutos本地客户端的地址, 实机上面是null。 devicesPortConfig: 一个对象,映射设备类型到其对应的 COM 端口。

devicesPortConfig参数说明:

temp: 温度计所使用的 COM 端口编号,通常是一个整数,例如 4。 heightWeight: 身高体重秤所使用的 COM 端口编号,通常是一个整数,例如 2。 bp: 血压监测仪所使用的 COM 端口编号,通常是一个整数,例如 10。

2.方法调用

  1. 身份证读卡器:
import { readCard } from 'cutos-SDK'
readCard((cardinfo) => {
  console.log(cardinfo, 'cardinfo')
})
  1. 温度计:
import { fetchTempData } from 'cutos-SDK'
fetchTempData()
  .then((res) => {
    console.log(res, 'res')
  })
  .catch((err) => {
    console.log(err, 'err')
  })
  1. 身高体重秤:
import { fetchHeightWeightData } from 'cutos-SDK'
fetchHeightWeightData()
  .then((res) => {
    console.log(res, 'res')
  })
  .catch((err) => {
    console.log(err, 'err')
  })
  1. 血压监测仪:
import { fetchBpData } from 'cutos-SDK'
fetchBpData()
  .then((res) => {
    console.log(res, 'res')
  })
  .catch((err) => {
    console.log(err, 'err')
  })
  1. 打印机:
import { toPrint } from 'cutos-SDK'
toPrint('打印文件url', '打印机名称', '打印成功回调函数', '打印失败回调函数')
  1. 设置接口代理
import { setProxy } from 'cutos-SDK'
setProxy('apiProxy', 'http://127.0.0.1:8888')
  1. 获取二维码扫描结果
import { getQrCodeData } from 'cutos-SDK'
getQrCodeData().then((res) => {
  console.log('res', res)
})
2.0.5

9 months ago

2.0.4

9 months ago

2.0.3

9 months ago

2.0.2

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.0.0

9 months ago