#include "fan_speed.hpp"
#include "hwmon.hpp"
#include "sysfs.hpp"
#include <experimental/filesystem>

namespace hwmon
{

uint64_t FanSpeed::target(uint64_t value)
{
    auto curValue = FanSpeedObject::target();

    if (curValue != value)
    {
        //Write target out to sysfs
        curValue = sysfs::writeSysfsWithCallout(value,
                                                sysfsRoot,
                                                instance,
                                                type,
                                                id,
                                                entry::target);
    }

    return FanSpeedObject::target(value);
}


void FanSpeed::enable()
{
    namespace fs = std::experimental::filesystem;

    auto path = sysfsRoot + "/" + instance;
    auto fullPath = sysfs::make_sysfs_path(path,
                                           type::pwm,
                                           id,
                                           entry::enable);

    if (fs::exists(fullPath))
    {
        //This class always uses RPM mode
        sysfs::writeSysfsWithCallout(enable::rpmMode,
                                     sysfsRoot,
                                     instance,
                                     type::pwm,
                                     id,
                                     entry::enable);
    }
}


} // namespace hwmon
