Allows to interact with a RTC Service.

#include <rtcApi.h>

Public Member Functions

 Rtc (std::string ip="127.0.0.1")
 Constructor of the class. More...
 
 ~Rtc ()
 Destructor of the class.
 
bool isAlive ()
 
void monitorServiceAvailability_S (dpyRtc::service_availability_handler handler)
 
void monitorServiceAvailability_U ()
 
void asyncSetSyncTime (std::uint32_t time_s, dpyRtc::result_handler handler)
 Method to set synchronism time period in seconds. More...
 
void asyncSetDiffTime (std::uint32_t time_s, dpyRtc::result_handler handler)
 Method to set maximum time in seconds allowed to RTC to be drifted from UTC valid time. More...
 
void asyncGetConfigValues (dpyRtc::params_handler handler)
 Method to get configuration parameters coming from RTC service. More...
 
void asyncGetDateTime (dpyRtc::time_and_date_handler handler)
 Method to get date and time coming from RTC service. More...
 
void asyncGetDateTime (dpyRtc::time_date_set_handler handler)
 Method to get date and time coming from RTC service, as well as last set date time. More...
 
void asyncGetSources (dpyRtc::sources_list_handler handler)
 Method used to get a sources list. More...
 
boost::system::error_code getDateTime (struct tm &date_and_time)
 Synchronous method to get date and time coming from RTC service. More...
 
boost::system::error_code getDateTime (struct tm &date_and_time, struct tm &last_set_date_and_time)
 Synchronous method to get date and time coming from RTC service as well as last set date of the RTC. More...
 
void asyncAddNewSourceDate (const std::string &source_name, const dpyRtc::DateSources &source, dpyRtc::result_handler handler)
 Method used to add a date source. More...
 
void asyncDeleteSourceDate (const std::string &source_name, dpyRtc::result_handler handler)
 Delete a particular date source. More...
 
boost::system::error_code addNewSourceDate (const std::string &source_name, const dpyRtc::DateSources &source)
 Method used to add a date source. More...
 
boost::system::error_code deleteSourceDate (const std::string &source_name)
 Delete a particular date source. More...
 

Constructor & Destructor Documentation

Rtc ( std::string  ip = "127.0.0.1")
explicit
Parameters
ipIP address to be binded to the App

Member Function Documentation

boost::system::error_code addNewSourceDate ( const std::string &  source_name,
const dpyRtc::DateSources source 
)
Parameters
source_namesource name that will be used for the operation
sourcedate source that will be passed depending on the operation
Returns
error code
void asyncAddNewSourceDate ( const std::string &  source_name,
const dpyRtc::DateSources source,
dpyRtc::result_handler  handler 
)
Parameters
source_namesource name that will be used for the operation
sourcedate source that will be passed depending on the operation
handleris the function that will be called when the response to the command arrives
void asyncDeleteSourceDate ( const std::string &  source_name,
dpyRtc::result_handler  handler 
)
Parameters
source_namesource name that will be used for the operation
handleris the function that will be called when the response to the command arrives
void asyncGetConfigValues ( dpyRtc::params_handler  handler)
Parameters
handlerHandler used to get response
void asyncGetDateTime ( dpyRtc::time_and_date_handler  handler)
Parameters
handlerHandler used to get response
Deprecated:
void asyncGetDateTime ( dpyRtc::time_date_set_handler  handler)
Parameters
handlerHandler used to get response
void asyncGetSources ( dpyRtc::sources_list_handler  handler)
Parameters
handlerHandler to be called when a response comes from the service
void asyncSetDiffTime ( std::uint32_t  time_s,
dpyRtc::result_handler  handler 
)
Parameters
time_sTime provided in seconds
handlerHandler used to get response
void asyncSetSyncTime ( std::uint32_t  time_s,
dpyRtc::result_handler  handler 
)
Parameters
time_sTime provided in seconds
handlerHandler used to get response
boost::system::error_code deleteSourceDate ( const std::string &  source_name)
Parameters
source_namesource name that will be used for the operation
Returns
error code
boost::system::error_code getDateTime ( struct tm &  date_and_time)
Parameters
date_and_timedate and time provided by the service
Returns
error code

In order to understand the reason of the error code returned in the handler, please attend the following table:

Deprecated:
ec (DPY_ERROR) Result meaning
DPY_OK Given time and date has been synced lately
DPY_NOT_READY Given time and date could not be synced lately.
Time and date values may be correct but they have not been checked against reliable date sources recently
boost::system::error_code getDateTime ( struct tm &  date_and_time,
struct tm &  last_set_date_and_time 
)
Parameters
date_and_timedate and time provided by the service
last_set_date_and_timedate and time provided by the service
Returns
error code

In order to understand the reason of the error code returned in the handler, please attend the following table:

ec (DPY_ERROR) Result meaning
DPY_OK Given time and date has been synced lately
DPY_NOT_READY Given time and date could not be synced lately.
Time and date values may be correct but they have not been checked against reliable date sources recently