|
@@ -118,7 +118,6 @@ object ModBusController {
|
|
|
/**
|
|
/**
|
|
|
* 初始化所有设备的状态
|
|
* 初始化所有设备的状态
|
|
|
*/
|
|
*/
|
|
|
- // TODO 通电后多久执行?App每次重启的执行是什么
|
|
|
|
|
fun initDevicesStatus() {
|
|
fun initDevicesStatus() {
|
|
|
readDeviceType { res ->
|
|
readDeviceType { res ->
|
|
|
res.forEach { bytes ->
|
|
res.forEach { bytes ->
|
|
@@ -133,15 +132,12 @@ object ModBusController {
|
|
|
else -> "未知"
|
|
else -> "未知"
|
|
|
}
|
|
}
|
|
|
LogUtil.i("initDevicesStatus 设备(${bytes[0].toInt()})类型:$type")
|
|
LogUtil.i("initDevicesStatus 设备(${bytes[0].toInt()})类型:$type")
|
|
|
-
|
|
|
|
|
- // TODO 设置所有钥匙的模式
|
|
|
|
|
- // TODO 通过HTTP获取所有钥匙的Mac
|
|
|
|
|
}
|
|
}
|
|
|
// TODO 待完善
|
|
// TODO 待完善
|
|
|
Executor.repeatOnMain({
|
|
Executor.repeatOnMain({
|
|
|
if (isInitReady) {
|
|
if (isInitReady) {
|
|
|
initLock() // 打开所有无锁的卡扣、关闭所有有锁的卡扣、读取所有锁的RFID
|
|
initLock() // 打开所有无锁的卡扣、关闭所有有锁的卡扣、读取所有锁的RFID
|
|
|
- initKey() // 打开所有无钥匙的卡扣、关闭所有有钥匙的卡扣、关闭所有钥匙灯光、读取所有钥匙的RFID
|
|
|
|
|
|
|
+ initKey() // 打开所有无钥匙的卡扣、关闭所有有钥匙的卡扣、读取所有钥匙的RFID
|
|
|
return@repeatOnMain false
|
|
return@repeatOnMain false
|
|
|
} else {
|
|
} else {
|
|
|
return@repeatOnMain true
|
|
return@repeatOnMain true
|
|
@@ -191,10 +187,12 @@ object ModBusController {
|
|
|
}
|
|
}
|
|
|
val rfid = res.copyOfRange(3, 11).toHexStrings(false).removeLeadingZeros()
|
|
val rfid = res.copyOfRange(3, 11).toHexStrings(false).removeLeadingZeros()
|
|
|
LogUtil.i("初始化钥匙 RFID : $rfid")
|
|
LogUtil.i("初始化钥匙 RFID : $rfid")
|
|
|
|
|
+ // 更新rfid
|
|
|
updateKeyRfid(dockBean.addr.toInt(), isLeft, rfid)
|
|
updateKeyRfid(dockBean.addr.toInt(), isLeft, rfid)
|
|
|
// 蓝牙准备操作
|
|
// 蓝牙准备操作
|
|
|
NetApi.getKeyInfo(rfid) {
|
|
NetApi.getKeyInfo(rfid) {
|
|
|
if (it != null && !it.macAddress.isNullOrEmpty()) {
|
|
if (it != null && !it.macAddress.isNullOrEmpty()) {
|
|
|
|
|
+ // 更新mac
|
|
|
updateKeyMac(dockBean.addr.toInt(), key.isLeft, it.macAddress)
|
|
updateKeyMac(dockBean.addr.toInt(), key.isLeft, it.macAddress)
|
|
|
BusinessManager.registerConnectListener(it.macAddress)
|
|
BusinessManager.registerConnectListener(it.macAddress)
|
|
|
} else {
|
|
} else {
|