IRremoteESP8266
|
Namespace for covering common functions & procedures for advancd protocol handlers. More...
Functions | |
String | addLabeledString (const String value, const String label, const bool precomma) |
Create a String with a colon separated "label: value" pair suitable for Humans. More... | |
String | addBoolToString (const bool value, const String label, const bool precomma) |
Create a String with a colon separated flag suitable for Humans. e.g. "Power: On". More... | |
String | addToggleToString (const bool toggle, const String label, const bool precomma) |
Create a String with a colon separated toggle flag suitable for Humans. e.g. "Light: Toggle", "Light: -". More... | |
String | addIntToString (const uint16_t value, const String label, const bool precomma) |
Create a String with a colon separated labeled Integer suitable for Humans. e.g. "Foo: 23". More... | |
String | addSignedIntToString (const int16_t value, const String label, const bool precomma) |
Create a String with a colon separated labeled Integer suitable for Humans. e.g. "Foo: 23". More... | |
String | modelToStr (const decode_type_t protocol, const int16_t model) |
Generate the model string for a given Protocol/Model pair. More... | |
String | addModelToString (const decode_type_t protocol, const int16_t model, const bool precomma) |
Create a String of human output for a given protocol model number. e.g. "Model: JKE". More... | |
String | addTempToString (const uint16_t degrees, const bool celsius, const bool precomma, const bool isSensorTemp) |
Create a String of human output for a given temperature. e.g. "Temp: 25C". More... | |
String | addTempFloatToString (const float degrees, const bool celsius, const bool precomma, const bool isSensorTemp) |
Create a String of human output for a given temperature. e.g. "Temp: 25.5C". More... | |
String | addModeToString (const uint8_t mode, const uint8_t automatic, const uint8_t cool, const uint8_t heat, const uint8_t dry, const uint8_t fan) |
Create a String of human output for the given operating mode. e.g. "Mode: 1 (Cool)". More... | |
String | addDayToString (const uint8_t day_of_week, const int8_t offset, const bool precomma) |
Create a String of the 3-letter day of the week from a numerical day of the week. e.g. "Day: 1 (Mon)". More... | |
String | dayToString (const uint8_t day_of_week, const int8_t offset) |
Create a String of the 3-letter day of the week from a numerical day of the week. e.g. "Mon". More... | |
String | addFanToString (const uint8_t speed, const uint8_t high, const uint8_t low, const uint8_t automatic, const uint8_t quiet, const uint8_t medium, const uint8_t maximum, const uint8_t medium_high) |
Create a String of human output for the given fan speed. e.g. "Fan: 0 (Auto)". More... | |
String | addSwingHToString (const uint8_t position, const uint8_t automatic, const uint8_t maxleft, const uint8_t left, const uint8_t middle, const uint8_t right, const uint8_t maxright, const uint8_t off, const uint8_t leftright, const uint8_t rightleft, const uint8_t threed, const uint8_t wide) |
Create a String of human output for the given horizontal swing setting. e.g. "Swing(H): 0 (Auto)". More... | |
String | addSwingVToString (const uint8_t position, const uint8_t automatic, const uint8_t highest, const uint8_t high, const uint8_t uppermiddle, const uint8_t middle, const uint8_t lowermiddle, const uint8_t low, const uint8_t lowest, const uint8_t off, const uint8_t swing, const uint8_t breeze, const uint8_t circulate) |
Create a String of human output for the given vertical swing setting. e.g. "Swing(V): 0 (Auto)". More... | |
String | addTimerModeToString (const uint8_t timerMode, const uint8_t noTimer, const uint8_t delayTimer, const uint8_t schedule1, const uint8_t schedule2, const uint8_t schedule3, const bool precomma) |
Create a String of human output for the given timer setting. e.g. "Timer Mode: 2 (Schedule 1)". More... | |
String | channelToString (const uint8_t channel) |
Create a String of human output for the given channel e.g. "[CH#0]". More... | |
String | irCommandTypeToString (uint8_t irCommandType, uint8_t acControlCmd, uint8_t iFeelReportCmd, uint8_t timerCmd, uint8_t configCmd) |
Create a String of human output for the given command type e.g. "IFeel Report". More... | |
String | daysBitmaskToString (uint8_t daysBitmap, uint8_t offset) |
Create a String of the 3-letter day of the week bitmap. More... | |
String | htmlEscape (const String unescaped) |
Escape any special HTML (unsafe) characters in a string. e.g. anti-XSS. More... | |
String | msToString (uint32_t const msecs) |
Convert a nr. of milliSeconds into a Human-readable string. e.g. "1 Day 6 Hours 34 Minutes 17 Seconds". More... | |
String | minsToString (const uint16_t mins) |
Convert a nr. of minutes into a 24h clock format Human-readable string. e.g. "23:59". More... | |
uint8_t | sumNibbles (const uint8_t *const start, const uint16_t length, const uint8_t init) |
Sum all the nibbles together in a series of bytes. More... | |
uint8_t | sumNibbles (const uint64_t data, const uint8_t count, const uint8_t init, const bool nibbleonly) |
Sum all the nibbles together in an integer. More... | |
uint16_t | sumBytes (const uint64_t data, const uint8_t count, const uint8_t init, const bool byteonly) |
Sum all the bytes together in an integer. More... | |
uint8_t | bcdToUint8 (const uint8_t bcd) |
Convert a byte of Binary Coded Decimal(BCD) into an Integer. More... | |
uint8_t | uint8ToBcd (const uint8_t integer) |
Convert an Integer into a byte of Binary Coded Decimal(BCD). More... | |
bool | getBit (const uint64_t data, const uint8_t position, const uint8_t size) |
Return the value of position th bit of an Integer. More... | |
bool | getBit (const uint8_t data, const uint8_t position) |
Return the value of position th bit of an Integer. More... | |
uint64_t | setBit (const uint64_t data, const uint8_t position, const bool on, const uint8_t size) |
Return the value of an Integer with the position th bit changed. More... | |
uint8_t | setBit (const uint8_t data, const uint8_t position, const bool on) |
Return the value of an Integer with the position th bit changed. More... | |
void | setBit (uint8_t *const data, const uint8_t position, const bool on) |
Alter the value of an Integer with the position th bit changed. More... | |
void | setBit (uint32_t *const data, const uint8_t position, const bool on) |
Alter the value of an Integer with the position th bit changed. More... | |
void | setBit (uint64_t *const data, const uint8_t position, const bool on) |
Alter the value of an Integer with the position th bit changed. More... | |
void | setBits (uint8_t *const dst, const uint8_t offset, const uint8_t nbits, const uint8_t data) |
Alter an uint8_t value by overwriting an arbitrary given number of bits. More... | |
void | setBits (uint32_t *const dst, const uint8_t offset, const uint8_t nbits, const uint32_t data) |
Alter an uint32_t value by overwriting an arbitrary given number of bits. More... | |
void | setBits (uint64_t *const dst, const uint8_t offset, const uint8_t nbits, const uint64_t data) |
Alter an uint64_t value by overwriting an arbitrary given number of bits. More... | |
uint8_t * | invertBytePairs (uint8_t *ptr, const uint16_t length) |
Create byte pairs where the second byte of the pair is a bit inverted/flipped copy of the first/previous byte of the pair. More... | |
bool | checkInvertedBytePairs (const uint8_t *const ptr, const uint16_t length) |
Check an array to see if every second byte of a pair is a bit inverted/flipped copy of the first/previous byte of the pair. More... | |
uint8_t | lowLevelSanityCheck (void) |
Perform a low level bit manipulation sanity check for the given cpu architecture and the compiler operation. Calls to this should return 0 if everything is as expected, anything else means the library won't work as expected. More... | |
Namespace for covering common functions & procedures for advancd protocol handlers.
Create a String with a colon separated flag suitable for Humans. e.g. "Power: On".
[in] | value | The value to come after the label. |
[in] | label | The label to precede the value. |
[in] | precomma | Should the output string start with ", " or not? |
String irutils::addDayToString | ( | const uint8_t | day_of_week, |
const int8_t | offset, | ||
const bool | precomma | ||
) |
Create a String of the 3-letter day of the week from a numerical day of the week. e.g. "Day: 1 (Mon)".
[in] | day_of_week | A numerical version of the sequential day of the week. e.g. Saturday = 7 etc. |
[in] | offset | Days to offset by. e.g. For different day starting the week. |
[in] | precomma | Should the output string start with ", " or not? |
String irutils::addFanToString | ( | const uint8_t | speed, |
const uint8_t | high, | ||
const uint8_t | low, | ||
const uint8_t | automatic, | ||
const uint8_t | quiet, | ||
const uint8_t | medium, | ||
const uint8_t | maximum, | ||
const uint8_t | medium_high | ||
) |
Create a String of human output for the given fan speed. e.g. "Fan: 0 (Auto)".
[in] | speed | The numeric speed of the fan to display. |
[in] | high | The numeric value for High speed. (second highest) |
[in] | low | The numeric value for Low speed. |
[in] | automatic | The numeric value for Auto speed. |
[in] | quiet | The numeric value for Quiet speed. |
[in] | medium | The numeric value for Medium speed. |
[in] | maximum | The numeric value for Highest speed. (if > high) |
[in] | medium_high | The numeric value for third-highest speed. (if > medium) |
Create a String with a colon separated labeled Integer suitable for Humans. e.g. "Foo: 23".
[in] | value | The value to come after the label. |
[in] | label | The label to precede the value. |
[in] | precomma | Should the output string start with ", " or not? |
Create a String with a colon separated "label: value" pair suitable for Humans.
[in] | value | The value to come after the label. |
[in] | label | The label to precede the value. |
[in] | precomma | Should the output string start with ", " or not? |
String irutils::addModelToString | ( | const decode_type_t | protocol, |
const int16_t | model, | ||
const bool | precomma | ||
) |
Create a String of human output for a given protocol model number. e.g. "Model: JKE".
[in] | protocol | The IR protocol. |
[in] | model | The model number for that protocol. |
[in] | precomma | Should the output string start with ", " or not? |
String irutils::addModeToString | ( | const uint8_t | mode, |
const uint8_t | automatic, | ||
const uint8_t | cool, | ||
const uint8_t | heat, | ||
const uint8_t | dry, | ||
const uint8_t | fan | ||
) |
Create a String of human output for the given operating mode. e.g. "Mode: 1 (Cool)".
[in] | mode | The operating mode to display. |
[in] | automatic | The numeric value for Auto mode. |
[in] | cool | The numeric value for Cool mode. |
[in] | heat | The numeric value for Heat mode. |
[in] | dry | The numeric value for Dry mode. |
[in] | fan | The numeric value for Fan mode. |
String irutils::addSignedIntToString | ( | const int16_t | value, |
const String | label, | ||
const bool | precomma | ||
) |
Create a String with a colon separated labeled Integer suitable for Humans. e.g. "Foo: 23".
[in] | value | The value to come after the label. |
[in] | label | The label to precede the value. |
[in] | precomma | Should the output string start with ", " or not? |
String irutils::addSwingHToString | ( | const uint8_t | position, |
const uint8_t | automatic, | ||
const uint8_t | maxleft, | ||
const uint8_t | left, | ||
const uint8_t | middle, | ||
const uint8_t | right, | ||
const uint8_t | maxright, | ||
const uint8_t | off, | ||
const uint8_t | leftright, | ||
const uint8_t | rightleft, | ||
const uint8_t | threed, | ||
const uint8_t | wide | ||
) |
Create a String of human output for the given horizontal swing setting. e.g. "Swing(H): 0 (Auto)".
[in] | position | The numeric position of the swing to display. |
[in] | automatic | The numeric value for Auto position. |
[in] | maxleft | The numeric value for most left position. |
[in] | left | The numeric value for Left position. |
[in] | middle | The numeric value for Middle position. |
[in] | right | The numeric value for Right position. |
[in] | maxright | The numeric value for most right position. |
[in] | off | The numeric value for Off position. |
[in] | leftright | The numeric value for "left right" position. |
[in] | rightleft | The numeric value for "right left" position. |
[in] | threed | The numeric value for 3D setting. |
[in] | wide | The numeric value for Wide position. |
String irutils::addSwingVToString | ( | const uint8_t | position, |
const uint8_t | automatic, | ||
const uint8_t | highest, | ||
const uint8_t | high, | ||
const uint8_t | uppermiddle, | ||
const uint8_t | middle, | ||
const uint8_t | lowermiddle, | ||
const uint8_t | low, | ||
const uint8_t | lowest, | ||
const uint8_t | off, | ||
const uint8_t | swing, | ||
const uint8_t | breeze, | ||
const uint8_t | circulate | ||
) |
Create a String of human output for the given vertical swing setting. e.g. "Swing(V): 0 (Auto)".
[in] | position | The numeric position of the swing to display. |
[in] | automatic | The numeric value for Auto position. |
[in] | highest | The numeric value for Highest position. |
[in] | high | The numeric value for High position. |
[in] | uppermiddle | The numeric value for Upper Middle position. |
[in] | middle | The numeric value for Middle position. |
[in] | lowermiddle | The numeric value for Lower Middle position. |
[in] | low | The numeric value for Low position. |
[in] | lowest | The numeric value for Low position. |
[in] | off | The numeric value for Off position. |
[in] | swing | The numeric value for Swing setting. |
[in] | breeze | The numeric value for Breeze setting. |
[in] | circulate | The numeric value for Circulate setting. |
String irutils::addTempFloatToString | ( | const float | degrees, |
const bool | celsius, | ||
const bool | precomma, | ||
const bool | isSensorTemp | ||
) |
Create a String of human output for a given temperature. e.g. "Temp: 25.5C".
[in] | degrees | The temperature in degrees. |
[in] | celsius | Is the temp Celsius or Fahrenheit. true is C, false is F |
[in] | precomma | Should the output string start with ", " or not? |
[in] | isSensorTemp | Is the value a room (ambient) temp. or target? |
String irutils::addTempToString | ( | const uint16_t | degrees, |
const bool | celsius, | ||
const bool | precomma, | ||
const bool | isSensorTemp | ||
) |
Create a String of human output for a given temperature. e.g. "Temp: 25C".
[in] | degrees | The temperature in degrees. |
[in] | celsius | Is the temp Celsius or Fahrenheit. true is C, false is F |
[in] | precomma | Should the output string start with ", " or not? |
[in] | isSensorTemp | Is the value a room (ambient) temp. or target? |
String irutils::addTimerModeToString | ( | const uint8_t | timerMode, |
const uint8_t | noTimer, | ||
const uint8_t | delayTimer, | ||
const uint8_t | schedule1, | ||
const uint8_t | schedule2, | ||
const uint8_t | schedule3, | ||
const bool | precomma | ||
) |
Create a String of human output for the given timer setting. e.g. "Timer Mode: 2 (Schedule 1)".
[in] | timerMode | The numeric value of the timer mode to display. |
[in] | noTimer | The numeric value for no timer (off) |
[in] | delayTimer | The numeric value for delay (sleep) timer |
[in] | schedule1 | The numeric value for schedule timer #1 |
[in] | schedule2 | The numeric value for schedule timer #2 |
[in] | schedule3 | The numeric value for schedule timer #3 |
[in] | precomma | Should the output string start with ", " or not? |
Create a String with a colon separated toggle flag suitable for Humans. e.g. "Light: Toggle", "Light: -".
[in] | toggle | The value of the toggle to come after the label. |
[in] | label | The label to precede the value. |
[in] | precomma | Should the output string start with ", " or not? |
uint8_t irutils::bcdToUint8 | ( | const uint8_t | bcd | ) |
Convert a byte of Binary Coded Decimal(BCD) into an Integer.
[in] | bcd | The BCD value. |
String irutils::channelToString | ( | const uint8_t | channel | ) |
Create a String of human output for the given channel e.g. "[CH#0]".
channel | The numeric value of the channel to display. |
bool irutils::checkInvertedBytePairs | ( | const uint8_t *const | ptr, |
const uint16_t | length | ||
) |
Check an array to see if every second byte of a pair is a bit inverted/flipped copy of the first/previous byte of the pair.
[in] | ptr | A pointer to the start of array to check. |
[in] | length | The byte size of the array. |
<= 1
will always return true. String irutils::daysBitmaskToString | ( | uint8_t | daysBitmap, |
uint8_t | offset | ||
) |
Create a String of the 3-letter day of the week bitmap.
[in] | daysBitmap | The bitmap representing days of week to represent e.g bit[0]=Sunday, bit[1]=Monday, ... |
[in] | offset | Days to offset by. e.g. For different day starting the week. |
String irutils::dayToString | ( | const uint8_t | day_of_week, |
const int8_t | offset | ||
) |
Create a String of the 3-letter day of the week from a numerical day of the week. e.g. "Mon".
[in] | day_of_week | A numerical version of the sequential day of the week. e.g. Sunday = 1, Monday = 2, ..., Saturday = 7 |
[in] | offset | Days to offset by. e.g. For different day starting the week. |
bool irutils::getBit | ( | const uint64_t | data, |
const uint8_t | position, | ||
const uint8_t | size | ||
) |
Return the value of position
th bit of an Integer.
[in] | data | Value to be examined. |
[in] | position | Nr. of the Nth bit to be examined. 0 is the LSB. |
[in] | size | Nr. of bits in data. |
bool irutils::getBit | ( | const uint8_t | data, |
const uint8_t | position | ||
) |
Return the value of position
th bit of an Integer.
[in] | data | Value to be examined. |
[in] | position | Nr. of the Nth bit to be examined. 0 is the LSB. |
Escape any special HTML (unsafe) characters in a string. e.g. anti-XSS.
[in] | unescaped | A String containing text to make HTML safe. |
uint8_t * irutils::invertBytePairs | ( | uint8_t * | ptr, |
const uint16_t | length | ||
) |
Create byte pairs where the second byte of the pair is a bit inverted/flipped copy of the first/previous byte of the pair.
[in,out] | ptr | A pointer to the start of array to modify. |
[in] | length | The byte size of the array. |
<= 1
will do nothing. String irutils::irCommandTypeToString | ( | uint8_t | irCommandType, |
uint8_t | acControlCmd, | ||
uint8_t | iFeelReportCmd, | ||
uint8_t | timerCmd, | ||
uint8_t | configCmd | ||
) |
Create a String of human output for the given command type e.g. "IFeel Report".
irCommandType | The numeric value of the command type to display. |
acControlCmd | The numeric value of the "control" (default) command |
iFeelReportCmd | The numeric value of the sensor temperature command |
timerCmd | The numeric value of the timer config IR command |
configCmd | The numeric value of the config param set IR command |
uint8_t irutils::lowLevelSanityCheck | ( | void | ) |
Perform a low level bit manipulation sanity check for the given cpu architecture and the compiler operation. Calls to this should return 0 if everything is as expected, anything else means the library won't work as expected.
String irutils::minsToString | ( | const uint16_t | mins | ) |
Convert a nr. of minutes into a 24h clock format Human-readable string. e.g. "23:59".
[in] | mins | Nr. of Minutes. |
String irutils::modelToStr | ( | const decode_type_t | protocol, |
const int16_t | model | ||
) |
Generate the model string for a given Protocol/Model pair.
[in] | protocol | The IR protocol. |
[in] | model | The model number for that protocol. |
String irutils::msToString | ( | uint32_t const | msecs | ) |
Convert a nr. of milliSeconds into a Human-readable string. e.g. "1 Day 6 Hours 34 Minutes 17 Seconds".
[in] | msecs | Nr. of milliSeconds (ms). |
uint64_t irutils::setBit | ( | const uint64_t | data, |
const uint8_t | position, | ||
const bool | on, | ||
const uint8_t | size | ||
) |
Return the value of an Integer with the position
th bit changed.
[in] | data | Value to be changed. |
[in] | position | Nr. of the bit to be changed. 0 is the LSB. |
[in] | on | Value to set the position'th bit to. |
[in] | size | Nr. of bits in data. |
uint8_t irutils::setBit | ( | const uint8_t | data, |
const uint8_t | position, | ||
const bool | on | ||
) |
Return the value of an Integer with the position
th bit changed.
[in] | data | Value to be changed. |
[in] | position | Nr. of the bit to be changed. 0 is the LSB. |
[in] | on | Value to set the position'th bit to. |
void irutils::setBit | ( | uint32_t *const | data, |
const uint8_t | position, | ||
const bool | on | ||
) |
Alter the value of an Integer with the position
th bit changed.
[in,out] | data | A pointer to the 32-bit integer to be changed. |
[in] | position | Nr. of the bit to be changed. 0 is the LSB. |
[in] | on | Value to set the position'th bit to. |
void irutils::setBit | ( | uint64_t *const | data, |
const uint8_t | position, | ||
const bool | on | ||
) |
Alter the value of an Integer with the position
th bit changed.
[in,out] | data | A pointer to the 64-bit integer to be changed. |
[in] | position | Nr. of the bit to be changed. 0 is the LSB. |
[in] | on | Value to set the position'th bit to. |
void irutils::setBit | ( | uint8_t *const | data, |
const uint8_t | position, | ||
const bool | on | ||
) |
Alter the value of an Integer with the position
th bit changed.
[in,out] | data | A pointer to the 8-bit integer to be changed. |
[in] | position | Nr. of the bit to be changed. 0 is the LSB. |
[in] | on | Value to set the position'th bit to. |
void irutils::setBits | ( | uint32_t *const | dst, |
const uint8_t | offset, | ||
const uint8_t | nbits, | ||
const uint32_t | data | ||
) |
Alter an uint32_t value by overwriting an arbitrary given number of bits.
[in,out] | dst | A pointer to the value to be changed. |
[in] | offset | Nr. of bits from the Least Significant Bit to be ignored |
[in] | nbits | Nr of bits of data to be placed into the destination. |
[in] | data | The value to be placed. |
void irutils::setBits | ( | uint64_t *const | dst, |
const uint8_t | offset, | ||
const uint8_t | nbits, | ||
const uint64_t | data | ||
) |
Alter an uint64_t value by overwriting an arbitrary given number of bits.
[in,out] | dst | A pointer to the value to be changed. |
[in] | offset | Nr. of bits from the Least Significant Bit to be ignored |
[in] | nbits | Nr of bits of data to be placed into the destination. |
[in] | data | The value to be placed. |
void irutils::setBits | ( | uint8_t *const | dst, |
const uint8_t | offset, | ||
const uint8_t | nbits, | ||
const uint8_t | data | ||
) |
Alter an uint8_t value by overwriting an arbitrary given number of bits.
[in,out] | dst | A pointer to the value to be changed. |
[in] | offset | Nr. of bits from the Least Significant Bit to be ignored |
[in] | nbits | Nr of bits of data to be placed into the destination. |
[in] | data | The value to be placed. |
uint16_t irutils::sumBytes | ( | const uint64_t | data, |
const uint8_t | count, | ||
const uint8_t | init, | ||
const bool | byteonly | ||
) |
Sum all the bytes together in an integer.
[in] | data | The integer to be summed. |
[in] | count | The number of bytes to sum. Starts from LSB. Max of 8. |
[in] | init | Starting value of the calculation to use. (Default is 0) |
[in] | byteonly | true, the result is 8 bits. false, it's 16 bits. |
uint8_t irutils::sumNibbles | ( | const uint64_t | data, |
const uint8_t | count, | ||
const uint8_t | init, | ||
const bool | nibbleonly | ||
) |
Sum all the nibbles together in an integer.
[in] | data | The integer to be summed. |
[in] | count | The number of nibbles to sum. Starts from LSB. Max of 16. |
[in] | init | Starting value of the calculation to use. (Default is 0) |
[in] | nibbleonly | true, the result is 4 bits. false, it's 8 bits. |
uint8_t irutils::sumNibbles | ( | const uint8_t *const | start, |
const uint16_t | length, | ||
const uint8_t | init | ||
) |
Sum all the nibbles together in a series of bytes.
[in] | start | A ptr to the start of the byte array to calculate over. |
[in] | length | How many bytes to use in the calculation. |
[in] | init | Starting value of the calculation to use. (Default is 0) |
uint8_t irutils::uint8ToBcd | ( | const uint8_t | integer | ) |
Convert an Integer into a byte of Binary Coded Decimal(BCD).
[in] | integer | The number to convert. |