The easy-connect library for GR-PEACH.
Dependencies: LWIPBP3595Interface_STA_for_mbed-os
Dependents: GR-PEACH_HVC-P2_sample_client GR-PEACH_HVC-P2_IoTPlatform_http GR-PEACH_IoT_Platform_HTTP_sample
Specifying connectivity method
Add the following to your mbed_app.json file:
mbed_app.json
{ "config": { "network-interface":{ "help": "Options are ETHERNET, WIFI_ESP8266, WIFI_BP3595", "value": "ETHERNET" } } }
To specify MAC address, add fllowing function to main.cpp. (When using Wifi, setting of MAC address is not necessary.)
Specify MAC address
// set mac address void mbed_mac_address(char *mac) { mac[0] = 0x00; mac[1] = 0x02; mac[2] = 0xF7; mac[3] = 0xF0; mac[4] = 0x00; mac[5] = 0x00; }
Wifi settings
If you choose BP3595, you'll also need to add the WiFi SSID, password and security type:
mbed_app.json
{ "config": { "network-interface":{ "help": "Options are ETHERNET, WIFI_ESP8266, WIFI_BP3595", "value": "WIFI_BP3595" }, "wifi-ssid": { "help": "WiFi SSID", "value": "\"SSID\"" }, "wifi-password": { "help": "WIFI Password", "value": "\"Password\"" }, "wifi-security":{ "help": "Options are NSAPI_SECURITY_WEP, NSAPI_SECURITY_WPA, NSAPI_SECURITY_WPA2, NSAPI_SECURITY_WPA_WPA2", "value": "NSAPI_SECURITY_WPA_WPA2" } } }
Using Easy Connect from your application
Easy Connect has just one function which will either return a NetworkInterface-pointer or NULL:
main.cpp
#include "easy-connect.h" int main(int, char**) { NetworkInterface* network = easy_connect(true); /* has 1 argument, enable_logging (pass in true to log to serial port) */ if (!network) { printf("Connecting to the network failed... See serial output.\r\n"); return 1; } // Rest of your program }
History
Update library
2017-03-28, by dkato [Tue, 28 Mar 2017 09:52:02 +0000] rev 2
Update library
The security of wifi can be changed from mbed_app.json.
2017-03-14, by dkato [Tue, 14 Mar 2017 05:41:15 +0000] rev 1
The security of wifi can be changed from mbed_app.json.
Delete WIFI_ODIN, MESH_LOWPAN_ND and MESH_THREAD.
2017-03-08, by dkato [Wed, 08 Mar 2017 07:17:06 +0000] rev 0
Delete WIFI_ODIN, MESH_LOWPAN_ND and MESH_THREAD.
; Added WIFI_BP3595.