IRremoteESP8266
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
IREuromAc Class Reference

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

#include <ir_Eurom.h>

Collaboration diagram for IREuromAc:
Collaboration graph
[legend]

Public Member Functions

 IREuromAc (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
 Class constructor.
 
void stateReset ()
 Reset the internals of the object to a known good state.
 
void send (const uint16_t repeat=kNoRepeat)
 Send the current internal state as an IR message.
 
int8_t calibrate (void)
 Run the calibration to calculate uSec timing offsets for this platform.
 
void begin (void)
 Set up hardware to be able to send a message.
 
void setRaw (const uint8_t state[])
 Set the raw state of the remote.
 
uint8_t * getRaw (void)
 Get the raw state of the remote, suitable to be sent with the appropriate IRsend object method.
 
void on (void)
 Set the internal state to powered on.
 
void off (void)
 Set the internal state to powered off.
 
void setPower (const bool state)
 Set the internal state to use the desired power setting.
 
bool getPower (void) const
 Get the current power setting from the internal state.
 
void setMode (const uint8_t mode)
 Set the internal state to use the desired operation mode.
 
uint8_t getMode (void) const
 Get the current operation mode setting from the internal state.
 
void setTemp (const uint8_t degrees, const bool fahrenheit=false)
 Set the internal state to use the desired temperature.
 
uint8_t getTemp (void) const
 Get the current temperature from the internal state.
 
bool getTempIsFahrenheit (void) const
 Check if Fahrenheit is currently being used by the internal state.
 
void setFan (const uint8_t speed)
 Set the internal state to use the desired fan speed.
 
uint8_t getFan (void) const
 Get the current fan speed from the internal state.
 
void setSwing (const bool state)
 Set the internal state to use the desired swing setting.
 
bool getSwing (void) const
 Get the current swing setting from the internal state.
 
void setSleep (const bool state)
 Set the internal state to use the desired sleep setting.
 
bool getSleep (void) const
 Get the current sleep setting from the internal state.
 
void setOffTimer (const uint8_t duration)
 Set the internal state to use the desired "off timer" duration.
 
uint8_t getOffTimer (void) const
 Get the current "off timer" duration from the internal state.
 
void setOnTimer (const uint8_t duration)
 Set the internal state to use the desired "on timer" duration.
 
uint8_t getOnTimer (void) const
 Get the current "on timer" duration from the internal state.
 
stdAc::state_t toCommon (void) const
 Convert the current internal state into its stdAc::state_t equivalent.
 
String toString (void) const
 Convert the current internal state into a human-readable string.
 

Static Public Member Functions

static uint8_t calcChecksum (const uint8_t state[], const uint16_t length=kEuromStateLength)
 Calculate the checksum for the supplied state.
 
static bool validChecksum (const uint8_t state[], const uint16_t length=kEuromStateLength)
 Verify if the checksum is valid for a given state.
 
static uint8_t convertMode (const stdAc::opmode_t mode)
 Convert a stdAc::opmode_t enum into its native operation mode.
 
static uint8_t convertFan (const stdAc::fanspeed_t speed)
 Convert a stdAc::fanspeed_t enum into its native speed.
 
static bool convertSwing (const stdAc::swingv_t swing)
 Convert a stdAc::swingv_t enum into its native swing.
 
static stdAc::opmode_t toCommonMode (const uint8_t mode)
 Convert a native operation mode into its stdAc enum equivalent.
 
static stdAc::fanspeed_t toCommonFanSpeed (const uint8_t speed)
 Convert a native fan speed into its stdAc enum equivalent.
 
static stdAc::swingv_t toCommonSwing (const bool swing)
 Convert a native swing setting into its stdAc enum equivalent.
 

Private Member Functions

uint8_t getModeCelsiusByte (const uint8_t mode, const uint8_t celsius) const
 Combine a mode flag and temperature into a single byte for the AC. Note that validity is not checked again.
 
uint8_t getSleepOnTimerByte (const bool sleep, const uint8_t hours) const
 Combine sleep mode and a timer duration into a single byte for the AC. Note that validity is not checked again.
 
void checksum (void)
 Update the checksum value for the current internal state.
 

Private Attributes

IRsend _irsend
 
EuromProtocol _
 
uint8_t state_mode_ = kEuromCool
 
uint8_t state_celsius_ = 23
 
bool state_sleep_ = false
 
uint8_t state_on_timer_ = kEuromTimerMin
 

Detailed Description

Class for handling detailed Eurom A/C messages.

Constructor & Destructor Documentation

◆ IREuromAc()

IREuromAc::IREuromAc ( const uint16_t  pin,
const bool  inverted = false,
const bool  use_modulation = true 
)
explicit

Class constructor.

Parameters
[in]pinGPIO to be used when sending.
[in]invertedIs the output signal to be inverted?
[in]use_modulationIs frequency modulation to be used?

Member Function Documentation

◆ begin()

void IREuromAc::begin ( void  )

Set up hardware to be able to send a message.

◆ calcChecksum()

uint8_t IREuromAc::calcChecksum ( const uint8_t  state[],
const uint16_t  length = kEuromStateLength 
)
static

Calculate the checksum for the supplied state.

Parameters
[in]stateThe source state to generate the checksum from.
[in]lengthLength of the supplied state to checksum.
Returns
The checksum value.

◆ calibrate()

int8_t IREuromAc::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 65 ms IR signal pulse at 38 kHz. Only ever needs to be run once per object instantiation, if at all.

◆ checksum()

void IREuromAc::checksum ( void  )
private

Update the checksum value for the current internal state.

◆ convertFan()

uint8_t IREuromAc::convertFan ( const stdAc::fanspeed_t  speed)
static

Convert a stdAc::fanspeed_t enum into its native speed.

Parameters
[in]speedThe enum to be converted.
Returns
The native equivalent of the enum.

◆ convertMode()

uint8_t IREuromAc::convertMode ( const stdAc::opmode_t  mode)
static

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

Parameters
[in]modeThe enum to be converted.
Returns
The native equivalent of the enum.

◆ convertSwing()

bool IREuromAc::convertSwing ( const stdAc::swingv_t  swing)
static

Convert a stdAc::swingv_t enum into its native swing.

Parameters
[in]swingThe enum to be converted.
Returns
The native equivalent of the enum.

◆ getFan()

uint8_t IREuromAc::getFan ( void  ) const

Get the current fan speed from the internal state.

Returns
The current fan speed.

◆ getMode()

uint8_t IREuromAc::getMode ( void  ) const

Get the current operation mode setting from the internal state.

Returns
The current operation mode.

◆ getModeCelsiusByte()

uint8_t IREuromAc::getModeCelsiusByte ( const uint8_t  mode,
const uint8_t  celsius 
) const
private

Combine a mode flag and temperature into a single byte for the AC. Note that validity is not checked again.

Parameters
[in]modeA valid mode flag.
[in]celsiusA valid temperature, i.e. within the proper range.

◆ getOffTimer()

uint8_t IREuromAc::getOffTimer ( void  ) const

Get the current "off timer" duration from the internal state.

Returns
The current duration, in hours.

◆ getOnTimer()

uint8_t IREuromAc::getOnTimer ( void  ) const

Get the current "on timer" duration from the internal state.

Returns
The current duration, in hours.

◆ getPower()

bool IREuromAc::getPower ( void  ) const

Get the current power setting from the internal state.

Returns
A boolean indicating the current power setting.

◆ getRaw()

uint8_t * IREuromAc::getRaw ( void  )

Get the raw state of the remote, suitable to be sent with the appropriate IRsend object method.

Returns
A PTR to the internal state.

◆ getSleep()

bool IREuromAc::getSleep ( void  ) const

Get the current sleep setting from the internal state.

Returns
A boolean indicating the current sleep setting.

◆ getSleepOnTimerByte()

uint8_t IREuromAc::getSleepOnTimerByte ( const bool  sleep,
const uint8_t  hours 
) const
private

Combine sleep mode and a timer duration into a single byte for the AC. Note that validity is not checked again.

Parameters
[in]sleepWhether sleep mode should be enabled.
[in]hoursA valid duration, i.e. within the proper range.

◆ getSwing()

bool IREuromAc::getSwing ( void  ) const

Get the current swing setting from the internal state.

Returns
A boolean indicating the current swing setting.

◆ getTemp()

uint8_t IREuromAc::getTemp ( void  ) const

Get the current temperature from the internal state.

Returns
The current temperature, which can be either Celsius or Fahrenheit, depending on what was used with setTemp(). See also: getTempIsFahrenheit().

◆ getTempIsFahrenheit()

bool IREuromAc::getTempIsFahrenheit ( void  ) const

Check if Fahrenheit is currently being used by the internal state.

Returns
A boolean indicating if the current temperature is in Fahrenheit.

◆ off()

void IREuromAc::off ( void  )

Set the internal state to powered off.

◆ on()

void IREuromAc::on ( void  )

Set the internal state to powered on.

◆ send()

void IREuromAc::send ( const uint16_t  repeat = kNoRepeat)

Send the current internal state as an IR message.

Parameters
[in]repeatNumber of times the message will be repeated. Note that the original remote sends the same signal twice, but the actual A/C works just fine if you send it once.

◆ setFan()

void IREuromAc::setFan ( const uint8_t  speed)

Set the internal state to use the desired fan speed.

Parameters
[in]speedThe desired fan speed.

◆ setMode()

void IREuromAc::setMode ( const uint8_t  mode)

Set the internal state to use the desired operation mode.

Parameters
[in]modeThe desired operation mode.

◆ setOffTimer()

void IREuromAc::setOffTimer ( const uint8_t  duration)

Set the internal state to use the desired "off timer" duration.

Parameters
[in]durationThe desired duration, in hours.

◆ setOnTimer()

void IREuromAc::setOnTimer ( const uint8_t  duration)

Set the internal state to use the desired "on timer" duration.

Parameters
[in]durationThe desired duration, in hours.

◆ setPower()

void IREuromAc::setPower ( const bool  state)

Set the internal state to use the desired power setting.

Parameters
[in]stateThe desired power setting.

◆ setRaw()

void IREuromAc::setRaw ( const uint8_t  state[])

Set the raw state of the remote.

Parameters
[in]stateThe raw state from the native IR message.

◆ setSleep()

void IREuromAc::setSleep ( const bool  state)

Set the internal state to use the desired sleep setting.

Parameters
[in]stateThe desired sleep setting.

◆ setSwing()

void IREuromAc::setSwing ( const bool  state)

Set the internal state to use the desired swing setting.

Parameters
[in]stateThe desired swing setting.

◆ setTemp()

void IREuromAc::setTemp ( const uint8_t  degrees,
const bool  fahrenheit = false 
)

Set the internal state to use the desired temperature.

Parameters
[in]degreesThe desired temperature in degrees, normally Celsius.
[in]fahrenheitIf the given temperature is in Fahrenheit instead.

◆ stateReset()

void IREuromAc::stateReset ( void  )

Reset the internals of the object to a known good state.

◆ toCommon()

stdAc::state_t IREuromAc::toCommon ( void  ) const

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

Returns
The stdAc struct equivalent of the native settings.

◆ toCommonFanSpeed()

stdAc::fanspeed_t IREuromAc::toCommonFanSpeed ( const uint8_t  speed)
static

Convert a native fan speed into its stdAc enum equivalent.

Parameters
[in]speedThe native speed setting to be converted.
Returns
The stdAc enum equivalent of the native setting.

◆ toCommonMode()

stdAc::opmode_t IREuromAc::toCommonMode ( const uint8_t  mode)
static

Convert a native operation mode into its stdAc enum equivalent.

Parameters
[in]modeThe native operation mode setting to be converted.
Returns
The stdAc enum equivalent of the native setting.

◆ toCommonSwing()

stdAc::swingv_t IREuromAc::toCommonSwing ( const bool  swing)
static

Convert a native swing setting into its stdAc enum equivalent.

Parameters
[in]swingThe native swing setting to be converted.
Returns
The stdAc enum equivalent of the native setting.

◆ toString()

String IREuromAc::toString ( void  ) const

Convert the current internal state into a human-readable string.

Returns
A human-readable string.

◆ validChecksum()

bool IREuromAc::validChecksum ( const uint8_t  state[],
const uint16_t  length = kEuromStateLength 
)
static

Verify if the checksum is valid for a given state.

Parameters
[in]stateThe source state to verify the checksum of.
[in]lengthThe size of the supplied state.
Returns
A boolean indicating if its checksum is valid.

Member Data Documentation

◆ _

EuromProtocol IREuromAc::_
private

◆ _irsend

IRsend IREuromAc::_irsend
private

◆ state_celsius_

uint8_t IREuromAc::state_celsius_ = 23
private

◆ state_mode_

uint8_t IREuromAc::state_mode_ = kEuromCool
private

◆ state_on_timer_

uint8_t IREuromAc::state_on_timer_ = kEuromTimerMin
private

◆ state_sleep_

bool IREuromAc::state_sleep_ = false
private

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