#pragma once #include #include #include #include #include namespace gpio { class GPIOInterface { public: using Callback_t = std::function(bool)>; GPIOInterface() = delete; GPIOInterface(sdbusplus::async::context& ctx, const std::string& consumerName, const std::string& pinName, bool activeLow, Callback_t updateStateCallback); /** @brief Start the GPIO Interface */ auto start() -> sdbusplus::async::task<>; private: /** @brief Read the gpio state asynchronously */ auto readGPIOAsync() -> sdbusplus::async::task<>; /** @brief Read the gpio state asynchronously based on gpio event */ auto readGPIOAsyncEvent() -> sdbusplus::async::task<>; sdbusplus::async::context& ctx; const std::string& pinName; Callback_t updateStateCallback; gpiod::line line; /** File descriptor based async event handler */ std::unique_ptr fdioInstance; }; } // namespace gpio