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 SPWFSAXX_AT_STRINGS_H
chuanga 0:43ff9e3bc244 2 #define SPWFSAXX_AT_STRINGS_H
chuanga 0:43ff9e3bc244 3
chuanga 0:43ff9e3bc244 4 /* Define beyond macro if your X-NUCLEO-IDW04A1 expansion board has NOT the `WIFI_RST` HW patch applied on it */
chuanga 0:43ff9e3bc244 5 // #define IDW04A1_WIFI_HW_BUG_WA // delegated to mbed config system
chuanga 0:43ff9e3bc244 6
chuanga 0:43ff9e3bc244 7 #if defined(TARGET_FF_ARDUINO)
chuanga 0:43ff9e3bc244 8
chuanga 0:43ff9e3bc244 9 #if !defined(SPWFSAXX_WAKEUP_PIN)
chuanga 0:43ff9e3bc244 10 #define SPWFSAXX_WAKEUP_PIN A3
chuanga 0:43ff9e3bc244 11 #endif
chuanga 0:43ff9e3bc244 12 #if !defined(SPWFSAXX_RESET_PIN)
chuanga 0:43ff9e3bc244 13 #ifndef IDW04A1_WIFI_HW_BUG_WA
chuanga 0:43ff9e3bc244 14 #define SPWFSAXX_RESET_PIN D7
chuanga 0:43ff9e3bc244 15 #else // IDW04A1_WIFI_HW_PATCH
chuanga 0:43ff9e3bc244 16 #define SPWFSAXX_RESET_PIN NC
chuanga 0:43ff9e3bc244 17 #endif // !IDW04A1_WIFI_HW_PATCH
chuanga 0:43ff9e3bc244 18 #endif
chuanga 0:43ff9e3bc244 19
chuanga 0:43ff9e3bc244 20 #else // !defined(TARGET_FF_ARDUINO)
chuanga 0:43ff9e3bc244 21
chuanga 0:43ff9e3bc244 22 #if !defined(SPWFSAXX_WAKEUP_PIN)
chuanga 0:43ff9e3bc244 23 #define SPWFSAXX_WAKEUP_PIN NC
chuanga 0:43ff9e3bc244 24 #endif
chuanga 0:43ff9e3bc244 25 #if !defined(SPWFSAXX_RESET_PIN)
chuanga 0:43ff9e3bc244 26 #define SPWFSAXX_RESET_PIN NC
chuanga 0:43ff9e3bc244 27 #endif
chuanga 0:43ff9e3bc244 28
chuanga 0:43ff9e3bc244 29 #endif // !defined(TARGET_FF_ARDUINO)
chuanga 0:43ff9e3bc244 30
chuanga 0:43ff9e3bc244 31 #define SPWFXX_SEND_RECV_PKTSIZE (730)
chuanga 0:43ff9e3bc244 32
chuanga 0:43ff9e3bc244 33 #define SPWFXX_OOB_ERROR "AT-S.ERROR:" // "ERROR:"
chuanga 0:43ff9e3bc244 34
chuanga 0:43ff9e3bc244 35 #define SPWFXX_RECV_OK "AT-S.OK\n" // "OK\n"
chuanga 0:43ff9e3bc244 36 #define SPWFXX_RECV_WIFI_UP "+WIND:24:WiFi Up:%*u:%u.%u.%u.%u\n" // "+WIND:24:WiFi Up:%u.%u.%u.%u\n"
chuanga 0:43ff9e3bc244 37 #define SPWFXX_RECV_IP_ADDR "AT-S.Var:ip_ipaddr=%u.%u.%u.%u\n" // "# ip_ipaddr = %u.%u.%u.%u\n"
chuanga 0:43ff9e3bc244 38 #define SPWFXX_RECV_GATEWAY "AT-S.Var:ip_gw=%u.%u.%u.%u\n" // "# ip_gw = %u.%u.%u.%u\n"
chuanga 0:43ff9e3bc244 39 #define SPWFXX_RECV_NETMASK "AT-S.Var:ip_netmask=%u.%u.%u.%u\n" // "# ip_netmask = %u.%u.%u.%u\n"
chuanga 0:43ff9e3bc244 40 #define SPWFXX_RECV_RX_RSSI "AT-S.Var:0.rx_rssi=%d\n" // "# 0.rx_rssi = %d\n"
chuanga 0:43ff9e3bc244 41 #define SPWFXX_RECV_MAC_ADDR "AT-S.Var:nv_wifi_macaddr=%x:%x:%x:%x:%x:%x\n" // "# nv_wifi_macaddr = %x:%x:%x:%x:%x:%x\n"
chuanga 0:43ff9e3bc244 42 #define SPWFXX_RECV_DATALEN "AT-S.Query:%u\n" // " DATALEN: %u\n"
chuanga 0:43ff9e3bc244 43 #define SPWFXX_RECV_PENDING_DATA "::%u:%*u:%u\n" // ":%d:%d\n"
chuanga 0:43ff9e3bc244 44 #define SPWFXX_RECV_SOCKET_CLOSED ":%u:%*u\n" // ":%d\n"
chuanga 0:43ff9e3bc244 45
chuanga 0:43ff9e3bc244 46 #define SPWFXX_SEND_FWCFG "AT+S.FCFG" // "AT&F"
chuanga 0:43ff9e3bc244 47 #define SPWFXX_SEND_DISABLE_LE "AT+S.SCFG=console_echo,0" // "AT+S.SCFG=localecho1,0"
chuanga 0:43ff9e3bc244 48 #define SPWFXX_SEND_DSPLY_CFGV "AT+S.GCFG" // "AT&V"
chuanga 0:43ff9e3bc244 49 #define SPWFXX_SEND_GET_CONS_STATE "AT+S.GCFG=console_enabled" // "AT+S.GCFG=console1_enabled"
chuanga 0:43ff9e3bc244 50 #define SPWFXX_SEND_GET_CONS_SPEED "AT+S.GCFG=console_speed" // "AT+S.GCFG=console1_speed"
chuanga 0:43ff9e3bc244 51 #define SPWFXX_SEND_GET_HWFC_STATE "AT+S.GCFG=console_hwfc" // "AT+S.GCFG=console1_hwfc"
chuanga 0:43ff9e3bc244 52 #define SPWFXX_SEND_GET_CONS_DELIM "AT+S.GCFG=console_delimiter" // "AT+S.GCFG=console1_delimiter"
chuanga 0:43ff9e3bc244 53 #define SPWFXX_SEND_GET_CONS_ERRS "AT+S.GCFG=console_errs" // "AT+S.GCFG=console1_errs"
chuanga 0:43ff9e3bc244 54 #define SPWFXX_SEND_DISABLE_FC "AT+S.SCFG=console_hwfc,0" // "AT+S.SCFG=console1_hwfc,0"
chuanga 0:43ff9e3bc244 55 #define SPWFXX_SEND_ENABLE_FC "AT+S.SCFG=console_hwfc,1" // "AT+S.SCFG=console1_hwfc,1"
chuanga 0:43ff9e3bc244 56 #define SPWFXX_SEND_SW_RESET "AT+S.RESET" // "AT+CFUN=1"
chuanga 0:43ff9e3bc244 57 #define SPWFXX_SEND_SAVE_SETTINGS "AT+S.WCFG" // "AT&W"
chuanga 0:43ff9e3bc244 58 #define SPWFXX_SEND_WIND_OFF_HIGH "AT+S.SCFG=console_wind_off_high," // "AT+S.SCFG=wind_off_high,"
chuanga 0:43ff9e3bc244 59 #define SPWFXX_SEND_WIND_OFF_MEDIUM "AT+S.SCFG=console_wind_off_medium," // "AT+S.SCFG=wind_off_medium,"
chuanga 0:43ff9e3bc244 60 #define SPWFXX_SEND_WIND_OFF_LOW "AT+S.SCFG=console_wind_off_low," // "AT+S.SCFG=wind_off_low,"
chuanga 0:43ff9e3bc244 61
chuanga 0:43ff9e3bc244 62 #define SPWFXX_WINDS_HIGH_ON "0x00100000" // "0x00000000"
chuanga 0:43ff9e3bc244 63 #define SPWFXX_WINDS_MEDIUM_ON "0x80000000" // "0x00000000"
chuanga 0:43ff9e3bc244 64
chuanga 0:43ff9e3bc244 65 #endif // SPWFSAXX_AT_STRINGS_H