IRremoteESP8266: IRArgoACBase< ARGO_PROTOCOL_T > Class Template Reference (original) (raw)

Base class for handling common support for Argo remote protocols (functionality is shared across WREM-2 and WREM-3 IR protocols) More...

#include <[ir_Argo.h](ir%5F%5FArgo%5F8h%5Fsource.html)>

Public Member Functions
IRArgoACBase (const uint16_t pin, const bool inverted=false, const bool use_modulation=true)
Class constructor. More...
void send (const uint16_t repeat=kArgoDefaultRepeat)
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 internal state to have the power on. More...
void off (void)
Set the internal state to have the power off. More...
void setPower (const bool on)
Set the internal state to have the desired power. More...
bool getPower (void) const
Get the power setting from the internal state. More...
void setTemp (const uint8_t degrees)
Set the temperature. More...
uint8_t getTemp (void) const
Get the current temperature setting. More...
void setSensorTemp (const uint8_t degrees)
Set the value for the current room temperature. More...
uint8_t getSensorTemp (void) const
Get the currently stored value for the room temperature setting. More...
void setFan (const argoFan_t fan)
Set the desired fan mode (WREM3). More...
void setFanEx (const argoFan_t fan)
argoFan_t getFanEx (void) const
-Ex for backw. compat w/ IRArgoAC More...
void setFlap (const argoFlap_t flap)
Set the desired flap mode. More...
void setFlapEx (const argoFlap_t flap)
argoFlap_t getFlapEx (void) const
-Ex for backw. compat w/ IRArgoAC More...
void setMode (const argoMode_t mode)
Set the desired operation mode. More...
void setModeEx (const argoMode_t mode)
argoMode_t getModeEx (void) const
-Ex for backw. compat w/ IRArgoAC More...
void setMax (const bool on)
Control the current Max setting. (i.e. Turbo) More...
bool getMax (void) const
Is the Max (i.e. Turbo) setting on? More...
void setNight (const bool on)
Turn on/off the Night mode. i.e. Sleep. More...
bool getNight (void) const
Get the status of Night mode. i.e. Sleep. More...
void setiFeel (const bool on)
Turn on/off the iFeel mode. More...
bool getiFeel (void) const
Get the status of iFeel mode. More...
void setMessageType (const argoIrMessageType_t msgType)
Set the message type of the next command (setting this resets state) More...
argoIrMessageType_t getMessageType (void) const
Get the message type. More...
uint8_t * getRaw (void)
Get the raw state of the object, suitable to be sent with the appropriate IRsend object method. More...
uint16_t getRawByteLength () const
Get actual raw state byte length for the current state. More...
void setRaw (const uint8_t state[], const uint16_t length)
Set the raw state of the object. More...
Static Public Member Functions
static argoIrMessageType_t getMessageType (const uint8_t state[], const uint16_t length)
Get message type from raw WREM-3 data. More...
static uint16_t getStateLengthForIrMsgType (argoIrMessageType_t type)
Get byte length of raw WREM-3 message based on IR cmd type. More...
static bool validChecksum (const uint8_t state[], const uint16_t length)
Verify the checksum is valid for a given state. More...
static argoMode_t convertMode (const stdAc::opmode_t mode)
Convert a stdAc::opmode_t enum into its native mode. More...
static argoFan_t convertFan (const stdAc::fanspeed_t speed)
Convert a stdAc::fanspeed_t enum into it's native speed. More...
static argoFlap_t convertSwingV (const stdAc::swingv_t position)
Convert a stdAc::swingv_t enum into it's native setting. More...
static argoIrMessageType_t convertCommand (const stdAc::ac_command_t command)
Convert a stdAc::ac_command_t enum into its native message type. More...
Protected Member Functions
void _stateReset (ARGO_PROTOCOL_T *state, argoIrMessageType_t messageType=argoIrMessageType_t::AC_CONTROL)
void stateReset (argoIrMessageType_t messageType=argoIrMessageType_t::AC_CONTROL)
Reset the internals of the object to a known good state. More...
void _checksum (ARGO_PROTOCOL_T *state)
void checksum (void)
Update the checksum for the internal state. More...
Static Protected Member Functions
static uint16_t getRawByteLength (const ARGO_PROTOCOL_T &raw, argoIrMessageType_t messageTypeHint=argoIrMessageType_t::AC_CONTROL)
static uint8_t calcChecksum (const uint8_t state[], const uint16_t length)
Calculate the checksum for a given state (WREM-3). More...
static uint8_t getChecksum (const uint8_t state[], const uint16_t length)
Retrieve the checksum value from transmitted state. More...
static stdAc::opmode_t toCommonMode (const argoMode_t mode)
Convert a native mode into its stdAc equivalent. More...
static stdAc::fanspeed_t toCommonFanSpeed (const argoFan_t speed)
Convert a native fan speed into its stdAc equivalent. More...
static stdAc::swingv_t toCommonSwingV (const uint8_t position)
Convert a native flap mode into its stdAc equivalent (WREM3). More...
static stdAc::ac_command_t toCommonCommand (const argoIrMessageType_t command)
Convert a native message type into its stdAc equivalent. More...
Protected Attributes
ARGO_PROTOCOL_T _
The raw protocol data. More...
uint16_t _length = kArgoStateLength
argoIrMessageType_t _messageType = argoIrMessageType_t::AC_CONTROL
IRsend _irsend
instance of the IR send class More...
Related Functions
(Note that these are not member functions.)
template<>
uint16_t getRawByteLength (const ArgoProtocol &, argoIrMessageType_t messageType)
Get actual raw state byte length for the current state _param 1st param ignored: WREM-2 does not caryy type in payload, allegedly. More...
template<>
uint16_t getRawByteLength (const ArgoProtocolWREM3 &raw, argoIrMessageType_t)
Get actual raw state byte length for the current state. More...
template<>
void _checksum (ArgoProtocol *state)
Update the checksum for a given state (WREM2). More...
template<>
void _checksum (ArgoProtocolWREM3 *state)
Update the checksum for a given state (WREM3). More...
template<>
void _stateReset (ArgoProtocol *state, argoIrMessageType_t)
Reset the given state to a known good state. More...
template<>
void _stateReset (ArgoProtocolWREM3 *state, argoIrMessageType_t messageType)
Reset the given state to a known good state. More...

template<typename ARGO_PROTOCOL_T>

class IRArgoACBase< ARGO_PROTOCOL_T >

Base class for handling common support for Argo remote protocols (functionality is shared across WREM-2 and WREM-3 IR protocols)

Note

This class uses static polymorphism and full template specializations when required, to avoid a performance penalty of doing v-table lookup. 2 instantiations are forced in impl. file: for [ArgoProtocol](unionArgoProtocol.html "Native representation of a Argo A/C message for WREM-2 remote.") and [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.")

This class is abstract (though does not declare a pure-virtual fn. for abovementioned reasons), and instead declares protected c-tor

Template Parameters

ARGO_PROTOCOL_T The Raw device protocol/message used

template

IRArgoACBase< T >::IRArgoACBase ( 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?

_checksum()

template<typename ARGO_PROTOCOL_T >

void IRArgoACBase< ARGO_PROTOCOL_T >::_checksum ( ARGO_PROTOCOL_T * state) protected

_stateReset()

template<typename ARGO_PROTOCOL_T >

begin()

template

void IRArgoACBase< T >::begin ( void )

Set up hardware to be able to send a message.

calcChecksum()

template<typename ARGO_PROTOCOL_T >

uint8_t calcChecksum ( const uint8_t _state_[], const uint16_t length ) staticprotected

Calculate the checksum for a given state (WREM-3).

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

[in] state The array to calculate the checksum for.
[in] length The size of the state.

Returns

The 8-bit calculated result. <ARGO_PROTOCOL_T>

calibrate()

template<typename ARGO_PROTOCOL_T >

int8_t IRArgoACBase< ARGO_PROTOCOL_T >::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()

Update the checksum for the internal state.

convertCommand()

Convert a stdAc::ac_command_t enum into its native message type.

Parameters

command The enum to be converted.

Returns

The native equivalent of the enum.

convertFan()

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

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.

convertSwingV()

Convert a stdAc::swingv_t enum into it's native setting.

Parameters

[in] position The enum to be converted.

Returns

The native equivalent of the enum.

getChecksum()

template<typename ARGO_PROTOCOL_T >

uint8_t getChecksum ( const uint8_t _state_[], const uint16_t length ) staticprotected

Retrieve the checksum value from transmitted state.

Note

This is a full specialization for [ArgoProtocol](unionArgoProtocol.html "Native representation of a Argo A/C message for WREM-2 remote.") type and while it semantically belongs to IrArgoAC class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

[in] state Raw state
length Length of state in bytes

Returns

Checksum value (8-bit) <ARGO_PROTOCOL_T>

getFanEx()

template<typename ARGO_PROTOCOL_T >

argoFan_t getFanEx ( void ) const

-Ex for backw. compat w/ [IRArgoAC](classIRArgoAC.html "Supports Argo A/C SAC-WREM2 IR remote protocol.")

Get the current fan mode setting as a strongly typed value (WREM3).

Get the current fan mode setting as a strongly typed value (WREM2).

Note

This is a full specialization for [ArgoProtocol](unionArgoProtocol.html "Native representation of a Argo A/C message for WREM-2 remote.") type and while it semantically belongs to IrArgoAC class impl., it has not been pushed there, to avoid having to use a virtual function

Returns

The current fan mode. <ARGO_PROTOCOL_T>

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Returns

The current fan mode. <ARGO_PROTOCOL_T>

getFlapEx()

-Ex for backw. compat w/ [IRArgoAC](classIRArgoAC.html "Supports Argo A/C SAC-WREM2 IR remote protocol.")

Get Flap (VSwing) value as a strongly-typed value.

Note

This [getFlapEx()](classIRArgoACBase.html#ad5465ccf35143d0898ed837d39b3fde6 "-Ex for backw. compat w/ IRArgoAC") method has been introduced to be able to retain old implementation of getFlap() for IRArgoAc which used uint8_t

Returns

Flap setting

getiFeel()

template

bool IRArgoACBase< T >::getiFeel ( void ) const

Get the status of iFeel mode.

Returns

true if on, false if off.

getMax()

template

bool IRArgoACBase< T >::getMax ( void ) const

Is the Max (i.e. Turbo) setting on?

Returns

The current value.

getMessageType() [1/2]

template<typename ARGO_PROTOCOL_T >

Get message type from raw WREM-3 data.

Parameters

state The raw IR data
length Length of state (in byte)

Returns

IR message type

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function <ARGO_PROTOCOL_T>

getMessageType() [2/2]

Get the message type.

Returns

Message type currently set

getModeEx()

template<typename ARGO_PROTOCOL_T >

argoMode_t getModeEx ( void ) const

-Ex for backw. compat w/ [IRArgoAC](classIRArgoAC.html "Supports Argo A/C SAC-WREM2 IR remote protocol.")

Get the current operation mode setting.

Note

This is a full specialization for [ArgoProtocol](unionArgoProtocol.html "Native representation of a Argo A/C message for WREM-2 remote.") type and while it semantically belongs to IrArgoAC class impl., it has not been pushed there, to avoid having to use a virtual function

Returns

The current operation mode.

Note

This [getModeEx()](classIRArgoACBase.html#a5b3a48dd4ebaef8ba73b300893213cf7 "-Ex for backw. compat w/ IRArgoAC") method has been introduced to be able to retain old implementation of getMode() for IRArgoAc which used uint8_t <ARGO_PROTOCOL_T>

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function.

Returns

The current operation mode.

Note

This [getModeEx()](classIRArgoACBase.html#a5b3a48dd4ebaef8ba73b300893213cf7 "-Ex for backw. compat w/ IRArgoAC") method has been introduced to be able to retain old implementation of getMode() for IRArgoAc which used uint8_t <ARGO_PROTOCOL_T>

getNight()

template

bool IRArgoACBase< T >::getNight ( void ) const

Get the status of Night mode. i.e. Sleep.

Returns

true if on, false if off.

getPower()

template<typename ARGO_PROTOCOL_T >

bool getPower ( void ) const

Get the power setting from the internal state.

Note

This is a full specialization for [ArgoProtocol](unionArgoProtocol.html "Native representation of a Argo A/C message for WREM-2 remote.") type and while it semantically belongs to IrArgoAC class impl., it has not been pushed there, to avoid having to use a virtual function

Returns

A boolean indicating the power setting. <ARGO_PROTOCOL_T>

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Returns

A boolean indicating the power setting. <ARGO_PROTOCOL_T>

getRaw()

template

uint8_t * IRArgoACBase< T >::getRaw ( void )

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

Returns

A PTR to the internal state.

getRawByteLength() [1/2]

Get actual raw state byte length for the current state.

Returns

Actual length of state (in bytes)

getRawByteLength() [2/2]

template<typename ARGO_PROTOCOL_T >

getSensorTemp()

template

uint8_t IRArgoACBase< T >::getSensorTemp ( void ) const

Get the currently stored value for the room temperature setting.

Note

Depending on message type - this will get sensor or roomTemp value

Returns

The current setting for the room temp. in degrees celsius.

getStateLengthForIrMsgType()

template<typename ARGO_PROTOCOL_T >

Get byte length of raw WREM-3 message based on IR cmd type.

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

type The type of IR command

Returns

Byte length of state command <ARGO_PROTOCOL_T>

getTemp()

template

uint8_t IRArgoACBase< T >::getTemp ( void ) const

Get the current temperature setting.

Returns

The current setting for temp. in degrees celsius.

off()

Set the internal state to have the power off.

on()

Set the internal state to have the power on.

send()

Send the current internal state as an IR message.

Parameters

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

setFan()

template<typename ARGO_PROTOCOL_T >

void setFan ( const argoFan_t fan )

Set the desired fan mode (WREM3).

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

[in] fan The desired fan speed. <ARGO_PROTOCOL_T>

setFanEx()

template<typename ARGO_PROTOCOL_T >

setFlap()

Set the desired flap mode.

Parameters

[in] flap The desired flap mode.

setFlapEx()

template<typename ARGO_PROTOCOL_T >

setiFeel()

template

void IRArgoACBase< T >::setiFeel ( const bool on )

Turn on/off the iFeel mode.

Parameters

[in] on The desired setting.

setMax()

template

void IRArgoACBase< T >::setMax ( const bool on )

Control the current Max setting. (i.e. Turbo)

Parameters

[in] on The desired setting.

setMessageType()

Set the message type of the next command (setting this resets state)

Parameters

msgType The message type to set

setMode()

template<typename ARGO_PROTOCOL_T >

void setMode ( const argoMode_t mode )

Set the desired operation mode.

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

[in] mode The desired operation mode. <ARGO_PROTOCOL_T>

setModeEx()

template<typename ARGO_PROTOCOL_T >

setNight()

template

void IRArgoACBase< T >::setNight ( const bool on )

Turn on/off the Night mode. i.e. Sleep.

Parameters

[in] on The desired setting.

setPower()

template<typename ARGO_PROTOCOL_T >

void setPower ( const bool on )

Set the internal state to have the desired power.

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

[in] on The desired power state. <ARGO_PROTOCOL_T>

setRaw()

template

void IRArgoACBase< T >::setRaw ( const uint8_t _state_[],
const uint16_t length
)

Set the raw state of the object.

Parameters

[in] state The raw state from the native IR message.
[in] length The length of raw state in bytes.

setSensorTemp()

template

void IRArgoACBase< T >::setSensorTemp ( const uint8_t degrees )

Set the value for the current room temperature.

Note

Depending on message type - this will set sensor or roomTemp value

Parameters

[in] degrees The temperature in degrees celsius.

setTemp()

template

void IRArgoACBase< T >::setTemp ( const uint8_t degrees )

Set the temperature.

Parameters

[in] degrees The temperature in degrees celsius.

Note

Sending 0 equals +4

stateReset()

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

Parameters

messageType Type of message to reset the state for

toCommonCommand()

Convert a native message type into its stdAc equivalent.

Parameters

[in] command The native setting to be converted.

Returns

The stdAc equivalent of the native setting.

toCommonFanSpeed()

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

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.

toCommonSwingV()

template<typename ARGO_PROTOCOL_T >

Convert a native flap mode into its stdAc equivalent (WREM3).

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

[in] position The native setting to be converted.

Returns

The stdAc equivalent of the native setting. <ARGO_PROTOCOL_T>

validChecksum()

template

bool IRArgoACBase< T >::validChecksum ( const 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 size of the state.

Returns

A boolean indicating if it's checksum is valid.

_checksum() [1/2]

Update the checksum for a given state (WREM2).

Note

This is a full specialization for [ArgoProtocol](unionArgoProtocol.html "Native representation of a Argo A/C message for WREM-2 remote.") type and while it semantically belongs to IrArgoAC class impl., it has not been pushed there, to avoid having to use a virtual function

Warning

This impl does not support short message format (iFeel)

Parameters

[in,out] state Pointer to a binary representation of the A/C state. <ARGO_PROTOCOL_T>

_checksum() [2/2]

Update the checksum for a given state (WREM3).

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

[in,out] state Pointer to a binary representation of the A/C state. <ARGO_PROTOCOL_T>

_stateReset() [1/2]

Reset the given state to a known good state.

Note

This is a full specialization for [ArgoProtocol](unionArgoProtocol.html "Native representation of a Argo A/C message for WREM-2 remote.") type and while it semantically belongs to IrArgoAC class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

[in,out] state Pointer to a binary representation of the A/C state. _param 2nd param unused (always resets to AC_CONTROL state) <ARGO_PROTOCOL_T>

_stateReset() [2/2]

Reset the given state to a known good state.

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function

Parameters

[in,out] state Pointer to a binary representation of the A/C state.
messageType Type of message to reset the state for <ARGO_PROTOCOL_T>

getRawByteLength() [1/2]

Get actual raw state byte length for the current state _param 1st param ignored: WREM-2 does not caryy type in payload, allegedly.

Parameters

messageType Type of message the state is carrying

Returns

Actual length of state (in bytes)

Note

This is a full specialization for [ArgoProtocol](unionArgoProtocol.html "Native representation of a Argo A/C message for WREM-2 remote.") type and while it semantically belongs to IrArgoAC class impl., it has not been pushed there, to avoid having to use a virtual function <ARGO_PROTOCOL_T>

getRawByteLength() [2/2]

Get actual raw state byte length for the current state.

Parameters

raw The raw state _param 2nd param ignored (1st byte of raw is sufficient to get len)

Returns

Actual length of state (in bytes)

Note

This is a full specialization for [ArgoProtocolWREM3](unionArgoProtocolWREM3.html "Native representation of A/C IR message for WREM-3 remote.") type and while it semantically belongs to IrArgoAC_WREM3 class impl., it has not been pushed there, to avoid having to use a virtual function <ARGO_PROTOCOL_T>

_

template<typename ARGO_PROTOCOL_T >

The raw protocol data.

_irsend

template<typename ARGO_PROTOCOL_T >

instance of the IR send class

_length

template<typename ARGO_PROTOCOL_T >

_messageType

template<typename ARGO_PROTOCOL_T >


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