reef monitor

Dependencies:   mbed-rtos EthernetInterface FatFileSystemCpp MCP23S17 SDFileSystem mbed

Fork of HTTPServerHelloWorld by Donatien Garnier

Model/Application.cpp

Committer:
wyunreal
Date:
2014-02-01
Revision:
4:a19825caaf41
Child:
5:df012c2caf40

File content as of revision 4:a19825caaf41:

#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;
}