#ifndef ANDROID_HARDWARE_POWERSTATS_RAILDATAPROVIDER_H #define ANDROID_HARDWARE_POWERSTATS_RAILDATAPROVIDER_H #include #include namespace android { namespace hardware { namespace google { namespace pixel { namespace powerstats { typedef MessageQueue MessageQueueSync; struct RailData { std::string devicePath; uint32_t index; std::string subsysName; uint32_t samplingRate; }; struct OnDeviceMmt { std::mutex mLock; bool hwEnabled; std::vector devicePaths; std::map railsInfo; std::vector reading; std::unique_ptr fmqSynchronized; }; class RailDataProvider : public IRailDataProvider { public: RailDataProvider(); // Methods from ::android::hardware::power::stats::V1_0::IPowerStats follow. Return getRailInfo(IPowerStats::getRailInfo_cb _hidl_cb) override; Return getEnergyData(const hidl_vec& railIndices, IPowerStats::getEnergyData_cb _hidl_cb) override; Return streamEnergyData(uint32_t timeMs, uint32_t samplingRate, IPowerStats::streamEnergyData_cb _hidl_cb) override; private: OnDeviceMmt mOdpm; void findIioPowerMonitorNodes(); size_t parsePowerRails(); int parseIioEnergyNode(std::string devName); Status parseIioEnergyNodes(); }; } // namespace powerstats } // namespace pixel } // namespace google } // namespace hardware } // namespace android #endif // ANDROID_HARDWARE_POWERSTATS_RAILDATAPROVIDER_H