|
|
@@ -49,25 +49,22 @@ class PresentationLoginActivity : BaseActivity<ActivityPresentationLoginBinding>
|
|
|
handleLoading(false)
|
|
|
}
|
|
|
|
|
|
- ModBusController.registerStatusListener(this) { res ->
|
|
|
- (res as List<ByteArray>).forEach { bytes ->
|
|
|
- val dockBean = ModBusController.updateStatus(bytes) ?: return@forEach
|
|
|
- when (dockBean.type) {
|
|
|
- DOCK_TYPE_PORTABLE -> {
|
|
|
- dockBean.deviceList.forEach { deviceBean ->
|
|
|
- if (deviceBean.isExist) {
|
|
|
- when (deviceBean.type) {
|
|
|
- DEVICE_TYPE_CARD -> {
|
|
|
- ModBusController.readPortalCaseCardRfid(dockBean.addr.toInt() - 1) { res ->
|
|
|
- val rfid = res.copyOfRange(3, 11).toHexStrings(false).removeLeadingZeros()
|
|
|
- println("卡片RFID : $rfid")
|
|
|
- if (cardList.any { it.rfid == rfid }) {
|
|
|
- ToastUtils.tip("登录成功,欢迎 $rfid")
|
|
|
- startActivity(Intent(this, PresentationActivity::class.java))
|
|
|
- return@readPortalCaseCardRfid
|
|
|
- }
|
|
|
- ToastUtils.tip("登录失败,$rfid 没有权限")
|
|
|
+ BusinessManager.registerStatusListener(this) { dockBean ->
|
|
|
+ when (dockBean.type) {
|
|
|
+ DOCK_TYPE_PORTABLE -> {
|
|
|
+ dockBean.deviceList.forEach { deviceBean ->
|
|
|
+ if (deviceBean.isExist) {
|
|
|
+ when (deviceBean.type) {
|
|
|
+ DEVICE_TYPE_CARD -> {
|
|
|
+ ModBusController.readPortalCaseCardRfid(dockBean.addr.toInt() - 1) { res ->
|
|
|
+ val rfid = res.copyOfRange(3, 11).toHexStrings(false).removeLeadingZeros()
|
|
|
+ println("卡片RFID : $rfid")
|
|
|
+ if (cardList.any { it.rfid == rfid }) {
|
|
|
+ ToastUtils.tip("登录成功,欢迎 $rfid")
|
|
|
+ startActivity(Intent(this, PresentationActivity::class.java))
|
|
|
+ return@readPortalCaseCardRfid
|
|
|
}
|
|
|
+ ToastUtils.tip("登录失败,$rfid 没有权限")
|
|
|
}
|
|
|
}
|
|
|
}
|