cordova-plugin-zijinutil-aisino
v0.0.27-5
Published
a cordova plugin for aisino device
Downloads
75
Readme
ZijinUtil-PhoneGap-Plugin
该版本插件主要适配航天信息的普通手持机
发布版本的时候请注意: 本分支分布的版本都为“预发布版本”,且以0.0.27开头。
npm version prerelease
npm publish --access=public
代码开发完成后,运行
npm run updatePlugin
发布新版本
建议发布版本前,到npm(https://www.npmjs.com/package/cordova-plugin-zijinutil-aisino) 上面看看本项目的最新版本是多少
插件安装
- 使用 git clone 命令将该项目下载到本地
- 使用 ionic cordova plugin add <cordova-plugin的路径> 安装插件
插件使用
条码扫描插件功能
1. 开启扫码模块,通过侧边按键方式触发扫码,并监听扫码返回的结果
zijinUtil.openScanReceiver().subscribe(barcode => {
console.log(`扫码结果:${barcode}`);
}, err => {
console.log(`扫码失败:${err}`);
});
2. 通过代码调用方式触发扫码,并监听扫码返回的结果
zijinUtil.scanBarcode().then(barcode => {
console.log(`扫码结果:${barcode}`);
}).catch(err => {
console.log(`扫码失败:${err}`);
});
3. 关闭条码扫描模块,并取消对扫码返回结果的监听
zijinUtil.closeScanReceiver();
UHF超高频电子标签扫描插件功能
1. 初始化UHF扫描模块
zijinUtil.openUHF().then(result => {
// UHF 模块开启成功
}).catch(err => {
// UHF 模块开启失败
});
2. 设置读标签的功率(功率范围:500~3000)
zijinUtil.setOutputPower(2800).then(result => {
// 标签读取功率设置成功
}).catch(err => {
// 标签读取功率设置失败
});
3. 开始盘点
zijinUtil.startInventoryReal().subscribe(epc => {
// epc的值为json数组,数据格式为:['AB001354','AB001355',...]
console.log(epc);
}, err => {
console.log(err);
});
4. 关闭UHF模块
zijinUtil.closeUHF();
以上 1-4 步为插件使用的基本流程。注意应当根据具体业务的应用场景来设置 UHF 的读取功率,以控制设备对 UHF 电子标签的读取距离。
注意
- 在 Ionic 中使用本插件时,应根据 Angular 组件的生命周期方法,在不需要使用插件功能时应及时进行插件的关闭和资源释放。以减少设备不必要的电量消耗。
- 在新增的应用内版本升级的功能中由于使用了自定义的Dialog布局,需要通过R类去索引资源的路径。插件中R类引入的路径为ionic默认创建时的包名称(io.ionic.starter),如果在发布apk时有修改包名的业务需求,则需同步修改平台代码(platforms/android)下的AppUpdatePlugin.java所引入R类的路径地址。
import io.ionic.starter.R;