IRremoteESP8266

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
IRFujitsuAC Class Reference

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

`#include <ir_Fujitsu.h>`

Collaboration diagram for IRFujitsuAC:
[legend]

## Public Member Functions
| IRFujitsuAC (const uint16_t pin, const fujitsu_ac_remote_model_t model=ARRAH2E, const bool inverted=false, const bool use_modulation=true)
| Class Constructor. More...
void | setModel (const fujitsu_ac_remote_model_t model)
| Set the currently emulated model of the A/C. More...
fujitsu_ac_remote_model_t | getModel (void) const
| Get the currently emulated/detected model of the A/C. More...
void | stateReset (void)
| Reset the state of the remote to a known good state/sequence. More...
void | send (const uint16_t repeat=kFujitsuAcMinRepeat)
| 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 | stepHoriz (void)
| Request the A/C to step the Horizontal Swing. More...
void | toggleSwingHoriz (const bool update=true)
| Request the A/C to toggle the Horizontal Swing mode. More...
void | stepVert (void)
| Request the A/C to step the Vertical Swing. More...
void | toggleSwingVert (const bool update=true)
| Request the A/C to toggle the Vertical Swing mode. More...
void | setCmd (const uint8_t cmd)
| Set the requested (special) command part for the A/C message. More...
uint8_t | getCmd (void) const
| Set the requested (special) command part for the A/C message. More...
void | setTemp (const float temp, const bool useCelsius=true)
| Set the temperature. More...
float | getTemp (void) const
| Get the current temperature setting. More...
void | setFanSpeed (const uint8_t fan)
| Set the speed of the fan. More...
uint8_t | getFanSpeed (void) const
| 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) const
| Get the operating mode setting of the A/C. More...
void | setSwing (const uint8_t mode)
| Set the requested swing operation mode of the A/C unit. More...
uint8_t | getSwing (void) const
| Get the requested swing operation mode of the A/C unit. More...
uint8_t * | getRaw (void)
| Get a PTR to the internal state/code for this protocol. More...
bool | setRaw (const uint8_t newState[], const uint16_t length)
| Set the internal state from a valid code for this protocol. More...
uint8_t | getStateLength (void)
| Get the length (size) of the state code for the current configuration. More...
bool | isLongCode (void) const
| Is the current binary state representation a long or a short code? More...
void | setPower (const bool on)
| Change the power setting. More...
void | off (void)
| Set the requested power state of the A/C to off. More...
void | on (void)
| Set the requested power state of the A/C to on. More...
bool | getPower (void) const
| Get the value of the current power setting. More...
void | setClean (const bool on)
| Set the Clean mode of the A/C. More...
bool | getClean (void) const
| Get the Clean mode status of the A/C. More...
void | setFilter (const bool on)
| Set the Filter mode status of the A/C. More...
bool | getFilter (void) const
| Get the Filter mode status of the A/C. More...
void | set10CHeat (const bool on)
| Set the 10C heat status of the A/C. More...
bool | get10CHeat (void) const
| Get the 10C heat status of the A/C. More...
void | setOutsideQuiet (const bool on)
| Set the Outside Quiet mode of the A/C. More...
bool | getOutsideQuiet (void) const
| Get the Outside Quiet mode status of the A/C. More...
uint8_t | getTimerType (void) const
| Get the Timer type of the A/C message. More...
void | setTimerType (const uint8_t timertype)
| Set the Timer type of the A/C message. More...
uint16_t | getOnTimer (void) const
| Get the On Timer setting of the A/C. More...
void | setOnTimer (const uint16_t nr_mins)
| Set the On Timer setting of the A/C. More...
uint16_t | getOffSleepTimer (void) const
| Get the Off/Sleep Timer setting of the A/C. More...
void | setOffTimer (const uint16_t nr_mins)
| Set the Off Timer time for the A/C. More...
void | setSleepTimer (const uint16_t nr_mins)
| Set the Sleep Timer time for the A/C. More...
void | setId (const uint8_t num)
| Set the device's remote ID number. More...
uint8_t | getId (void) const
| Get the current device's remote ID number. More...
void | setCelsius (const bool on)
| Set the Temperature units for the A/C. More...
bool | getCelsius (void) const
| Get the Clean mode status of the A/C. More...
stdAc::state_t | toCommon (const stdAc::state_t *prev=NULL)
| Convert the current internal state into its stdAc::state_t equivalent. More...
String | toString (void) const
| Convert the current internal state into a human readable string. More...

## Static Public Member Functions
static bool | validChecksum (uint8_t *state, const uint16_t length)
| Verify the checksum is valid 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 (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 and set the checksum values for the internal state. More...
bool | updateUseLongOrShort (void)
| Update the length (size) of the state code for the current configuration. More...
void | buildFromState (const uint16_t length)
| Build the internal state/config from the current (raw) A/C message. More...
void | setOffSleepTimer (const uint16_t nr_mins)
| Set the Off/Sleep Timer time for the A/C. More...

## Private Attributes
IRsend | _irsend
| Instance of the IR send class. More...
FujitsuProtocol | _
uint8_t | _cmd
fujitsu_ac_remote_model_t | _model
uint8_t | _state_length
uint8_t | _state_length_short
bool | _rawstatemodified

## Detailed Description

Class for handling detailed Fujitsu A/C messages.

## Constructor & Destructor Documentation

## ◆ IRFujitsuAC()

IRFujitsuAC::IRFujitsuAC | ( | const uint16_t | pin,
|  | const fujitsu_ac_remote_model_t | model = `ARRAH2E`,
|  | const bool | inverted = `false`,
|  | const bool | use_modulation = `true`
| ) |  |
| explicit

Class Constructor.

Parameters

  [in] | pin | GPIO to be used when sending.
  [in] | model | The enum for the model of A/C to be emulated.
  [in] | inverted | Is the output signal to be inverted?
  [in] | use_modulation | Is frequency modulation to be used?

## Member Function Documentation

## ◆ begin()

void IRFujitsuAC::begin | ( | void |  | ) |

Set up hardware to be able to send a message.

## ◆ buildFromState()

void IRFujitsuAC::buildFromState | ( | const uint16_t | length | ) |
| private

Build the internal state/config from the current (raw) A/C message.

Parameters

  [in] | length | Size of the current/used (raw) A/C message array.

## ◆ calibrate()

int8_t IRFujitsuAC::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 IRFujitsuAC::checkSum | ( | void |  | ) |
| private

Calculate and set the checksum values for the internal state.

## ◆ convertFan()

uint8_t IRFujitsuAC::convertFan | ( | 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 IRFujitsuAC::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.

## ◆ get10CHeat()

bool IRFujitsuAC::get10CHeat | ( | void |  | ) | const

Get the 10C heat status of the A/C.

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

## ◆ getCelsius()

bool IRFujitsuAC::getCelsius | ( | void |  | ) | const

Get the Clean mode status of the A/C.

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

## ◆ getClean()

bool IRFujitsuAC::getClean | ( | void |  | ) | const

Get the Clean mode status of the A/C.

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

## ◆ getCmd()

uint8_t IRFujitsuAC::getCmd | ( | void |  | ) | const

Set the requested (special) command part for the A/C message.

Returns
  The special command code.

## ◆ getFanSpeed()

uint8_t IRFujitsuAC::getFanSpeed | ( | void |  | ) | const

Get the current fan speed setting.

Returns
  The current fan speed.

## ◆ getFilter()

bool IRFujitsuAC::getFilter | ( | void |  | ) | const

Get the Filter mode status of the A/C.

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

## ◆ getId()

uint8_t IRFujitsuAC::getId | ( | void |  | ) | const

Get the current device's remote ID number.

Returns
  The current device's remote ID number.

## ◆ getMode()

uint8_t IRFujitsuAC::getMode | ( | void |  | ) | const

Get the operating mode setting of the A/C.

Returns
  The current operating mode setting.

## ◆ getModel()

fujitsu_ac_remote_model_t IRFujitsuAC::getModel | ( | void |  | ) | const

Get the currently emulated/detected model of the A/C.

Returns
  The enum representing the model of A/C.

## ◆ getOffSleepTimer()

uint16_t IRFujitsuAC::getOffSleepTimer | ( | void |  | ) | const

Get the Off/Sleep Timer setting of the A/C.

Returns
  nr of minutes left on the timer. 0 means disabled/not supported.

## ◆ getOnTimer()

uint16_t IRFujitsuAC::getOnTimer | ( | void |  | ) | const

Get the On Timer setting of the A/C.

Returns
  nr of minutes left on the timer. 0 means disabled/not supported.

## ◆ getOutsideQuiet()

bool IRFujitsuAC::getOutsideQuiet | ( | void |  | ) | const

Get the Outside Quiet mode status of the A/C.

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

## ◆ getPower()

bool IRFujitsuAC::getPower | ( | void |  | ) | const

Get the value of the current power setting.

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

## ◆ getRaw()

uint8_t * IRFujitsuAC::getRaw | ( | void |  | ) |

Get a PTR to the internal state/code for this protocol.

Returns
  PTR to a code for this protocol based on the current internal state.

## ◆ getStateLength()

uint8_t IRFujitsuAC::getStateLength | ( | void |  | ) |

Get the length (size) of the state code for the current configuration.

Returns
  The length of the state array required for this config.

## ◆ getSwing()

uint8_t IRFujitsuAC::getSwing | ( | void |  | ) | const

Get the requested swing operation mode of the A/C unit.

Returns
  The contents of the swing state/mode.

## ◆ getTemp()

float IRFujitsuAC::getTemp | ( | void |  | ) | const

Get the current temperature setting.

Returns
  The current setting for temp. in degrees of the currently set units.

## ◆ getTimerType()

uint8_t IRFujitsuAC::getTimerType | ( | void |  | ) | const

Get the Timer type of the A/C message.

Returns
  The current timer type in numeric form.

## ◆ isLongCode()

bool IRFujitsuAC::isLongCode | ( | void |  | ) | const

Is the current binary state representation a long or a short code?

Returns
  true, if long; false, if short.

## ◆ off()

void IRFujitsuAC::off | ( | void |  | ) |

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

## ◆ on()

void IRFujitsuAC::on | ( | void |  | ) |

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

## ◆ send()

void IRFujitsuAC::send | ( | const uint16_t | repeat = `kFujitsuAcMinRepeat` | ) |

Send the current internal state as an IR message.

Parameters

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

## ◆ set10CHeat()

void IRFujitsuAC::set10CHeat | ( | const bool | on | ) |

Set the 10C heat status of the A/C.

Parameters

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

## ◆ setCelsius()

void IRFujitsuAC::setCelsius | ( | const bool | on | ) |

Set the Temperature units for the A/C.

Parameters

  [in] | on | true, use Celsius. false, use Fahrenheit.

## ◆ setClean()

void IRFujitsuAC::setClean | ( | const bool | on | ) |

Set the Clean mode of the A/C.

Parameters

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

## ◆ setCmd()

void IRFujitsuAC::setCmd | ( | const uint8_t | cmd | ) |

Set the requested (special) command part for the A/C message.

Parameters

  [in] | cmd | The special command code.

## ◆ setFanSpeed()

void IRFujitsuAC::setFanSpeed | ( | const uint8_t | fanSpeed | ) |

Set the speed of the fan.

Parameters

  [in] | fanSpeed | The desired setting.

## ◆ setFilter()

void IRFujitsuAC::setFilter | ( | const bool | on | ) |

Set the Filter mode status of the A/C.

Parameters

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

## ◆ setId()

void IRFujitsuAC::setId | ( | const uint8_t | num | ) |

Set the device's remote ID number.

Parameters

  [in] | num | The ID for the remote. Valid number range is 0 to 3.

## ◆ setMode()

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

Set the operating mode of the A/C.

Parameters

  [in] | mode | The desired operating mode.

## ◆ setModel()

void IRFujitsuAC::setModel | ( | const fujitsu_ac_remote_model_t | model | ) |

Set the currently emulated model of the A/C.

Parameters

  [in] | model | An enum representing the model to support/emulate.

## ◆ setOffSleepTimer()

void IRFujitsuAC::setOffSleepTimer | ( | const uint16_t | nr_mins | ) |
| inlineprivate

Set the Off/Sleep Timer time for the A/C.

Parameters

  [in] | nr_mins | Nr. of minutes to set the timer to. 0 means disabled.

## ◆ setOffTimer()

void IRFujitsuAC::setOffTimer | ( | const uint16_t | nr_mins | ) |

Set the Off Timer time for the A/C.

Parameters

  [in] | nr_mins | Nr. of minutes to set the timer to. 0 means disabled.

## ◆ setOnTimer()

void IRFujitsuAC::setOnTimer | ( | const uint16_t | nr_mins | ) |

Set the On Timer setting of the A/C.

Parameters

  [in] | nr_mins | Nr. of minutes to set the timer to. 0 means disabled.

## ◆ setOutsideQuiet()

void IRFujitsuAC::setOutsideQuiet | ( | const bool | on | ) |

Set the Outside Quiet mode of the A/C.

Parameters

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

## ◆ setPower()

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

Change the power setting.

Parameters

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

## ◆ setRaw()

bool IRFujitsuAC::setRaw | ( | const uint8_t | newState[],
|  | const uint16_t | length
| ) |  |

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

Parameters

  [in] | newState | A valid code for this protocol.
  [in] | length | Size of the newState array.

Returns
  true, if successful; Otherwise false. (i.e. size check)

## ◆ setSleepTimer()

void IRFujitsuAC::setSleepTimer | ( | const uint16_t | nr_mins | ) |

Set the Sleep Timer time for the A/C.

Parameters

  [in] | nr_mins | Nr. of minutes to set the timer to. 0 means disabled.

## ◆ setSwing()

void IRFujitsuAC::setSwing | ( | const uint8_t | swingMode | ) |

Set the requested swing operation mode of the A/C unit.

Parameters

  [in] | swingMode | The swingMode code for the A/C. Vertical, Horizon, or Both. See constants for details.

Note
  Not all models support all possible swing modes.

## ◆ setTemp()

void IRFujitsuAC::setTemp | ( | const float | temp,
|  | const bool | useCelsius = `true`
| ) |  |

Set the temperature.

Parameters

  [in] | temp | The temperature in degrees.
  [in] | useCelsius | Use Celsius or Fahrenheit?

## ◆ setTimerType()

void IRFujitsuAC::setTimerType | ( | const uint8_t | timertype | ) |

Set the Timer type of the A/C message.

Parameters

  [in] | timertype | The kind of timer to use for the message.

## ◆ stateReset()

void IRFujitsuAC::stateReset | ( | void |  | ) |

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

## ◆ stepHoriz()

void IRFujitsuAC::stepHoriz | ( | void |  | ) |

Request the A/C to step the Horizontal Swing.

## ◆ stepVert()

void IRFujitsuAC::stepVert | ( | void |  | ) |

Request the A/C to step the Vertical Swing.

## ◆ toCommon()

stdAc::state_t IRFujitsuAC::toCommon | ( | const stdAc::state_t * | prev = `NULL` | ) |

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

Parameters

  [in] | prev | Ptr to a previous state.

Returns
  The stdAc equivalent of the native settings.

## ◆ toCommonFanSpeed()

stdAc::fanspeed_t IRFujitsuAC::toCommonFanSpeed | ( | const uint8_t | speed | ) |
| static

Convert a native fan speed into its stdAc equivalent.

Parameters

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

Returns
  The stdAc equivalent of the native setting.

## ◆ toCommonMode()

stdAc::opmode_t IRFujitsuAC::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.

## ◆ toggleSwingHoriz()

void IRFujitsuAC::toggleSwingHoriz | ( | const bool | update = `true` | ) |

Request the A/C to toggle the Horizontal Swing mode.

Parameters

  [in] | update | Do we need to update the general swing config?

## ◆ toggleSwingVert()

void IRFujitsuAC::toggleSwingVert | ( | const bool | update = `true` | ) |

Request the A/C to toggle the Vertical Swing mode.

Parameters

  [in] | update | Do we need to update the general swing config?

## ◆ toString()

String IRFujitsuAC::toString | ( | void |  | ) | const

Convert the current internal state into a human readable string.

Returns
  A human readable string.

## ◆ updateUseLongOrShort()

bool IRFujitsuAC::updateUseLongOrShort | ( | void |  | ) |
| private

Update the length (size) of the state code for the current configuration.

Returns
  true, if use long codes; false, use short codes.

## ◆ validChecksum()

bool IRFujitsuAC::validChecksum | ( | uint8_t * | state,
|  | const uint16_t | length
| ) |  |
| static

Verify the checksum is valid for a given state.

Parameters

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

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

## Member Data Documentation

## ◆ _

FujitsuProtocol IRFujitsuAC::_
| private

## ◆ _cmd

uint8_t IRFujitsuAC::_cmd
| private

## ◆ _irsend

IRsend IRFujitsuAC::_irsend
| private

Instance of the IR send class.

## ◆ _model

fujitsu_ac_remote_model_t IRFujitsuAC::_model
| private

## ◆ _rawstatemodified

bool IRFujitsuAC::_rawstatemodified
| private

## ◆ _state_length

uint8_t IRFujitsuAC::_state_length
| private

## ◆ _state_length_short

uint8_t IRFujitsuAC::_state_length_short
| private

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

- src/ir_Fujitsu.h
- src/ir_Fujitsu.cpp