Colin Stearns / Mbed 2 deprecated qcControl

Dependencies:   mbed

Fork of dgps by Colin Stearns

Revision:
18:e72ee7aed088
Parent:
16:4f5d20b87dc3
Child:
19:8c1f2a2204fb
--- a/main.cpp	Sat Apr 19 14:39:19 2014 +0000
+++ b/main.cpp	Sun Apr 20 08:04:37 2014 +0000
@@ -24,6 +24,10 @@
     }
 }
 
+void connection_lost(){
+    USB::getSerial().printf("TCP connection lost!\r\n");    
+}
+
 //sends: "$<command>*<checksum>\r\l"
 void sendGpsCommand(string command)
 {
@@ -136,7 +140,32 @@
         //XBEE::getSerial().printf("ABC\n");
     //}
     USB::getSerial().printf("Check GPS\n");
+    
+    USB::getSerial().printf("Connect to the wifly network now!\r\n");
+    __disable_irq();
+    XBEE::getTCPInterrupt().fall(&connection_lost);
+    
+    getPS().wait_for_egg();
+    //for(int a=0;a<1000000000;a++);
     while(1){
+        //while(1){
+//            USB::getSerial().printf("sending 0's\n");
+//            getPS().openConnection();
+//            USB::getSerial().printf("connection open!\r\n");
+//            for(int b=0;b<50;b++){
+//                for(int a=0;a<sizeof(PacketStruct)-1;a++){
+//                    while(!getPS().outputDevice.writeable()){}
+//                    getPS().outputDevice.putc(0);
+//                }
+//                while(!getPS().outputDevice.writeable()){}
+//                getPS().outputDevice.putc(0xFF);
+//            }
+//            USB::getSerial().printf("sent all data\r\n");
+//            //for(int a=0;a<10000000;a++);
+//            getPS().closeConnection();
+//            //for(int a=0;a<10000000;a++);
+//        }
+
         // Run image handler
         USB::getSerial().printf("Check Image\n");
         imageHand.run();