Dreamforce 2014 Workshop Exercise - RFID Case Generator

Dependencies:   BufferedSerial C12832 EndpointMain-rfid EthernetInterface Logger StatusReporter-df2014 mbed-rtos mbed

Fork of df-2014-workshop-rfid-case-generator-k64f by Doug Anson

Overview

This code demonstrates how to use the mbed platform with a ID-12LA RFID reader and a Freescale K64F to get data into the SalesForce cloud.
This project was generated as a workshop for DreamForce 2014..

Details

The 2014 DreamForce workshop centers around an example scenario where you, as a street light technician, will "check in" to a given street light to service it. The street lights in this example are intelligent - they are connected, have knowledge about who/what they are, and in this example, contain an RFID sensor to allow technicians to "check in" during a service event.

The purpose of the workshop exercise is to provide exposure to new developers that the mbed IDE and development environment/ecosystem is very simple and easy to setup and use. Additionally, the workshop highlights that mbed devices can directly interact with SalesForce. The slides for the workshop can be found here.

For more information about the mbed SalesForce Interface API and its use, please see: http://developer.mbed.org/teams/MBED_DEMOS/code/SalesforceInterface/

Pretty Pictures

For the workshop the mbed team designed breakout boards to connect the ID12LA to the Freescale K64F for ease of use. Pictures of the boards can be found below. If you are interested in the breakout board you can order one from the OSHPark project page or use the eagle or gerber files as you see fit.

The ID-12LA sockets onto the RFID Brekout Board which then is put onto the Freescale K64F.

/media/uploads/mbedAustin/rfidboard_-8-.small.jpg

/media/uploads/mbedAustin/rfidboard_-9-.small.jpg

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Thu Aug 28 20:19:08 2014 +0000
Parent:
12:a8c9a0190d30
Child:
14:3af24f140601
Commit message:
updates and redesign of key classes

Changed in this revision

ErrorHandler.lib Show annotated file Show diff for this revision Revisions of this file
ID12RFID.lib Show diff for this revision Revisions of this file
Logger.lib Show diff for this revision Revisions of this file
SalesforceCaseGenerator.lib Show diff for this revision Revisions of this file
StatusReporter.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ErrorHandler.lib	Thu Aug 28 20:19:08 2014 +0000
@@ -0,0 +1,1 @@
+ErrorHandler#906788c5813d
--- a/ID12RFID.lib	Thu Aug 28 00:07:52 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/simon/code/ID12RFID/#280ef169667c
--- a/Logger.lib	Thu Aug 28 00:07:52 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Logger#5b5ceb10c045
--- a/SalesforceCaseGenerator.lib	Thu Aug 28 00:07:52 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-SalesforceCaseGenerator#09d5df94e8ae
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/StatusReporter.lib	Thu Aug 28 20:19:08 2014 +0000
@@ -0,0 +1,1 @@
+StatusReporter#ba3327ba3a04
--- a/main.cpp	Thu Aug 28 00:07:52 2014 +0000
+++ b/main.cpp	Thu Aug 28 20:19:08 2014 +0000
@@ -16,23 +16,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
  
- // our definitions
- #include "Definitions.h"
-
- // RFID Reader - on P14 pin  
- #if ID12_ENABLE
-    #include "ID12RFID.h"
-    ID12RFID rfid_reader(p13,p14);
- #endif 
-
- // Salesforce Case Generator
- #include "SalesForceCaseGenerator.h"
- 
- // our Logger
- #include "Logger.h"
- 
- // our WidgetDB
- #include "WidgetDB.h"
+ // StatusReporter
+ #include "StatusReporter.h"
  
  // our LCD Panel
  #include "C12832_lcd.h"
@@ -52,10 +37,10 @@
  // Main Entry...
  int main() {
     // create our object instances
-    Logger logger(&pc,&lcd);
+    ErrorHandler logger(&pc,&lcd);
     
     // announce
-    logger.log("DF 2014 RFID Reader\r\nVersion: %s",APP_VERSION);
+    logger.log("ARM/DreamForce 2014 mbed Status Reporter v%s",APP_VERSION);
     
     // initialize Ethernet
     logger.log("Initializing Ethernet...");
@@ -67,63 +52,16 @@
         // log our IP address (DHCP)
         logger.log("IP Address: %s",ethernet.getIPAddress());
         
-        // create the WidgetDB
-        WidgetDB db;
-        
-        // create the Salesforce Case Generator
-        SalesForceCaseGenerator case_generator(&logger);
+        // create the StatusReporter
+        StatusReporter status_reporter(&logger);
         
         // entering main loop
         logger.log("Entering Main Loop...\r\nScanning...");
         
         // Enter the main loop
         while(true) {
-#if ID12_ENABLE
-            // look for a readable RFID tag
-            //logger.log("RFID: Scanning...");
-            if(rfid_reader.readable()) {
-                // capture the RFID id...
-                logger.log("RFID: Found RFID.\r\nReading...");
-                int rfid = rfid_reader.read();
-                logger.log("RFID: ID %d found...\r\nProcessing...",rfid);
-                
-                // look it up in our WidgetDB... proceed only if we find something we know about...
-                char *name = db.lookupWidgetName(rfid);
-                if (name != NULL) {
-                    // build out a simple subject for the case
-                    char subject[MAX_NAME_LENGTH+1];
-                    memset(subject,0,MAX_NAME_LENGTH+1);
-                    sprintf(subject,"%s case update",name);
-                    
-                    // create and dispatch a case
-                    bool success = case_generator.createCase(subject,db.lookupWidgetDescription(rfid));
-                    if (success == true) {
-                        logger.log("Case Generated!\r\nScanning...");
-                    }
-                    else {
-                        logger.log("Case Generation FAILED\r\nScanning...");
-                    }
-                }
-                else {
-                    // unrecognized RFID
-                    logger.log("RFID unk-ignored.\r\nScanning...");
-                }
-             }
-#else 
-             // simply create and dispatch a single case
-             logger.log("Creating Case...");
-             bool success = case_generator.createCase("sample mbed case","this is a sample mbed case");
-             if (success == true) {
-                 logger.log("Case Generated!");
-                 logger.log("Exiting...");
-                 exit(1);
-             }
-             else {
-                 logger.log("Case Generation FAILED");
-                 logger.log("Exiting...");
-                 exit(1);
-             }
-#endif
+             // check and report on status updates
+             status_reporter.checkAndReportOnStatus();
           
              // wait a bit and look again
              wait_ms(WAIT_TIME_MS);