eventAppli
with a User application.eventAppli
of the first tutorial.
PublishModule
had no graphical interface and:EventModule
had a graphical interface and:EventModule
module by a User Application. It will be embedded in a built-in UA application. This module will:types.xml
or the services.xml
configuration files, because we will use the same services as in the first tutorial. But we will replace the eventAppli
by a User Application:<applications> <application name="uaappli"> <deployment> <lib url="UAApplication.jar" /> </deployment> <modules> <module name="uaappli"> <interfaces> <eventSend service="event" attach="attach"/> <subscribe service="published" /> </interfaces> </module> </modules> </application> <application name="publishAppli" "> <modules> <module name="PublishModule" > <implementation path="org.da.samples.protoframework.publish.PublishModule" > <initEntryPoint method="init" /> <defaultReceiveEntryPoint method="subscribe" /> <defaultSendEntryPoint method="publish" /> </implementation> <interfaces> <eventReceived service="event"/> <cyclic service="published" frequency="200ms" attach="attach"/> </interfaces> </module> </modules> </application> </applications>
<cockpit> <DFFiles> <df path="tutorial.xml" /> </DFFiles> <windows> <windowDef name="Window" width="8000" height="3000" x="0" y="0" /> </windows> <configs border="255,255,255" borderWidth="3"> <display id="1" name="simple" width="8000" height="3000" defaultLayout="1"> <layout name="layout" id="1"> <window name="Window"> <layer layerID="1" /> </window> </layout> </display> </configs> </cockpit>Now we will specify the ARINC 661 configuration for both the ARINC 661 Client and the ARINC 661 Server:
graphics=DefGraphics.xml ui=LookAndFeel.xml pictures=DefPictures.xml lf=JavaFX supplement=6 warnForUndefAttrs=false serverInputPort=8080 serverOutputPort=8081 serverInputSize=50000 serverOutputSize=200 server.autoVisible=true logServerArea=true windowManager=windows server.windows=tutorialWindow.xml server.computeLayerSize=false server.menus=true server.uiCombo=true maximumQueueSize=50The result will be:
init()
method will be used to add the listener which will listen to the click on the ToggleButton and invoke the event Servicesubscribe(ServiceInstance)
method will be fired when the User Application module is notified from the publish
Servicepublic class UATutorial extends AbstractFunctionalUA { private static final int LAYER = 1; private static final int TOGGLE_BUTTON = 1; private static final int LABEL = 2; private SendEventServiceInstance eventService = null; public UATutorial() { } public void init() { this.eventService = (SendEventServiceInstance) module.getService("event"); api.addWidgetEventListener(LAYER, TOGGLE_BUTTON, new ARINCEventListener() { public void eventReceived(ARINCEvent evt) { WidgetEvent widgetEvt = (WidgetEvent) evt; try { boolean isSelected = ((Boolean) widgetEvt.getValues().get(0)); eventService.setDataBooleanValue("event", isSelected); eventService.invoke(); } catch (ARINCRuntimeException ex) { logger.error(module, ex.getMessage()); } } }); } public void subscribe(ServiceInstance service) { if (hasChanged("value")) { String value = getStringValue("value"); api.setWidgetParameter(LAYER, LABEL, ARINC661.A661_STRING, value); api.sendAll(); } } }
api
in the UA. In our example:public class UATutorial extends AbstractFunctionalUA { ... public void subscribe(ServiceInstance service) { if (hasChanged("value")) { String value = getStringValue("value"); runtimeAPIHelper.setA661WidgetParameter(LAYER, LABEL, ARINC661.A661_STRING, value); runtimeAPIHelper.sendAllA661BufferContent(); } } }We can use the parrameter namer rather than its ID:
public class UATutorial extends AbstractFunctionalUA { ... public void subscribe(ServiceInstance service) { if (hasChanged("value")) { String value = getStringValue("value"); runtimeAPIHelper.setA661WidgetParameter(LAYER, LABEL, "LabelString", value); runtimeAPIHelper.sendAllA661BufferContent(); } } }or even with using the names of the Layer and the Widget:
public class UATutorial extends AbstractFunctionalUA { ... public void subscribe(ServiceInstance service) { if (hasChanged("value")) { String value = getStringValue("value"); runtimeAPIHelper.setA661WidgetParameterFromName("MyLayer", "label", "LabelString", value); runtimeAPIHelper.sendAllA661BufferContent(); } } }
<properties> <application name="uaappli" > <module name="uaappli" > <moduleProperty key="uaImpl" value="UATutorial.jar" /> <moduleProperty key="uaPath" value="org.da.protoframework.tutorial.uaappli.UATutorial" /> <moduleProperty key="a661Config" value="a661/tutorial.properties" /> <moduleProperty key="includeServer" value="true" /> </module> </application> </properties>
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence