61 return "HotPlugManager";
81 void start(uint32_t intervalMs,
bool oneShot =
false);
106 void checkHotPlugEvents();
114 void handleUdevEvent(
int fd);
119 static void udevCallbackWrapper(
int fd,
void* userdata);
121 std::vector<std::shared_ptr<HotPlugCapableDevice>> registeredHandlers;
123 std::recursive_mutex handlersMutex;
127 udev_monitor* udevMonitor;
130 std::atomic_int pollingCount;
131 std::atomic_bool oneShotMode;
132 std::chrono::steady_clock::time_point nonUdevPollingStartTime;
133 std::atomic_int nonUdevPollingDurationSeconds;
134 std::atomic_int initialPollingDurationSeconds;
135 std::atomic_bool udevEventReceived;
static HotPlugManager & getInstance()
Get the singleton instance of HotPlugManager.
void registerHandler(std::shared_ptr< HotPlugCapableDevice > handler)
Register a HotPlugCapableDevice handler with the manager.
HotPlugManager & operator=(const HotPlugManager &)=delete
static const char * getDeviceName()
Static name used for LOGGING purposes.
void start(uint32_t intervalMs, bool oneShot=false)
Starts the hot-plugging timer.
void setInitialPollingDuration(int seconds)
Set the maximum initial polling duration for systems with udev.
void setNonUdevPollingDuration(int seconds)
Set the maximum polling duration for non-udev systems (macOS, Windows).
void unregisterHandler(std::shared_ptr< HotPlugCapableDevice > handler)
Unregister a HotPlugCapableDevice handler from the manager.
HotPlugManager(const HotPlugManager &)=delete
void stop()
Stops the hot-plugging timer.
The Timer class provides repetitive and single-shot timers.
Namespace to encapsulate INDI client, drivers, and mediator classes.