Files
obsidian_note/各种项目/光交锁/智能锁-Android API文档.md
2025-12-04 09:12:56 +08:00

359 lines
28 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
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.
| <font style="color:rgb(51, 51, 51);">版本记录</font> | <font style="color:rgb(51, 51, 51);">时间</font> | <font style="color:rgb(51, 51, 51);">修改者</font> | <font style="color:rgb(51, 51, 51);">日志</font> |
| :---: | :---: | :---: | :---: |
| <font style="color:rgb(51, 51, 51);">1.0.0</font> | <font style="color:rgb(51, 51, 51);">2025.01.07</font> | <font style="color:rgb(51, 51, 51);">陈强</font> | <font style="color:rgb(51, 51, 51);">初版</font> |
| <font style="color:rgb(51, 51, 51);">1.1.0</font> | <font style="color:rgb(51, 51, 51);">2025.02.08</font> | <font style="color:rgb(51, 51, 51);">陈强</font> | <font style="color:rgb(51, 51, 51);">移除部分描述</font> |
<h2 id="4b954e6d"><font style="color:rgb(0, 0, 0);">1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">前言</font>**</h2>
<font style="color:rgb(51, 51, 51);">针对现在公司现有的光交锁产品进行功能合并和兼容处理包含NFC、蓝牙读写器、蓝牙锁、USB锁等四种方式。</font>
<h2 id="1f6ee72f"><font style="color:rgb(0, 0, 0);">2.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">流程图</font>**</h2>
![](https://cdn.nlark.com/yuque/0/2025/png/600469/1736320210281-7cf87e30-06dc-4307-8a67-04bfc26d9217.png)
<h2 id="7fadd862"><font style="color:rgb(0, 0, 0);">3.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">配置</font>**</h2>
<h4 id="a285d945"><font style="color:rgb(0, 0, 0);">3.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">密钥、appID申请</font>**</h4>
<font style="color:rgb(51, 51, 51);">使用本SDK之前请开发联系商务并提供app的包名以便获取appID和密钥后续激活SDK使用</font>
<h4 id="b8ba0858"><font style="color:rgb(0, 0, 0);">3.2.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">权限配置</font>**</h4>
```java
<!-- 低版本蓝牙权限兼容 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- 蓝牙操作权限 -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!-- Android11及以上需补充以下权限 -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<!--NFC权限-->
<uses-permission android:name="android.permission.NFC" />
<uses-feature
android:name="android.hardware.nfc"
android:required="true" />
<!--USB权限-->
<uses-feature android:name="android.hardware.usb.host" />
<uses-permission android:name="android.permission.USB_PERMISSION" />
```
<h3 id="inchN">3.3. 开锁密码</h3>
开锁时需要对应的密码集成SDK时建议做好密码管理。开锁时传入对应的密码。
<h2 id="fad055a2"><font style="color:rgb(0, 0, 0);">4.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">参数说明</font>**</h2>
<h4 id="cb5b8a2b"><font style="color:rgb(0, 0, 0);">4.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">接口数据采用Map集合</font>**</h4>
| <font style="color:rgb(51, 51, 51);">键key</font> | <font style="color:rgb(51, 51, 51);">值value)</font> | <font style="color:rgb(51, 51, 51);">类型</font> | <font style="color:rgb(51, 51, 51);">备注</font> |
| :---: | :---: | :---: | :---: |
| <font style="color:rgb(51, 51, 51);">lockStatus</font> | <font style="color:rgb(51, 51, 51);">1或0</font> | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">1开启</font><br/><font style="color:rgb(51, 51, 51);">0关闭</font> |
| <font style="color:rgb(51, 51, 51);">nfcElectricity</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">NF电量</font> |
| <font style="color:rgb(51, 51, 51);">solarEnergyElectricity</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">太阳能电量</font> |
| <font style="color:rgb(51, 51, 51);">batteryElectricity</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">电池电量</font> |
| <font style="color:rgb(51, 51, 51);">lockBeamStatus</font> | <font style="color:rgb(51, 51, 51);">1或0</font> | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">锁梁状态(运营商锁)</font><br/><font style="color:rgb(51, 51, 51);">1已脱落</font><br/><font style="color:rgb(51, 51, 51);">0锁梁正常</font> |
| <font style="color:rgb(51, 51, 51);">lockTypeC</font> | <font style="color:rgb(51, 51, 51);">1或0</font> | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">TypeC状态运营商锁</font><br/><font style="color:rgb(51, 51, 51);">1已连接</font><br/><font style="color:rgb(51, 51, 51);">0未连接</font> |
| <font style="color:rgb(51, 51, 51);">lockBle</font> | <font style="color:rgb(51, 51, 51);">1或0</font> | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">蓝牙状态(运营商锁)</font><br/><font style="color:rgb(51, 51, 51);">1已连接</font><br/><font style="color:rgb(51, 51, 51);">0未连接</font> |
| <font style="color:rgb(51, 51, 51);">birth</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">出厂日期(运营商锁)</font> |
| <font style="color:rgb(51, 51, 51);">version</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">固件版本号</font> |
| <font style="color:rgb(51, 51, 51);">hardwareVersion</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">硬件版本号</font> |
| <font style="color:rgb(51, 51, 51);">sn</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">智能锁序号</font> |
| <font style="color:rgb(51, 51, 51);">unlockTimes</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">开锁次数</font> |
| <font style="color:rgb(51, 51, 51);">status</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">网络状态NB锁</font> |
| <font style="color:rgb(51, 51, 51);">pw</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">网络信号强度NB锁</font> |
| <font style="color:rgb(51, 51, 51);">read</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">读取MCU状态</font> |
| <font style="color:rgb(51, 51, 51);">open</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">读取传感器状态(门状态)</font> |
| <font style="color:rgb(51, 51, 51);">localStatus</font> | | <font style="color:rgb(51, 51, 51);">String</font> | <font style="color:rgb(51, 51, 51);">读取传感器状态(锁舌状态)</font> |
<h4 id="6d61a52c"><font style="color:rgb(0, 0, 0);">4.2.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">设备枚举类型</font>**</h4>
**<font style="color:rgb(0, 0, 0);">MkdLockTypeEnum设备类型</font>**
| <font style="color:rgb(51, 51, 51);">类型</font> | <font style="color:rgb(51, 51, 51);">说明</font> |
| --- | --- |
| **<font style="color:rgb(51, 51, 51);">MKD_LOCK_TYPE_NFC</font>** | <font style="color:rgb(51, 51, 51);">通过手机的NFC功能实现开锁适用于支持NFC功能的设备</font> |
| **<font style="color:rgb(51, 51, 51);">MKD_LOCK_TYPE_READER</font>** | <font style="color:rgb(51, 51, 51);">利用蓝牙读写器进行开锁,适合需要通过蓝牙连接的场景</font> |
| **<font style="color:rgb(51, 51, 51);">MKD_LOCK_TYPE_BLE</font>** | <font style="color:rgb(51, 51, 51);">通过手机蓝牙与锁具连接进行开锁</font> |
| **<font style="color:rgb(51, 51, 51);">MKD_LOCK_TYPE_USB</font>** | <font style="color:rgb(51, 51, 51);">通过手机外接USB设备实现开锁适用于需要物理连接的情况</font> |
<h2 id="349b2093"><font style="color:rgb(0, 0, 0);">5.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">接入流程</font>**</h2>
<h4 id="04d11cf5"><font style="color:rgb(0, 0, 0);">5.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">管理类-</font>****<font style="color:rgb(255, 0, 0);">MkdLockManagerNewer</font>**</h4>
<h4 id="d46d7388"><font style="color:rgb(0, 0, 0);">5.2.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">激活SDK</font>**</h4>
```java
/**
* 初始化鉴权
*
* @param appID AppID
* @param appSecret 密钥
* @return boolean true激活成功 false激活失败
*/
public boolean initWithAppID(String appID, String appSecret,Application application)
```
<h4 id="aed007a9"><font style="color:rgb(0, 0, 0);">5.3.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">设备类型设置</font>**</h4>
```java
/**
* 根据不同的锁类型切换当前的锁类型
* 此方法主要用于在应用中切换锁的类型,以便适应不同的安全或使用需求
*
* @param mkdLockTypeEnum 新的锁类型通过MkdLockTypeEnum枚举指定
*/
public void changeCurrentLockType(MkdLockTypeEnum mkdLockTypeEnum)
```
<h4 id="18518649"><font style="color:rgb(0, 0, 0);">5.4.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">蓝牙</font>**</h4>
<h5 id="af37e7fb"><font style="color:rgb(0, 0, 0);">5.4.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">设备搜索</font>**</h5>
```java
/**
* 开始搜索设备
*
* @param timeOut 超时设置
* @param scanListener 设备搜索回调
*/
void startScan(int timeOut, MkdScanListener scanListener);
```
```java
public interface MkdScanListener {
//开始扫描
void onScanStart();
//停止扫描
void onScanStop();
//获取扫描结果
void onScanResult(Device device, boolean isConnectedBySys);
//扫描错误
void onScanError(String errorMsg);
}
```
<h5 id="75329907"><font style="color:rgb(0, 0, 0);">5.4.2.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">停止搜索</font>**</h5>
```java
public void stopScan()
```
<h5 id="a67e0421"><font style="color:rgb(0, 0, 0);">5.4.3.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">设置搜索过滤条件</font>**</h5>
```java
public void setDeviceScanPrefix(String... prefix)
```
<h5 id="bcd86ed3"><font style="color:rgb(0, 0, 0);">5.4.4.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">设备连接</font>**</h5>
```java
/**
* 连接设备
* @param device 设备对象
* @param listener 连接监听器
*/
public void connectDevice(Device device, MkdBleConnectListener listener)
```
```java
/**
* 连接设备
* @param device 设备标识字符串
* @param listener 连接监听器
*/
public void connectDevice(String device, MkdBleConnectListener listener)
```
```java
public interface MkdBleConnectListener {
void connectSuccess (Device device);
void connectFailed(String msg);
void connectClose();
}
```
<h5 id="ab9c6740"><font style="color:rgb(0, 0, 0);">5.4.5.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">设备断开</font>**</h5>
```java
public void disConnectDevice()
```
<h5 id="11231a8b"><font style="color:rgb(0, 0, 0);">5.4.6.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">释放资源</font>**</h5>
```java
public void releaseAllConnection()
```
<h5 id="e39db310"><font style="color:rgb(0, 0, 0);">5.4.7.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">其他</font>**</h5>
```java
//是否真正扫描设备中
public boolean isScanning()
//移除扫描监听
public void removeScanListener()
//是否连接设备
public boolean isBleDeviceConnect()
```
<h4 id="5.5.-nfc"><font style="color:rgb(0, 0, 0);">5.5.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">NFC</font>**</h4>
<h5 id="cc4b5a42"><font style="color:rgb(0, 0, 0);">5.5.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">NFC Tag监听</font>**</h5>
```java
//注意此处未使用onNewIntent方式来获取NFC Tag的方式是由于在部分手机设备上
//存在Intent携带的Tag为null导致无法使用NFC
NfcAdapter mNfcAdapter = NfcAdapter.getDefaultAdapter(activity);
mNfcAdapter.enableReaderMode(activity, new NfcAdapter.ReaderCallback() {
@Override
public void onTagDiscovered(Tag tag) {
Log.e("onTagDiscovered", "tag = " + tag);
//接收获取的NFC 信息便于后续连接处理
}
}, NfcAdapter.FLAG_READER_NFC_A | NfcAdapter.FLAG_READER_NFC_B | NfcAdapter.FLAG_READER_NFC_F | NfcAdapter.FLAG_READER_NFC_V | NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK, null);
```
<h5 id="eb8ccd8e"><font style="color:rgb(0, 0, 0);">5.5.2.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">创建NFC意图</font>**</h5>
```java
public void createPendingIntent(Activity activity)
```
<h5 id="9f013c12"><font style="color:rgb(0, 0, 0);">5.5.3.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">开启NFC前台分发</font>**</h5>
```java
public void enableForegroundDispatch(Activity activity)
```
<h5 id="a321a077"><font style="color:rgb(0, 0, 0);">5.5.4.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">关闭NFC前台分发</font>**</h5>
```java
public void disableForegroundDispatch(Activity activity)
```
<h5 id="32489a7d"><font style="color:rgb(0, 0, 0);">5.5.5.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">连接NFC</font>**</h5>
```java
public void connectTag(Tag mTag, MkdNfcConnectStatusListener listener)
```
```java
public interface MkdNfcConnectStatusListener {
/**
* 连接状态
* @param status true已连接 false未连接
*/
void connectStatus(boolean status);
}
```
<h4 id="e22349ec"><font style="color:rgb(0, 0, 0);">5.6.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">API方法</font>**</h4>
<h5 id="5ac96d8d"><font style="color:rgb(0, 0, 0);">5.6.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">添加蓝牙读写器寻卡监听</font>**</h5>
```java
public void addReceiveRWSearchCardListener(MkdLockManagerListener listener)
```
<h6 id="7a81c120"><font style="color:rgb(0, 0, 0);">5.6.1.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">返回</font>****<font style="color:rgb(26, 26, 26);">数据</font>**</h6>
| <font style="color:rgb(51, 51, 51);">参数</font><font style="color:rgb(51, 51, 51);">key</font> | <font style="color:rgb(51, 51, 51);">类型</font> | <font style="color:rgb(51, 51, 51);">值</font> | <font style="color:rgb(51, 51, 51);">说明</font> |
| --- | --- | --- | --- |
| <font style="color:rgb(51, 51, 51);">hasCard</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | <font style="color:rgb(51, 51, 51);">“1”</font><font style="color:rgb(51, 51, 51);">or</font><font style="color:rgb(51, 51, 51);">"</font><font style="color:rgb(51, 51, 51);">0"</font> | <font style="color:rgb(51, 51, 51);">"</font><font style="color:rgb(51, 51, 51);">1"</font><font style="color:rgb(51, 51, 51);">:</font><font style="color:rgb(51, 51, 51);">有卡</font><br/><font style="color:rgb(51, 51, 51);">“0”</font><font style="color:rgb(51, 51, 51);">:</font><font style="color:rgb(51, 51, 51);">无卡</font> |
| <font style="color:rgb(51, 51, 51);">uid</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">锁</font><font style="color:rgb(51, 51, 51);">mac</font><font style="color:rgb(51, 51, 51);">地址</font> |
| <font style="color:rgb(51, 51, 51);">protocol</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">寻</font><font style="color:rgb(51, 51, 51);">卡</font><font style="color:rgb(51, 51, 51);">的</font><font style="color:rgb(51, 51, 51);">类型</font><font style="color:rgb(51, 51, 51);"></font><br/><font style="color:rgb(51, 51, 51);">“default”</font><font style="color:rgb(51, 51, 51);"></font><font style="color:rgb(51, 51, 51);">全部</font><br/><font style="color:rgb(51, 51, 51);">“ISO14443A”</font><font style="color:rgb(51, 51, 51);"></font><font style="color:rgb(51, 51, 51);">1</font><font style="color:rgb(51, 51, 51);">4</font><font style="color:rgb(51, 51, 51);">4</font><font style="color:rgb(51, 51, 51);">4</font><font style="color:rgb(51, 51, 51);">3</font><font style="color:rgb(51, 51, 51);">A</font><font style="color:rgb(51, 51, 51);"> N</font><font style="color:rgb(51, 51, 51);">F</font><font style="color:rgb(51, 51, 51);">C</font><font style="color:rgb(51, 51, 51);">协议</font><br/><font style="color:rgb(51, 51, 51);">“ISO14443B”</font><font style="color:rgb(51, 51, 51);"></font><font style="color:rgb(51, 51, 51);">1</font><font style="color:rgb(51, 51, 51);">4</font><font style="color:rgb(51, 51, 51);">4</font><font style="color:rgb(51, 51, 51);">4</font><font style="color:rgb(51, 51, 51);">3</font><font style="color:rgb(51, 51, 51);">B</font><font style="color:rgb(51, 51, 51);"> N</font><font style="color:rgb(51, 51, 51);">F</font><font style="color:rgb(51, 51, 51);">C</font><font style="color:rgb(51, 51, 51);">协议</font><br/><font style="color:rgb(51, 51, 51);">“ISO1</font><font style="color:rgb(51, 51, 51);">5</font><font style="color:rgb(51, 51, 51);">6</font><font style="color:rgb(51, 51, 51);">9</font><font style="color:rgb(51, 51, 51);">3</font><font style="color:rgb(51, 51, 51);">”</font><font style="color:rgb(51, 51, 51);">1</font><font style="color:rgb(51, 51, 51);">5</font><font style="color:rgb(51, 51, 51);">6</font><font style="color:rgb(51, 51, 51);">9</font><font style="color:rgb(51, 51, 51);">3</font><font style="color:rgb(51, 51, 51);"> N</font><font style="color:rgb(51, 51, 51);">F</font><font style="color:rgb(51, 51, 51);">C</font><font style="color:rgb(51, 51, 51);">协议</font> |
<h5 id="d5989665"><font style="color:rgb(0, 0, 0);">5.6.2.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">查询蓝牙读写器状态</font>**</h5>
```java
public void queryBleReaderWriterStatus(MkdLockManagerListener listener)
```
<h6 id="75566fd9"><font style="color:rgb(0, 0, 0);">5.6.2.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">返回</font>****<font style="color:rgb(26, 26, 26);">数据</font>**</h6>
| <font style="color:rgb(51, 51, 51);">参数</font><font style="color:rgb(51, 51, 51);">key</font> | <font style="color:rgb(51, 51, 51);">类型</font> | <font style="color:rgb(51, 51, 51);">值</font> | <font style="color:rgb(51, 51, 51);">说明</font> |
| --- | --- | :---: | --- |
| <font style="color:rgb(0, 0, 0);">rwPowerMV</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">读写器</font><font style="color:rgb(51, 51, 51);">电量</font> |
| <font style="color:rgb(0, 0, 0);">rwPowerPercent</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">读写器</font><font style="color:rgb(51, 51, 51);">电量</font><font style="color:rgb(51, 51, 51);">百分</font><font style="color:rgb(51, 51, 51);">比</font> |
| <font style="color:rgb(0, 0, 0);">rwHW</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">读写</font><font style="color:rgb(51, 51, 51);">硬件</font><font style="color:rgb(51, 51, 51);">版本</font> |
| <font style="color:rgb(0, 0, 0);">rwSW</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">读写器</font><font style="color:rgb(51, 51, 51);">软件</font><font style="color:rgb(51, 51, 51);">版本</font> |
<h5 id="d1f3bbdc"><font style="color:rgb(0, 0, 0);">5.6.3.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">读取锁的基本信息</font>**</h5>
```java
public void readLockBasicInfoSuccess(MkdLockManagerListener listener)
```
<h6 id="6c3764af"><font style="color:rgb(0, 0, 0);">5.6.3.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">返回</font>****<font style="color:rgb(26, 26, 26);">数据</font>**</h6>
| <font style="color:rgb(51, 51, 51);">参数</font><font style="color:rgb(51, 51, 51);">key</font> | <font style="color:rgb(51, 51, 51);">类型</font> | <font style="color:rgb(51, 51, 51);">值</font> | <font style="color:rgb(51, 51, 51);">说明</font> |
| --- | --- | :---: | --- |
| <font style="color:rgb(0, 0, 0);">sn</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">锁</font><font style="color:rgb(51, 51, 51);">序号</font> |
| <font style="color:rgb(0, 0, 0);">mac</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">锁</font><font style="color:rgb(51, 51, 51);">mac</font><font style="color:rgb(51, 51, 51);">地址</font> |
<h5 id="93b5a1c9"><font style="color:rgb(0, 0, 0);">5.6.4.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">读取锁的状态和电量</font>**</h5>
```java
public void readStatusAndElectricity( MkdLockManagerListener listener)
```
<h6 id="6b67d0d1"><font style="color:rgb(0, 0, 0);">5.6.4.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">返回</font>****<font style="color:rgb(26, 26, 26);">数据</font>**</h6>
| <font style="color:rgb(51, 51, 51);">参数</font><font style="color:rgb(51, 51, 51);">key</font> | <font style="color:rgb(51, 51, 51);">类型</font> | <font style="color:rgb(51, 51, 51);">值</font> | <font style="color:rgb(51, 51, 51);">说明</font> |
| --- | --- | --- | --- |
| <font style="color:rgb(51, 51, 51);">lockStatus</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | <font style="color:rgb(51, 51, 51);">1或0</font> | <font style="color:rgb(51, 51, 51);">1开启</font><br/><font style="color:rgb(51, 51, 51);">0关闭</font> |
| <font style="color:rgb(51, 51, 51);">nfcElectricity</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">NF电量</font> |
| <font style="color:rgb(51, 51, 51);">solarEnergyElectricity</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">太阳能电量</font> |
| <font style="color:rgb(51, 51, 51);">batteryElectricity</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">电池电量</font> |
| <font style="color:rgb(51, 51, 51);">lockBeamStatus</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | <font style="color:rgb(51, 51, 51);">1或0</font> | <font style="color:rgb(51, 51, 51);">锁梁状态LK02-BT运营商锁</font><br/><font style="color:rgb(51, 51, 51);">1已连接</font><br/><font style="color:rgb(51, 51, 51);">0未连接</font> |
| <font style="color:rgb(51, 51, 51);">lockTypeC</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | <font style="color:rgb(51, 51, 51);">1或0</font> | <font style="color:rgb(51, 51, 51);">TypeC状态LK02-BT运营商锁</font><br/><font style="color:rgb(51, 51, 51);">1已连接</font><br/><font style="color:rgb(51, 51, 51);">0未连接</font> |
| <font style="color:rgb(51, 51, 51);">lockBle</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | <font style="color:rgb(51, 51, 51);">1或0</font> | <font style="color:rgb(51, 51, 51);">蓝牙状态LK02-BT运营商锁</font><br/><font style="color:rgb(51, 51, 51);">1已连接</font><br/><font style="color:rgb(51, 51, 51);">0未连接</font> |
| <font style="color:rgb(51, 51, 51);">birth</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">出厂日期LK02-BT运营商锁</font> |
<h5 id="dc2cd2e5"><font style="color:rgb(0, 0, 0);">5.6.5.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">读取开锁次数</font>**</h5>
```java
public void readUnlockTimes(MkdLockManagerListener listener)
```
<h6 id="6a1d0416"><font style="color:rgb(0, 0, 0);">5.6.5.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">返回</font>****<font style="color:rgb(26, 26, 26);">数据</font>**</h6>
| <font style="color:rgb(51, 51, 51);">参数</font><font style="color:rgb(51, 51, 51);">key</font> | <font style="color:rgb(51, 51, 51);">类型</font> | <font style="color:rgb(51, 51, 51);">值</font> | <font style="color:rgb(51, 51, 51);">说明</font> |
| --- | --- | :---: | --- |
| <font style="color:rgb(0, 0, 0);">unlockTimes</font> | <font style="color:rgb(51, 51, 51);">S</font><font style="color:rgb(51, 51, 51);">tring</font> | | <font style="color:rgb(51, 51, 51);">累计</font><font style="color:rgb(51, 51, 51);">的</font><font style="color:rgb(51, 51, 51);">开锁</font><font style="color:rgb(51, 51, 51);">次数</font> |
<h5 id="2012032f"><font style="color:rgb(0, 0, 0);">5.6.6.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">读取锁的固件版本</font>**</h5>
```java
public void readFWVersion(MkdLockManagerListener listener)
```
<h6 id="2d83230a"><font style="color:rgb(0, 0, 0);">5.6.6.1.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">返回</font>****<font style="color:rgb(26, 26, 26);">数据</font>**</h6>
| <font style="color:rgb(51, 51, 51);">参数</font><font style="color:rgb(51, 51, 51);">key</font> | <font style="color:rgb(51, 51, 51);">类型</font> | <font style="color:rgb(51, 51, 51);">值</font> | <font style="color:rgb(51, 51, 51);">说明</font> |
| --- | --- | :---: | --- |
| <font style="color:rgb(51, 51, 51);">version</font> | <font style="color:rgb(51, 51, 51);">String</font> | | <font style="color:rgb(51, 51, 51);">固件版本号</font> |
| <font style="color:rgb(51, 51, 51);">hardwareVersion</font> | <font style="color:rgb(51, 51, 51);">String</font> | | <font style="color:rgb(51, 51, 51);">硬件版本号</font> |
<h5 id="3107205e"><font style="color:rgb(0, 0, 0);">5.6.7.</font><font style="color:rgb(0, 0, 0);"> </font>**<font style="color:rgb(26, 26, 26);">密钥开锁</font>**</h5>
```java
//encryptedPassword获取的开锁密钥
//listener开锁结果回调包含充电进度、开锁失败、开锁成功
public void unlockWithSecretKey(String encryptedPassword, MkdLockManagerProgressListener listener)
```
<h5 id="f1cf8f66"><font style="color:rgb(0, 0, 0);">5.6.8. </font>**<font style="color:rgb(26, 26, 26);">资源释放</font>**</h5>
```java
public void release()
```