Show Contents

# Set up your project for Digi APIX

## Use the library

To work with Digi APIX library, you must:

1. Include the required header files in your application source code. This depends on the interfaces you are going to use. For example, to use GPIO and PWM APIs:

>     #include <libdigiapix/gpio.h>
>     #include <libdigiapix/pwm.h>

1. Link against the dynamic library already included in the precompiled toolchain. See Application development for more information.

> The library provides a pkg-config file, libdigiapix.pc. To configure the proper compilation flags and linked libraries, add the following lines in your makefile:

>     [...]

>     CFLAGS += $(shell pkg-config --cflags libdigiapix)
>     LDLIBS += $(shell pkg-config --libs --static libdigiapix)

>     [...]

## Set library logging

The library uses syslog for logging. By default, the log level is error (LOG_ERR).

You can establish the logging level of the library by calling ldx_set_log_level():

Function | Description
--- | ---
ldx_set_log_level(level) | Set the log level of the Digi APIX library. level can be one of the log levels defined in syslog.h: LOG_EMERG: System is unusable LOG_ALERT: Action must be taken immediately LOG_CRIT: Critical conditions LOG_ERR: Error conditions LOG_WARNING: Warning conditions LOG_NOTICE: Normal but significant condition LOG_INFO: Informational LOG_DEBUG: Debug-level messages

## Build your application

You can build your own application:

- Using the pre-compiled toolchain:
  - In command line, follow the steps in Application development.
  - In Eclipse with Digi Embedded Yocto plug-in, follow the steps in Create a C/C++ project from scratch.
- As part of the Digi Embedded Yocto build.
  You must create a recipe similar to dey-examples-digiapix.bb recipe. Make sure your recipe:
  - Adds a build-time dependency on libdigiapix
  - Adds a runtime dependency on libdigiapix

>     SUMMARY = "My Digi APIX application"

>     [...]

>     DEPENDS = "libdigiapix"

>     [...]

>     RDEPENDS_${PN} = "libdigiapix"

>     [...]

## Security recommendations

Digi recommends to run your applications as a standard user and not as root. For that purpose, Digi embedded API extensions creates the group called digiapix with permissions to access the API interfaces.

You only need to add your user to the digiapix group to have privileges to access the required interfaces. See Create users and groups.

© 2018 Digi International Inc. All rights reserved.
Set up your project for Digi APIX updated on 22 January 2018 08:04:58 PM