|
LightHub 4.6.0
Open-source smart home controller firmware
|
#include "Arduino.h"#include "aJSON.h"Go to the source code of this file.
Classes | |
| union | itemCmdStore |
| Packed 32-bit command word of itemCmd. More... | |
| union | itemArgStore |
| 32-bit parameter storage of itemCmd. More... | |
| class | itemCmd |
| Command + value container passed between items, drivers and MQTT. More... | |
Macros | |
| #define | commandsNum sizeof(commands_P)/sizeof(cmdstr) |
| #define | ch_typeNum sizeof(ch_type_P)/sizeof(ch_type) |
| #define | CMD_ON 1 |
| Definition of Commands. | |
| #define | CMD_OFF 2 |
| #define | CMD_RESTORE 3 |
| #define | CMD_TOGGLE 4 |
| #define | CMD_HALT 5 |
| #define | CMD_XON 6 |
| #define | CMD_XOFF 7 |
| #define | CMD_UP 8 |
| #define | CMD_DN 9 |
| #define | CMD_ENABLE 0xa |
| #define | CMD_DISABLE 0xb |
| #define | CMD_UNFREEZE 0xc |
| #define | CMD_FREEZE 0xd |
| #define | CMD_AUTO 0xe |
| #define | CMD_FAN 0xf |
| #define | CMD_HIGH 0x10 |
| #define | CMD_MED 0x11 |
| #define | CMD_LOW 0x12 |
| #define | CMD_HEATCOOL 0x13 |
| #define | CMD_HEAT 0x14 |
| #define | CMD_COOL 0x15 |
| #define | CMD_DRY 0x16 |
| #define | CMD_RGB 0x17 |
| #define | CMD_HSV 0x18 |
| #define | CMD_RESET 0x19 |
| #define | CMD_MASK 0xffUL |
| Low byte of the packed I_CMD int - command code. | |
| #define | FLAG_MASK 0x00ffff00UL |
| High two bytes of the packed I_CMD int - state flags (FLAG_*). | |
| #define | CMD_VOID 0 |
| #define | CMD_UNKNOWN -1 |
| #define | CMD_JSON -2 |
| #define | FLAG_DISABLED 0x100UL |
| #define | FLAG_LOCKED_CMD 0x200UL |
| #define | FLAG_LOCKED_SET 0x400UL |
| #define | FLAG_FREEZED 0x600UL |
| #define | FLAG_SEND_DEFFERED 0x800UL |
| #define | FLAG_COMMAND 0x1000UL |
| #define | FLAG_PARAMETERS 0x2000UL |
| #define | FLAG_FLAGS 0x4000UL |
| #define | FLAG_SEND_RETRY 0x8000UL |
| #define | FLAG_ACTION_NEEDED 0x10000UL |
| #define | FLAG_ACTION_IN_PROCESS 0x20000UL |
| #define | FLAG_HALTED 0x40000UL |
| #define | FLAG_XON 0x80000UL |
| #define | FLAG_SEND_DELAYED 0x100000UL |
| #define | FLAG_SEND_IMMEDIATE 0x1UL |
| #define | FLAG_NOT_SEND_CAN 0x2UL |
| #define | ST_VOID 0 |
| Definition of all possible types of argument, contained in class. | |
| #define | ST_PERCENTS255 1 |
| #define | ST_HSV255 2 |
| #define | ST_HS 3 |
| #define | ST_RGB 4 |
| #define | ST_RGBW 5 |
| #define | ST_TENS 6 |
| #define | ST_FLOAT 7 |
| #define | ST_FLOAT_CELSIUS 8 |
| #define | ST_FLOAT_FARENHEIT 9 |
| #define | ST_INT32 10 |
| #define | ST_UINT32 11 |
| #define | ST_STRING 12 |
| #define | MAP_SCALE 1 |
| Mapping options for doMapping()/doReverseMapping(). | |
| #define | MAP_VAL_CMD 2 |
Typedefs | |
| typedef char | cmdstr[10] |
| typedef char | ch_type[9] |
Functions | |
| int | txt2cmd (char *payload) |
| int | replaceTypeToInt (aJsonObject *verb) |
Variables | |
| const cmdstr commands_P[] | PROGMEM |
| #define ch_typeNum sizeof(ch_type_P)/sizeof(ch_type) |
| #define CMD_AUTO 0xe |
| #define CMD_COOL 0x15 |
| #define CMD_DISABLE 0xb |
| #define CMD_DN 9 |
| #define CMD_DRY 0x16 |
| #define CMD_ENABLE 0xa |
| #define CMD_FAN 0xf |
| #define CMD_FREEZE 0xd |
| #define CMD_HALT 5 |
| #define CMD_HEAT 0x14 |
| #define CMD_HEATCOOL 0x13 |
| #define CMD_HIGH 0x10 |
| #define CMD_HSV 0x18 |
| #define CMD_JSON -2 |
| #define CMD_LOW 0x12 |
| #define CMD_MASK 0xffUL |
Low byte of the packed I_CMD int - command code.
| #define CMD_MED 0x11 |
| #define CMD_OFF 2 |
| #define CMD_ON 1 |
Definition of Commands.
Command codes (indexes of commands_P). Codes 1..9 are decimal, 0xA..0x19 are hex. Commands up to CMD_FAN (0xF) are "channel commands" that affect the whole channel state; the rest are device-specific (AC modes, color, reset). CMD_VOID/CMD_UNKNOWN/CMD_JSON are special non-wired codes used internally.
| #define CMD_RESET 0x19 |
| #define CMD_RESTORE 3 |
| #define CMD_RGB 0x17 |
| #define CMD_TOGGLE 4 |
| #define CMD_UNFREEZE 0xc |
| #define CMD_UNKNOWN -1 |
| #define CMD_UP 8 |
| #define CMD_VOID 0 |
| #define CMD_XOFF 7 |
| #define CMD_XON 6 |
| #define commandsNum sizeof(commands_P)/sizeof(cmdstr) |
| #define FLAG_ACTION_IN_PROCESS 0x20000UL |
| #define FLAG_ACTION_NEEDED 0x10000UL |
| #define FLAG_COMMAND 0x1000UL |
| #define FLAG_DISABLED 0x100UL |
State flags packed with the command in the I_CMD item element (FLAG_MASK bits):
SendStatus options:
| #define FLAG_FLAGS 0x4000UL |
| #define FLAG_FREEZED 0x600UL |
| #define FLAG_HALTED 0x40000UL |
| #define FLAG_LOCKED_CMD 0x200UL |
| #define FLAG_LOCKED_SET 0x400UL |
| #define FLAG_MASK 0x00ffff00UL |
High two bytes of the packed I_CMD int - state flags (FLAG_*).
| #define FLAG_NOT_SEND_CAN 0x2UL |
| #define FLAG_PARAMETERS 0x2000UL |
| #define FLAG_SEND_DEFFERED 0x800UL |
| #define FLAG_SEND_DELAYED 0x100000UL |
| #define FLAG_SEND_IMMEDIATE 0x1UL |
| #define FLAG_SEND_RETRY 0x8000UL |
| #define FLAG_XON 0x80000UL |
| #define MAP_SCALE 1 |
Mapping options for doMapping()/doReverseMapping().
| #define MAP_VAL_CMD 2 |
| #define ST_FLOAT 7 |
| #define ST_FLOAT_CELSIUS 8 |
| #define ST_FLOAT_FARENHEIT 9 |
| #define ST_HS 3 |
| #define ST_HSV255 2 |
| #define ST_INT32 10 |
| #define ST_PERCENTS255 1 |
| #define ST_RGB 4 |
| #define ST_RGBW 5 |
| #define ST_STRING 12 |
| #define ST_TENS 6 |
| #define ST_UINT32 11 |
| #define ST_VOID 0 |
Definition of all possible types of argument, contained in class.
Storage type codes (ST_*) - how the 4-byte itemCmd parameter word is interpreted (value representation of a channel).
| typedef char ch_type[9] |
Short textual names of channel types (CH_*); array indexes match CH_DIMMER(0)..CH_SPRINKLER(23). Used to resolve "type":"DMX" etc. in config.
| typedef char cmdstr[10] |
Textual names of item commands; array indexes match the CMD_* codes (CMD_ON=1 ... CMD_RESET=0x19).
| int replaceTypeToInt | ( | aJsonObject * | verb | ) |
| int txt2cmd | ( | char * | payload | ) |
Translate a text payload to a command code.
| payload | - text command word, number or color ("ON", "-5", "#FF0000") |
Translate a text payload to a command code.
| payload | - text command word ("ON", "HALT", ...), number or color |
| const ch_type ch_type_P [] PROGMEM |