All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Legato cdef Files

These sections are available in the Component.cdef :

sources

Contains a list of source code files.

One source file must implement a COMPONENT_INIT function called at start-up.

sources:
foo.c
bar.c
init.c // This one implements the COMPONENT_INIT

import

Lists IPC services required by this component from other components.

Consists of a service instance name and interface definition (.api) file path separated by an equals sign (‘=’).

import:
hello = sample/greet.api // We need to use the Greet API to say “hello” to the world.

The build tools search for the interface definition (.api) file based on the interface search path.

Inside the component’s source code, you can call API functions defined inside the .api files service instance name prepended.

If sample/greet.api defines a function called Greet() , the source code for the component can call it as hello_Greet() . In C, source code must #include “interfaces.h” to use the auto-generated function definition.

Multiple instances of the same API listed in the “import” section must have unique instance names, and will appear as separate functions with different prefixes.

import:
heat = digitalOutput.api // This is what we use to turn on and off the heater.
cool = digitalOutput.api // This is what we use to turn on and off the cooling (A/C).

If digitalOutput.api defines two functions On() and Off(), then the component’s source code would have four functions available to it: heat_On(), heat_Off(), cool_On(), and cool_Off().

export

Lists IPC services provided by this component to other components. Contents use the same syntax as the the “import” section.

export:
hello = sample/greet.api // We offer the Greet API to others so they can say “hello” to the world.

The component’s source code implements the API functions defined inside the .api files, with the service instance name prepended. If

sample/greet.api

defines a function called

“Greet()”

, the source code for the component must implement a function called

“hello_Greet()”

. In C, the source code must #include “interfaces.h” to get the function prototype definition.

files

The same as the files section in .adef files.

Copyright (C) Sierra Wireless, Inc. 2014. All rights reserved. Use of this work is subject to license.