This is a NetworkSocketAPI example for LWIPBP3595Interface_STA library. LWIPBP3595Interface_STA library only works with GR-PEACH. The base example is HelloLWIPInterface.

Dependencies:   LWIPBP3595Interface_STA LWIPInterface NetworkSocketAPI mbed-rtos mbed

Fork of HelloLWIPBP3595Interface by Rohm

Files at this revision

API Documentation at this revision

Comitter:
tousaki
Date:
Wed May 25 05:01:56 2016 +0000
Child:
1:97d54645c995
Commit message:
Created 1st version.

Changed in this revision

LWIPBP3595Interface_STA.lib Show annotated file Show diff for this revision Revisions of this file
LWIPInterface.lib Show annotated file Show diff for this revision Revisions of this file
NetworkSocketAPI.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LWIPBP3595Interface_STA.lib	Wed May 25 05:01:56 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Rohm/code/LWIPBP3595Interface_STA/#f045a230502f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LWIPInterface.lib	Wed May 25 05:01:56 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/NetworkSocketAPI/code/LWIPInterface/#366181e36f99
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NetworkSocketAPI.lib	Wed May 25 05:01:56 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/NetworkSocketAPI/code/NetworkSocketAPI/#ea3a618e0818
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 25 05:01:56 2016 +0000
@@ -0,0 +1,61 @@
+/* main.cpp in HelloLWIPBP3595Interface */
+/* Copyright (C) 2016 Grape Systems, Inc. */
+/* The base file is main.cpp in HelloLWIPInterface. */
+
+/* main.cpp in HelloLWIPInterface */
+/* NetworkSocketAPI Example Program
+ * Copyright (c) 2015 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mbed.h"
+#include "LWIPBP3595Interface.h"
+#include "TCPSocket.h"
+
+LWIPBP3595Interface wifi;
+
+DigitalOut led(LED_GREEN);
+void blink()
+{
+    led = !led;
+}
+
+int main()
+{
+    Ticker blinky;
+    blinky.attach(blink, 0.4f);
+
+    printf("NetworkSocketAPI Example\r\n");
+
+    wifi.connect("ssid", "password");
+    const char *ip = wifi.get_ip_address();
+    const char *mac = wifi.get_mac_address();
+    printf("IP address is: %s\r\n", ip ? ip : "No IP");
+    printf("MAC address is: %s\r\n", mac ? mac : "No MAC");
+    
+    SocketAddress addr(&wifi, "mbed.org");
+    printf("mbed.org resolved to: %s\r\n", addr.get_ip_address());
+
+    TCPSocket socket(&wifi);
+    socket.connect("4.ifcfg.me", 23);
+
+    char buffer[64];
+    int count = socket.recv(buffer, sizeof buffer);
+    printf("public IP address is: %.15s\r\n", &buffer[15]);
+    
+    socket.close();
+    wifi.disconnect();
+
+    printf("Done\r\n");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Wed May 25 05:01:56 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#bdd541595fc5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 25 05:01:56 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f
\ No newline at end of file