SDK in C++ for developing MODE device driver on embedded Linux systems.
C++ Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Linux Device C++ SDK

This is an SDK in C++ for developing MODE device driver on embedded Linux systems.


This SDK is for anyone implementing MODE device drivers on embedded Linux platforms. It contains a library for the device to communicate with the MODE cloud, and a sample program that shows how the library can be used in a typical use case.

Supported Hardware

This SDK is intended for embedded Linux platforms like Armadillo-IoT. The minimum hardware requirement is ARM-9 core or a CPU with similar power, and 128MB of memory for running Linux. And it requires 3MB of disk space to store the runtime shared libraries (OpenSSL, C++ standard library, etc). It can also be used on more powerful Linux environments.

SDK Dependencies

This SDK needs a development environment for the target architecture. You would want to set up cross-compilation environment for ARM chips on x86 Linux box, for example. Or you can use x86 Linux as your development environment and run the built binary on another x86 Linux hardware.

The SDK requires the following runtime shared libraries:


Most Linux PC environments have the libraries but small embedded Linux target machines may not have them by default. So make sure they are installed on the target machine.

Building the Sample Program on x86 Linux

Make sure you set up the dependencies and build environment for C++. If you are running a Debian-based system like Ubuntu, please run the following command:

$ sudo apt-get install build-essential

You would also need to install the OpenSSL header files and libraries. The command is as follows:

$ sudo apt-get install libssl-dev

Once you get the SDK source code from GitHub. You have to set up the device API key and device ID in You can find the device API key and ID in the MODE Developer Console. If you are not sure what they are, please read this doc.

Locate the following lines in, and update accordingly.

// Change your device API key and Id.
static const char* g_api_key = "xxxxx";
static const char* g_device_id = "1234";

Then execute the make command and build the sample code:

$ make

You will find a binary file named sample if the build is successful.

Using the Sample Program

First, we need to install a Root certificate that MODE cloud uses to the system.

$ make install_cert

You can use sample by just invoking the command:

$ ./sample

What do you want?
1. Enable claim mode
2. Start listening to commands
3. End listening to commands
4. Trigger an event
5. Quit

Just input an option number and enter any extra information when prompted. Look inside the source file for more detailed information. Also, the header file lib/ModeDevice.h provides full documenation on the API.

Running the Sample Program on Armadillo IoT

To run sample on Armadillo IoT, please set up the ATDE environment on your PC. You can build cross-platform binaries on the virtual machine.

ATDE already has the whole ARM libraries, headers and build tools for development so that you can simply rebuild the binary for the ARM platform as follows:

$ make clean all PLATFORM=ARM

Run the following command to create packages containing the necessary SSL/TLS certificate and shared library for installation to the target machine:

$ sh

Please make sure pem.tar.gz and libs.tar.gz are generated. Then transfer them to Armadillo IoT. Please make sure Armadillo is online and ready for connection via FTP.

$ ftp armadillo.ip.addr
ftp> cd pub
ftp> put libs.tar.gz
ftp> put pem.tar.gz
ftp> put
ftp> put sample

Log in to Armadillo on the serial console, and run the following commands:

# ntpclient -h -s
# cd /home/ftp/pub
# sh
# chmod +x sample

Then run the sample program:

# ./sample
What do you want?
1. Enable claim mode
2. Start listening to commands
3. End listening to commands
4. Trigger an event
5. End

Copyright and License

Code and documentation copyright 2015-2016 Mode, Inc. Released under the MIT license.