|
@@ -1,37 +1,25 @@
|
|
|
package com.grkj.iscs.presentation
|
|
package com.grkj.iscs.presentation
|
|
|
|
|
|
|
|
|
|
+import com.grkj.iscs.BusinessManager
|
|
|
import com.grkj.iscs.base.BasePresenter
|
|
import com.grkj.iscs.base.BasePresenter
|
|
|
-import com.grkj.iscs.extentions.removeLeadingZeros
|
|
|
|
|
-import com.grkj.iscs.extentions.toHexStrings
|
|
|
|
|
-import com.grkj.iscs.modbus.ModBusController
|
|
|
|
|
-import com.grkj.iscs.model.DeviceConst.DEVICE_TYPE_CARD
|
|
|
|
|
-import com.grkj.iscs.model.DeviceConst.DEVICE_TYPE_FINGERPRINT
|
|
|
|
|
import com.grkj.iscs.model.DeviceConst.DEVICE_TYPE_KEY
|
|
import com.grkj.iscs.model.DeviceConst.DEVICE_TYPE_KEY
|
|
|
import com.grkj.iscs.model.DeviceConst.DEVICE_TYPE_LOCK
|
|
import com.grkj.iscs.model.DeviceConst.DEVICE_TYPE_LOCK
|
|
|
-import com.grkj.iscs.model.DeviceConst.DOCK_TYPE_KEY
|
|
|
|
|
-import com.grkj.iscs.model.DeviceConst.DOCK_TYPE_LOCK
|
|
|
|
|
import com.grkj.iscs.model.DeviceConst.DOCK_TYPE_PORTABLE
|
|
import com.grkj.iscs.model.DeviceConst.DOCK_TYPE_PORTABLE
|
|
|
-import com.grkj.iscs.util.ToastUtils
|
|
|
|
|
-import com.grkj.iscs.util.log.LogUtil
|
|
|
|
|
|
|
|
|
|
class PresentationPresenter : BasePresenter<IPresentationView>() {
|
|
class PresentationPresenter : BasePresenter<IPresentationView>() {
|
|
|
fun registerStatusListener() {
|
|
fun registerStatusListener() {
|
|
|
- ModBusController.registerStatusListener(this) { res ->
|
|
|
|
|
- LogUtil.i("设备状态:${(res as List<ByteArray>).map { it.toHexStrings() }}")
|
|
|
|
|
- res.forEach { bytes ->
|
|
|
|
|
- val dockBean = ModBusController.updateStatus(bytes) ?: return@forEach
|
|
|
|
|
- when (dockBean.type) {
|
|
|
|
|
- DOCK_TYPE_PORTABLE -> {
|
|
|
|
|
- // TODO 便携式待完善
|
|
|
|
|
- dockBean.deviceList.forEach { deviceBean ->
|
|
|
|
|
- if (deviceBean.isExist) {
|
|
|
|
|
- when (deviceBean.type) {
|
|
|
|
|
- DEVICE_TYPE_KEY -> {
|
|
|
|
|
- // TODO 读工作票
|
|
|
|
|
- }
|
|
|
|
|
- DEVICE_TYPE_LOCK -> {
|
|
|
|
|
|
|
+ BusinessManager.registerStatusListener(this) { dockBean ->
|
|
|
|
|
+ when (dockBean.type) {
|
|
|
|
|
+ DOCK_TYPE_PORTABLE -> {
|
|
|
|
|
+ // TODO 便携式待完善
|
|
|
|
|
+ dockBean.deviceList.forEach { deviceBean ->
|
|
|
|
|
+ if (deviceBean.isExist) {
|
|
|
|
|
+ when (deviceBean.type) {
|
|
|
|
|
+ DEVICE_TYPE_KEY -> {
|
|
|
|
|
+ // TODO 读工作票
|
|
|
|
|
+ }
|
|
|
|
|
+ DEVICE_TYPE_LOCK -> {
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|