Kevin Rhyne / Whiffy

Dependencies:   4DGL-uLCD-SE mbed

src/Whiffy.cpp

Committer:
kevinrhyne
Date:
2015-10-20
Revision:
17:4d0e180cde20
Parent:
13:ef68cbcb4e9a
Child:
18:94536dca963c

File content as of revision 17:4d0e180cde20:

#include "Whiffy.h"


Whiffy::Whiffy() : wifi(), reporter(){
    
    Serial pc(USBTX, USBRX);
    pc.baud(115200);
    pc.printf("\r\nReporter & WifiControl created\r\n");
    
    
    
};

void Whiffy::update() {
    
    Serial pc(USBTX, USBRX);
    pc.baud(115200);
    wait(2);
    pc.printf("\r\n\r\nCreating APVectorBuilder\r\n");
    wait(2);
    APVectorBuilder apBuilder;
    wait(2);
    while(true) {
        pc.printf("\r\nGetting AP list\r\n");
        wait(2);
        string real(wifi.pollAP()); //Get list of APs
        wait(2);
        pc.printf("\r\nVectorizing AP list\r\n");
        wait(2);
        vector<AccessPoint> APList(apBuilder.build(real)); //Finish building AP list
        wait(2);
        pc.printf("\r\nSending AP list to reporter\r\n");
        wait(1);
        pc.printf("5th element: %s\r\n", APList[5].getSSID().c_str());
        wait(2);
        reporter.update(APList);
    }
    
    
    
    

    //pc.printf("Access points found: \r\n");
    //pc.printf("%s", real.c_str());

    
    
    
    //pc.printf("\r\n\r\n Access Point information ------------- \r\n\r\n");
    // Print elements
    //for (int i = 0; i < APList.size(); i++){
    //    pc.printf("\r\nList Element: %s, %d", APList[i].getSSID(), APList[i].getStrength());
    //}
    
}