emv_work.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @文件 :emv_work.py
  5. @时间 :2022/11/16 13:32:02
  6. @作者 :None
  7. @版本 :1.0
  8. @说明 :
  9. '''
  10. from utils.globalvar import SD
  11. from utils.qt import QObject, Signal
  12. from utils.delay import m_delay
  13. class EmvCanReceived(QObject):
  14. show_emv_ce_signal = Signal(object, int)
  15. show_emv_cf_signal = Signal(object)
  16. def __init__(self):
  17. super(EmvCanReceived, self).__init__()
  18. # 接收数据
  19. def received(self):
  20. while SD.CAN_ON_OFF:
  21. restNum = SD.CAN_CONTROL.get_undeal_number()
  22. if restNum <= 0:
  23. continue
  24. revRet = SD.CAN_CONTROL.receive(restNum)
  25. for i in revRet:
  26. if int(i.RemoteFlag) != 0:
  27. continue
  28. if i.ID == 0x1800CF00 | SD.EMV_ID:
  29. self.show_emv_cf_signal.emit(i.Data)
  30. elif i.ID == 0x1800CE00 | SD.EMV_ID:
  31. self.show_emv_ce_signal.emit(i.Data, 0)
  32. else:
  33. continue
  34. class EmvComWork(QObject):
  35. show_com_signal = Signal(int, int, int)
  36. def __init__(self):
  37. super(EmvComWork, self).__init__()
  38. # 接收数据
  39. def work(self):
  40. while SD.CAN_ON_OFF:
  41. ver = SD.COM_CONTROL.reveive_env_version()
  42. if ver[0] == 1:
  43. self.show_com_signal.emit(ver[1], ver[2], ver[3])
  44. m_delay(10)