Dreamforce 2014 Workshop RFID Case Generator - FRDM-K64F
Dependencies: EndpointMain-rfid EthernetInterface StatusReporter BufferedSerial mbed-rtos mbed Logger C12832
Fork of df-2014-workshop-rfid-case-generator-ublox by
Revision 0:df2aa79c64f2, committed 2014-08-23
- Comitter:
- ansond
- Date:
- Sat Aug 23 20:17:18 2014 +0000
- Child:
- 1:5c7d6b24a773
- Commit message:
- initial checkin
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Definitions.h Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,63 @@ +/* Copyright C2014 ARM, MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files the "Software", to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + #ifndef _DEFINITIONS_H_ + #define _DEFINITIONS_H_ + + // Include mbed + #include "mbed.h" + + // Our App version + #define APP_VERSION "1.0.0" + + // My Salesforce APEX host for case generation + #define MY_SF_HOST "danson.na17.force.com" + + // My Salesforce APEX case resource path + #define MY_APEX_CASE_RESOURCE "/services/apexrest/CaseService" + + // Buffer length for HTTPS requests + #define BUFFER_LENGTH 256 + + // maximum log message length + #define MAX_LOG_MESSAGE 128 + + // What platform we are compiling on + #define _NXP_PLATFORM true + + // Wait Time for iterations (ms) + #define WAIT_TIME_MS 500 + + // Tunables for WidgetDB + #define MAX_NAME_LENGTH 64 + #define MAX_DESCRIPTION_LENGTH 128 + #define MAX_NUM_WIDGETS 2 + + // convenience definitions for WidgetDB... 2 RFIDs/station + #define FIRST_WIDGET 0 + #define SECOND_WIDGET 1 + + #define FIRST_WIDGET_RFID 0123345 + #define FIRST_WIDGET_NAME "WizBang Thingy" + #define FIRST_WIDGET_DESCRIPTION "Neutron De-nebulizer" + + #define SECOND_WIDGET_RFID 6789012 + #define SECOND_WIDGET_NAME "OddStrange Thingy" + #define SECOND_WIDGET_DESCRIPTION "Colorizing Tenderizer" + + #endif // _DEFINITIONS_H_ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetInterface.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/EthernetInterface/#5887ae6c0c2c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPSClient_cyassl.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/feb11/code/HTTPSClient_cyassl/#1abc65a0f50b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ID12RFID.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/ID12RFID/#f04afa911cf5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Logger.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +Logger#5b5ceb10c045
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MbedJSONValue.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/ansond/code/MbedJSONValue/#02d251fdacfd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SalesforceCaseGenerator.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +SalesforceCaseGenerator#5953127f7c19
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TLS_cyassl.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/feb11/code/TLS_cyassl/#c12f49c210c2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WidgetDB.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +WidgetDB#6a368cae1bdb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,91 @@ +/* Copyright C2014 ARM, MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files the "Software", to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * 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 + #include "ID12RFID.h" + ID12RFID rfid_reader(p14); + + // Salesforce Case Generator + #include "SalesForceCaseGenerator.h" + + // our Logger + #include "Logger.h" + + // our WidgetDB + #include "WidgetDB.h" + + // our LCD Panel + #include "C12832_lcd.h" + C12832_LCD lcd; + + // our Serial port + #include "Serial.h" + Serial pc(USBTX, USBRX); + + // Main Entry... + int main() { + // create our object instances + Logger logger(&pc,&lcd); + + // announce + logger.log("DF 2014 RFID Reader\r\nVersion: %s",APP_VERSION); + + // create the WidgetDB + WidgetDB db; + + // create the Salesforce Case Generator + SalesForceCaseGenerator case_generator(&logger); + + // Enter the main loop + while(true) { + // look for a readable RFID tag + if(rfid_reader.readable()) { + // capture the RFID id... + int rfid = rfid_reader.read(); + logger.log("RFID: %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,"Widget %s detected",name); + + // create and dispatch a case + bool success = case_generator.createCase(subject,db.lookupWidgetDescription(rfid)); + if (success == true) { + logger.log("Case Generated!"); + } + else { + logger.log("Case Generation FAILED"); + } + } + else { + // unrecognized RFID + logger.log("RFID unknown. Ignoring..."); + } + } + + // wait a bit and look again + wait_ms(WAIT_TIME_MS); + } + } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#bd07334df5b1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Aug 23 20:17:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file