SMACC2
Loading...
Searching...
No Matches
cb_status.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{
23
24 if (!client_)
25 {
26 RCLCPP_ERROR(getLogger(), "[CbStatus] ClGcalcli client not available");
28 return;
29 }
30
31 auto * connection = client_->getConnection();
32 auto * poller = client_->getPoller();
33
34 if (connection)
35 {
36 connection_state_ = connection->getConnectionState();
37 }
38 else
39 {
41 }
42
43 if (poller)
44 {
45 events_ = poller->getEvents();
46 active_events_ = poller->getActiveEvents();
47 }
48
49 RCLCPP_INFO(
50 getLogger(), "[CbStatus] Connection: %s, Events: %zu, Active: %zu",
54 : "ERROR",
55 events_.size(), active_events_.size());
56}
57
58} // namespace cl_gcalcli
void onEntry() override
Definition cb_status.cpp:20
std::vector< CalendarEvent > events_
Definition cb_status.hpp:64
ConnectionState connection_state_
Definition cb_status.hpp:63
ClGcalcli * client_
Definition cb_status.hpp:62
std::vector< CalendarEvent > active_events_
Definition cb_status.hpp:65
CpGcalcliConnection * getConnection()
CpCalendarPoller * getPoller()
virtual rclcpp::Logger getLogger() const
void requiresClient(SmaccClientType *&storage)