Damien Frost / WiflyInterface

Dependents:   IoT_Ex BatteryModelTester BatteryModelTester

Fork of WiflyInterface by Components

Files at this revision

API Documentation at this revision

Comitter:
defrost
Date:
Thu Feb 18 12:05:53 2016 +0000
Parent:
11:fc3d86645d23
Child:
13:8846f12fa277
Commit message:
- Adding lots of random code to Wifly Interface

Changed in this revision

Wifly/Wifly.cpp Show annotated file Show diff for this revision Revisions of this file
Wifly/Wifly.h Show annotated file Show diff for this revision Revisions of this file
WiflyInterface.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Wifly/Wifly.cpp	Tue Jun 03 18:43:14 2014 +0000
+++ b/Wifly/Wifly.cpp	Thu Feb 18 12:05:53 2016 +0000
@@ -68,6 +68,7 @@
 bool Wifly::join()
 {
     char cmd[20];
+    pc.printf("Got to 0\n\r");
 
     for (int i= 0; i < MAX_TRY_JOIN; i++) {
 
@@ -141,7 +142,7 @@
 
         //key step
         if (state.sec != NONE) {
-            if (state.sec == WPA)
+            if ((state.sec == WPA)||(state.sec == WPA2))
                 sprintf(cmd, "set w p %s\r", phrase);
             else if (state.sec == WEP_128)
                 sprintf(cmd, "set w k %s\r", phrase);
@@ -168,8 +169,13 @@
 
         exit();
 
+        pc.printf("Got to 10\n\r");
+
         state.associated = true;
         INFO("\r\nssid: %s\r\nphrase: %s\r\nsecurity: %s\r\n\r\n", this->ssid, this->phrase, getStringSecurity());
+        
+        
+        pc.printf("\r\nssid: %s\r\nphrase: %s\r\nsecurity: %s\r\n\r\n", this->ssid, this->phrase, getStringSecurity());
         return true;
     }
     return false;
@@ -219,6 +225,8 @@
 {
     char rcv[20];
     char cmd[20];
+    
+    
 
     // try to open
     sprintf(cmd, "open %s %d\r", host, port);
@@ -227,6 +235,7 @@
         state.cmd_mode = false;
         return true;
     }
+    
 
     // if failed, retry and parse the response
     if (sendCommand(cmd, NULL, rcv, 5000)) {
@@ -245,6 +254,7 @@
     } else {
         return false;
     }
+    
 
     state.tcp = true;
     state.cmd_mode = false;
--- a/Wifly/Wifly.h	Tue Jun 03 18:43:14 2014 +0000
+++ b/Wifly/Wifly.h	Thu Feb 18 12:05:53 2016 +0000
@@ -24,6 +24,8 @@
  * http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Wireless/WiFi/WiFly-RN-UM.pdf
  */
 
+
+
 #ifndef WIFLY_H
 #define WIFLY_H
 
@@ -32,6 +34,8 @@
 
 #define DEFAULT_WAIT_RESP_TIMEOUT 500
 
+extern Serial pc;
+
 enum Security {
     NONE = 0,
     WEP_128 = 1,
--- a/WiflyInterface.cpp	Tue Jun 03 18:43:14 2014 +0000
+++ b/WiflyInterface.cpp	Thu Feb 18 12:05:53 2016 +0000
@@ -29,7 +29,9 @@
 
 int WiflyInterface::connect()
 {
-    return join();
+    int i = join();
+    pc.printf("Join() complete. %d\n\r",i);
+    return i;
 }
 
 int WiflyInterface::disconnect()