eventAppli
of the first tutorial by a Groovy Script.PublishModule
had no graphical interface and:types.xml
services.xml
applications.xml
, because we will keep the same UA Application. It's only the configuration of the UA Application itself which will changeinit()
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
Serviceint LAYER = 1; int TOGGLE_BUTTON = 1; int LABEL = 2; SendEventServiceInstance eventService = null; public void init() { this.eventService = (SendEventServiceInstance) context.getModule().getService("event"); // listen to widgets events 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) { context.error(ex.getMessage()); } } }); } public void subscribe(ServiceInstance service) { if (helper.hasChanged("value")) { String value = helper.getStringValue("value"); api.setWidgetParameter(LAYER, LABEL, ARINC661.A661_STRING, value); api.sendAll(); } }
<properties> <application name="uaappli" > <module name="uaappli" > <moduleProperty key="script" value="uaScript.groovy" /> <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