<cyclic service="position" frequency="100ms" />
AbstractFunctionalUA
has these useful fields, automatically created by the UAAppli Application:api
: the ARINC 661 client API to communicate with the ARINC661 server. This is an instance of the arinc661.client.api.StateFullAPI
interfaceruntimeAPIHelper
: the helper class allowing to use the simpler Functional UA runtime API to communicate with the ARINC661 server. This is an instance of the A661RuntimeAPI interfacelogger
: the framework loggermodule
: the UAAppli Application moduleinit()
method allows to perform code at the module initialization.module
won't be created yet:public class MyUAAppli extends AbstractFunctionalUA { private ServiceInstance sendService = null; public MyUAAppli() { this.sendService = module.getService("sendService"); } }Instead you can perform:
public class MyUAAppli extends AbstractFunctionalUA { private ServiceInstance sendService = null; public MyUAAppli() { } public init() { this.sendService = module.getService("sendService"); } }Also bear in mind that you won't be able to send anything to the server at this time. You will only be able to send buffers to the server after the
connected
method has been called.
preConfigure()
method allows to define properties programmatically. For example, the following code adds a param
property.module.addPropertyType("params", URL.class, null, false);
api
instance which is the ARINC 661 client API allowing to communicate with the ARINC661 serverstart()
method allows to perform code at the module start. You must be aware that:uaImpl
and uaPath
properties), then this User Application is subscribed for all the services for which the UA module is subscribed togetxxxValue(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[2]
getxxxValue(String, String)
methods return the value of a Data in a specified type for the specified Service namegetxxxValue(String, , String, String)
methods return the value of a Data in a specified type for the specified Service uri and name// return the float value of a data named "myDataName" // if there is no data for all services named "myDataName", or more than one service having a data with this name, // the method will return 0 float valueF = getFloatValue("myDataName"); // return the int value of a data named "myDataName", for the Service "myService" (with no namespace) // if there is no data for the service named "myDataName" the method will return 0 int valueI = getIntValue("myService", "myDataName"); // return the boolean value of a data named "myDataName", for the Service "myService" (with namespace "http://my.namespace") // if there is no data for the service named "myDataName" the method will return false boolean b = getBooleanValue("http://my.namespace", "myService", "myDataName");
// **** First Example *** // format the value of a numeric data named "myDataName". The format will keep the int part of the value, // and the two first decimals // if there is no data for all services named "myDataName", or more than one service having a data with this name, // the method will return an empty String // if the data is not numeric, the method will just return the data converted to a String // return the formatted String value of a data named "myDataName", for the Service "myService" (with no namespace) // if there is no data for the service named "myDataName" the method will return an empty String // if the data value is 5.2346, the result will be "5.23" String formattedValue = formatValueAsString("myDataName", "%.2f"); // **** Second Example *** String formattedValue = formatValueAsString("myDataName", "%08d"); // return the formatted String value of a data named "myDataName", for the Service "myService" (with no namespace) // if there is no data for the service named "myDataName" the method will return an empty String // if the data value is 55555, the result will be "00005555"
public void subscribe(ServiceInstance service) { if (hasChanged("value")) { String value = getStringValue("value"); api.setWidgetParameter(LAYER, LABEL, ARINC661.A661_STRING, value); api.sendAll(); } }For a specified service:
public void subscribe(ServiceInstance service) { if (hasChanged("publishedService", "value")) { String value = getStringValue("publishedService", "value"); api.setWidgetParameter(LAYER, LABEL, ARINC661.A661_STRING, value); api.sendAll(); } }
service.setDataBooleanValue("event", isSelected); service.invoke();
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()); } } }); }
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence