Fawkes API  Fawkes Development Version
ClockPlexilTimeAdapter Class Reference

An interface adapter using standard POSIX time facilities to implement LookupNow and LookupOnChange. More...

#include <clock_adapter.h>

Inheritance diagram for ClockPlexilTimeAdapter:

Public Member Functions

 ClockPlexilTimeAdapter (PLEXIL::AdapterExecInterface &execInterface)
 Constructor. More...
 
 ClockPlexilTimeAdapter (PLEXIL::AdapterExecInterface &execInterface, pugi::xml_node const xml)
 Constructor from configuration XML. More...
 
virtual ~ClockPlexilTimeAdapter ()
 Destructor. More...
 
double getCurrentTime () throw (PLEXIL::InterfaceError)
 Get the current time from the operating system. More...
 
virtual bool initialize ()
 Initialize adapter. More...
 
virtual bool start ()
 Start adapter. More...
 
virtual bool stop ()
 Stop adapter. More...
 
virtual bool reset ()
 Reset adapter. More...
 
virtual bool shutdown ()
 Shut adapter down. More...
 
virtual void lookupNow (PLEXIL::State const &state, PLEXIL::StateCacheEntry &cacheEntry)
 Immediate lookup of value. More...
 
virtual void subscribe (const PLEXIL::State &state)
 Subscribe to updates for given state. More...
 
virtual void unsubscribe (const PLEXIL::State &state)
 Unsubscribe from updates. More...
 
virtual void setThresholds (const PLEXIL::State &state, double hi, double lo)
 Set thresholds for subscription. More...
 
virtual void setThresholds (const PLEXIL::State &state, int32_t hi, int32_t lo)
 Set thresholds for subscription. More...
 
virtual void timer_event ()
 Called for timer events. More...
 

Detailed Description

An interface adapter using standard POSIX time facilities to implement LookupNow and LookupOnChange.

Plexil adapter to provide time from Fawkes time source.

Author
Tim Niemueller

Definition at line 36 of file clock_adapter.h.

Constructor & Destructor Documentation

◆ ClockPlexilTimeAdapter() [1/2]

ClockPlexilTimeAdapter::ClockPlexilTimeAdapter ( PLEXIL::AdapterExecInterface &  execInterface)

Constructor.

Parameters
execInterfaceReference to the parent AdapterExecInterface object.

Definition at line 39 of file clock_adapter.cpp.

◆ ClockPlexilTimeAdapter() [2/2]

ClockPlexilTimeAdapter::ClockPlexilTimeAdapter ( PLEXIL::AdapterExecInterface &  execInterface,
pugi::xml_node const  xml 
)

Constructor from configuration XML.

Parameters
execInterfaceReference to the parent AdapterExecInterface object.
xmlA const reference to the XML element describing this adapter
Note
The instance maintains a shared pointer to the XML.

Definition at line 49 of file clock_adapter.cpp.

◆ ~ClockPlexilTimeAdapter()

ClockPlexilTimeAdapter::~ClockPlexilTimeAdapter ( )
virtual

Destructor.

Definition at line 56 of file clock_adapter.cpp.

Member Function Documentation

◆ getCurrentTime()

double ClockPlexilTimeAdapter::getCurrentTime ( )
throw (PLEXIL::InterfaceError
)

Get the current time from the operating system.

Returns
A double representing the current time.

Definition at line 194 of file clock_adapter.cpp.

References fawkes::Time::in_sec().

Referenced by lookupNow().

◆ initialize()

bool ClockPlexilTimeAdapter::initialize ( )
virtual

Initialize adapter.

Returns
true if initialization was successful, false otherwise.

Definition at line 64 of file clock_adapter.cpp.

◆ lookupNow()

void ClockPlexilTimeAdapter::lookupNow ( PLEXIL::State const &  state,
PLEXIL::StateCacheEntry &  cache_entry 
)
virtual

Immediate lookup of value.

Parameters
statestate variable to lookup
cache_entrycache entry for retrieved value

Definition at line 122 of file clock_adapter.cpp.

References getCurrentTime().

◆ reset()

bool ClockPlexilTimeAdapter::reset ( void  )
virtual

Reset adapter.

Returns
true if successful, false otherwise.

Definition at line 103 of file clock_adapter.cpp.

◆ setThresholds() [1/2]

void ClockPlexilTimeAdapter::setThresholds ( const PLEXIL::State &  state,
double  hi,
double  lo 
)
virtual

Set thresholds for subscription.

Parameters
statestate variable
hihigh value
lolow value

Definition at line 157 of file clock_adapter.cpp.

References fawkes::Time::in_sec(), PlexilTimerThread::start_timer(), and timer_event().

Referenced by setThresholds().

◆ setThresholds() [2/2]

void ClockPlexilTimeAdapter::setThresholds ( const PLEXIL::State &  state,
int32_t  hi,
int32_t  lo 
)
virtual

Set thresholds for subscription.

Parameters
statestate variable
hihigh value
lolow value

Definition at line 179 of file clock_adapter.cpp.

References setThresholds().

◆ shutdown()

bool ClockPlexilTimeAdapter::shutdown ( )
virtual

Shut adapter down.

Returns
true if successful, false otherwise.

Definition at line 112 of file clock_adapter.cpp.

◆ start()

bool ClockPlexilTimeAdapter::start ( )
virtual

Start adapter.

Returns
true if starting was successful, false otherwise.

Definition at line 75 of file clock_adapter.cpp.

References fawkes::Thread::start().

◆ stop()

bool ClockPlexilTimeAdapter::stop ( )
virtual

Stop adapter.

Returns
true if successful, false otherwise.

Definition at line 89 of file clock_adapter.cpp.

References PlexilTimerThread::abort_timer(), fawkes::Thread::cancel(), and fawkes::Thread::join().

◆ subscribe()

void ClockPlexilTimeAdapter::subscribe ( const PLEXIL::State &  state)
virtual

Subscribe to updates for given state.

Parameters
statestate variable to subscribe for

Definition at line 137 of file clock_adapter.cpp.

◆ timer_event()

void ClockPlexilTimeAdapter::timer_event ( )
virtual

Called for timer events.

Implements PlexilTimerThread::CallbackListener.

Definition at line 185 of file clock_adapter.cpp.

Referenced by setThresholds().

◆ unsubscribe()

void ClockPlexilTimeAdapter::unsubscribe ( const PLEXIL::State &  state)
virtual

Unsubscribe from updates.

Parameters
statestate variable to unsubscribe from

Definition at line 146 of file clock_adapter.cpp.

References PlexilTimerThread::abort_timer().


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