Tony Lee | 84d430c | 2019-06-13 15:26:15 +0800 | [diff] [blame^] | 1 | #include "config.h" |
| 2 | |
| 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include <sdbusplus/server.hpp> |
| 5 | #include <sdbusplus/server/object.hpp> |
| 6 | #include <sdeventplus/clock.hpp> |
| 7 | #include <sdeventplus/event.hpp> |
| 8 | #include <sdeventplus/utility/timer.hpp> |
| 9 | |
| 10 | namespace phosphor |
| 11 | { |
| 12 | namespace nvme |
| 13 | { |
| 14 | |
| 15 | class Nvme |
| 16 | { |
| 17 | public: |
| 18 | Nvme() = delete; |
| 19 | Nvme(const Nvme&) = delete; |
| 20 | Nvme& operator=(const Nvme&) = delete; |
| 21 | Nvme(Nvme&&) = delete; |
| 22 | Nvme& operator=(Nvme&&) = delete; |
| 23 | |
| 24 | Nvme(sdbusplus::bus::bus& bus) : |
| 25 | bus(bus), _event(sdeventplus::Event::get_default()), |
| 26 | _timer(_event, std::bind(&Nvme::read, this)) |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | void run(); |
| 31 | |
| 32 | private: |
| 33 | sdbusplus::bus::bus& bus; |
| 34 | |
| 35 | sdeventplus::Event _event; |
| 36 | /** @brief Read Timer */ |
| 37 | sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> _timer; |
| 38 | |
| 39 | void init(); |
| 40 | void read(); |
| 41 | }; |
| 42 | } // namespace nvme |
| 43 | } // namespace phosphor |