port to cellular

Dependencies:   C027_Support LM75B M2XStreamClient jsonlite mbed mbed-rtos

Fork of m2x-demo-all by AT&T M2X Team

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Tue May 13 07:18:59 2014 +0000
Parent:
0:38a7a8cae773
Child:
2:83dd0b8109ca
Commit message:
inital port

Changed in this revision

C027.lib Show annotated file Show diff for this revision Revisions of this file
C027_Support.lib Show annotated file Show diff for this revision Revisions of this file
EthernetInterface.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C027.lib	Tue May 13 07:18:59 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/ublox/code/C027/#89c45165ee87
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C027_Support.lib	Tue May 13 07:18:59 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/ublox/code/C027_Support/#1f65abb842be
--- a/EthernetInterface.lib	Fri Feb 21 21:12:15 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/EthernetInterface/#6a67d2bddc7c
--- a/main.cpp	Fri Feb 21 21:12:15 2014 +0000
+++ b/main.cpp	Tue May 13 07:18:59 2014 +0000
@@ -2,9 +2,33 @@
 #include "M2XStreamClient.h"
 
 #include "mbed.h"
-#include "EthernetInterface.h"
 #include "LM75B.h"  //I2C Temperature Sensor
 
+#include "C027.h"
+#include "MDM.h"
+
+//----------------------------------------------------------------------
+// You may need to configure these parameters
+
+/** Set your secret SIM pin here "1234"
+*/
+#define SIMPIN      NULL
+
+/** The APN of your network operator, sometimes it is "internet" 
+    check your contract with the network operator
+*/
+#define APN         "gprs.swisscom.ch"
+
+/** 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
+*/
+#define PASSWORD    NULL 
+
+C027 c027;
+
 char feedId[] = "<feed id>"; // Feed you want to post to
 char m2xKey[] = "<m2x api key>"; // Your M2X access key
 char streamName[] = "<stream name>"; // Stream you want to post to
@@ -17,8 +41,7 @@
 Client client;
 M2XStreamClient m2xClient(&client, m2xKey);
 
-EthernetInterface eth;
-LM75B tmp(p28,p27);         // I2C Temperature Sensor
+LM75B tmp(SDA,SCL);         // I2C Temperature Sensor
 
 void on_data_point_found(const char* at, const char* value, int index, void* context) {
   printf("Found a data point, index: %d\r\n", index);
@@ -38,9 +61,12 @@
 }
 
 int main() {
-  eth.init();
-  eth.connect();
-  printf("IP Address: %s\r\n", eth.getIPAddress());
+  // turn on the supplies of the Modem and the GPS
+  c027.mdmPower(true);
+  printf("Modem Initialize\r\n");
+  MDMSerial mdm;
+  if (!mdm.connect(SIMPIN, APN,USERNAME,PASSWORD, true))
+    return -1;
 
   char amb_temp[6];
   
@@ -72,4 +98,9 @@
     // wait 60 secs and then loop
     delay(60000);
   }
+
+  mdm.disconnect();
+  mdm.powerOff();
+  c027.mdmPower(false);
+  printf("Done\n");
 }
\ No newline at end of file
--- a/mbed-rtos.lib	Fri Feb 21 21:12:15 2014 +0000
+++ b/mbed-rtos.lib	Tue May 13 07:18:59 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#f88660a9bed1
+http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d
--- a/mbed.bld	Fri Feb 21 21:12:15 2014 +0000
+++ b/mbed.bld	Tue May 13 07:18:59 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file