|
|
@@ -20,6 +20,7 @@ import com.grkj.iscs.ble.CustomBleIndicateCallback
|
|
|
import com.grkj.iscs.ble.CustomBleScanCallback
|
|
|
import com.grkj.iscs.ble.CustomBleWriteCallback
|
|
|
import com.grkj.iscs.extentions.removeLeadingZeros
|
|
|
+import com.grkj.iscs.extentions.serialNo
|
|
|
import com.grkj.iscs.extentions.startsWith
|
|
|
import com.grkj.iscs.extentions.toByteArray
|
|
|
import com.grkj.iscs.extentions.toHexStrings
|
|
|
@@ -127,14 +128,13 @@ object BusinessManager {
|
|
|
// TODO 考虑快速拿取
|
|
|
ModBusController.controlLockBuckle(false, dockBean.addr.toInt() - 1, lockBean.idx) { itRst ->
|
|
|
if (itRst.isNotEmpty()) {
|
|
|
- // TODO 上报锁具信息
|
|
|
+ // 上报锁具信息
|
|
|
+ NetApi.updateLockReturn(rfid, MyApplication.instance!!.serialNo()) {}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- // TODO 上报锁具信息
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -150,7 +150,13 @@ object BusinessManager {
|
|
|
ModBusController.readKeyRfid(dockBean.addr.toInt() - 1, deviceBean.idx) { isLeft, res ->
|
|
|
val rfid = res.copyOfRange(3, 11).toHexStrings(false).removeLeadingZeros()
|
|
|
ModBusController.updateKeyRfid(dockBean.addr.toInt(), true, rfid)
|
|
|
- // TODO 从HTTP读取Mac
|
|
|
+ NetApi.getKeyInfo(rfid) {
|
|
|
+ if (it != null && !it.macAddress.isNullOrEmpty()) {
|
|
|
+ ModBusController.updateKeyMac(dockBean.addr.toInt(), isLeft, it.macAddress)
|
|
|
+ } else {
|
|
|
+ ToastUtils.tip(R.string.get_key_info_fail)
|
|
|
+ }
|
|
|
+ }
|
|
|
// TODO 蓝牙通信
|
|
|
}
|
|
|
ModBusController.controlKeyBuckle(false, isLeft = true, dockBean.addr.toInt() - 1)
|
|
|
@@ -159,8 +165,19 @@ object BusinessManager {
|
|
|
ModBusController.readLockRfid(dockBean.addr.toInt() - 1, deviceBean.idx) { res ->
|
|
|
val rfid = res.copyOfRange(3, 11).toHexStrings(false).removeLeadingZeros()
|
|
|
ModBusController.updateLockRfid(dockBean.addr.toInt(), deviceBean.idx, rfid)
|
|
|
+
|
|
|
+ NetApi.getLockInfo(rfid) {
|
|
|
+ if (it != null) {
|
|
|
+ // TODO 考虑快速拿取
|
|
|
+ ModBusController.controlLockBuckle(false, dockBean.addr.toInt() - 1, deviceBean.idx) { itRst ->
|
|
|
+ if (itRst.isNotEmpty()) {
|
|
|
+ // 上报锁具信息
|
|
|
+ NetApi.updateLockReturn(rfid, MyApplication.instance!!.serialNo()) {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- ModBusController.controlLockBuckle(false, dockBean.addr.toInt() - 1, deviceBean.idx)
|
|
|
}
|
|
|
DEVICE_TYPE_CARD -> {
|
|
|
ModBusController.readPortalCaseCardRfid(dockBean.addr.toInt() - 1) { res ->
|