|
|
@@ -105,7 +105,47 @@ class DockBean(
|
|
|
}
|
|
|
DOCK_TYPE_PORTABLE -> {
|
|
|
// TODO 便携式底座更新
|
|
|
- return null
|
|
|
+ val tempList = mutableListOf<Boolean>()
|
|
|
+ for (i in 0..2) {
|
|
|
+ tempList.add((byteArray[4].toInt() shr i) and 0x1 == 1)
|
|
|
+ }
|
|
|
+ if (getLockList().isEmpty()) {
|
|
|
+ for (i in 0 until tempList.size) {
|
|
|
+ deviceList.add(LockBean(i, tempList[i], null))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ val isKeyExist = (byteArray[3].toInt() shr 0) and 0x1 == 1
|
|
|
+ val isKeyCharging = (byteArray[3].toInt() shr 1) and 0x1 == 1
|
|
|
+
|
|
|
+ if (getKeyList().isEmpty()) {
|
|
|
+ deviceList.add(KeyBean(0, isKeyExist, true, isKeyCharging, null, null))
|
|
|
+ }
|
|
|
+
|
|
|
+ val isDockCharging = (byteArray[3].toInt() shr 6) and 0x1 == 1
|
|
|
+ val isDockFullCharged = (byteArray[3].toInt() shr 7) and 0x1 == 1
|
|
|
+
|
|
|
+ val changeList = mutableListOf<DeviceBean>()
|
|
|
+ for (i in 0 until getLockList().size) {
|
|
|
+ if (getLockList()[i].isExist != tempList[i]) {
|
|
|
+ getLockList()[i].isExist = tempList[i]
|
|
|
+ changeList.add(getLockList()[i])
|
|
|
+ // 拿走锁具,移除锁具信息
|
|
|
+ if (!tempList[i]) {
|
|
|
+ getLockList()[i].rfid = null
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (getKeyList()[0].isExist != isKeyExist) {
|
|
|
+ getKeyList()[0].isExist = isKeyExist
|
|
|
+ changeList.add(getKeyList()[0])
|
|
|
+ // 拿走钥匙,移除钥匙信息
|
|
|
+ if (!isKeyExist) {
|
|
|
+ getKeyList()[0].rfid = null
|
|
|
+ getKeyList()[0].mac = null
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return DockBean(addr, type, changeList)
|
|
|
}
|
|
|
else -> return null
|
|
|
}
|