更新记录

3.5(2022-10-31)

适配android12

3.1(2022-06-27)

新增设置读取门禁类型的接口

3.0(2022-05-26)

1.修复清空卡无效的问题

查看更多

平台兼容性

Android Android CPU类型 iOS
适用版本区间:4.4 - 12.0 armeabi-v7a:支持,arm64-v8a:支持,x86:支持 适用版本区间:9 - 15

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


接口函数:

[TOC]

blueToothOpenDoor

[功能] 蓝牙开门接口,返回值详细请参见《附表一》。

[函数] blueToothOpenDoor(JSONObject object, final JSCallback jsCallback);

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

var JsonObj = {
            "appEkey": "",
            "devSn": "",
            "deviceModelValue": "",
            "devMac": ""
        };
const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');

bluetoothModule.blueToothOpenDoor(JsonObj,(res => {
            console.log(JSON.stringify(res));
        }));

getSimstatus

[功能] 获取SIM卡信息。返回值详细请参见《附表一》。

[函数] getSimstatus(JSONObject object, final JSCallback jsCallback);

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

var JsonObj = {
            "appEkey": "",
            "devSn": "",
            "deviceModelValue": "",
            "devMac": ""
        };
const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');

bluetoothModule.getSimstatus(JsonObj,(res => {
            console.log(JSON.stringify(res));
        }));

setServerIP

[功能] 设置设备连接服务器地址,适用于V500等设备。返回值详细请参见《附表一》。

[函数] setServerIP(JSONObject devObject, JSONObject configParam, final JSCallback jsCallback);

[参数说明] devObject: 设备信息,需要包含键(eKey,devSn,devType,devMac)。 configParam: 需要设置的数据,需要包含键(ipAddress,port)。 Callback: 回调函数;

[示例]

var JsonObj = {
            "appEkey": "",
            "devSn": "",
            "deviceModelValue": "",
            "devMac": ""
        };

var configParamJson = {
            "ipAddress": "",
            "port": ,
        };
const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');

bluetoothModule.setServerIP(JsonObj,configParamJson,(res => {
            console.log(JSON.stringify(res));
        }));

configWifi

[功能] 蓝牙配置wifi。返回值详细请参见《附表一》。

[函数] configWifi(JSONObject devObject, JSONObject configParam, final JSCallback jsCallback); [参数说明]

devObject: 设备信息,需要包含键(eKey,devSn,devType,devMac)。 configParam: 需要设置的数据,需要包含键(wifiName,wifiPwd,ipAddress,port)。 Callback: 回调函数;

[示例]

var JsonObj = {
            "appEkey": "",
            "devSn": "",
            "deviceModelValue": "",
            "devMac": ""
        };

var configParamJson = {
            "wifiName": "",
            "wifiPwd": ,
            "ipAddress": "",
            "port": ,
        };
const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');

bluetoothModule.configWifi(JsonObj,configParamJson,(res => {
            console.log(JSON.stringify(res));
        }));

clearFrequencyband

[功能] 清频接口。返回值详细请参见《附表一》。

[函数] clearFrequencyband(JSONObject devObject, final JSCallback jsCallback);

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

        var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
                const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.clearFrequencyband(JsonObj, (res => {
                    console.log(JSON.stringify(res));
                }));

getNBParamInfo

[功能] 获取nb基站各参数

[函数] getNBParamInfo(JSONObject devObject, final JSCallback jsCallback);

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

    var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
                const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.getNBParamInfo(JsonObj, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

setNBUnicomPlatformParams

[功能] 联通nb平台参数配置。返回值详细请参见《附表一》

[函数] setNBUnicomPlatformParams(JSONObject devObject, String unlink_pk, String unlink_devsecret, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); unlink_pk:设备需要配置的unlink_pk; unlink_devsecret:设备需要配置的unlink_devsecret; Callback: 回调函数;

[示例]

    var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };

const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
    bluetoothModule.setNBUnicomPlatformParams(JsonObj, "", "", (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

getNBUnicomPlatfromParams

[功能] 读取联通nb平台参数,返回值详细请参见《附表一》;

[函数] getNBUnicomPlatfromParams(JSONObject devObject, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

    var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
                const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.getNBUnicomPlatfromParams(JsonObj, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

setCPUCardKey

[功能] 配置cpu卡密钥,返回值详细请参见《附表一》。

[函数] setCPUCardKey(JSONObject devObject, String cpuCardkey, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); cpuCardkey: 需要配置的cpu卡密钥 (10位数字 String) Callback: 回调函数;

[示例]


                var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
                const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.setCPUCardKey(JsonObj, "", (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

getCpuCardkey

[功能] 获取cpu卡密钥,返回值详细请参见《附表一》。

[函数] getCpuCardkey(JSONObject devObject, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

        var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
                const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.getCpuCardkey(JsonObj, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

setCardTypeVerifyType

[功能] 设置卡类型及验证方式,返回值详细请参见《附表一》。

[函数] setCardTypeVerifyType(JSONObject devObject, byte cardTypeset, byte verificationMethodset, final JSCallback jsCallback) [参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); cardTypeset:需要设置的卡类型 1:0x01(A卡) 2:0x02(B卡) 3:0x03(AB卡) cardTypeset:需要设置的验证方式 1:0x01(仅卡号) 2:0x02(卡号或扇区密钥) 3:0x03(卡号加扇区密钥) 4:0x04(CPU卡) Callback: 回调函数;

[示例]

        var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
                const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.setCardTypeVerifyType(JsonObj, 0x01, 0x01, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

getCardTypeVerifyType

[功能] 获取卡类型及验证方式,返回值详细请参见《附表一》。

[函数] getCardTypeVerifyType(JSONObject devObject, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
                const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.getCardTypeVerifyType(JsonObj, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

enableAntiCopy

[功能] 开关防复制,返回值详细请参见《附表一》。

[函数] enableAntiCopy(JSONObject devObject, Boolean isenable, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); isenable: 开关防复制,true 为开启,false为关闭。 Callback: 回调函数;

[示例]

var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
        const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.enableAntiCopy(JsonObj, true, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

setWiganOutputparams

[功能] 设置韦根输出参数,返回值详细请参见《附表一》。

[函数] setWiganOutputparams(JSONObject devObject, boolean isreal, boolean issequence, String virtualcard, final JSCallback jsCallback) [参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); isreal:设置卡号模式,true为真实卡号,false为虚拟卡号 issequence:设置韦根输出字节序,true为正序,false为反序 virtualcard:虚拟卡号,当设置卡号模式为虚拟卡号才有效,如设置为真实卡号模式,则传空字符串即可 Callback: 回调函数;

[示例]

        var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
        const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.setWiganOutputparams(JsonObj, false, false, "1234567899", (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

getwiganOutputparams

[功能] 获取韦根输出参数,返回值详细请参见《附表一》。

[函数] getwiganOutputparams(JSONObject devObject, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
                const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.getwiganOutputparams(JsonObj, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

setNormallyOpenclosedmode

[功能] 设置常开常闭模式,返回值详细请参见《附表一》。

[函数] setNormallyOpenclosedmode(JSONObject devObject, Boolean isnormallyopen, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); isnormallyopen: 设置常开常闭模式,true 为常开,false为常闭。 Callback: 回调函数;

[示例]

var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
        const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.setNormallyOpenclosedmode(JsonObj, true, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

getNormallyOpenclosedmode

[功能] 获取常开常闭模式,返回值详细请参见《附表一》。

[函数] setNormallyOpenclosedmode(JSONObject devObject, Boolean isnormallyopen, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.getNormallyOpenclosedmode(JsonObj, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

setDeviceStaticIP

[功能] 配置设备IP地址。返回值详细请参见《附表一》。

[函数] setDeviceStaticIP(JSONObject devObject, JSONObject configParam, final JSCallback jsCallback); [参数说明]

devObject: 设备信息,需要包含键(eKey,devSn,devType,devMac)。 configParam: 需要设置的数据,需要包含键(dhcpEnable,staticIP,gateway,subnetMask,subnetdnsServerMask)。 Callback: 回调函数;

[示例]

var JsonObj = {
            "appEkey": "",
            "devSn": "",
            "deviceModelValue": "",
            "devMac": ""
        };

var configParamJson = {
            "dhcpEnable": ,
            "staticIP": ,
            "gateway": "",
            "subnetMask": "",
            "subnetdnsServerMask":"" 
        };
const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');

bluetoothModule.setDeviceStaticIP(JsonObj,configParamJson,(res => {
            console.log(JSON.stringify(res));
        }));

setReadSectorKey

[功能] 配置读卡扇区密钥。返回值详细请参见《附表一》。

[函数] setReadSectorKey(JSONObject devObject, JSONObject configParam, final JSCallback jsCallback) [参数说明]

devObject: 设备信息,需要包含键(eKey,devSn,devType,devMac)。 configParam: 需要设置的数据,需要包含键(devId,mifareSector,sectorKey)。 Callback: 回调函数;

[示例]

var JsonObj = {
            "appEkey": "",
            "devSn": "",
            "deviceModelValue": "",
            "devMac": ""
        };

var configParamJson = {
            "devId": ,
            "mifareSector": ,
            "subnetdnsServerMask":"" 
        };
const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');

bluetoothModule.setReadSectorKey(JsonObj,configParamJson,(res => {
            console.log(JSON.stringify(res));
        }));

getDeviceConfig

[功能] 获取设备系统信息,返回值详细请参见《附表一》。

[函数] getDeviceConfig(JSONObject devObject, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.getDeviceConfig(JsonObj, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

getCardNumbersFromDevice

[功能] 读取设备卡号,返回值详细请参见《附表一》。

[函数] getCardNumbersFromDevice(JSONObject devObject, final JSCallback jsCallback)

[参数说明] object: 设备信息,需要包含键(eKey,devSn,devType,devMac); Callback: 回调函数;

[示例]

var JsonObj = {
                    "appEkey": "",
                    "devSn": "",
                    "deviceModelValue": "",
                    "devMac": ""
                };
const bluetoothModule = uni.requireNativePlugin('DoorMaster-Bluetooth-Plugin');
                bluetoothModule.getDeviceConfig(JsonObj, (res => {
                    // callback(res);
                    console.log(JSON.stringify(res));
                }));

三. 附录 附表一

返回值 返回值说明
通信返回值类
0 操作成功
1 CRC校验错误
2 通信命令格式错误
3 设备管理密码错误
4 ERROR_POWER(仅适用于锁)
5 数据读写错误
6 用户未注册在设备中
7 随机数检测错误
8 获取随机数错误
9 命令长度不匹配
10 未进入添加设备模式
11 devKey检测错误
12 功能不支持
13 容量超过限制
48 通信连接超时
49 蓝牙服务未发现
50 通信数据长度错误,重新添加
51 接受数据为空
52 命令解析错误
53 未获取到随机数
54 未获取到配置子命令
55 未获取数据操作子命令
参数设置返回值
-1 卡号为空
-2 Sn为空
-3 Mac为空
-4 E-Key为空
-5 设备类型为空
-6 设备权限为空
-7 开门方式值错误
-8 验证方式值错误
-9 起始时间格式错误
-10 冻结时间格式错误
-11 使用次数未设置
-12 值未定义
-13 operation 其他功能未开放
-14 非法时间开门,即不在有效期内开门错误
-15 超过设置的开门距离
-16 韦根格式错误,当前仅支持26和34
-17 开门时长值范围错误,仅支持 1-254秒
-18 电器开关参数值错误,仅支持 0电锁控制,1电器开关
-19 密码必须为6位数字
-20 卡号列表不能为空
-21 卡号写入设备,每次不能大于200张卡
-22 扇区密钥必须是16进制字符串,并且长度为12
-23 设备编号范围只能是0-255
-24 卡扇区编号范围只能是 0-15
-25 scanTime 参数不能为空
-41 device不能为null
-42 context不能为null
-43 Device 过期
-44 Device未到使用时间
其余错误返回值
-100 不支持BLE
-101 BLE未打开
-102 指定的SN不存在
-103 蓝牙通信返回值为空
-104 开门失败
-105 设备未反应
-106 设备不在附近
-107 设备正在操作中
-108 sec扫描时间单位错误
-109 设置扫描秒数超出范围
-110 设备已经存在超级用户,必须先初始化设备才能添加设备
-111 设备MAC地址错误
-112 使用蓝牙扫描太频繁(Android 7.0 的限制)
-113 EID连接失败
-114 登录失败
-115 CRC校验失败
-116 命令ID不匹配
-117 用户ID错误
-118 一键开门设备权限为空
-119 一键开门未扫描到任何设备
-120 一键开门匹配不到有权限的设备
-121 扫描设备缺少定位权限
-122 扫描设备缺少定位权限且拒绝不再询问

隐私、权限声明

1. 本插件需要申请的系统权限列表:

蓝牙,定位(andorid6.0以上蓝牙操作需要定位权限),附近的设备(android12需要)

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

作者未提供license.md

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问