#include "ics3/parameter.hpp"

ics::Parameter ics::Parameter::stretch() noexcept {
  static const Parameter STRETCH(0x01, 1, 127);
  return STRETCH;
}

ics::Parameter ics::Parameter::speed() noexcept {
  static const Parameter SPEED(0x02, 1, 127);
  return SPEED;
}

ics::Parameter ics::Parameter::current() noexcept {
  static const Parameter CURRENT(0x03, 0, 63);
  return CURRENT;
}

ics::Parameter ics::Parameter::temperature() noexcept {
  static const Parameter TEMPERATURE(0x04, 1, 127);
  return TEMPERATURE;
}

unsigned char ics::Parameter::get() const noexcept {
  return data;
}

void ics::Parameter::set(unsigned char input) throw(std::invalid_argument) {
  if (input < min) throw std::invalid_argument("Too small value");
  if (max < input) throw std::invalid_argument("Too big value");
  data = input;
}

ics::Parameter::Parameter(unsigned char sc, unsigned char min, unsigned char max) noexcept
: sc(sc),
  min(min),
  max(max)
{}

#include "ics3/parameter.hpp"

ics::Parameter ics::Parameter::stretch() noexcept {
  static const Parameter STRETCH(0x01, 1, 127);
  return STRETCH;
}

ics::Parameter ics::Parameter::speed() noexcept {
  static const Parameter SPEED(0x02, 1, 127);
  return SPEED;
}

ics::Parameter ics::Parameter::current() noexcept {
  static const Parameter CURRENT(0x03, 0, 63);
  return CURRENT;
}

ics::Parameter ics::Parameter::temperature() noexcept {
  static const Parameter TEMPERATURE(0x04, 1, 127);
  return TEMPERATURE;
}

unsigned char ics::Parameter::get() const noexcept {
  return data;
}

void ics::Parameter::set(unsigned char input) throw(std::invalid_argument) {
  if (input < min) throw std::invalid_argument("Too small value");
  if (max < input) throw std::invalid_argument("Too big value");
  data = input;
}

ics::Parameter::Parameter(unsigned char sc, unsigned char min, unsigned char max) noexcept
: sc(sc),
  min(min),
  max(max),
  data(-1)
{}

Update Parameter for init data to impossible
Update Parameter for init data to impossible
