23#include <rclcpp/rclcpp.hpp>
60 std::vector<CalendarEvent>
getEvents()
const;
67 std::vector<CalendarEvent>
findEvents(
const std::string & pattern,
bool use_regex =
false)
const;
73 std::chrono::system_clock::time_point start, std::chrono::system_clock::time_point end)
const;
91 void (T::*callback)(
const std::vector<CalendarEvent> &), T *
object)
102 template <
typename TOrthogonal,
typename TSourceObject>
123 std::vector<CalendarEvent>
parseTsvOutput(
const std::string & output);
128 std::optional<CalendarEvent>
parseTsvLine(
const std::string & line);
135 std::optional<std::chrono::system_clock::time_point>
parseDateTime(
136 const std::string & date_str,
const std::string & time_str);
Component that polls Google Calendar and parses event data.
std::optional< std::chrono::system_clock::time_point > parseDateTime(const std::string &date_str, const std::string &time_str)
Parse date and time strings into time_point.
smacc2::SmaccSignal< void(const std::vector< CalendarEvent > &)> onAgendaUpdated_
std::vector< CalendarEvent > getEventsInWindow(std::chrono::system_clock::time_point start, std::chrono::system_clock::time_point end) const
Get events happening within a time window.
std::chrono::system_clock::time_point last_poll_time_
bool refreshAgenda()
Force an immediate agenda refresh.
void update() override
Periodic update for polling (called by SignalDetector)
std::vector< CalendarEvent > findEvents(const std::string &pattern, bool use_regex=false) const
Get events matching a title pattern.
void onStateOrthogonalAllocation()
Template method for type-safe event posting setup.
void onInitialize() override
CpGcalcliConnection * connection_
std::vector< CalendarEvent > getActiveEvents() const
Get currently active events.
std::vector< CalendarEvent > getEvents() const
Get cached list of calendar events.
std::string generateEventId(const CalendarEvent &event)
Generate a unique ID for an event.
std::optional< CalendarEvent > parseTsvLine(const std::string &line)
Parse a single TSV line into a CalendarEvent.
std::chrono::steady_clock::time_point last_poll_attempt_
std::function< void(const std::vector< CalendarEvent > &)> postAgendaUpdatedEvent_
smacc2::SmaccSignalConnection onAgendaUpdated(void(T::*callback)(const std::vector< CalendarEvent > &), T *object)
std::vector< CalendarEvent > parseTsvOutput(const std::string &output)
Parse TSV output into CalendarEvent structures.
virtual ~CpCalendarPoller()=default
std::chrono::system_clock::time_point getLastPollTime() const
Get the time of the last successful poll.
std::vector< CalendarEvent > cached_events_
Component that manages gcalcli connection health.
ISmaccStateMachine * getStateMachine()
smacc2::SmaccSignalConnection createSignalConnection(TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)
boost::signals2::connection SmaccSignalConnection
Represents a Google Calendar event.
Event posted when the agenda is updated.