Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
Diff: main.cpp
- Revision:
- 20:f2dbbd852e08
- Parent:
- 18:bc165829bb88
- Child:
- 26:791d22d43cb4
diff -r 0e62467605e9 -r f2dbbd852e08 main.cpp --- a/main.cpp Wed Feb 26 07:22:26 2014 +0000 +++ b/main.cpp Wed Feb 26 18:59:01 2014 +0000 @@ -45,18 +45,28 @@ } // ErrorHandler (logger) - ErrorHandler *logger() { return error_handler; } + ErrorHandler *logger() { return error_handler; } + + // translate a closedown code to a string + char str_code[16]; + char *strCode(int code) { + memset(str_code,0,16); + if (code == 1) strcpy(str_code,"(USER)"); + if (code == 2) strcpy(str_code,"(ERROR)"); + return str_code; + } // close down the application and exit - void closedown() { + void closedown(int code) { if (endpoint != NULL) { error_handler->log("Closing down Endpoint..."); delete endpoint; } pc.printf("Exiting...\r\n"); + lcd.cls(); lcd.locate(0,0); - lcd.printf("Shutdown Complete"); + lcd.printf("Endpoint Shutdown %s",strCode(code)); delete error_handler; exit(1); }