RFID/README.md
2020-01-08 17:41:18 +08:00

75 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#### 乐亭项目RFID读取
**安装方式**
`cordova plugin add https://github.com/shuto-cn/RFID.git`
**相关方法**
- openBlueTooth **打开设备蓝牙**
- 参数
- success 成功回调
- error 失败回调
- 返回值
- success => 蓝牙开启成功
- error => 蓝牙开启失败
- 调用示例
```
rfid.openBlueTooth(success,error);
```
- getBlueToothList **获取蓝牙列表会自动调用openBlueTooth方法**
- 参数
- success 成功回调
- error 失败回调
- 返回值
- success => { message: "", data:[
{"name":"DYD0CZJ895NEL93","address":"3C:F8:62:13:29:B8"} ] }
- error => errorMsg
- 调用示例
```
rfid.getBlueToothList(success,error);
```
- connectBlueTooth **链接某蓝牙**
- 参数
- success 成功回调
- error 失败回调
- address 待链接蓝牙地址
- 返回值
- success => 模块打开成功
- error => 模块打开失败
- 调用示例
```
rfid.connectBlueTooth(success,error,{address: address});
```
- window.sendDataToJs
**注这是一个js方法用于plugin向js发送消息通知更新蓝牙的链接状态**
- 返回值
- {code : 0/1} => 0 链接断开 1 链接正常
- 调用示例
```
window.sendDataToJs = function (data) { }
```
- read
- 参数
- success 成功回调
- error 失败回调
- 返回值
- success => { message: "", data:[ EPClist ] }
- error => errorMsg
- 调用示例
```
rfid.read(success,error);
```
- write
- 参数
- success 成功回调
- error 失败回调
- epc_number 待写入EPC值
- epc_len EPC编码方式16进制 **选填默认0c**
- 返回值
- success => 写入成功
- error => errorMsg
- 调用示例
```
rfid.write(success,error, {epc_number: $scope.input.epc_number});
```