PublishModule
module increments or decrements a value cyclicallyEventModule
module allows to click on a toggle to set if the first module should increment or decrement the value, and shows the valuehttp://proto.tutorial.com
. We will modify the services.xml
XML file to define the two services in this namespace:<services> <namespace uri="http://proto.tutorial.com" > <event name="event" id="1" > <data name="event" type="bool" /> </event> <publish name="published" id="2" > <data name="value" type="int" /> </publish> </namespace> </services>
http://proto.tutorial.com
. We will modify the services.xml
XML file to define our types in this namespace:<types> <namespace uri="http://proto.tutorial.com" > <simpleType name="bool" baseType="boolean" /> <simpleType name="int" baseType="int" /> </namespace> </types>
applications.xml
is modified as follows:<applications> <application name="eventAppli" id="1"> <modules> <module name="EventModule" id="1" > <interfaces> <eventSend service="event" uri="http://proto.tutorial.com" attach="attach"/> <subscribe service="published" uri="http://proto.tutorial.com"/> </interfaces> </module> </modules> </application> <application name="publishAppli" id="2"> <modules> <module name="PublishModule" id="1" > <interfaces> <eventReceived service="event" uri="http://proto.tutorial.com"/> <cyclic service="published" frequency="200ms" uri="http://proto.tutorial.com" attach="attach"/> </interfaces> </module> </modules> </application> </applications>
public class PublishModule { ... public void init(Module module) { eventService = module.getService("http://proto.tutorial.com", "event"); publishService = module.getService("http://proto.tutorial.com", "published"); } ... }
public class PublishModule { ... public void init(Module module) { eventService = module.getService("http://proto.tutorial.com", "event"); publishService = module.getService("http://proto.tutorial.com", "published"); } ... }
public class EventModule { ... public void init(Module module) { eventService = module.getService("http://proto.tutorial.com", "event"); publishService = module.getService("http://proto.tutorial.com", "published"); gui = new EventGUI(this); gui.setup(); gui.pack(); gui.setVisible(true); } }
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence