# IRremoteESP8266: IRVestelAc Class Reference

IRVestelAc Class Reference

Class for handling detailed Vestel A/C messages. More...

`#include <ir_Vestel.h>`

Collaboration diagram for IRVestelAc:
[legend]

## Public Member Functions

| IRVestelAc (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
| Class constructor. More...
void | stateReset (void)
| Reset the state of the remote to a known good state/sequence. More...
void | send (const uint16_t repeat=kNoRepeat)
| Send the current internal state as an IR message. More...
int8_t | calibrate (void)
| Run the calibration to calculate uSec timing offsets for this platform. More...
void | begin (void)
| Set up hardware to be able to send a message. More...
void | on (void)
| Set the requested power state of the A/C to on. More...
void | off (void)
| Set the requested power state of the A/C to off. More...
void | setPower (const bool on)
| Change the power setting. More...
bool | getPower (void)
| Get the value of the current power setting. More...
void | setAuto (const int8_t autoLevel)
| Set Auto mode/level of the A/C. More...
void | setTimer (const uint16_t minutes)
| Set Timer option of A/C. More...
uint16_t | getTimer (void)
| Get the Timer time of A/C. More...
void | setTime (const uint16_t minutes)
| Set the A/C's internal clock. More...
uint16_t | getTime (void)
| Get the A/C's internal clock's time. More...
void | setOnTimer (const uint16_t minutes)
| Set the On timer time on the A/C. More...
uint16_t | getOnTimer (void)
| Get the A/C's On Timer time. More...
void | setOffTimer (const uint16_t minutes)
| Set the Off timer time on the A/C. More...
uint16_t | getOffTimer (void)
| Get the A/C's Off Timer time. More...
void | setTemp (const uint8_t temp)
| Set the temperature. More...
uint8_t | getTemp (void)
| Get the current temperature setting. More...
void | setFan (const uint8_t fan)
| Set the speed of the fan. More...
uint8_t | getFan (void)
| Get the current fan speed setting. More...
void | setMode (const uint8_t mode)
| Set the operating mode of the A/C. More...
uint8_t | getMode (void)
| Get the operating mode setting of the A/C. More...
void | setRaw (const uint8_t *newState)
| Set the internal state from a valid code for this protocol. More...
void | setRaw (const uint64_t newState)
| Set the internal state from a valid code for this protocol. More...
uint64_t | getRaw (void)
| Get a copy of the internal state/code for this protocol. More...
void | setSwing (const bool on)
| Set the Swing Roaming setting of the A/C. More...
bool | getSwing (void)
| Get the Swing Roaming setting of the A/C. More...
void | setSleep (const bool on)
| Set the Sleep setting of the A/C. More...
bool | getSleep (void)
| Get the Sleep setting of the A/C. More...
void | setTurbo (const bool on)
| Set the Turbo setting of the A/C. More...
bool | getTurbo (void)
| Get the Turbo setting of the A/C. More...
void | setIon (const bool on)
| Set the Ion (Filter) setting of the A/C. More...
bool | getIon (void)
| Get the Ion (Filter) setting of the A/C. More...
bool | isTimeCommand (void)
| Is the current state a time command? More...
bool | isOnTimerActive (void)
| Get if the On Timer is active on the A/C. More...
void | setOnTimerActive (const bool on)
| Set the On timer to be active on the A/C. More...
bool | isOffTimerActive (void)
| Get if the Off Timer is active on the A/C. More...
void | setOffTimerActive (const bool on)
| Set the Off timer to be active on the A/C. More...
bool | isTimerActive (void)
| Get if the Timer is active on the A/C. More...
void | setTimerActive (const bool on)
| Set the timer to be active on the A/C. More...
stdAc::state_t | toCommon (void)
| Convert the current internal state into its stdAc::state_t equivalent. More...
String | toString (void)
| Convert the current internal state into a human readable string. More...

## Static Public Member Functions

static bool | validChecksum (const uint64_t state)
| Verify the checksum is valid for a given state. More...
static uint8_t | calcChecksum (const uint64_t state)
| Calculate the checksum for a given state. More...
static uint8_t | convertMode (const stdAc::opmode_t mode)
| Convert a stdAc::opmode_t enum into its native mode. More...
static uint8_t | convertFan (const stdAc::fanspeed_t speed)
| Convert a stdAc::fanspeed_t enum into it's native speed. More...
static stdAc::opmode_t | toCommonMode (const uint8_t mode)
| Convert a native mode into its stdAc equivalent. More...
static stdAc::fanspeed_t | toCommonFanSpeed (const uint8_t speed)
| Convert a native fan speed into its stdAc equivalent. More...

## Private Member Functions

void | checksum (void)
| Calculate & set the checksum for the current internal state of the remote. More...
void | _setTimer (const uint16_t minutes, const uint8_t offset)
| Set a given timer time at a given bit offset. More...
uint16_t | _getTimer (const uint8_t offset)
| Get the number of minutes a timer is set for. More...

## Private Attributes

IRsend | _irsend
| Instance of the IR send class. More...
uint64_t | remote_state
| The state of the IR remote in IR code form. More...
uint64_t | remote_time_state
| The time state of the remote in code form. More...
bool | use_time_state

## Detailed Description

Class for handling detailed Vestel A/C messages.

## Constructor & Destructor Documentation

## IRVestelAc()

IRVestelAc::IRVestelAc | ( | const uint16_t | pin,
|  | const bool | inverted = `false`,
|  | const bool | use_modulation = `true`
| ) |  |

explicit

Class constructor.

Parameters

  [in] | pin | GPIO to be used when sending.
  [in] | inverted | Is the output signal to be inverted?
  [in] | use_modulation | Is frequency modulation to be used?

## Member Function Documentation

## _getTimer()

uint16_t IRVestelAc::_getTimer | ( | const uint8_t | offset | ) |

private

Get the number of minutes a timer is set for.

Parameters

  [in] | offset | Nr. of bits offset from the start of the state.

Returns
  The time expressed in nr. of minutes.

## _setTimer()

void IRVestelAc::_setTimer | ( | const uint16_t | minutes,
|  | const uint8_t | offset
| ) |  |

private

Set a given timer time at a given bit offset.

Parameters

  [in] | minutes | Time in nr. of minutes.
  [in] | offset | Nr. of bits offset from the start of the state.

## begin()

void IRVestelAc::begin | ( | void |  | ) |

Set up hardware to be able to send a message.

## calcChecksum()

uint8_t IRVestelAc::calcChecksum | ( | const uint64_t | state | ) |

static

Calculate the checksum for a given state.

Parameters

  [in] | state | The state to calc the checksum of.

Returns
  The calculated checksum value.

## calibrate()

int8_t IRVestelAc::calibrate | ( | void |  | ) |

inline

Run the calibration to calculate uSec timing offsets for this platform.

Returns
  The uSec timing offset needed per modulation of the IR Led.

Note
  This will produce a 65ms IR signal pulse at 38kHz. Only ever needs to be run once per object instantiation, if at all.

## checksum()

void IRVestelAc::checksum | ( | void |  | ) |

private

Calculate & set the checksum for the current internal state of the remote.

## convertFan()

uint8_t IRVestelAc::convertFan | ( | const stdAc::fanspeed_t | speed | ) |

static

Convert a stdAc::fanspeed_t enum into it's native speed.

Parameters

  [in] | speed | The enum to be converted.

Returns
  The native equivalent of the enum.

## convertMode()

uint8_t IRVestelAc::convertMode | ( | const stdAc::opmode_t | mode | ) |

static

Convert a stdAc::opmode_t enum into its native mode.

Parameters

  [in] | mode | The enum to be converted.

Returns
  The native equivalent of the enum.

## getFan()

uint8_t IRVestelAc::getFan | ( | void |  | ) |

Get the current fan speed setting.

Returns
  The current fan speed/mode.

## getIon()

bool IRVestelAc::getIon | ( | void |  | ) |

Get the Ion (Filter) setting of the A/C.

Returns
  true, the setting is on. false, the setting is off.

## getMode()

uint8_t IRVestelAc::getMode | ( | void |  | ) |

Get the operating mode setting of the A/C.

Returns
  The current operating mode setting.

## getOffTimer()

uint16_t IRVestelAc::getOffTimer | ( | void |  | ) |

Get the A/C's Off Timer time.

Returns
  The time expressed in nr. of minutes.

## getOnTimer()

uint16_t IRVestelAc::getOnTimer | ( | void |  | ) |

Get the A/C's On Timer time.

Returns
  The time expressed in nr. of minutes.

## getPower()

bool IRVestelAc::getPower | ( | void |  | ) |

Get the value of the current power setting.

Returns
  true, the setting is on. false, the setting is off.

## getRaw()

uint64_t IRVestelAc::getRaw | ( | void |  | ) |

Get a copy of the internal state/code for this protocol.

Returns
  A code for this protocol based on the current internal state.

## getSleep()

bool IRVestelAc::getSleep | ( | void |  | ) |

Get the Sleep setting of the A/C.

Returns
  true, the setting is on. false, the setting is off.

## getSwing()

bool IRVestelAc::getSwing | ( | void |  | ) |

Get the Swing Roaming setting of the A/C.

Returns
  true, the setting is on. false, the setting is off.

## getTemp()

uint8_t IRVestelAc::getTemp | ( | void |  | ) |

Get the current temperature setting.

Returns
  The current setting for temp. in degrees celsius.

## getTime()

uint16_t IRVestelAc::getTime | ( | void |  | ) |

Get the A/C's internal clock's time.

Returns
  The time expressed in nr. of minutes past midnight.

## getTimer()

uint16_t IRVestelAc::getTimer | ( | void |  | ) |

Get the Timer time of A/C.

Returns
  The number of minutes of time on the timer.

## getTurbo()

bool IRVestelAc::getTurbo | ( | void |  | ) |

Get the Turbo setting of the A/C.

Returns
  true, the setting is on. false, the setting is off.

## isOffTimerActive()

bool IRVestelAc::isOffTimerActive | ( | void |  | ) |

Get if the Off Timer is active on the A/C.

Returns
  true, the setting is on. false, the setting is off.

## isOnTimerActive()

bool IRVestelAc::isOnTimerActive | ( | void |  | ) |

Get if the On Timer is active on the A/C.

Returns
  true, the setting is on. false, the setting is off.

## isTimeCommand()

bool IRVestelAc::isTimeCommand | ( | void |  | ) |

Is the current state a time command?

Returns
  true, if the state is a time message. Otherwise, false.

## isTimerActive()

bool IRVestelAc::isTimerActive | ( | void |  | ) |

Get if the Timer is active on the A/C.

Returns
  true, the setting is on. false, the setting is off.

## off()

void IRVestelAc::off | ( | void |  | ) |

Set the requested power state of the A/C to off.

## on()

void IRVestelAc::on | ( | void |  | ) |

Set the requested power state of the A/C to on.

## send()

void IRVestelAc::send | ( | const uint16_t | repeat = `kNoRepeat` | ) |

Send the current internal state as an IR message.

Parameters

  [in] | repeat | Nr. of times the message will be repeated.

## setAuto()

void IRVestelAc::setAuto | ( | const int8_t | autoLevel | ) |

Set Auto mode/level of the A/C.

Parameters

  [in] | autoLevel | The auto mode/level setting.

## setFan()

void IRVestelAc::setFan | ( | const uint8_t | fan | ) |

Set the speed of the fan.

Parameters

  [in] | fan | The desired setting.

## setIon()

void IRVestelAc::setIon | ( | const bool | on | ) |

Set the Ion (Filter) setting of the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setMode()

void IRVestelAc::setMode | ( | const uint8_t | mode | ) |

Set the operating mode of the A/C.

Parameters

  [in] | mode | The desired operating mode.

Note
  If we get an unexpected mode, default to AUTO.

## setOffTimer()

void IRVestelAc::setOffTimer | ( | const uint16_t | minutes | ) |

Set the Off timer time on the A/C.

Parameters

  [in] | minutes | Time in nr. of minutes.

## setOffTimerActive()

void IRVestelAc::setOffTimerActive | ( | const bool | on | ) |

Set the Off timer to be active on the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setOnTimer()

void IRVestelAc::setOnTimer | ( | const uint16_t | minutes | ) |

Set the On timer time on the A/C.

Parameters

  [in] | minutes | Time in nr. of minutes.

## setOnTimerActive()

void IRVestelAc::setOnTimerActive | ( | const bool | on | ) |

Set the On timer to be active on the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setPower()

void IRVestelAc::setPower | ( | const bool | on | ) |

Change the power setting.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setRaw() [1/2]

void IRVestelAc::setRaw | ( | const uint64_t | newState | ) |

Set the internal state from a valid code for this protocol.

Parameters

  [in] | newState | A valid code for this protocol.

## setRaw() [2/2]

void IRVestelAc::setRaw | ( | const uint8_t * | newState | ) |

Set the internal state from a valid code for this protocol.

Parameters

  [in] | newState | A valid code for this protocol.

## setSleep()

void IRVestelAc::setSleep | ( | const bool | on | ) |

Set the Sleep setting of the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setSwing()

void IRVestelAc::setSwing | ( | const bool | on | ) |

Set the Swing Roaming setting of the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setTemp()

void IRVestelAc::setTemp | ( | const uint8_t | temp | ) |

Set the temperature.

Parameters

  [in] | temp | The temperature in degrees celsius.

## setTime()

void IRVestelAc::setTime | ( | const uint16_t | minutes | ) |

Set the A/C's internal clock.

Parameters

  [in] | minutes | The time expressed in nr. of minutes past midnight.

## setTimer()

void IRVestelAc::setTimer | ( | const uint16_t | minutes | ) |

Set Timer option of A/C.

Parameters

  [in] | minutes | Nr of minutes the timer is to be set for.

Note
  Valid arguments are 0, 0.5, 1, 2, 3 and 5 hours (in minutes). 0 disables the timer.

## setTimerActive()

void IRVestelAc::setTimerActive | ( | const bool | on | ) |

Set the timer to be active on the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## setTurbo()

void IRVestelAc::setTurbo | ( | const bool | on | ) |

Set the Turbo setting of the A/C.

Parameters

  [in] | on | true, the setting is on. false, the setting is off.

## stateReset()

void IRVestelAc::stateReset | ( | void |  | ) |

Reset the state of the remote to a known good state/sequence.

Note
  Power On, Mode Auto, Fan Auto, Temp = 25C/77F

## toCommon()

stdAc::state_t IRVestelAc::toCommon | ( | void |  | ) |

Convert the current internal state into its stdAc::state_t equivalent.

Returns
  The stdAc equivalent of the native settings.

## toCommonFanSpeed()

stdAc::fanspeed_t IRVestelAc::toCommonFanSpeed | ( | const uint8_t | spd | ) |

static

Convert a native fan speed into its stdAc equivalent.

Parameters

  [in] | spd | The native setting to be converted.

Returns
  The stdAc equivalent of the native setting.

## toCommonMode()

stdAc::opmode_t IRVestelAc::toCommonMode | ( | const uint8_t | mode | ) |

static

Convert a native mode into its stdAc equivalent.

Parameters

  [in] | mode | The native setting to be converted.

Returns
  The stdAc equivalent of the native setting.

## toString()

String IRVestelAc::toString | ( | void |  | ) |

Convert the current internal state into a human readable string.

Returns
  A human readable string.

## validChecksum()

bool IRVestelAc::validChecksum | ( | const uint64_t | state | ) |

static

Verify the checksum is valid for a given state.

Parameters

  [in] | state | The state to verify the checksum of.

Returns
  true, if the state has a valid checksum. Otherwise, false.

## Member Data Documentation

## _irsend

IRsend IRVestelAc::_irsend

private

Instance of the IR send class.

## remote_state

uint64_t IRVestelAc::remote_state

private

The state of the IR remote in IR code form.

## remote_time_state

uint64_t IRVestelAc::remote_time_state

private

The time state of the remote in code form.

## use_time_state

bool IRVestelAc::use_time_state

private

The documentation for this class was generated from the following files:

- src/ir_Vestel.h
- src/ir_Vestel.cpp