This Time Service allows clients to query and set the system time for the component. Note that exclusive control is required to set the time, but is not required to query it. More...
#include <timeservice.h>
Public Member Functions | |
TimeService () | |
Constructor. | |
~TimeService () | |
Destructor. | |
virtual bool | IsDiscoverable () const |
virtual bool | GenerateEvent (const Events::Subscription &info) const |
Generates an event for the given information. | |
virtual bool | IsEventSupported (const Events::Type type, const double requestedPeriodicRate, const Message *queryMessage, double &confirmedPeriodicRate, std::string &errorMessage) const |
Checks if the event is supported by the Service. | |
virtual void | Receive (const Message *message) |
Processes message received by the Service. If not supported, then message is passed to inheriting services. | |
virtual Message * | CreateMessage (const UShort messageCode) const |
Attempts to create the message desired. Only message supported by this Service can be created by this Service. | |
void | SetChangeTimeMethod (bool(*changeTime)(const Time &time, const Date &date)) |
Static Public Attributes | |
static const std::string | Name = "urn:jaus:jss:core:Time" |
String name of the Service. | |
Protected Member Functions | |
virtual void | CheckServiceSynchronization (const unsigned int timeSinceLastCheckMs) |
If synchronization is enabled, then this method is used to subscribe to sensor data from the component we are synchronizing with. | |
Protected Attributes | |
bool(* | mpChangeTimeMethod )(const Time &time, const Date &date) |
This Time Service allows clients to query and set the system time for the component. Note that exclusive control is required to set the time, but is not required to query it.
Depending your system or OS, the way the system time is changed may vary. Therefore, it is recommend you set the function you want your Time Service to use with the SetChangeTimeMethod access function. Although there is a method supplied to do this, it may not work depending on your permissions, etc. of your program.
Definition at line 62 of file timeservice.h.
TimeService::TimeService | ( | ) |
Constructor.
Definition at line 57 of file timeservice.cpp.
TimeService::~TimeService | ( | ) |
Destructor.
Definition at line 68 of file timeservice.cpp.
void TimeService::CheckServiceSynchronization | ( | const unsigned int | timeSinceLastCheckMs ) | [protected, virtual] |
If synchronization is enabled, then this method is used to subscribe to sensor data from the component we are synchronizing with.
[in] | timeSinceLastCheckMs | Time since last update in ms. |
Implements JAUS::Sensor.
Definition at line 344 of file timeservice.cpp.
Attempts to create the message desired. Only message supported by this Service can be created by this Service.
This Service supports messages for the Time Service.
[in] | messageCode | Message to create. |
Implements JAUS::Service.
Definition at line 313 of file timeservice.cpp.
bool TimeService::GenerateEvent | ( | const Events::Subscription & | info ) | const [virtual] |
Generates an event for the given information.
[in] | info | The event information (ID, Sequence #, etc.) for generation. |
Implements JAUS::Events::Child.
Definition at line 82 of file timeservice.cpp.
virtual bool JAUS::TimeService::IsDiscoverable | ( | ) | const [inline, virtual] |
Implements JAUS::Service.
Definition at line 71 of file timeservice.h.
bool TimeService::IsEventSupported | ( | const Events::Type | type, |
const double | requestedPeriodicRate, | ||
const Message * | queryMessage, | ||
double & | confirmedPeriodicRate, | ||
std::string & | errorMessage | ||
) | const [virtual] |
Checks if the event is supported by the Service.
[in] | type | The event type (Periodic/EveryChange). |
[in] | requestedPeriodicRate | If type == Periodic, then this is the desired update rate. |
[in] | queryMessage | The query message associated with the event. |
[out] | confirmedPeriodicRate | This is the confirmed periodic rate supported by the Service. |
[out] | errorMessage | If not supported, this is an optional error message. |
Implements JAUS::Events::Child.
Definition at line 134 of file timeservice.cpp.
void TimeService::Receive | ( | const Message * | message ) | [virtual] |
Processes message received by the Service. If not supported, then message is passed to inheriting services.
This Service supports the following message: Query Heartbeat Pulse and Report Heartbeat Pulse.
[in] | message | Message data to process. |
Reimplemented from JAUS::Service.
Definition at line 161 of file timeservice.cpp.
void JAUS::TimeService::SetChangeTimeMethod | ( | bool(*)(const Time &time, const Date &date) | changeTime ) | [inline] |
Definition at line 85 of file timeservice.h.
bool(* JAUS::TimeService::mpChangeTimeMethod)(const Time &time, const Date &date) [protected] |
Definition at line 88 of file timeservice.h.
const std::string TimeService::Name = "urn:jaus:jss:core:Time" [static] |
String name of the Service.
Definition at line 65 of file timeservice.h.