reef monitor
Dependencies: mbed-rtos EthernetInterface FatFileSystemCpp MCP23S17 SDFileSystem mbed
Fork of HTTPServerHelloWorld by
Model/Application.cpp
- Committer:
- wyunreal
- Date:
- 2014-02-01
- Revision:
- 5:df012c2caf40
- Parent:
- 4:a19825caaf41
- Child:
- 6:b2c4687b421d
File content as of revision 5:df012c2caf40:
#include "Application.h" extern "C" void mbed_reset(); Application::Application() { } void Application::run() { setup(); while(1) { loop(); ethernetService->poll(); if (ethernetService->isLinkRestored()) { // if ethernet link is restored, application needs to be restarted applicationReset(); } } } void Application::setup() { // setup ethernet ethernetService = new EthernetService(); if(!ethernetService->setup()) { applicationReset(); } // set the system time from NTP ethernetService->setRtcTime(); // starting the file system fileSystem = new LocalFileSystem("local"); // start the rest api server restServer = new RestServer(fileSystem); restServer->bind(); } void Application::loop() { } void Application::applicationReset() { wait(5); mbed_reset(); } Application::~Application() { delete ethernetService; }