|
SMACC2
|
Async behavior that waits for a calendar event's start time to arrive. More...
#include <cb_detect_calendar_event.hpp>


Public Member Functions | |
| CbDetectCalendarEvent (const std::string &pattern, bool use_regex=false, int minutes_before=0) | |
| Construct with pattern configuration. | |
| virtual | ~CbDetectCalendarEvent ()=default |
| void | onEntry () override |
| void | onExit () override |
| std::optional< CalendarEvent > | getDetectedEvent () const |
| Get the detected event (if any) | |
Public Member Functions inherited from smacc2::SmaccAsyncClientBehavior | |
| template<typename TOrthogonal , typename TSourceObject > | |
| void | onStateOrthogonalAllocation () |
| virtual | ~SmaccAsyncClientBehavior () |
| template<typename TCallback , typename T > | |
| smacc2::SmaccSignalConnection | onSuccess (TCallback callback, T *object) |
| template<typename TCallback , typename T > | |
| smacc2::SmaccSignalConnection | onFinished (TCallback callback, T *object) |
| template<typename TCallback , typename T > | |
| smacc2::SmaccSignalConnection | onFailure (TCallback callback, T *object) |
| void | requestForceFinish () |
| void | executeOnEntry () override |
| void | executeOnExit () override |
| void | waitOnEntryThread (bool requestFinish) |
| template<typename TCallbackMethod , typename T > | |
| smacc2::SmaccSignalConnection | onSuccess (TCallbackMethod callback, T *object) |
| template<typename TCallbackMethod , typename T > | |
| smacc2::SmaccSignalConnection | onFinished (TCallbackMethod callback, T *object) |
| template<typename TCallbackMethod , typename T > | |
| smacc2::SmaccSignalConnection | onFailure (TCallbackMethod callback, T *object) |
Public Member Functions inherited from smacc2::ISmaccClientBehavior | |
| ISmaccClientBehavior () | |
| virtual | ~ISmaccClientBehavior () |
| ISmaccStateMachine * | getStateMachine () |
| std::string | getName () const |
| template<typename SmaccClientType > | |
| void | requiresClient (SmaccClientType *&storage) |
| template<typename SmaccComponentType > | |
| void | requiresComponent (SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT) |
Private Member Functions | |
| void | onEventStarted (const CalendarEvent &event) |
| Callback when an event starts. | |
Private Attributes | |
| std::string | pattern_ |
| bool | use_regex_ |
| int | minutes_before_ |
| CpCalendarEventListener * | listener_ |
| ClGcalcli * | client_ |
| std::optional< CalendarEvent > | detected_event_ |
| bool | triggered_ |
Additional Inherited Members | |
Protected Member Functions inherited from smacc2::SmaccAsyncClientBehavior | |
| void | postSuccessEvent () |
| void | postFailureEvent () |
| virtual void | dispose () override |
| bool | isShutdownRequested () |
| onEntry is executed in a new thread. However the current state cannot be left until the onEntry thread finishes. This flag can be checked from the onEntry thread to force finishing the thread. | |
Protected Member Functions inherited from smacc2::ISmaccClientBehavior | |
| virtual void | runtimeConfigure () |
| template<typename EventType > | |
| void | postEvent (const EventType &ev) |
| template<typename EventType > | |
| void | postEvent () |
| ISmaccState * | getCurrentState () |
| virtual rclcpp::Node::SharedPtr | getNode () const |
| virtual rclcpp::Logger | getLogger () const |
Async behavior that waits for a calendar event's start time to arrive.
This behavior configures a watch pattern on the CpCalendarEventListener and waits for an event matching the pattern to start. When the event start time arrives (minus minutes_before), it posts EvCbSuccess.
Usage in state:
Definition at line 43 of file cb_detect_calendar_event.hpp.
| cl_gcalcli::CbDetectCalendarEvent::CbDetectCalendarEvent | ( | const std::string & | pattern, |
| bool | use_regex = false, | ||
| int | minutes_before = 0 ) |
Construct with pattern configuration.
| pattern | Pattern to match event titles |
| use_regex | If true, use regex matching; if false, substring match |
| minutes_before | Trigger N minutes before event starts (0 = at start) |
Definition at line 24 of file cb_detect_calendar_event.cpp.
|
virtualdefault |
|
inline |
Get the detected event (if any)
Definition at line 63 of file cb_detect_calendar_event.hpp.
References detected_event_.
|
overridevirtual |
Reimplemented from smacc2::ISmaccClientBehavior.
Definition at line 35 of file cb_detect_calendar_event.cpp.
References cl_gcalcli::CpCalendarEventListener::addWatch(), client_, cl_gcalcli::EventWatch::continuous, cl_gcalcli::ClGcalcli::getEventListener(), smacc2::ISmaccClientBehavior::getLogger(), listener_, cl_gcalcli::EventWatch::minutes_before, minutes_before_, onEventStarted(), cl_gcalcli::CpCalendarEventListener::onEventStarted(), cl_gcalcli::EventWatch::pattern, pattern_, smacc2::SmaccAsyncClientBehavior::postFailureEvent(), smacc2::ISmaccClientBehavior::requiresClient(), cl_gcalcli::CpCalendarEventListener::resetTriggeredEvents(), cl_gcalcli::EventWatch::trigger_on_end, cl_gcalcli::EventWatch::trigger_on_start, cl_gcalcli::EventWatch::use_regex, and use_regex_.

|
private |
Callback when an event starts.
Definition at line 79 of file cb_detect_calendar_event.cpp.
References detected_event_, smacc2::ISmaccClientBehavior::getLogger(), pattern_, smacc2::SmaccAsyncClientBehavior::postSuccessEvent(), cl_gcalcli::CalendarEvent::title, triggered_, and use_regex_.
Referenced by onEntry().


|
overridevirtual |
Reimplemented from smacc2::ISmaccClientBehavior.
Definition at line 74 of file cb_detect_calendar_event.cpp.
References smacc2::ISmaccClientBehavior::getLogger().

|
private |
Definition at line 76 of file cb_detect_calendar_event.hpp.
Referenced by onEntry().
|
private |
Definition at line 78 of file cb_detect_calendar_event.hpp.
Referenced by getDetectedEvent(), and onEventStarted().
|
private |
Definition at line 75 of file cb_detect_calendar_event.hpp.
Referenced by onEntry().
|
private |
Definition at line 73 of file cb_detect_calendar_event.hpp.
Referenced by onEntry().
|
private |
Definition at line 71 of file cb_detect_calendar_event.hpp.
Referenced by onEntry(), and onEventStarted().
|
private |
Definition at line 79 of file cb_detect_calendar_event.hpp.
Referenced by onEventStarted().
|
private |
Definition at line 72 of file cb_detect_calendar_event.hpp.
Referenced by onEntry(), and onEventStarted().