SMACC2
Loading...
Searching...
No Matches
cb_refresh_agenda.cpp
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
16
17namespace cl_gcalcli
18{
19
21{
22 RCLCPP_INFO(getLogger(), "[CbRefreshAgenda] Refreshing calendar agenda");
23
24 success_ = false;
25
27
28 if (!client_)
29 {
30 RCLCPP_ERROR(getLogger(), "[CbRefreshAgenda] ClGcalcli client not available");
31 return;
32 }
33
34 auto * poller = client_->getPoller();
35 if (!poller)
36 {
37 RCLCPP_ERROR(getLogger(), "[CbRefreshAgenda] CpCalendarPoller not available");
38 return;
39 }
40
41 success_ = poller->refreshAgenda();
42
43 if (success_)
44 {
45 auto events = poller->getEvents();
46 RCLCPP_INFO(getLogger(), "[CbRefreshAgenda] Agenda refreshed: %zu events", events.size());
47 }
48 else
49 {
50 RCLCPP_WARN(getLogger(), "[CbRefreshAgenda] Agenda refresh failed");
51 }
52}
53
54} // namespace cl_gcalcli
CpCalendarPoller * getPoller()
virtual rclcpp::Logger getLogger() const
void requiresClient(SmaccClientType *&storage)