Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

Revision:
159:329e3271c87e
Parent:
157:33db0c5e0bd8
Child:
160:24337c83dd1d
--- a/main.cpp	Mon Jun 30 17:38:36 2014 +0000
+++ b/main.cpp	Mon Jun 30 22:17:32 2014 +0000
@@ -21,7 +21,16 @@
  #include <string.h>
  #include <stdlib.h>
  
- #ifndef CELLULAR_NETWORK
+ #ifdef CELLULAR_NETWORK
+    // MDMSerial 
+    #include "MDM.h"
+    MDMSerial modem; 
+    
+    // GPSParser
+    //#include "GPS.h"
+    //GPSParser gps;
+    void *gps = NULL; 
+ #else
     // Ethernet Interface
     #include "EthernetInterface.h"
     EthernetInterface ethernet;
@@ -107,65 +116,11 @@
      return NULL;
  }
  
- #ifdef CELLULAR_NETWORK
- int _ublox_cell_connect_status = 0;
- int getUbloxConnectStatus() { return _ublox_cell_connect_status; }
- C027 c027;
- 
- /*
- #include "Websocket.h"
- 
- void ublox_test_modem(int index) {
-    // See the output on http://sockets.mbed.org/demo/viewer
-    char *url = "ws://sockets.mbed.org:443/ws/demo/rw";
-    Websocket ws(url);
-
-    pc.printf("connecting to websocket: %s\r\n",url);
-    bool c = ws.connect();
-    pc.printf("Connect result: %s\n", c?"OK":"Failed");
-    
-    char msg[512];
-    memset(msg,0,512);
-    sprintf(msg,"testing mbed websockets...123...%d",index);
-    
-    pc.printf("Sending data...\r\n");
-    ws.send(msg);    
-    wait(0.5f);
-    memset(msg,0,512);
-        
-    pc.printf("Receiving data...\r\n");
-    if (ws.read(msg))
-        pc.printf("Websocket Receive: [%s]\r\n", msg);
-    else
-        pc.printf("Error in reading from websocket!\r\n");
-        
-    pc.printf("closing websockets.");
-    ws.close();
-}
-*/
-
- #endif
- 
  // HARD RESET - ugly but necessary - we seem to develop memory holes.... :(
  extern "C" void HardFault_Handler() { NVIC_SystemReset(); }
  
  // main entry point
  int main() {      
-#ifdef CELLULAR_NETWORK
-    c027.mdmUsbEnable(true);
-    c027.mdmPower(true);
-    c027.mdmReset();
-    c027.mdmWakeup();
-    UBLOX_MODEM modem(NC,true,1);
-    modem.power(true);
-    Thread::wait(3000);
-    _ublox_cell_connect_status = modem.connect("internet");
-    if (_ublox_cell_connect_status) pc.printf("Unable to connect cell modem\r\n");
-    else pc.printf("Cell modem connected!\r\n");
-    //ublox_test_modem(1);
-    //ublox_test_modem(2);
-    //ublox_test_modem(3);
-#endif
 #ifdef NETWORK_MUTEX
     network_mutex = new Mutex();
     if (network_mutex != NULL) network_mutex->unlock();
@@ -177,7 +132,7 @@
 #endif
     error_handler = new ErrorHandler(&pc,&lcd);
 #ifdef CELLULAR_NETWORK
-    endpoint = new MBEDEndpoint(error_handler,&modem,&c027);
+    endpoint = new MBEDEndpoint(error_handler,&modem,&gps);
 #else
     endpoint = new MBEDEndpoint(error_handler,&ethernet,NULL);
 #endif