MQTT cellular example

Dependencies:   C027_Support C12832 MQTT mbed

Fork of Cellular_HelloMQTT by Michael Ammann

Revision:
12:0ec1916059b5
Parent:
11:c074866fcad7
Child:
14:d495a85ed55b
--- a/main.cpp	Tue May 13 09:33:30 2014 +0000
+++ b/main.cpp	Tue May 20 14:33:13 2014 +0000
@@ -23,33 +23,25 @@
   system libraries.
  
  */
-
 #include "mbed.h"
-#include "EthernetInterfaceIPStack.h"
-#include "C027.h"
-#include "MDM.h"
-
-//----------------------------------------------------------------------
-// You may need to configure these parameters
-
-/** Set your secret SIM pin here "1234"
-*/
-#define SIMPIN      NULL
+#include "MbedIPStack.h"
 
-/** The APN of your network operator, sometimes it is "internet" 
-    check your contract with the network operator
-*/
+//------------------------------------------------------------------------------------
+// You need to configure these cellular modem / SIM parameters.
+// These parameters are ignored for LISA-C200 variants and can be left NULL.
+//------------------------------------------------------------------------------------
+#include "MDM.h"
+//! Set your secret SIM pin here (e.g. "1234"). Check your SIM manual.
+#define SIMPIN      NULL
+/*! The APN of your network operator SIM, sometimes it is "internet" check your 
+    contract with the network operator. You can also try to look-up your settings in 
+    google: https://www.google.de/search?q=APN+list */
 #define APN         "gprs.swisscom.ch"
-
-/** Set the user name for your APN, or NULL if not needed
-*/
+//! Set the user name for your APN, or NULL if not needed
 #define USERNAME    NULL
-
-/** Set the password for your APN, or NULL if not needed
-*/
+//! Set the password for your APN, or NULL if not needed
 #define PASSWORD    NULL 
-
-C027 c027;
+//------------------------------------------------------------------------------------
 
 #include "C12832.h"
 C12832 lcd(D11, D13, D12, D7, D10);
@@ -71,14 +63,9 @@
 
 int main(int argc, char* argv[])
 {   
-    Serial pc(USBTX,USBRX);
-    pc.baud(115200);
-
-    // turn on the supplies of the Modem
-    c027.mdmPower(true);
-    printf("Modem Initialize\r\n");
     MDMSerial mdm;
-    if (!mdm.connect(SIMPIN, APN,USERNAME,PASSWORD, true))
+    //mdm.setDebug(4); // enable this for debugging issues 
+    if (!mdm.connect(SIMPIN, APN,USERNAME,PASSWORD))
         return -1;
             
     IPStack ipstack = IPStack();
@@ -151,7 +138,6 @@
 
     mdm.disconnect();
     mdm.powerOff();
-    c027.mdmPower(false);
     
     lcd.cls();
     lcd.locate(0,3);