22#include <rclcpp/rclcpp.hpp>
83 const std::string & args,
int timeout_ms = 30000);
102 template <
typename T>
108 template <
typename T>
112 onAuthenticationRequired_, callback,
object);
123 template <
typename TOrthogonal,
typename TSourceObject>
129 postConnectionRestoredEvent_ = [
this]()
132 postAuthenticationRequiredEvent_ = [
this]()
Component that manages gcalcli connection health.
ConnectionState getConnectionState() const
Get current connection state.
std::function< void()> postConnectionLostEvent_
const GcalcliConfig & getConfig() const
Get the gcalcli configuration.
bool isAuthenticationError(const std::string &output) const
Check if output indicates authentication failure.
int consecutive_failures_
smacc2::SmaccSignal< void()> onConnectionLost_
smacc2::SmaccSignal< void()> onAuthenticationRequired_
void restartConnection()
Restart connection after failure.
void update() override
Periodic update for heartbeat (called by SignalDetector)
bool isConnected() const
Check if connected to Google Calendar.
std::function< void()> postAuthenticationRequiredEvent_
smacc2::SmaccSignal< void()> onConnectionRestored_
ConnectionState connection_state_
smacc2::SmaccSignalConnection onConnectionLost(void(T::*callback)(), T *object)
smacc2::client_core_components::CpSubprocessExecutor * subprocess_executor_
smacc2::client_core_components::SubprocessResult executeGcalcli(const std::string &args, int timeout_ms=30000)
Execute a gcalcli command.
virtual ~CpGcalcliConnection()=default
void handleConnectionStateChange(bool success, const std::string &output)
Handle connection state change.
bool checkConnection()
Manually trigger a connection check.
std::function< void()> postConnectionRestoredEvent_
void configure(const GcalcliConfig &config)
Configure the gcalcli connection parameters.
void onInitialize() override
void performHeartbeat()
Perform the heartbeat check.
smacc2::SmaccSignalConnection onConnectionRestored(void(T::*callback)(), T *object)
std::chrono::steady_clock::time_point last_heartbeat_time_
void onStateOrthogonalAllocation()
Template method for type-safe event posting setup.
smacc2::SmaccSignalConnection onAuthenticationRequired(void(T::*callback)(), T *object)
ISmaccStateMachine * getStateMachine()
smacc2::SmaccSignalConnection createSignalConnection(TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)
Generic subprocess execution component for running CLI tools.
ConnectionState
Connection state for gcalcli.
boost::signals2::connection SmaccSignalConnection
Configuration for gcalcli client.
Result of a subprocess execution.