| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_COLLECTOR_FAKE_GPIO_COLLECTOR_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_COLLECTOR_FAKE_GPIO_COLLECTOR_H_ |
| |
| #include <memory> |
| #include <string> |
| |
| #include "absl/container/flat_hash_map.h" |
| #include "absl/functional/any_invocable.h" |
| #include "absl/status/status.h" |
| #include "absl/status/statusor.h" |
| #include "absl/strings/string_view.h" |
| #include "absl/time/time.h" |
| #include <nlohmann/json.hpp> |
| #include "tlbmc/collector/gpio_collector.h" |
| #include "gpio_config.pb.h" |
| |
| namespace milotic_tlbmc { |
| |
| class FakeGpioCollector : public GpioCollector { |
| public: |
| static std::unique_ptr<FakeGpioCollector> Create(); |
| |
| nlohmann::json GetSchedulerStats() const override; |
| |
| nlohmann::json ToJson() const override; |
| |
| absl::Status SetActiveForDuration(absl::string_view gpio_name, |
| absl::Duration duration) override; |
| |
| absl::Status SetGpio(absl::string_view gpio_name, bool value) override; |
| |
| absl::Status SetActive(absl::string_view gpio_name) override; |
| |
| absl::StatusOr<bool> GetValue(absl::string_view gpio_name) override; |
| absl::StatusOr<bool> IsActive(absl::string_view gpio_name) override; |
| |
| absl::Status RegisterCallback( |
| absl::string_view gpio_name, |
| absl::AnyInvocable<void(GpioEventType event)> callback) override; |
| |
| private: |
| absl::flat_hash_map<std::string, bool> gpio_values_; |
| }; |
| |
| } // namespace milotic_tlbmc |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_COLLECTOR_FAKE_GPIO_COLLECTOR_H_ |