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

Native configuration specification



This article explains the interfacing configuration of configured C modules.

Overview

Configured C modules are specified with an XML file specifying how they are interfaces with the framework. Contrary to basic C modules, they must have: For example here we define the native configuration for the PublishModule in the first tutorial:
      <application name="publishAppli">
         <deployment>
      <lib url="CLibrary.jar" />
         </deployment>      
         <modules>
            <cModule name="PublishModule"> 
               <cImplementation path="PublishModule2" nativeConfig="nativeConfig.xml"/>
               <interfaces>
                  <eventReceived service="event"/>
                  <cyclic service="published" frequency="200ms" attach="attach"/>
               </interfaces>             
            </cModule>
         </modules>
      </application>

Java interfacing library


The Java interfacing library models the C library functions using JNA. Each method corresponds to one function in the C library.

For example the following declaration corresponds to the interface with a C module implementing the PublishModule in the first tutorial:
      public interface CLibrary extends Library {      
        @SignatureTag(type=SignatureType.NOTIFICATION, name="event")
        public void receive(boolean state);
   
        @SignatureTag(type=SignatureType.CYCLIC_SERVICE, name="published")
        public void publish();   
   
        @SignatureTag(type=SignatureType.INVOCATION, name="published")
        public void setInvoker(Invoker callback);

        public interface Invoker extends Callback {
          void invoke(int value);
        }
      }     
The associated Java interface must be exposed by the deployment element of the C module associated application. For example:
      <application name="publishAppli">
         <deployment>
      <lib url="CLibrary.jar" />
         </deployment>      
         <modules>
            <cModule name="PublishModule"> 
      ...          
            </cModule>
         </modules>
      </application>
The path of the interface must also be specified in the associated native configuration specification.

Native configuration specification


The native configuration specification is an XML file which specifies:
  • The path of the Java interface which is used to model the functions of the C library
  • The association between each argument in the C function to the corresponding data in the associated service
For example the following XML specification corresponds the PublishModule in the first tutorial:
      <nativeConfig libPath="org.da.testutils.clibrary.CLibrary">
         <invokeServices>
            <invokeService name="published">
               <argument name="value" />
            </invokeService>       
         </invokeServices>
         <notifServices>
            <notifService name="event">
               <argument name="event" />
            </notifService>
         </notifServices>    
      </nativeConfig>

See also


Categories: concepts | development

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