feature/SysfsReaderClass #2
@ -5,6 +5,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
enum class SysfsStatus
|
||||
{
|
||||
/// @brief File cannot be opened or does not exist.
|
||||
@ -18,3 +20,21 @@ enum class SysfsStatus
|
||||
/// @brief File contains an UnexpectedValue; producer must not send.
|
||||
UnexpectedValue
|
||||
};
|
||||
|
||||
class SysfsReader
|
||||
{
|
||||
public:
|
||||
/// @brief Construct a SysfsReader bound to a specific input file path.
|
||||
/// @param input_path Path to the sysfs-like input file.
|
||||
explicit SysfsReader(const std::filesystem::path& input_path);
|
||||
|
||||
/// @brief Read and interpret the current status of the input file.
|
||||
///
|
||||
/// This function never throws on common I/O errors; instead it reports them
|
||||
/// via the SysfsStatus enum.
|
||||
/// @return Interpreted status of the input file
|
||||
SysfsStatus read_status() const;
|
||||
|
||||
private:
|
||||
std::filesystem::path m_path; // Path to the input file.
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user