equal
deleted
inserted
replaced
93 svghmi_root = None |
93 svghmi_root = None |
94 svghmi_listener = None |
94 svghmi_listener = None |
95 svghmi_send_thread = None |
95 svghmi_send_thread = None |
96 |
96 |
97 def SendThreadProc(): |
97 def SendThreadProc(): |
98 global svghmi_session |
98 global svghmi_session |
99 size = ctypes.c_uint32() |
99 size = ctypes.c_uint32() |
100 ptr = ctypes.c_void_p() |
100 ptr = ctypes.c_void_p() |
101 res = 0 |
101 res = 0 |
102 while True: |
102 while True: |
103 res=svghmi_send_collect(ctypes.byref(size), ctypes.byref(ptr)) |
103 res=svghmi_send_collect(ctypes.byref(size), ctypes.byref(ptr)) |
104 if res == 0: |
104 if res == 0: |
105 # TODO multiclient : dispatch to sessions |
105 # TODO multiclient : dispatch to sessions |
106 if svghmi_session is not None: |
106 if svghmi_session is not None: |
107 svghmi_session.sendMessage(ctypes.string_at(ptr.value,size.value)) |
107 svghmi_session.sendMessage(ctypes.string_at(ptr.value,size.value)) |
108 elif res not in [errno.EAGAIN, errno.ENODATA]: |
108 elif res == errno.ENODATA: |
109 break |
109 # this happens when there is no data after wakeup |
|
110 # because of hmi data refresh period longer than PLC common ticktime |
|
111 pass |
|
112 else: |
|
113 # this happens when finishing |
|
114 break |
110 |
115 |
111 |
116 |
112 |
117 |
113 |
118 |
114 # Called by PLCObject at start |
119 # Called by PLCObject at start |