|
@@ -49,7 +49,7 @@ class ModBusHardwareHelper : IHardwareHelper {
|
|
|
val dockData =
|
|
val dockData =
|
|
|
ModBusController.dockList.filter { it.type == DeviceConst.DOCK_TYPE_LOCK || it.type == DeviceConst.DOCK_TYPE_KEY || it.type == DeviceConst.DOCK_TYPE_PORTABLE }
|
|
ModBusController.dockList.filter { it.type == DeviceConst.DOCK_TYPE_LOCK || it.type == DeviceConst.DOCK_TYPE_KEY || it.type == DeviceConst.DOCK_TYPE_PORTABLE }
|
|
|
return dockData.filter { it.type == DeviceConst.DOCK_TYPE_KEY }.flatMap { it.deviceList }
|
|
return dockData.filter { it.type == DeviceConst.DOCK_TYPE_KEY }.flatMap { it.deviceList }
|
|
|
- .filterIsInstance<DockBean.KeyBean>().map { it.mac ?: "" }
|
|
|
|
|
|
|
+ .filterIsInstance<DockBean.KeyBean>().filter { it.isExist }.map { it.mac ?: "" }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun controlKeyLockAndCharge(
|
|
override fun controlKeyLockAndCharge(
|
|
@@ -66,18 +66,20 @@ class ModBusHardwareHelper : IHardwareHelper {
|
|
|
ModBusController.dockList.filter { it.type == DeviceConst.DOCK_TYPE_LOCK || it.type == DeviceConst.DOCK_TYPE_KEY || it.type == DeviceConst.DOCK_TYPE_PORTABLE }
|
|
ModBusController.dockList.filter { it.type == DeviceConst.DOCK_TYPE_LOCK || it.type == DeviceConst.DOCK_TYPE_KEY || it.type == DeviceConst.DOCK_TYPE_PORTABLE }
|
|
|
return dockData.filter { it.type == DeviceConst.DOCK_TYPE_KEY }.map {
|
|
return dockData.filter { it.type == DeviceConst.DOCK_TYPE_KEY }.map {
|
|
|
DockData.KeyDock().apply {
|
|
DockData.KeyDock().apply {
|
|
|
- keyData.addAll(it.deviceList.filterIsInstance<DockBean.KeyBean>().map {
|
|
|
|
|
- DockData.KeyDock.KeyBean().apply {
|
|
|
|
|
- this.addr = it.addr.toInt()
|
|
|
|
|
- this.idx = it.idx
|
|
|
|
|
- this.row = it.row
|
|
|
|
|
- this.rfid = it.rfid ?: ""
|
|
|
|
|
- this.mac = it.mac ?: ""
|
|
|
|
|
- this.isExist = it.isExist
|
|
|
|
|
- this.type = it.type
|
|
|
|
|
- this.newHardware = it.newHardware
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ keyData.addAll(
|
|
|
|
|
+ it.deviceList.filterIsInstance<DockBean.KeyBean>()
|
|
|
|
|
+ .filter { it.isExist && it.newHardware }.map {
|
|
|
|
|
+ DockData.KeyDock.KeyBean().apply {
|
|
|
|
|
+ this.addr = it.addr.toInt()
|
|
|
|
|
+ this.idx = it.idx
|
|
|
|
|
+ this.row = it.row
|
|
|
|
|
+ this.rfid = it.rfid ?: ""
|
|
|
|
|
+ this.mac = it.mac ?: ""
|
|
|
|
|
+ this.isExist = it.isExist
|
|
|
|
|
+ this.type = it.type
|
|
|
|
|
+ this.newHardware = it.newHardware
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -192,7 +194,7 @@ class ModBusHardwareHelper : IHardwareHelper {
|
|
|
) {
|
|
) {
|
|
|
ModBusController.controlKeyCharge(
|
|
ModBusController.controlKeyCharge(
|
|
|
!isOpen, idx,
|
|
!isOpen, idx,
|
|
|
- slaveAddress?.toByte()
|
|
|
|
|
|
|
+ slaveAddress?.toByte(), done
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -202,11 +204,10 @@ class ModBusHardwareHelper : IHardwareHelper {
|
|
|
lockIdxList: Int,
|
|
lockIdxList: Int,
|
|
|
done: ((ByteArray) -> Unit)?
|
|
done: ((ByteArray) -> Unit)?
|
|
|
) {
|
|
) {
|
|
|
-
|
|
|
|
|
ModBusController.controlLockBuckle(
|
|
ModBusController.controlLockBuckle(
|
|
|
isOpen,
|
|
isOpen,
|
|
|
slaveAddress?.toByte(),
|
|
slaveAddress?.toByte(),
|
|
|
- lockIdxList,
|
|
|
|
|
|
|
+ lockIdxList, done
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|