Wiljan Arias / WhexReefMonitor

Dependencies:   mbed-rtos EthernetInterface FatFileSystemCpp MCP23S17 SDFileSystem mbed

Fork of HTTPServerHelloWorld by Donatien Garnier

Committer:
wyunreal
Date:
Fri Jan 31 23:19:28 2014 +0000
Revision:
3:5dc0023e6284
First approach of EthernetService class

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wyunreal 3:5dc0023e6284 1 #include "EthernetService.h"
wyunreal 3:5dc0023e6284 2
wyunreal 3:5dc0023e6284 3 EthernetService::EthernetService() {
wyunreal 3:5dc0023e6284 4 ethernetInterface = new EthernetNetIf();
wyunreal 3:5dc0023e6284 5 ntpClient = new NTPClient();
wyunreal 3:5dc0023e6284 6 }
wyunreal 3:5dc0023e6284 7
wyunreal 3:5dc0023e6284 8 EthernetService::~EthernetService() {
wyunreal 3:5dc0023e6284 9 delete ntpClient;
wyunreal 3:5dc0023e6284 10 delete ethernetInterface;
wyunreal 3:5dc0023e6284 11 }
wyunreal 3:5dc0023e6284 12
wyunreal 3:5dc0023e6284 13 int EthernetService::setup() {
wyunreal 3:5dc0023e6284 14 EthernetErr ethErr = ethernetInterface->setup();
wyunreal 3:5dc0023e6284 15 if(ethErr) {
wyunreal 3:5dc0023e6284 16 return 0;
wyunreal 3:5dc0023e6284 17 }
wyunreal 3:5dc0023e6284 18 return 1;
wyunreal 3:5dc0023e6284 19 }
wyunreal 3:5dc0023e6284 20
wyunreal 3:5dc0023e6284 21 int EthernetService::setRtcTime() {
wyunreal 3:5dc0023e6284 22 Host server(IpAddr(), 123, "0.es.pool.ntp.org");
wyunreal 3:5dc0023e6284 23 ntpClient->setTime(server);
wyunreal 3:5dc0023e6284 24 return 1;
wyunreal 3:5dc0023e6284 25 }