reef monitor
Dependencies: mbed-rtos EthernetInterface FatFileSystemCpp MCP23S17 SDFileSystem mbed
Fork of HTTPServerHelloWorld by
Diff: Model/Application.cpp
- Revision:
- 4:a19825caaf41
- Child:
- 5:df012c2caf40
diff -r 5dc0023e6284 -r a19825caaf41 Model/Application.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Model/Application.cpp Sat Feb 01 17:29:15 2014 +0000 @@ -0,0 +1,38 @@ +#include "Application.h" + +extern "C" void mbed_reset(); + +Application::Application() { +} + +void Application::run() { + setup(); + while(1) { + loop(); + ethernetService->poll(); + if (ethernetService->isLinkRestored()) { + applicationReset(); + } + } +} + +void Application::setup() { + ethernetService = new EthernetService(); + if(!ethernetService->setup()) { + applicationReset(); + } + ethernetService->setRtcTime(); +} + +void Application::loop() { + +} + +void Application::applicationReset() { + wait(5); + mbed_reset(); +} + +Application::~Application() { + delete ethernetService; +} \ No newline at end of file