npm.io
2.10.0-A-7800S.13 • Published 1 year ago

@neuqsoft/jna-jssdk

Licence
MIT
Version
2.10.0-A-7800S.13
Deps
1
Size
647 kB
Vulns
0
Weekly
0

jna-jssdk

  • 设备相关 API

引入方式

  1. script

<script src="./integrated-machine-jssdk.js"></script>
<script>
    const JsInterface = window['@neuqsoft/integrated-machine-jssdk']
</script>
  1. import
npm install @neuqsoft/integrated-machine-jssdk
import JsInterface from '@neuqsoft/integrated-machine-jssdk'

sdk接口声明

let device = new JsInterface.SDKInterface()

sdk 实现注入

// 获取URL:env 参数
const envUrl = JsInterface.getUrlParam('env')
// 获取配置文件
JsInterface.getDeviceJsSDK({
    URL: envUrl,
    success: ({config, device: _device}) => {
        // 获取 机器配置信息 config/window.DEVICE_CONFIG
        this.device_config = config || window.DEVICE_CONFIG || {}
        // 执行接口注入
        device = _device || window.device || device
    },
    fail: err => {
    	console.log(err);
    }
})

envUrl 为 env.js 的链接地址 env.js 应至少包含 vender 厂商名称, JSSdkUrl jssdk文件地址 两项

window.DEVICE_CONFIG = {
	vender: '测试厂商A',
	JSSdkUrl: 'http://10.19.92.216:8080/jna-jssdk.min.js'
}

一体机本机配置设置

getConfig

获取一体机配置信息

调用方式

device.getConfig(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:Json

调用示例
device.getConfig({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
setConfig

设置一体机配置信息

调用方式

device.setConfig(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
data Object - 要设置的配置键值对
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.setConfig({
    data: {aaa: "aaavalue", bbb: 'bbbvalue'},
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

获取广播内容

listenAiring

监听广播

调用方式

device.listenAiring(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:Json

调用示例
device.listenAiring({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
removeListenAiring

移除监听广播

调用方式

device.removeListenAiring(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 -
ok 成功状态 成功为 true true
调用示例
device.removeListenAiring({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

身份证读卡器

getIDCard

获取身份证信息

调用方式

device.getIDCard(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:

参数 是否必填 描述 备注 示例
name 姓名
sex 性别
nationality 民族
birthday 生日
address 地址
idcard 身份证号
issue 签发机关
startDate 发卡日期
endDate 卡有效期
passNumber 通行证号码
signTimes 签发次数
certType 证件类型 I:外国人 J:港澳台居住证
pic 照片数据 base64文件流
调用示例
device.getIDCard({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeIDCard

关闭身份证读卡器

调用方式

device.closeIDCard(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
isvoice string -
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeIDCard({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

社保卡读卡器

getSICard

获取社保卡信息

调用方式

device.getSICard(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:

参数 是否必填 描述 备注 示例
cardNo 社保卡号
idcard 身份证号
name 姓名
sex 性别
nationality 民族
birthday 生日
type 卡类型 2-二代卡;3-三代卡
调用示例
device.getSICard({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeSICard

关闭社保卡读卡器

调用方式

device.closeSICard(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeSICard({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

数字密码键盘

getNumLock

获取数字键盘输入信息

调用方式

device.getNumLock(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:(int : 输入键子,如按键按下1,返回值为标准键盘输入1的keyenter值49)

调用示例
device.getNumLock({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeNumLock

关闭数字键盘

调用方式

device.closeNumLock(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeNumLock({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

灯控

lightControl

控制灯光

调用方式

device.lightControl(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
light String - 编号 1 社保卡 2 身份证 3 打印机 4 银行卡 5 激光打印
state String - 状态 0 常亮 1 闪烁 2 关闭
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.lightControl({
    light: '1',
    state: '1',
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeLight

关闭灯光

调用方式

device.closeLight(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeLight({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

打印机

getPrinterList

获取打印机名称列表

调用方式

device.getPrinterList(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true

data 响应数据:(JsonArray)

参数 是否必填 描述 备注 示例
printerName 打印机名称
调用示例
device.getPrinterList({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
printer

打印文件

调用方式

device.printer(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
printerType String - printerType 与 printerName 二选一 打印机类型:热敏打印机:thermalPrinter, A4打印机: A4Printer, A3打印机: A3Printer
printerName String - printerType 与 printerName 二选一 打印机名称
fileType String - 文件类型: 图片格式 jpg,PDF格式 pdf,OFD格式 ofd
fileData String - 编码后的文件流:Base64字符串
pageFormat String - 类型为ofd时必填,其他不填 文件方向:横向0 ,纵向1
size String - 纸张类型: A3纸张打印3, A4纸张打印 4, A5纸张打印 5
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.printer({
    printerName: "Microsoft Print to PDF",
    fileType: 'jpg',
    fileData: "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAIAAAA8r+mnAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAEXRFWHRTb2Z0d2FyZQBTbmlwYXN0ZV0Xzt0AAAAUSURBVAiZY/z//z8DNsCEVZQsCQAm3QMFLDQKIgAAAABJRU5ErkJggg==",
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
getPrintQueue

获取打印队列

调用方式

device.getPrintQueue(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
printerName String - 打印机名称
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true

data 响应数据:(Json)

参数 是否必填 描述 备注 示例
queue 打印机队列数
调用示例
device.getPrintQueue({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

设备地址

getNetworkAddr

获取设备地址

调用方式

device.getNetworkAddr(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true

data 响应数据:

参数 是否必填 描述 备注 示例
mac 本机MAC地址
ipv4 本机IPV4地址
调用示例
device.getNetworkAddr({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
getDeviceInfo

获取设备信息

调用方式

device.getDeviceInfo(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true

data 响应数据:

参数 是否必填 描述 备注 示例
deviceId 机器id 没有获取到设备ID时返回null
deviceModel 机器类型
调用示例
device.getDeviceInfo({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

键盘输入(屏幕键盘)

openKeyboard

获取键盘输入

调用方式

device.openKeyboard(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
value String - 编辑的文本原始值
type String string 键盘类型: string为全键盘,idCard为身份证键盘,number为数字键盘
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:String

调用示例
device.openKeyboard({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeKeyboard

关闭键盘输入

调用方式

device.closeKeyboard(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
value String - 编辑的文本原始值
type String string 键盘类型: string 全键盘
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeKeyboard({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
getHighCameraUri

获取高拍仪实时视频流(实时图片地址)

调用方式

device.getHighCameraUri(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:Object object

参数 是否必填 描述 备注 示例
imgUri 视频流接口地址 https://localhost/highstream/video=stream&camidx=0?1666233563588
调用示例
device.getHighCameraStream({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
getHighCameraStream

获取高拍摄像头视频流(需要主动调用关闭高拍)

调用方式

device.getHighCameraStream(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
width Number - 分辨率宽
height Number - 分辨率高
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:MediaStream stream

调用示例
device.getHighCameraStream({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
getHighCameraResolvingPowerList

获取高拍分辨率

调用方式

device.getHighCameraResolvingPowerList(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

参数 String data:

4208*3120|3264*2448|2592*1944|2048*1536|1920*1080|1600*1200|1280*960|1280*720|640*480

调用示例
device.getHighCameraResolvingPowerList({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
setHighCameraResolvingPower

设置高拍分辨率

调用方式

device.setHighCameraResolvingPower(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
width String - 设置分辨率宽(例:4208)
height String - 设置分辨率高(例:3120)
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.setHighCameraResolvingPower({
    width: "4208",
    height: "3120",
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
highCameraControl

高拍控制

调用方式

device.highCameraControl(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
imageCorrection String - 纠偏: 'open' 开启, 'close' 关闭
rotate String - 旋转:左旋 'left', 右旋 'right'
a3a4switch Function - A3A4幅面自动切换:'open' 开启, 'close' 关闭
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.highCameraControl({
    imageCorrection: 'open',
    rotate: 'left',
    a3a4switch: 'open',
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
getHighCamera

获取高拍照片(需要主动调用关闭高拍)

调用方式

device.getHighCamera(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
timeout Number 3000 获取高拍图片主动延时时长,单位毫秒,为0时不主动延时
width String - 图片宽 (例:4208)
height String - 图片高 (例:3120)
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:

参数 是否必填 描述 备注 示例
filename 图片文件名
file 图片文件(Base64编码)

file示例

/9j/4AAQSkZJRgABAQEAYABgAAD//gAUU29mdHdhcmU6IFNuaXBhc3Rl/9sAQwADAgIDAgIDAwMDBAMDBAUIBQUEBAUKBwcGCAwKDAwLCgsLDQ4SEA0OEQ4LCxAWEBETFBUVFQwPFxgWFBgSFBUU/9sAQwEDBAQFBAUJBQUJFA0LDRQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAAQABAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A/VOiiigD/9k=
调用示例
device.getHighCamera({
    timeout: 0,
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeHighCamera

关闭高拍仪

调用方式

device.closeHighCamera(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeHighCamera({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

摄像头

getVideoCamera

获取摄像头视频流

调用方式

device.getVideoCamera(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
type String color 摄像头类型:彩色 color,黑白 infrared, 双目 double
width Number 640 分辨率宽
height Number 480 分辨率高
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据彩色视频 见下文
dataInfrared 响应数据黑白视频 见下文
ok 成功状态 成功为 true true

data 响应数据:MediaStream stream

dataInfrared 响应数据:MediaStream stream

调用示例
device.getVideoCamera({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
switchFaceFlag

人脸设别框开关

调用方式

device.switchFaceFlag(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
power String open 开关标志:开启open, 关闭 close
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.switchFaceFlag({
    power: "open",
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeVideoCamera

关闭摄像头

调用方式

device.closeVideoCamera(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeVideoCamera({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
getDoubleCamera

获取双目摄像头照片

调用方式

device.getDoubleCamera(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
mode String picture 模式:只获取图片picture, 进行活体检测 checkLiving
cameraIndex String 0 图片选择,mode为picture时生效, 彩色0, 黑白1
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 见下文
ok 成功状态 成功为 true true

data 响应数据:

参数 是否必填 描述 备注 示例
filenameIr 红外图片文件名
fileIr 红外base64图片流 活体检测使用的黑白图片
filenameVl 彩色图片文件名
fileVl 彩色base64图片流 活体检测使用的彩色图片
living 活体检测结果 "true"-活体检测通过;"false"-活体检测不通过;"none"-未进行活体检测
调用示例
device.getDoubleCamera({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeDoubleCamera

关闭双目摄像头

调用方式

device.closeDoubleCamera(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeDoubleCamera({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

播放声音

voiceBroadcast

文字朗读

调用方式

device.voiceBroadcast(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
word String - 朗读的文字
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.voiceBroadcast({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeVoice

关闭文字朗读

调用方式

device.closeVoice(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeVoice({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

发送消息到其他屏幕

openMsgConnection

建立通信链接

调用方式

device.openMsgConnection(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.openMsgConnection({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
sendMsgToOtherScreen

发送消息到其他屏幕

调用方式

device.sendMsgToOtherScreen(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
msg Object - 详见msg
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数

参数 Object msg

属性 类型 默认值 是否必填 说明
eventId String - 事件id(来自业务申请)
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.sendMsgToOtherScreen({
    msg: {
        "eventId": "ksy_def1"
    },
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeMsgConnection

关闭通信链接

调用方式

device.closeMsgConnection(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeMsgConnection({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

社保卡制卡

openCardPrinting

打开制卡机

调用方式

device.openCardPrinting(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.openCardPrinting({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
beginCardPrinting

开始制卡

调用方式

device.beginCardPrinting(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
idcard String - 身份证号(密文)
name String - 姓名(密文)
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.beginCardPrinting({
    idcard: "5dd549fe7549af78b007579245932d4dce287ffdb9ec82c72817a1c60523d85b",
    name: "201cc41ea53a04bc714ec0d628a8314a",
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closeCardPrinting

关闭制卡机

调用方式

device.closeCardPrinting(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closeCardPrinting({
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
getCardPrintingInfo

获取制卡机信息

调用方式

device.getCardPrintingInfo(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
keys string[] - 信息的键列表【设备ID:ReaderDevID,设备密码:ReaderDevPwd,地域编码:AreaCode,银行网点代码:BankCode】
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.getCardPrintingInfo({
    keys: ["ReaderDevID", "ReaderDevPwd"],
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
getInvoke

获取启用接口列表

调用方式

device.getInvoke(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
参数说明:
名称 接口说明 备注
bankcard 银行卡读卡器
humanInduction 人体感应器
idcard 身份证读卡器
light 灯控
pinpad 数字密码键盘
print 打印
printer-device 打印机设备 仅x64 jna启用
receiptPrint 热敏打印 仅x64 jna启用
screen 双屏互动
sicard 社保卡读卡器
sicard-make 社保卡制卡
调用示例
device.getCardPrintingInfo({
    keys: ["ReaderDevID", "ReaderDevPwd"],
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

就诊卡制卡

getPatientCardInfo

就诊卡读卡

调用方式

device.getPatientCardInfo(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
decodeType "GBK" | "UTF-8" | "RC5-EN" | "RC5-ZH" - 解码方式
hex boolean false 就诊卡信息是否以16进制返回
params {addr: number; keyType: 96 | 97; password: string;} - 就诊卡请求参数
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 "4321"
ok 成功状态 成功为 true true
调用示例
device.getPatientCardInfo({
    decodeType: "RC5-ZH",
    hex: false,
    params: {"addr": 28, "keyType": 96, "password": "ffffffffffff"},
    success: (res) => {
        // hex(true)  {"code":"00000","message":"OK","data":"D5C5C8FD000000000000000000000000","ok":true}
        // hex(false) {"code":"00000","message":"OK","data":"张三","ok":true}
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
setPatientCardInfo

就诊卡写卡

调用方式

device.setPatientCardInfo(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
decodeType "GBK" | "UTF-8" | "RC5-EN" | "RC5-ZH" - 解码方式
hex boolean false 就诊卡信息是否以16进制写入
params {addr: number; keyType: 96 | 97; password: string; data: string} - 就诊卡请求参数
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.setPatientCardInfo({
    decodeType: "RC5-ZH",
    hex: false,
    params: {"addr": 28, "keyType": 96, "password": "ffffffffffff", "data": "张三"},
    success: (res) => {
        // {"code":"00000","message":"OK","data":null,"ok":true}
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closePatientCard

关闭就诊卡读卡器

调用方式

device.closePatientCard(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closePatientCard({
    success: (res) => {
        // {"code":"00000","message":"OK","data":null,"ok":true}
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})
closePatientCard

关闭就诊卡读卡器

调用方式

device.closePatientCard(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据
ok 成功状态 成功为 true true
调用示例
device.closePatientCard({
    success: (res) => {
        // {"code":"00000","message":"OK","data":null,"ok":true}
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

热敏打印

thermalPrint

热敏打印

调用方式

device.thermalPrint(Object object)

参数 Object object
属性 类型 默认值 是否必填 说明
printerName string - d打印机名称
printInfoList PrintInfoItem[] - 打印信息列表, PrintInfoItem详见下表
type "58" | "80" - 纸张类型 "58" 或 "80"
adapt boolean - 是否自适应
height string - 高度 “130”
success Function - 接口调用成功的回调函数
fail Function - 接口调用失败的回调函数
complete Function - 接口调用结束的回调函数
参数 Object PrintInfoItem
属性 类型 默认值 是否必填 说明
content string - 打印内容
fontSize number - 字体大小
drawX number - 起始x轴
drawY number - 起始y轴
targetType "text" | "qrCode" - text: 打印文本;qrCode: 打印二维码
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 null
ok 成功状态 成功为 true true
调用示例
device.thermalPrint({
    "printerName": "POS80",
    "printInfoList": [
        {
            "content": "测试打印字符串",
            "fontSize": 12,
            "drawX": 0,
            "drawY": 10,
            "targetType": "text"
        },
        {
            "content": "测试打印二维码内容",
            "fontSize": 12,
            "drawX": 52,
            "drawY": 15,
            "targetType": "qrCode"
        }
    ],
    "type": "58",
    "adapt": false,
    "height": "130",
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

日志打印

printLog

日志打印

调用方式

device.printLog(Object)

参数 Object
属性 类型 默认值 是否必填 说明
clientSign string - 目录名
logContent string - 日志内容
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 null
ok 成功状态 成功为 true true
调用示例
const data = {clientSign:'',logContent:''}
device.printLog({
    data,
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

国家医保电子凭证业务标准动态库

gjybdzpzPrint

调起国家医保电子凭证业务标准动态库

调用方式

device.gjybdzpzPrint(String,Object)

参数 Object
属性 类型 默认值 是否必填 说明
strUrl string - /
inData object - /
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 null
ok 成功状态 成功为 true true
调用示例
device.gjybdzpzPrint({
    strUrl: this.strUrl,
    inData: this.inData,
    success: (res) => {
        const response = res
    },
    fail: (err) => {
        const error = err
    }
})

北京医保

callBeijingYb

调用北京医保接口

调用方式

device.callBeijingYb(String,Object)

参数 Object
属性 类型 默认值 是否必填 说明
methodName string - 北京医保函数名称(和北京医保接口文档保持一致)
params string - 北京医保入参(xml,详见北京医保接口文档)
回调函数 Function object['success' | 'fail'](Object res)
参数 Object res:
参数 是否必填 描述 备注 示例
code 错误码 成功为 00000 00000
message 错误信息 成功为 OK OK
data 响应数据 null
ok 成功状态 成功为 true true
调用示例
device.callBeijingYb({
    // methodName: "Open",
    methodName: "test",
    // methodName: "GetPersonInfo_Multimedia",
    params: parm,
    success: (res) => {
        if (res.code==="00000") {
            const result = JSON.parse(res.data)
            const warning = result.state.warning
            const information = result.state.information

            let warnInfos = this.handleInfo(warning)
            let informationInfos = this.handleInfo(information)
            if (warnInfos.length > 0) {
                alert(warnInfos.join("\n"))
            }
            if (informationInfos.length > 0) {
                alert(informationInfos.join("<br><br>"))
            }
            console.log("北京医保返回warnInfo:",warnInfos )
            console.log("北京医保返回information:",informationInfos )
            const success = result.state["@success"]
            if (success === "true") {
                let output = result.output
                console.log("北京医保返回output:",output )
            }else {
                const error = result.state.error
                let errorInfos = this.handleInfo(error)
                console.log("北京医保返回errorInfo:",errorInfos )
                if (errorInfos.length > 0) {
                    alert(errorInfos.join("\n"))
                }
            }
        }else {
            console.log("北京医保返回失败",res.message )
        }
    },
    fail: (err) => {
        const error = err
    }
})