Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Service datas



A service has a contract and associated input and output datas. The datas values can be:
  • Set by the modules which provide the Service
  • Get by the modules which are subscribed to the Service


Note that it is perfectly valid for a Service to not have associated Datas at all. For example, it can be sufficient to be notified from the execution of an Event Service without the need to have any additional datas, such as a click on a Button for example.

Data identification

A data is identified by a unique name in the Service. For example:
      <services>
         <publish name="position" id="1" >
            <data name="latitude" type="float" />
            <data name="longitude" type="float" />
            <data name="altitude" type="float" />
         </publish>
      </services>
The following definition would be incorrect:
      <services>
         <publish name="position" id="1" >
            <data name="longitude" type="float" />
            <data name="longitude" type="float" />
            <data name="altitude" type="float" />
         </publish>
      </services>

Description and comment attributes

It is possible to add a desc (description) and comment (comment) attributes to the data:
  • The description is stored by the framework but not used by the runtime
  • The comment is neither stored nor used by the runtime. You can for example use the comment attribute to add metadatas used by another application
Example:
      <services>
         <publish name="position" >
            <data name="latitude" type="float" desc="the latitude" comment="DATA01" />
            <data name="longitude" type="float" desc="the longitude" comment="DATA02"/>
         </publish>
      </services>

Data type

The type of the data refers to a type defined in the types.

Continuous Datas


Numeric datas can be specified as continuous or not continous. Setting a numeric data as not continuous specifies that even as this data is numeric, the possible values are discrete (as for enumerations).

In the following example, the "aircraftID" Data is an int data but its values are not continuous (they correspond to an aircraft ID):
      <services>
         <publish name="aircraft" >
            <data name="aircraftID" type="int" continuous="false" />
            <data name="aircraftLongitude" type="float" />
            <data name="aircraftAltitude" type="float" />
         </publish>
      </services>

Setting the value for a data

Main Article: Data manipulation

There are several methods in the Data class to set the value of a Data. Note that the framework will always try to cast the value if possible[1] .

Setting the value for a data can also be directly performed through the ServiceInstance class.

Setting the value for an enumeration data

enumerations values can be set by either:
  • Setting the int value of the state
  • Setting the name of the state


For example suppose that we have the following definition for the types:
      <types>
         <enumType name="intEnum" >
            <enumValue name="ZERO" />
            <enumValue name="ONE"/>
         </enumType>
      </types>
And that the "myData" data is of the "myEnum" type. Then all of the following codes are equivalent:
      Data data = service.getData("myData");
      data.setValue(1);
      data.setIntValue(1);
      data.setStringValue("ONE");

Setting the value for an XML data

XML values can be set by either:
  • Setting the XML as a String value
  • Setting the XML as a XMLNode

Getting the value for a data

Main Article: Data manipulation

There are several methods in the Data class to get the value of a Data. Note that the framework will always try to cast the value if possible[2] .

Getting the value for a data can also be directly performed through the ServiceInstance class.

Notes

See also


Categories: concepts

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence