libPocuter  1.0
Support library for programming the Pocuter
PocuterTime Class Referenceabstract

access the Pocuter real time clock More...

#include <PocuterTime.h>

Collaboration diagram for PocuterTime:

Classes

struct  pocuterTimezone
 

Public Types

enum  TIMEERROR { TIMEERROR_OK = 0, TIMEERROR_FAILED = 1, TIMEERROR_UNKNOWN }
 

Public Member Functions

virtual TIMEERROR setTimezone (const pocuterTimezone *tz, bool save=true)=0
 changes the time zone More...
 
virtual TIMEERROR getLocalTime (tm *time)=0
 get the local time as tm struct. More...
 
virtual TIMEERROR getGMTTime (tm *time)=0
 get the gmt time as tm struct. More...
 
virtual TIMEERROR setLocalTime (tm *time)=0
 set the local time More...
 
virtual const char * getCurrentTimezone ()=0
 get the current time zone More...
 
virtual TIMEERROR setTimeServer (const char *timeServer)=0
 set the address of the time server More...
 
virtual TIMEERROR setTimeServer (bool on)=0
 activate / deactivate the timeserver connection More...
 
virtual bool isTimeServer ()=0
 request if a timeserver connection was activated More...
 
virtual const char * getTimeServer ()=0
 get the current time server address More...
 
TIMEERROR getAllTimezones (const pocuterTimezone **tz, uint16_t *count)
 get all available timezones More...
 

Public Attributes

const pocuterTimezone c_tz [TIME_ZONES_COUNT]
 

Detailed Description

access the Pocuter real time clock

Member Enumeration Documentation

◆ TIMEERROR

Enumerator
TIMEERROR_OK 
TIMEERROR_FAILED 
TIMEERROR_UNKNOWN 

Member Function Documentation

◆ getAllTimezones()

TIMEERROR PocuterTime::getAllTimezones ( const pocuterTimezone **  tz,
uint16_t *  count 
)
inline

get all available timezones

Parameters
tz(out) a pointer to an array. You must not allocate memory for this.
count(out) a pointer to an uint16_t. The number of array elements will be set here.
Returns
TIMEERROR_OK

◆ getCurrentTimezone()

virtual const char* PocuterTime::getCurrentTimezone ( )
pure virtual

get the current time zone

Returns
  • const char* a zero terminated string, the name of the timezone

◆ getGMTTime()

virtual TIMEERROR PocuterTime::getGMTTime ( tm *  time)
pure virtual

get the gmt time as tm struct.

Parameters
time(out) a pointer to the time struct
Returns
  • TIMEERROR_OK everything works well
  • TIMEERROR_FAILED could not set the timezone

◆ getLocalTime()

virtual TIMEERROR PocuterTime::getLocalTime ( tm *  time)
pure virtual

get the local time as tm struct.

Parameters
time(out) a pointer to the time struct
Returns
  • TIMEERROR_OK everything works well
  • TIMEERROR_FAILED could not set the timezone

◆ getTimeServer()

virtual const char* PocuterTime::getTimeServer ( )
pure virtual

get the current time server address

Returns
  • const char* a zero terminated string, the name of the timezone

◆ isTimeServer()

virtual bool PocuterTime::isTimeServer ( )
pure virtual

request if a timeserver connection was activated

Returns
true / false

◆ setLocalTime()

virtual TIMEERROR PocuterTime::setLocalTime ( tm *  time)
pure virtual

set the local time

Parameters
timea pointer to the time struct with the local time
Returns
  • TIMEERROR_OK everything works well
  • TIMEERROR_FAILED could not set the timezone

◆ setTimeServer() [1/2]

virtual TIMEERROR PocuterTime::setTimeServer ( bool  on)
pure virtual

activate / deactivate the timeserver connection

Parameters
onactivate / deactivate the timeserver connection
Returns
  • TIMEERROR_OK everything works well
  • TIMEERROR_FAILED could not set the timezone

◆ setTimeServer() [2/2]

virtual TIMEERROR PocuterTime::setTimeServer ( const char *  timeServer)
pure virtual

set the address of the time server

Parameters
timeServera string with the timeserver ( "pool.ntp.org" for example )
Returns
  • TIMEERROR_OK everything works well
  • TIMEERROR_FAILED could not set the timezone

◆ setTimezone()

virtual TIMEERROR PocuterTime::setTimezone ( const pocuterTimezone tz,
bool  save = true 
)
pure virtual

changes the time zone

Parameters
tza pointer to the timezone you want to use
save(optional) if true, the time zone is stored on the SDCard. Therefore it will still be set after a reboot.
Returns
  • TIMEERROR_OK everything works well
  • TIMEERROR_FAILED could not set the timezone

Member Data Documentation

◆ c_tz

const pocuterTimezone PocuterTime::c_tz[TIME_ZONES_COUNT]

The documentation for this class was generated from the following file: