PublishModule module increments or decrements a value cyclicallyPublishModule by communicating though http rather than UDP.
pythonHttpModule.py scriptpythonHttpUtils.py scriptapplications.xml XML file will be modified to use a  Python http module.
applications.xml XML file, by modifying the  PublishModule configuration:<application name="publishAppli"> <modules> <pythonHttpModule name="PublishModule"> <pythonImplementation path="pythonAppli" port="8080"/> <interfaces> <eventReceived service="event"/> <cyclic service="published"/> </interfaces> </pythonHttpModule> </modules> </application>
start method to start a timer.from pythonHttpUtils import PythonHttpUtils class PythonAppli: step = 1 count = 0 def start(self): # start a timer with a period of 1 second, and call the tick method for each iteration self.pythonHttpUtils.startTimer('timer', 1, self.tick) def subscribe(self, serviceName): eventService = self.pythonHttpUtils.getService(serviceName); eventValue = eventService["event"] if eventValue: self.step = -1 else: self.step = 1 def tick(self): # this method is called for each iteration of the timer self.pythonHttpUtils.notify("event") # used to get the content of the "event" service self.subscribe("event") # update the event attribute # invoke the service publishService = self.pythonHttpUtils.getService("published"); self.pythonHttpUtils.setValue(publishService, "value", self.count) r1 = self.pythonHttpUtils.invoke("published") # update the count value self.count = self.count + self.step
http://127.0.0.1:8080/proto/api/notify/event to get the content of the  event servicehttp://127.0.0.1:8080/proto/api/notify/published to get the content of the  published servicehttp://127.0.0.1:8080/proto/api/invoke/published to invoke the  published servicehttp://127.0.0.1:8080/proto/api/stdout to send a message to the framework Logginghttp://127.0.0.1:8080/proto/api/stderr to send an error message to the framework Logginghttp://127.0.0.1:8080/proto/api/notify/event to get the content of the  event servicehttp://127.0.0.1:8080/proto/api/invoke/published to invoke the  published servicehttp://127.0.0.1:8080/proto/api/notify/event address on a tab, you will obtain the  following result: 
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence