Generic Pelion Device Management example for various Advantech modules.

This example is known to work great on the following platforms:

Example Functionality

This example showcases the following device functionality:

  • On timer button increment, simulate Pelion LWM2M button resource change

Use this example with Mbed CLI

1. Import the application into your desktop:

mbed import https://os.mbed.com/teams/Advantech/code/pelion-example-common
cd pelion-example-common

2. Download your developer certificate from pelion portal

3. Compile the program

mbed compile -t <toolchain> -m <TARGET_BOARD>

(supported toolchains : GCC_ARM / ARM / IAR)

4. Copy the binary file pelion-example-common.bin to your mbed device.

Committer:
chuanga
Date:
Tue Mar 12 13:48:39 2019 +0800
Revision:
0:43ff9e3bc244
copying sources from github repository

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chuanga 0:43ff9e3bc244 1 #ifndef BLOCK_EXEC_H
chuanga 0:43ff9e3bc244 2 #define BLOCK_EXEC_H
chuanga 0:43ff9e3bc244 3
chuanga 0:43ff9e3bc244 4 #include "mbed.h"
chuanga 0:43ff9e3bc244 5
chuanga 0:43ff9e3bc244 6 /* Helper class to execute something whenever entering/leaving a basic block */
chuanga 0:43ff9e3bc244 7 class BlockExecuter {
chuanga 0:43ff9e3bc244 8 public:
chuanga 0:43ff9e3bc244 9 BlockExecuter(Callback<void()> exit_cb, Callback<void()> enter_cb = Callback<void()>()) :
chuanga 0:43ff9e3bc244 10 _exit_cb(exit_cb) {
chuanga 0:43ff9e3bc244 11 if((bool)enter_cb) enter_cb();
chuanga 0:43ff9e3bc244 12 }
chuanga 0:43ff9e3bc244 13
chuanga 0:43ff9e3bc244 14 ~BlockExecuter(void) {
chuanga 0:43ff9e3bc244 15 _exit_cb();
chuanga 0:43ff9e3bc244 16 }
chuanga 0:43ff9e3bc244 17
chuanga 0:43ff9e3bc244 18 private:
chuanga 0:43ff9e3bc244 19 Callback<void()> _exit_cb;
chuanga 0:43ff9e3bc244 20 };
chuanga 0:43ff9e3bc244 21
chuanga 0:43ff9e3bc244 22 #endif //BLOCK_EXEC_H