Dreamforce 2014 Demo of RFID-based Salesforce Case generation for status reporting.
Dependencies: ID12RFID ReportDB SalesforceCaseGenerator SalesforceInterface
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
Revision 13:a3715360e454, committed 2014-09-09
- Comitter:
- ansond
- Date:
- Tue Sep 09 20:45:00 2014 +0000
- Parent:
- 12:ba63d4f862e8
- Child:
- 14:f4ab5c7abc50
- Commit message:
- relocated main.cpp to make StatusReporter portable
Changed in this revision
main.cpp | Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Sep 09 20:23:05 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* 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. - */ - - // StatusReporter - #include "StatusReporter.h" - - // appboard LCD Panel - #if _NXP_PLATFORM - #include "C12832_lcd.h" - C12832_LCD lcd; - #endif - #if _UBLOX_PLATFORM - #include "C12832.h" - C12832 lcd(D11, D13, D12, D7, D10); - #endif - - // our Serial port - #include "BufferedSerial.h" - BufferedSerial pc(USBTX, USBRX); - - // Ethernet - #include "EthernetInterface.h" - EthernetInterface ethernet; - - // HTTP - #include "HTTPClient.h" - HTTPClient http; - - // HARD RESET -extern "C" void HardFault_Handler() { NVIC_SystemReset(); } - - // Main Task... - void mainTask(void const *v) { - // create our object instances -#if _NXP_PLATFORM || _UBLOX_PLATFORM - ErrorHandler logger(&pc,&lcd); -#endif -#if _K64F_PLATFORM - ErrorHandler logger(&pc,NULL); -#endif - - // announce - logger.log("ARM/DreamForce 2014 mbed Status Reporter v%s",APP_VERSION); - logger.turnLEDBlue(); - - // initialize Ethernet - logger.log("Initializing Ethernet..."); - ethernet.init(); - - // get a DHCP address and bring the network interface up - logger.log("Getting IP Address..."); - logger.turnLEDOrange(); - if (ethernet.connect() == 0) { - // log our IP address (DHCP) - logger.log("IP Address: %s",ethernet.getIPAddress()); - - // create the StatusReporter - StatusReporter status_reporter(&logger,(void *)&http); - - // entering main loop - logger.log("Entering Main Loop...\r\nScanning..."); - logger.turnLEDGreen(); - - // Enter the main loop - while(true) { - // check and report on status updates - status_reporter.checkAndReportOnStatus(); - } - } - else { - logger.log("No Network... Exiting..."); - logger.turnLEDRed(); - exit(1); - } - - // disconnect - logger.log("Disconnecting..."); - logger.turnLEDOrange(); - ethernet.disconnect(); - - // Exit - logger.log("Exiting..."); - logger.turnLEDBlue(); - exit(1); - } - - // main entry - int main() { - #if _K64F_PLATFORM - Thread workerTask(mainTask, NULL, osPriorityNormal, STACK_SIZE); - while (true) { - Thread::wait(10*WAIT_TIME_MS); - } - #else - mainTask(NULL); - #endif - } \ No newline at end of file