# IRremoteESP8266: IRFujitsuAC Class Reference

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)
| 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 (const bool raw=false)
| Set the requested (special) command part for the A/C message. More...
void | setTemp (const uint8_t temp)
| Set the temperature. More...
uint8_t | getTemp (void)
| Get the current temperature setting. More...
void | setFanSpeed (const uint8_t fan)
| Set the speed of the fan. More...
uint8_t | getFanSpeed (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 | setSwing (const uint8_t mode)
| Set the requested swing operation mode of the A/C unit. More...
uint8_t | getSwing (const bool raw=false)
| 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...
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)
| 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 (const bool raw=false)
| 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 (const bool raw=false)
| Get the Filter mode status of the A/C. More...
void | setOutsideQuiet (const bool on)
| Set the Outside Quiet mode of the A/C. More...
bool | getOutsideQuiet (const bool raw=false)
| Get the Outside Quiet mode status of the A/C. More...
uint8_t | getTimerType (const bool raw=false)
| 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 (const bool raw=false)
| 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 (const bool raw=false)
| 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...
uint8_t | convertMode (const stdAc::opmode_t mode)
| Convert a stdAc::opmode_t enum into its native mode. More...
uint8_t | convertFan (stdAc::fanspeed_t speed)
| Convert a stdAc::fanspeed_t enum into it's native speed. 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 (uint8_t *state, const uint16_t length)
| Verify the checksum is valid for a given state. 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 | buildState (void)
| (Re)Build the state from the currently configured settings. 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...
uint8_t | remote_state [kFujitsuAcStateLength]
| The state of the IR remote. More...
uint8_t | _temp
uint8_t | _fanSpeed
uint8_t | _mode
uint8_t | _swingMode
uint8_t | _cmd
fujitsu_ac_remote_model_t | _model
uint8_t | _state_length
uint8_t | _state_length_short
bool | _outsideQuiet
bool | _clean
bool | _filter
uint16_t | _ontimer
uint16_t | _offtimer
uint8_t | _timertype

## 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.

## buildState()

void IRFujitsuAC::buildState | ( | void |  | ) |

private

(Re)Build the state from the currently configured settings.

## 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.

## convertFan()

uint8_t IRFujitsuAC::convertFan | ( | stdAc::fanspeed_t | speed | ) |

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 | ) |

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.

## getClean()

bool IRFujitsuAC::getClean | ( | const bool | raw = `false` | ) |

Get the Clean mode status of the A/C.

Parameters

  [in] | raw | Do we get the result from base data?

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

## getCmd()

uint8_t IRFujitsuAC::getCmd | ( | const bool | raw = `false` | ) |

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

Parameters

  [in] | raw | Do we need to get it from first principles from the raw data?

Returns
  The special command code.

## getFanSpeed()

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

Get the current fan speed setting.

Returns
  The current fan speed.

## getFilter()

bool IRFujitsuAC::getFilter | ( | const bool | raw = `false` | ) |

Get the Filter mode status of the A/C.

Parameters

  [in] | raw | Do we get the result from base data?

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

## getMode()

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

Get the operating mode setting of the A/C.

Returns
  The current operating mode setting.

## getModel()

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

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

Returns
  The enum representing the model of A/C.

## getOffSleepTimer()

uint16_t IRFujitsuAC::getOffSleepTimer | ( | const bool | raw = `false` | ) |

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

Parameters

  [in] | raw | Do we get the result from base data?

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

## getOnTimer()

uint16_t IRFujitsuAC::getOnTimer | ( | const bool | raw = `false` | ) |

Get the On Timer setting of the A/C.

Parameters

  [in] | raw | Do we get the result from base data?

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

## getOutsideQuiet()

bool IRFujitsuAC::getOutsideQuiet | ( | const bool | raw = `false` | ) |

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

Parameters

  [in] | raw | Do we get the result from base data?

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

## getPower()

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

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 | ( | const bool | raw = `false` | ) |

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

Parameters

  [in] | raw | Do we need to get it from first principles from the raw data?

Returns
  The contents of the swing state/mode.

## getTemp()

uint8_t IRFujitsuAC::getTemp | ( | void |  | ) |

Get the current temperature setting.

Returns
  The current setting for temp. in degrees celsius.

## getTimerType()

uint8_t IRFujitsuAC::getTimerType | ( | const bool | raw = `false` | ) |

Get the Timer type of the A/C message.

Parameters

  [in] | raw | Do we get the result from base data?

Returns
  The current timer type in numeric form.

## 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.

## 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.

## 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 | ) |

private

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 uint8_t | temp | ) |

Set the temperature.

Parameters

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

## 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 | ( | void |  | ) |

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

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 |  | ) |

Convert the current internal state into a human readable string.

Returns
  A human readable string.

## 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

## _clean

bool IRFujitsuAC::_clean

private

## _cmd

uint8_t IRFujitsuAC::_cmd

private

## _fanSpeed

uint8_t IRFujitsuAC::_fanSpeed

private

## _filter

bool IRFujitsuAC::_filter

private

## _irsend

IRsend IRFujitsuAC::_irsend

private

Instance of the IR send class.

## _mode

uint8_t IRFujitsuAC::_mode

private

## _model

fujitsu_ac_remote_model_t IRFujitsuAC::_model

private

## _offtimer

uint16_t IRFujitsuAC::_offtimer

private

## _ontimer

uint16_t IRFujitsuAC::_ontimer

private

## _outsideQuiet

bool IRFujitsuAC::_outsideQuiet

private

## _state_length

uint8_t IRFujitsuAC::_state_length

private

## _state_length_short

uint8_t IRFujitsuAC::_state_length_short

private

## _swingMode

uint8_t IRFujitsuAC::_swingMode

private

## _temp

uint8_t IRFujitsuAC::_temp

private

## _timertype

uint8_t IRFujitsuAC::_timertype

private

## remote_state

uint8_t IRFujitsuAC::remote_state[kFujitsuAcStateLength]

private

The state of the IR remote.

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

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