svghmi/svghmi_server.py
branchsvghmi
changeset 2993 b76f303ffce6
parent 2835 bc666f020ab3
child 3200 75cb73b4a606
equal deleted inserted replaced
2992:d48ad9c3ec91 2993:b76f303ffce6
   165 def watchdog_trigger():
   165 def watchdog_trigger():
   166     print("SVGHMI watchdog trigger")
   166     print("SVGHMI watchdog trigger")
   167     
   167     
   168 
   168 
   169 # Called by PLCObject at start
   169 # Called by PLCObject at start
   170 def _runtime_svghmi0_start():
   170 def _runtime_00_svghmi_start():
   171     global svghmi_listener, svghmi_root, svghmi_send_thread
   171     global svghmi_listener, svghmi_root, svghmi_send_thread
   172 
   172 
   173     svghmi_root = Resource()
   173     svghmi_root = Resource()
   174     svghmi_root.putChild("ws", WebSocketResource(HMIWebSocketServerFactory()))
   174     svghmi_root.putChild("ws", WebSocketResource(HMIWebSocketServerFactory()))
   175 
   175 
   179     svghmi_send_thread = Thread(target=SendThreadProc, name="SVGHMI Send")
   179     svghmi_send_thread = Thread(target=SendThreadProc, name="SVGHMI Send")
   180     svghmi_send_thread.start()
   180     svghmi_send_thread.start()
   181 
   181 
   182 
   182 
   183 # Called by PLCObject at stop
   183 # Called by PLCObject at stop
   184 def _runtime_svghmi0_stop():
   184 def _runtime_00_svghmi_stop():
   185     global svghmi_listener, svghmi_root, svghmi_send_thread, svghmi_session
   185     global svghmi_listener, svghmi_root, svghmi_send_thread, svghmi_session
   186 
   186 
   187     if svghmi_session is not None:
   187     if svghmi_session is not None:
   188         svghmi_session.close()
   188         svghmi_session.close()
   189     svghmi_root.delEntity("ws")
   189     svghmi_root.delEntity("ws")