PublishModule
module increments or decrements a value cyclicallyPublishModule
by setting a factor for the incrementation or decrementation step in the start method.
applications.xml
XML file will be modified to specify a start EntryPoint.
applications.xml
XML file, by modifying the PublishModule
configuration:<application name="publishAppli"> <modules> <pythonModule name="PublishModule"> <pythonImplementation path="pythonAppli"> <startEntryPoint method="start" /> <defaultSendEntryPoint method="publish" /> </pythonImplementation> <interfaces> <eventReceived service="event"/> <cyclic service="published" frequency="200ms" attach="attach"/> </interfaces> </pythonModule> </modules> </application>
start
method to set the step.from pythonUtils import PythonUtils class PythonAppli: step = 1 count = 1 factor = 1; def start(self, pythonUtils): self.factor = 10 def subscribe(self, pythonUtils, serviceName): eventService = pythonUtils.getService("event"); eventValue = eventService["event"] if eventValue: self.step = -1 else: self.step = 1 def publish(self, pythonUtils, serviceName): publishService = pythonUtils.getService("published"); pythonUtils.setValue(publishService, "value", self.count) self.count = self.count + self.step * self.factor pythonUtils.send("published")
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence