Added support for WNC M14A2A Cellular LTE Data Module.

Dependencies:   WNC14A2AInterface

Dependents:   http-example-wnc http-example-wnc-modified

Committer:
JMF
Date:
Wed Apr 19 20:58:54 2017 +0000
Revision:
4:daf182af022b
Parent:
0:2563b0415d1f
json file changes;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JMF 0:2563b0415d1f 1 # Easy Connect - Easily add all supported connectivity methods to your mbed OS project
JMF 0:2563b0415d1f 2
JMF 0:2563b0415d1f 3 Often you want to give users of your application the choice to switch between connectivity methods. The
JMF 0:2563b0415d1f 4 `NetworkInterface` API makes this easy, but you'll still need a mechanism for the user to chooce the method,
JMF 0:2563b0415d1f 5 throw in some `#define`'s, etc. Easy Connect handles all this for you. Just declare the desired connectivity
JMF 0:2563b0415d1f 6 method in your `mbed_app.json` file, and call `easy_connect()` from your application.
JMF 0:2563b0415d1f 7
JMF 0:2563b0415d1f 8 ## Specifying connectivity method
JMF 0:2563b0415d1f 9
JMF 0:2563b0415d1f 10 Add the following to your ``mbed_app.json`` file:
JMF 0:2563b0415d1f 11
JMF 0:2563b0415d1f 12 ```json
JMF 0:2563b0415d1f 13 {
JMF 0:2563b0415d1f 14 "config": {
JMF 0:2563b0415d1f 15 "network-interface":{
JMF 0:2563b0415d1f 16 "help": "options are ETHERNET,WIFI_ESP8266,WIFI_ODIN,MESH_LOWPAN_ND,MESH_THREAD,WNC14A2A",
JMF 0:2563b0415d1f 17 "value": "ETHERNET"
JMF 0:2563b0415d1f 18 }
JMF 0:2563b0415d1f 19 },
JMF 0:2563b0415d1f 20 "target_overrides": {
JMF 0:2563b0415d1f 21 "*": {
JMF 0:2563b0415d1f 22 "target.features_add": ["NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"],
JMF 0:2563b0415d1f 23 "mbed-mesh-api.6lowpan-nd-channel-page": 0,
JMF 0:2563b0415d1f 24 "mbed-mesh-api.6lowpan-nd-channel": 12
JMF 0:2563b0415d1f 25 }
JMF 0:2563b0415d1f 26 }
JMF 0:2563b0415d1f 27 }
JMF 0:2563b0415d1f 28 ```
JMF 0:2563b0415d1f 29 >If you choose `WNC14A2A` you'll also need to indicate if you want WNC14A2A debug output or not. You
JMF 0:2563b0415d1f 30 >Have 3 levels of debug (via bit settings). The debug value is set with the with the value of WNC_DEBUG_SETTING.
JMF 0:2563b0415d1f 31 >1 - Basic WNC driver debug output
JMF 0:2563b0415d1f 32 >2 - Comprehensive WNC driver debug output
JMF 0:2563b0415d1f 33 >4 - Network Layer debug output
JMF 0:2563b0415d1f 34 >You can have any combination you want 0 - 7.
JMF 0:2563b0415d1f 35 >Turning on or off WNC_DEBUG output is set with the WNC_DEBG setting.
JMF 0:2563b0415d1f 36 >If you choose `WIFI_ESP8266` or `WIFI_ODIN`, you'll also need to add the WiFi SSID and password:
JMF 0:2563b0415d1f 37
JMF 0:2563b0415d1f 38 ```json
JMF 0:2563b0415d1f 39 "config": {
JMF 0:2563b0415d1f 40 "network-interface":{
JMF 0:2563b0415d1f 41 "help": "options are ETHERNET,WIFI_ESP8266,WIFI_ODIN,MESH_LOWPAN_ND,MESH_THREAD",
JMF 0:2563b0415d1f 42 "value": "WIFI_ESP8266"
JMF 0:2563b0415d1f 43 },
JMF 0:2563b0415d1f 44 "esp8266-tx": {
JMF 0:2563b0415d1f 45 "help": "Pin used as TX (connects to ESP8266 RX)",
JMF 0:2563b0415d1f 46 "value": "PTD3"
JMF 0:2563b0415d1f 47 },
JMF 0:2563b0415d1f 48 "esp8266-rx": {
JMF 0:2563b0415d1f 49 "help": "Pin used as RX (connects to ESP8266 TX)",
JMF 0:2563b0415d1f 50 "value": "PTD2"
JMF 0:2563b0415d1f 51 },
JMF 0:2563b0415d1f 52 "esp8266-debug": {
JMF 0:2563b0415d1f 53 "value": true
JMF 0:2563b0415d1f 54 },
JMF 0:2563b0415d1f 55 "wifi-ssid": {
JMF 0:2563b0415d1f 56 "value": "\"SSID\""
JMF 0:2563b0415d1f 57 },
JMF 0:2563b0415d1f 58 "WNC_DEBUG": {
JMF 0:2563b0415d1f 59 "value": false
JMF 0:2563b0415d1f 60 },
JMF 0:2563b0415d1f 61 "WNC_DEBUG_SETTING": {
JMF 0:2563b0415d1f 62 "value": 4
JMF 0:2563b0415d1f 63 },
JMF 0:2563b0415d1f 64 "wifi-password": {
JMF 0:2563b0415d1f 65 "value": "\"Password\""
JMF 0:2563b0415d1f 66 }
JMF 0:2563b0415d1f 67 }
JMF 0:2563b0415d1f 68 ```
JMF 0:2563b0415d1f 69
JMF 0:2563b0415d1f 70 If you use `MESH_LOWPAN_ND` or `MESH_THREAD` you will need to specify your radio module:
JMF 0:2563b0415d1f 71
JMF 0:2563b0415d1f 72 ```json
JMF 0:2563b0415d1f 73 "config": {
JMF 0:2563b0415d1f 74 "network-interface":{
JMF 0:2563b0415d1f 75 "help": "options are ETHERNET,WIFI_ESP8266,WIFI_ODIN,MESH_LOWPAN_ND,MESH_THREAD",
JMF 0:2563b0415d1f 76 "value": "MESH_LOWPAN_ND"
JMF 0:2563b0415d1f 77 },
JMF 0:2563b0415d1f 78 "mesh_radio_type": {
JMF 0:2563b0415d1f 79 "help": "options are ATMEL, MCR20",
JMF 0:2563b0415d1f 80 "value": "ATMEL"
JMF 0:2563b0415d1f 81 }
JMF 0:2563b0415d1f 82 }
JMF 0:2563b0415d1f 83 ```
JMF 0:2563b0415d1f 84
JMF 0:2563b0415d1f 85 ## Using Easy Connect from your application
JMF 0:2563b0415d1f 86
JMF 0:2563b0415d1f 87 Easy Connect has just one function which will either return a `NetworkInterface`-pointer or `NULL`:
JMF 0:2563b0415d1f 88
JMF 0:2563b0415d1f 89 ```cpp
JMF 0:2563b0415d1f 90 #include "easy-connect.h"
JMF 0:2563b0415d1f 91
JMF 0:2563b0415d1f 92 int main(int, char**) {
JMF 0:2563b0415d1f 93 NetworkInterface* network = easy_connect(true); /* has 1 argument, enable_logging (pass in true to log to serial port) */
JMF 0:2563b0415d1f 94 if (!network) {
JMF 0:2563b0415d1f 95 printf("Connecting to the network failed... See serial output.\r\n");
JMF 0:2563b0415d1f 96 return 1;
JMF 0:2563b0415d1f 97 }
JMF 0:2563b0415d1f 98
JMF 0:2563b0415d1f 99 // Rest of your program
JMF 0:2563b0415d1f 100 }
JMF 0:2563b0415d1f 101 ```
JMF 0:2563b0415d1f 102 ## CR/LF in serial output
JMF 0:2563b0415d1f 103
JMF 0:2563b0415d1f 104 If you want to avoid using `\r\n` in your printouts and just use normal C-style `\n` instead, please specify these to your `mbed_app.json`
JMF 0:2563b0415d1f 105
JMF 0:2563b0415d1f 106 ```json
JMF 0:2563b0415d1f 107 "target_overrides": {
JMF 0:2563b0415d1f 108 "*": {
JMF 0:2563b0415d1f 109 "platform.stdio-baud-rate": 115200,
JMF 0:2563b0415d1f 110 "platform.stdio-convert-newlines": true
JMF 0:2563b0415d1f 111 }
JMF 0:2563b0415d1f 112 }
JMF 0:2563b0415d1f 113 ```
JMF 0:2563b0415d1f 114
JMF 0:2563b0415d1f 115 ## Extra defines
JMF 0:2563b0415d1f 116
JMF 0:2563b0415d1f 117 If you'd like to use Easy Connect with mbed Client then you're in luck. Easy Connect automatically defines the `MBED_SERVER_ADDRESS` macro depending on your connectivity method (either IPv4 or IPv6 address). Use this address to connect to the right instance of mbed Device Connector.