23#include "clock_adapter.h"
25#include <AdapterConfiguration.hh>
26#include <AdapterExecInterface.hh>
27#include <AdapterFactory.hh>
29#include <StateCacheEntry.hh>
40: TimeAdapter(execInterface)
50 pugi::xml_node
const xml)
51: TimeAdapter(execInterface, xml)
67 PLEXIL::g_configuration->registerLookupInterface(
"time",
this);
77 clock_ =
reinterpret_cast<fawkes::Clock *
>(m_execInterface.getProperty(
"::Fawkes::Clock"));
124 if (state != PLEXIL::State::timeState()) {
126 cache_entry.setUnknown();
159 if (state != PLEXIL::State::timeState()) {
166 warn(
"FawkesTimeAdapter:setThresholds: timeout already passed");
187 m_execInterface.notifyOfExternalEvent();
202initFawkesTimeAdapter()
An interface adapter using standard POSIX time facilities to implement LookupNow and LookupOnChange.
virtual bool reset()
Reset adapter.
virtual void subscribe(const PLEXIL::State &state)
Subscribe to updates for given state.
virtual bool initialize()
Initialize adapter.
virtual bool shutdown()
Shut adapter down.
virtual bool start()
Start adapter.
virtual void setThresholds(const PLEXIL::State &state, double hi, double lo)
Set thresholds for subscription.
virtual void lookupNow(PLEXIL::State const &state, PLEXIL::StateCacheEntry &cacheEntry)
Immediate lookup of value.
virtual bool stop()
Stop adapter.
virtual ~ClockPlexilTimeAdapter()
Destructor.
virtual void timer_event()
Called for timer events.
double getCurrentTime()
Get the current time from the operating system.
ClockPlexilTimeAdapter(PLEXIL::AdapterExecInterface &execInterface)
Constructor.
virtual void unsubscribe(const PLEXIL::State &state)
Unsubscribe from updates.
void start_timer(CallbackListener *listener, const fawkes::Time &wait_until)
Start timer non-blocking.
void abort_timer()
Abort a currently running timer.
This is supposed to be the central clock in Fawkes.
void start(bool wait=true)
Call this method to start the thread.
void join()
Join the thread.
void cancel()
Cancel a thread.
A class for handling time.
double in_sec() const
Convet time to seconds.