public void init()
: called when the UA Application is initializedpublic void start()
: called when the UA Application is startedpublic void subscribe(ServiceInstance)
: called when the UA Application is notified from one of the Services on which the UA is subscribed topublic void push(ServiceInstance)
: called when the UA Application is called automatically for a cyclic invocation[1]
<cyclic service="position" frequency="100ms" />
context
: the Script context, which is an instance of the UAScriptContext class. See script contexthelper
: the Script helper, which is an instance of the UAScriptHelper class. See script helperapi
: the ARINC 661 API. See ARINC 661 client APIgetxxxValue(String)
methods return the value of a Data in a specified type, if there is only one Service which has a Data with this name[3]
getxxxValue(String, String)
methods return the value of a Data in a specified type for the a specified Servicepublic void subscribe(ServiceInstance service) { if (helper.hasChanged("value")) { String value = helper.getStringValue("value"); api.setWidgetParameter(LAYER, LABEL, ARINC661.A661_STRING, value); api.sendAll(); } }For a specified service:
public void subscribe(ServiceInstance service) { if (helper.hasChanged("publishedService", "value")) { String value = helper.getStringValue("publishedService", "value"); api.setWidgetParameter(LAYER, LABEL, ARINC661.A661_STRING, value); api.sendAll(); } }
service.setDataBooleanValue("event", isSelected); service.invoke();
logger.error(message)
should be replaced by context.error(message)
getStringValue("value");
should be replaced by helper.getStringValue("value");
int LAYER = 1; int TOGGLE_BUTTON = 1; int LABEL = 2; SendEventServiceInstance eventService = null; public void init() { this.eventService = (SendEventServiceInstance) context.getModule().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) { 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(); } }
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence