runtime/webinterface.js
author Edouard Tisserant
Thu, 19 Apr 2018 12:22:40 +0200
changeset 1994 1fdc32be71b8
parent 719 db54ccc96309
permissions -rw-r--r--
Rework of runtime non-real-time threading, and shared object dynamic loading :
- All exposed operations on PLCObject are now serialized through main thread
(@RunInMain). Only one exception : python trace thread calling _GetDebugData
- Re-loading of same shared object is prevented. dlclose/delte/rewrite/dlopen
don't happen in that case. This is a workaround for some xenomai copperplate
bug triggering segfault, inbetween delete and rewrite.
- Trace thread now waits for data, dies if no data, and dies instead of
suspending as before when no data consumed after 3 seconds.
- Disabled threading in Pyro client
- Enforced auxiliary threads starting sequence : Pyro -> [UI] ->
PLCWorker.RunLoop
// import Nevow.Athena

function init() {
  Nevow.Athena.Widget.fromAthenaID(1).callRemote('HMIexec', 'HMIinitialisation');
}

WebInterface.PLC = Nevow.Athena.Widget.subclass('WebInterface.PLC');
WebInterface.PLC.method(
	 'updateHMI',
	 function (self, data) {
	   d = self.callRemote('getPLCElement');
	   d.addCallback(
			 function liveElementReceived(le) {
				d2 = self.addChildWidgetFromWidgetInfo(le);
				d2.addCallback(
						function childAdded(widget) {
						var node = self.nodeById('content');
						node.replaceChild(widget.node, node.getElementsByTagName('div')[0]);
						init();
						});
				});
	   });

Divmod.Base.addLoadEvent(init);