Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes

JAUS::TimeService Class Reference

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>

Inheritance diagram for JAUS::TimeService:
JAUS::AccessControl::Child JAUS::Sensor JAUS::Events::Child JAUS::Service

List of all members.

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 MessageCreateMessage (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)

Detailed Description

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.


Constructor & Destructor Documentation

TimeService::TimeService (  )

Constructor.

Definition at line 57 of file timeservice.cpp.

TimeService::~TimeService (  )

Destructor.

Definition at line 68 of file timeservice.cpp.


Member Function Documentation

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.

Parameters:
[in]timeSinceLastCheckMsTime since last update in ms.

Implements JAUS::Sensor.

Definition at line 344 of file timeservice.cpp.

Message * TimeService::CreateMessage ( const UShort  messageCode ) const [virtual]

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.

Parameters:
[in]messageCodeMessage to create.
Returns:
Pointer to newly allocated Message data, NULL if message is not supported by the Service.

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.

Parameters:
[in]infoThe event information (ID, Sequence #, etc.) for generation.
Returns:
True if event generated, otherwise false.

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.

Parameters:
[in]typeThe event type (Periodic/EveryChange).
[in]requestedPeriodicRateIf type == Periodic, then this is the desired update rate.
[in]queryMessageThe query message associated with the event.
[out]confirmedPeriodicRateThis is the confirmed periodic rate supported by the Service.
[out]errorMessageIf not supported, this is an optional error message.
Returns:
True if event supported, otherwise false.

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.

Parameters:
[in]messageMessage 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.


Member Data Documentation

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines