npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@neuqsoft/integrated-machine-jssdk

v2.0.0

Published

设备相关接口声明

Readme

integrated-machine-jssdk

设备相关接口声明

引入方式

  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'
}

jna-jssdk.min.js 应有 device 并包含 以下方法

'getIDCard,closeIDCard,getSICard,closeSICard,getNumLock,closeNumLock,lightControl,closeLight,getPrinterList,printer,getPrintQueue,getNetworkAddr'

window.device = {
    getIDCard,
    ...
}

如果需要初始化

可在 device.init 中设置初始内容

window.device = {
	init() {
		// do something
	}
}   

device 包含的方法及使用

身份证读卡器

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:港澳台居住证 | |

调用示例

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 打印机 | | 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 | | 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
  }
})

高拍仪

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
  }
})

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

| 属性 | 类型 | 默认值 | 是否必填 | 说明 | | -------- | -------- | ------ | -------- | ---------------------- | | 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({
  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
  }
})