23#ifndef SERVICEMONITOR_H
24#define SERVICEMONITOR_H
26#include <IDobbyIPCUtils.h>
27#include <IDobbyUtils.h>
67 const std::shared_ptr<IDobbyUtils> &utils,
69 const std::string &serviceName,
72 const std::function<
void(
State)> &stateChangeHandler);
89 const std::shared_ptr<IDobbyUtils> mUtilities;
90 const std::shared_ptr<IDobbyIPCUtils> mIPCUtilities;
92 const std::string mServiceName;
95 const std::function<void(
State)> mStateChangeHandler;
98 mutable std::mutex mLock;
101 int mServiceHandlerId;
102 int mSignalHandlerId;
BusType
The type of dbus to call methods on / emit signals.
Definition IDobbyIPCUtils.h:60
Utility class to actively monitor the status of a dbus service.
Definition ServiceMonitor.h:55
void onReadyNotification(const AI_IPC::VariantList &args)
Callback function called when the service daemon has sent a signal saying it's ready to process reque...
Definition ServiceMonitor.cpp:190
State state() const
Returns the current state of the service.
Definition ServiceMonitor.cpp:117
State
Definition ServiceMonitor.h:58
@ NotRunning
dbus service not detected on the bus
@ Ready
ready signal received
void onServiceNotification(bool added)
Callback function called when the daemon service has been added or removed from the bus.
Definition ServiceMonitor.cpp:147
bool onTimer()
Timer handler called every second, it sends out a ping request to the daemon if we think it is not al...
Definition ServiceMonitor.cpp:216
void sendIsReadyRequest() const
Sends a method call over dbus asking the service daemon to reply with a ready notification / signal i...
Definition ServiceMonitor.cpp:238
void forceReadyCheck()
Sends out an 'is ready' method request to the service.
Definition ServiceMonitor.cpp:129
Method identified by a service, object, interface and method name itself.
Definition IpcCommon.h:90
Method identified by object, interface and signal name itself.
Definition IpcCommon.h:105