wefghuygf

Dependencies:   HTTPClient WizFi310Interface_Legacynew mbed

Fork of dweetIo_CloudService_Helloworld_WIZwiki- by ajeet prajapati

Files at this revision

API Documentation at this revision

Comitter:
wiznetw7500
Date:
Tue Nov 28 09:06:42 2017 +0000
Parent:
5:95b9bcc5dd34
Commit message:
sdftrdx

Changed in this revision

WIZnetInterface.lib Show diff for this revision Revisions of this file
WizFi310Interface_Legacynew.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.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 95b9bcc5dd34 -r 1a0f0aa70f49 WIZnetInterface.lib
--- a/WIZnetInterface.lib	Tue Oct 24 04:32:01 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/teams/WIZnet/code/WIZnetInterface/#c91884bd2713
diff -r 95b9bcc5dd34 -r 1a0f0aa70f49 WizFi310Interface_Legacynew.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WizFi310Interface_Legacynew.lib	Tue Nov 28 09:06:42 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/ajeet3004/code/WizFi310Interface_Legacynew/#a4890cc8be69
diff -r 95b9bcc5dd34 -r 1a0f0aa70f49 main.cpp
--- a/main.cpp	Tue Oct 24 04:32:01 2017 +0000
+++ b/main.cpp	Tue Nov 28 09:06:42 2017 +0000
@@ -1,22 +1,28 @@
 #include "mbed.h"
-#include "EthernetInterface.h"
+//#include "EthernetInterface.h"
 #include "HTTPClient.h"
+#include "WizFi310Interface.h"
 
+
+#define SECURE WizFi310::SEC_WPA2_MIXED
+#define SSID "CDI"
+#define PASS "Cdi*1717"
 /*
     SET DHCP
 */
 #define USE_DHCP    1
 //--------- Have to modify the mac address-------------
 unsigned char MAC_Addr[6] = {0x00,0x08,0xDC,0x12,0x34,0x56};
-
+#if defined(TARGET_WIZwiki_W7500)
+    WizFi310Interface wizfi310(D1, D0, D7, D6, D8, NC, 115200);
+    Serial pc(USBTX, USBRX);
+#endif
 /* IP SET */
 //char IP_Addr[] = "192.168.0.100";
 //char IP_Subnet[] = "255.255.255.0";
 //char IP_Gateway[] = "192.168.0.1";
 
-Serial pc(USBTX, USBRX);
-
-EthernetInterface ethernet;
+//EthernetInterface ethernet;
 
 AnalogIn Sensor(A0);
 
@@ -24,27 +30,16 @@
 
 
   ///  mbed_mac_address((char *)MAC_Addr); //Use mbed mac addres
-    pc.baud(9600);
-    #if USE_DHCP
-    int ret = ethernet.init(MAC_Addr);
-    #else
-    int ret = ethernet.init(MAC_Addr,IP_Addr,IP_Subnet,IP_Gateway);
-    #endif
-    if (!ret) {
-        pc.printf("Initialized, MAC: %s\r\n", ethernet.getMACAddress());
-        ret = ethernet.connect();
-        if (!ret) {
-            pc.printf("IP: %s, MASK: %s, GW: %s\r\n",
-                      ethernet.getIPAddress(), ethernet.getNetworkMask(), ethernet.getGateway());
-        } else {
-            pc.printf("Error ethernet.connect() - ret = %d\r\n", ret);
-            exit(0);
-        }
-    } else {
-        pc.printf("Error ethernet.init() - ret = %d\r\n", ret);
-        exit(0);
-    }
-    
+   pc.baud(115200);
+ 
+    printf("WizFi310  STATION. \r\n");
+    wizfi310.init();
+    printf("After Initialisation. \r\n");
+
+    printf("After Set Address. \r\n");
+    if ( wizfi310.connect(SECURE, SSID, PASS, WizFi310::WM_STATION))      return -1;
+    printf("After Connect. \r\n");
+    printf("IP Address is %s\r\n", wizfi310.getIPAddress());  
     char str[512];
     char msg[128]= "";
     
@@ -61,7 +56,7 @@
         
         pc.printf("Send post message to dweet.io\r\n");
         pc.printf("msg : %s\r\n",msg);
-        ret = http.get(msg, str, sizeof(str));
+       int ret = http.get(msg, str, sizeof(str));
         if(!ret)
         {
           pc.printf("\r\nPage fetched successfully - read %d characters\r\n", strlen(str));
diff -r 95b9bcc5dd34 -r 1a0f0aa70f49 mbed.bld
--- a/mbed.bld	Tue Oct 24 04:32:01 2017 +0000
+++ b/mbed.bld	Tue Nov 28 09:06:42 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/a330f0fddbec
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e7ca05fa8600
\ No newline at end of file