Door controller and proximity switch detection.

Dependencies:   mbed-rtos mbed VodafoneUSBModem_bleedingedge

This program takes in a digital input - which is a reed switch for a door - and an output to a relay. The door is open with a simple 'text' to the modem on the USB bus (i used k3770 vodafone dongle).

The door will send an alarm message to your nominated numbers at the start of the program if the door is open without a command being sent.

Very simple - and just meant as a demonstration of how to incorporate GSM/3G functionality to a evice.

Revision:
17:9b57d29e2eab
Parent:
16:9245c3a37491
Child:
18:ad4ae0caf337
diff -r 9245c3a37491 -r 9b57d29e2eab main.cpp
--- a/main.cpp	Wed Sep 26 17:02:59 2012 +0000
+++ b/main.cpp	Thu Sep 27 13:06:55 2012 +0000
@@ -70,7 +70,7 @@
   LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN;                                 // an enum to hold the type of bearer established by the connection manager
   int rssi = -1000;                                                                         // a signal strength indicator variable - set to a very default low value.
 
-
+  int ret = connectionManager.getLinkState(&rssi, &regState, &bearer);
   // LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_HOME_NETWORK;
 
   // before we do anything we need to make sure we have a connection to a network.
@@ -79,8 +79,8 @@
   
   while(detectRegState)
   {
-      if(connectionManager.getLinkState(&rssi, &regState, &bearer)==0) 
-      //if (detectRegState ==1)
+      //if(connectionManager.getLinkState(&rssi, &regState, &bearer)==0) 
+      if (detectRegState ==1)
       {
         if(rssi==-1000) 
         { 
@@ -115,7 +115,7 @@
                 break;
             default:
                 DBG("regState: ERROR. Failing.");
-                break;
+
         }
       }
   Thread::wait(500);
@@ -125,7 +125,7 @@
 
 
 
-  connectionManager.sendSM(MY_PHONE_NUMBER, "Hello from mbed door controller:)");
+  ret = connectionManager.sendSM(MY_PHONE_NUMBER, "Hello from mbed door controller");
 
 
 
@@ -243,7 +243,7 @@
   DBG_INIT();
   DBG_SET_SPEED(115200);
 
-  Thread testTask(test, NULL, osPriorityNormal, 1024*5);
+  Thread testTask(test, NULL, osPriorityNormal, 1024*6);
   keepAlive(NULL);