Wifly interface for RN-XV (wifly RN171XVW) senCommand: ssid & pharse no AOK needed

Fork of WiflyInterface by mbed official

Files at this revision

API Documentation at this revision

Comitter:
BjornVB
Date:
Wed Feb 05 21:11:23 2014 +0000
Parent:
1:fb4494783863
Commit message:
Wifly library for RN171XVW (RN-XV) Wifly; sendCommand: ssid and phrase --> no AOK //solved

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
--- a/Wifly/Wifly.cpp	Fri Aug 24 13:48:36 2012 +0000
+++ b/Wifly/Wifly.cpp	Wed Feb 05 21:11:23 2014 +0000
@@ -47,7 +47,6 @@
 {
     memset(&state, 0, sizeof(state));
     state.sec = sec;
-
     // change all ' ' in '$' in the ssid and the passphrase
     strcpy(this->ssid, ssid);
     for (int i = 0; i < strlen(ssid); i++) {
@@ -81,7 +80,7 @@
         // red led on when tcp connection active
         if (!sendCommand("set s i 0x40\r", "AOK"))
             continue;
-
+        
         // no string sent to the tcp client
         if (!sendCommand("set c r 0\r", "AOK"))
             continue;
@@ -97,26 +96,26 @@
         //no echo
         if (!sendCommand("set u m 1\r", "AOK"))
             continue;
-
+        
         // no auto join
         if (!sendCommand("set w j 0\r", "AOK"))
             continue;
-
+        
         //dhcp
         sprintf(cmd, "set i d %d\r", (state.dhcp) ? 1 : 0);
         if (!sendCommand(cmd, "AOK"))
             continue;
-
+        
         // ssid
         sprintf(cmd, "set w s %s\r", ssid);
-        if (!sendCommand(cmd, "AOK"))
-            continue;
-
+        if (!sendCommand(cmd, "NULL"))// origineel "AOK"
+        //    continue;
+        
         //auth
         sprintf(cmd, "set w a %d\r", state.sec);
         if (!sendCommand(cmd, "AOK"))
             continue;
-
+        
         // if no dhcp, set ip, netmask and gateway
         if (!state.dhcp) {
             DBG("not dhcp\r");
@@ -138,25 +137,26 @@
         if (state.sec != NONE) {
             if (state.sec == WPA)
                 sprintf(cmd, "set w p %s\r", phrase);
+            else if (state.sec == WPA1)
+                sprintf(cmd, "set w p %s\r", phrase);
             else if (state.sec == WEP_128)
                 sprintf(cmd, "set w k %s\r", phrase);
-
-            if (!sendCommand(cmd, "AOK"))
-                continue;
+            
+            sendCommand(cmd, "NULL");//origineel "AOK"
         }
-
+        
         //join the network
         sprintf(cmd, "join\r");
         if (!sendCommand(cmd, "Associated", NULL, 3000))
             continue;
-
+        
         if (state.dhcp) {
             if (!sendCommand("", "DHCP=ON", NULL, 3000))
                 continue;
         }
 
         exit();
-
+        
         state.associated = true;
         INFO("\r\nssid: %s\r\nphrase: %s\r\nsecurity: %s\r\n\r\n", this->ssid, this->phrase, getStringSecurity());
         return true;
@@ -200,6 +200,8 @@
             return "NONE";
         case WEP_128:
             return "WEP_128";
+        case WPA1:
+            return "WPA1";
         case WPA:
             return "WPA";
     }
@@ -376,7 +378,6 @@
     return wifi.putc(c);
 }
 
-
 bool Wifly::exit()
 {
     flush();
--- a/Wifly/Wifly.h	Fri Aug 24 13:48:36 2012 +0000
+++ b/Wifly/Wifly.h	Wed Feb 05 21:11:23 2014 +0000
@@ -27,6 +27,7 @@
 #ifndef WIFLY_H
 #define WIFLY_H
 
+
 #include "mbed.h"
 #include "CBuffer.h"
 
@@ -35,6 +36,7 @@
 enum Security {
     NONE = 0,
     WEP_128 = 1,
+    WPA1 = 2,
     WPA = 3
 };
 
@@ -136,8 +138,7 @@
     * @param the character which will be written
     */
     int putc(char c);
-
-
+    
     /*
     * To enter in command mode (we can configure the module)
     *