SMACC2
Loading...
Searching...
No Matches
cb_event_detect.hpp
Go to the documentation of this file.
1// Copyright 2024 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <string>
18
20
23#include <cl_gcalcli/types.hpp>
24
25namespace cl_gcalcli
26{
27
44{
45public:
52 CbEventDetect(const std::string & pattern, bool use_regex = false, int minutes_before = 0);
53
54 virtual ~CbEventDetect() = default;
55
56 void onEntry() override;
57 void onExit() override;
58
62 std::optional<CalendarEvent> getDetectedEvent() const { return detected_event_; }
63
64private:
68 void onEventStarted(const CalendarEvent & event);
69
70 std::string pattern_;
73
76
77 std::optional<CalendarEvent> detected_event_;
79};
80
81} // namespace cl_gcalcli
Async behavior that waits for a calendar event's start time to arrive.
std::optional< CalendarEvent > detected_event_
CpCalendarEventListener * listener_
std::optional< CalendarEvent > getDetectedEvent() const
Get the detected event (if any)
virtual ~CbEventDetect()=default
CbEventDetect(const std::string &pattern, bool use_regex=false, int minutes_before=0)
Construct with pattern configuration.
void onEventStarted(const CalendarEvent &event)
Callback when an event starts.
SMACC2 Client for Google Calendar integration via gcalcli.
Component that listens for calendar events and triggers notifications.
Represents a Google Calendar event.
Definition types.hpp:40