Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos EthernetInterface FatFileSystemCpp MCP23S17 SDFileSystem mbed
Fork of HTTPServerHelloWorld by
Model/Application.cpp
- Committer:
- wyunreal
- Date:
- 2014-02-02
- Revision:
- 6:b2c4687b421d
- Parent:
- 5:df012c2caf40
- Child:
- 7:1fe91b525d9a
File content as of revision 6:b2c4687b421d:
#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
localFileSystem = new LocalFileSystem("local");
mscFileSystem = new MSCFileSystem("msc");
// start the rest api server
restServer = new RestServer(localFileSystem, mscFileSystem);
restServer->bind();
}
void Application::loop() {
}
void Application::applicationReset() {
wait(5);
mbed_reset();
}
Application::~Application() {
delete ethernetService;
}
