equal
deleted
inserted
replaced
238 class HMIWebSocketServerFactory(WebSocketServerFactory): |
238 class HMIWebSocketServerFactory(WebSocketServerFactory): |
239 protocol = HMIProtocol |
239 protocol = HMIProtocol |
240 |
240 |
241 svghmi_servers = {} |
241 svghmi_servers = {} |
242 svghmi_send_thread = None |
242 svghmi_send_thread = None |
|
243 |
|
244 # python's errno on windows seems to have no ENODATA |
|
245 ENODATA = errno.ENODATA if hasattr(errno,"ENODATA") else None |
243 |
246 |
244 def SendThreadProc(): |
247 def SendThreadProc(): |
245 global svghmi_session_manager |
248 global svghmi_session_manager |
246 size = ctypes.c_uint32() |
249 size = ctypes.c_uint32() |
247 ptr = ctypes.c_void_p() |
250 ptr = ctypes.c_void_p() |
253 svghmi_session.session_index, |
256 svghmi_session.session_index, |
254 ctypes.byref(size), ctypes.byref(ptr)) |
257 ctypes.byref(size), ctypes.byref(ptr)) |
255 if res == 0: |
258 if res == 0: |
256 svghmi_session.sendMessage( |
259 svghmi_session.sendMessage( |
257 ctypes.string_at(ptr.value,size.value)) |
260 ctypes.string_at(ptr.value,size.value)) |
258 elif res == errno.ENODATA: |
261 elif res == ENODATA: |
259 # this happens when there is no data after wakeup |
262 # this happens when there is no data after wakeup |
260 # because of hmi data refresh period longer than |
263 # because of hmi data refresh period longer than |
261 # PLC common ticktime |
264 # PLC common ticktime |
262 pass |
265 pass |
263 else: |
266 else: |