MySensors Library & Examples  2.3.2-62-ge298769
MyMessage.h
Go to the documentation of this file.
1 /*
2  * The MySensors Arduino library handles the wireless radio link and protocol
3  * between your home built sensors/actuators and HA controller of choice.
4  * The sensors forms a self healing radio network with optional repeaters. Each
5  * repeater and gateway builds a routing tables in EEPROM which keeps track of the
6  * network topology allowing messages to be routed to nodes.
7  *
8  * Created by Henrik Ekblad <[email protected]>
9  * Copyright (C) 2013-2022 Sensnology AB
10  * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
11  *
12  * Documentation: http://www.mysensors.org
13  * Support Forum: http://forum.mysensors.org
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * version 2 as published by the Free Software Foundation.
18  */
19 
31 #ifndef MyMessage_h
32 #define MyMessage_h
33 
34 #ifdef __cplusplus
35 #include <Arduino.h>
36 #include <stdint.h>
37 #endif
38 
39 #define V2_MYS_HEADER_PROTOCOL_VERSION (2u)
40 #define V2_MYS_HEADER_SIZE (7u)
41 #define V2_MYS_HEADER_MAX_MESSAGE_SIZE (32u)
42 
43 #define V2_MYS_HEADER_VSL_VERSION_POS (0)
44 #define V2_MYS_HEADER_VSL_VERSION_SIZE (2u)
45 #define V2_MYS_HEADER_VSL_SIGNED_POS (2u)
46 #define V2_MYS_HEADER_VSL_SIGNED_SIZE (1u)
47 #define V2_MYS_HEADER_VSL_LENGTH_POS (3u)
48 #define V2_MYS_HEADER_VSL_LENGTH_SIZE (5u)
49 
50 #define V2_MYS_HEADER_CEP_COMMAND_POS (0)
51 #define V2_MYS_HEADER_CEP_COMMAND_SIZE (3u)
52 #define V2_MYS_HEADER_CEP_ECHOREQUEST_POS (3u)
53 #define V2_MYS_HEADER_CEP_ECHOREQUEST_SIZE (1u)
54 #define V2_MYS_HEADER_CEP_ECHO_POS (4u)
55 #define V2_MYS_HEADER_CEP_ECHO_SIZE (1u)
56 #define V2_MYS_HEADER_CEP_PAYLOADTYPE_POS (5u)
57 #define V2_MYS_HEADER_CEP_PAYLOADTYPE_SIZE (3u)
58 
59 #define MAX_MESSAGE_SIZE V2_MYS_HEADER_MAX_MESSAGE_SIZE
60 #define HEADER_SIZE V2_MYS_HEADER_SIZE
61 #define MAX_PAYLOAD_SIZE (MAX_MESSAGE_SIZE - HEADER_SIZE)
62 
63 // deprecated in 3.0.0
64 #define MAX_PAYLOAD MAX_PAYLOAD_SIZE
65 
66 typedef enum {
69  C_SET = 1,
70  C_REQ = 2,
71  C_INTERNAL = 3,
72  C_STREAM = 4,
77 
78 #if !DOXYGEN // Hide until we migrate
79 typedef enum {
81  S_DOOR = 0,
82  S_MOTION = 1,
83  S_SMOKE = 2,
84  S_BINARY = 3,
85  S_LIGHT = 3,
86  S_DIMMER = 4,
87  S_COVER = 5,
88  S_TEMP = 6,
89  S_HUM = 7,
90  S_BARO = 8,
91  S_WIND = 9,
92  S_RAIN = 10,
93  S_UV = 11,
94  S_WEIGHT = 12,
95  S_POWER = 13,
96  S_HEATER = 14,
97  S_DISTANCE = 15,
98  S_LIGHT_LEVEL = 16,
99  S_ARDUINO_NODE = 17,
100  S_ARDUINO_REPEATER_NODE = 18,
101  S_LOCK = 19,
102  S_IR = 20,
103  S_WATER = 21,
104  S_AIR_QUALITY = 22,
105  S_CUSTOM = 23,
106  S_DUST = 24,
107  S_SCENE_CONTROLLER = 25,
108  S_RGB_LIGHT = 26,
109  S_RGBW_LIGHT = 27,
110  S_COLOR_SENSOR = 28,
111  S_HVAC = 29,
112  S_MULTIMETER = 30,
113  S_SPRINKLER = 31,
114  S_WATER_LEAK = 32,
115  S_SOUND = 33,
116  S_VIBRATION = 34,
117  S_MOISTURE = 35,
118  S_INFO = 36,
119  S_GAS = 37,
120  S_GPS = 38,
121  S_WATER_QUALITY = 39
122 } mysensors_sensor_t;
123 
125 typedef enum {
126  V_TEMP = 0,
127  V_HUM = 1,
128  V_STATUS = 2,
129  V_LIGHT = 2,
130  V_PERCENTAGE = 3,
131  V_DIMMER = 3,
132  V_PRESSURE = 4,
133  V_FORECAST = 5,
134  V_RAIN = 6,
135  V_RAINRATE = 7,
136  V_WIND = 8,
137  V_GUST = 9,
138  V_DIRECTION = 10,
139  V_UV = 11,
140  V_WEIGHT = 12,
141  V_DISTANCE = 13,
142  V_IMPEDANCE = 14,
143  V_ARMED = 15,
144  V_TRIPPED = 16,
145  V_WATT = 17,
146  V_KWH = 18,
147  V_SCENE_ON = 19,
148  V_SCENE_OFF = 20,
149  V_HVAC_FLOW_STATE = 21,
150  V_HEATER = 21,
151  V_HVAC_SPEED = 22,
152  V_LIGHT_LEVEL = 23,
153  V_VAR1 = 24,
154  V_VAR2 = 25,
155  V_VAR3 = 26,
156  V_VAR4 = 27,
157  V_VAR5 = 28,
158  V_UP = 29,
159  V_DOWN = 30,
160  V_STOP = 31,
161  V_IR_SEND = 32,
162  V_IR_RECEIVE = 33,
163  V_FLOW = 34,
164  V_VOLUME = 35,
165  V_LOCK_STATUS = 36,
166  V_LEVEL = 37,
167  V_VOLTAGE = 38,
168  V_CURRENT = 39,
169  V_RGB = 40,
170  V_RGBW = 41,
171  V_ID = 42,
172  V_UNIT_PREFIX = 43,
173  V_HVAC_SETPOINT_COOL = 44,
174  V_HVAC_SETPOINT_HEAT = 45,
175  V_HVAC_FLOW_MODE = 46,
176  V_TEXT = 47,
177  V_CUSTOM = 48,
178  V_POSITION = 49,
179  V_IR_RECORD = 50,
180  V_PH = 51,
181  V_ORP = 52,
182  V_EC = 53,
183  V_VAR = 54,
184  V_VA = 55,
185  V_POWER_FACTOR = 56,
186  V_MULTI_MESSAGE = 57,
187 } mysensors_data_t;
188 #endif
189 
191 typedef enum {
193  I_TIME = 1,
194  I_VERSION = 2,
198  I_CONFIG = 6,
202  I_CHILDREN = 10,
205  I_REBOOT = 13,
215  I_LOCKED = 23,
216  I_PING = 24,
217  I_PONG = 25,
220  I_DEBUG = 28,
227 
229 typedef enum {
234  ST_SOUND = 4,
235  ST_IMAGE = 5,
239 
241 typedef enum {
242  P_STRING = 0,
243  P_BYTE = 1,
244  P_INT16 = 2,
245  P_UINT16 = 3,
246  P_LONG32 = 4,
247  P_ULONG32 = 5,
248  P_CUSTOM = 6,
251 
252 
253 #ifndef BIT
254 #define BIT(n) ( 1<<(n) )
255 #endif
256 #define BIT_MASK(len) ( BIT(len)-1 )
257 #define BF_MASK(start, len) ( BIT_MASK(len)<<(start) )
258 
259 #define BF_PREP(x, start, len) ( ((x)&BIT_MASK(len)) << (start) )
260 #define BF_GET(y, start, len) ( ((y)>>(start)) & BIT_MASK(len) )
261 #define BF_SET(y, x, start, len) ( y= ((y) &~ BF_MASK(start, len)) | BF_PREP(x, start, len) )
262 
263 // Getters/setters for special bit fields in header
264 // deprecated in 3.0.0
265 #define mSetVersion(_message, _version) _message.setVersion(_version)
266 #define mGetVersion(_message) _message.getVersion()
267 
268 #define mSetSigned(_message, _signed) _message.setSigned(_signed)
269 #define mGetSigned(_message) _message.getSigned()
270 
271 #define mSetLength(_message,_length) _message.setLength(_length)
272 #define mGetLength(_message) _message.getLength()
273 
274 #define mSetCommand(_message, _command) _message.setCommand(_command)
275 #define mGetCommand(_message) _message.getCommand()
276 
277 #define mSetRequestEcho(_message, _requestEcho) _message.setRequestEcho(_requestEcho)
278 #define mGetRequestEcho(_message) _message.getRequestEcho()
279 
280 #define mSetEcho(_message, _echo) _message.setEcho(_echo)
281 #define mGetEcho(_message) _message.getEcho()
282 
283 #define mSetPayloadType(_message, _payloadType) _message.setPayloadType(_payloadType)
284 #define mGetPayloadType(_message) _message.getPayloadType()
285 
286 #if defined(__cplusplus) || defined(DOXYGEN)
287 
291 {
292 private:
293  char* getCustomString(char *buffer) const;
294 
295 public:
296 
300  MyMessage(void);
301 
307  MyMessage(const uint8_t sensorId, const mysensors_data_t dataType);
308 
312  void clear(void);
313 
320  char* getStream(char *buffer) const;
321 
325  char* getString(char *buffer) const;
326 
331  const char* getString(void) const;
332 
337  void* getCustom(void) const;
338 
343  bool getBool(void) const;
344 
349  uint8_t getByte(void) const;
350 
355  float getFloat(void) const;
356 
361  int16_t getInt(void) const;
362 
367  uint16_t getUInt(void) const;
368 
373  int32_t getLong(void) const;
374 
379  uint32_t getULong(void) const;
380 
385  uint8_t getHeaderSize(void) const;
386 
391  uint8_t getMaxPayloadSize(void) const;
392 
397  uint8_t getExpectedMessageSize(void) const;
398 
403  bool isProtocolVersionValid(void) const;
404 
409  bool getRequestEcho(void) const;
410 
415  MyMessage& setRequestEcho(const bool requestEcho);
416 
421  uint8_t getVersion(void) const;
422 
426  MyMessage& setVersion(void);
427 
432  uint8_t getLength(void) const;
433 
438  MyMessage& setLength(const uint8_t length);
439 
444  mysensors_command_t getCommand(void) const;
445 
450  MyMessage& setCommand(const mysensors_command_t command);
451 
457 
462  MyMessage& setPayloadType(const mysensors_payload_t payloadType);
463 
468  bool getSigned(void) const;
469 
474  MyMessage& setSigned(const bool signedFlag);
475 
481  bool isAck(void) const;
482 
487  bool isEcho(void) const;
488 
493  MyMessage& setEcho(const bool echo);
494 
499  uint8_t getType(void) const;
500 
505  MyMessage& setType(const uint8_t messageType);
506 
511  uint8_t getLast(void) const;
512 
517  MyMessage& setLast(const uint8_t lastId);
518 
523  uint8_t getSender(void) const;
524 
529  MyMessage& setSender(const uint8_t senderId);
530 
535  uint8_t getSensor(void) const;
536 
541  MyMessage& setSensor(const uint8_t sensorId);
542 
547  uint8_t getDestination(void) const;
548 
553  MyMessage& setDestination(const uint8_t destinationId);
554 
560  MyMessage& set(const void* payload, const size_t length);
561 
566  MyMessage& set(const char* value);
567 #if !defined(__linux__)
568 
572  MyMessage& set(const __FlashStringHelper* value);
573 #endif
574 
580  MyMessage& set(const float value, const uint8_t decimals);
581 
586  MyMessage& set(const bool value);
587 
592  MyMessage& set(const uint8_t value);
593 
598  MyMessage& set(const uint32_t value);
599 
604  MyMessage& set(const int32_t value);
605 
610  MyMessage& set(const uint16_t value);
611 
616  MyMessage& set(const int16_t value);
617 
618 #else
619 
620 typedef union {
621  struct {
622 
623 #endif
624  uint8_t last;
625  uint8_t sender;
626  uint8_t destination;
627 
633  uint8_t version_length;
634 
642 
643  uint8_t type;
644  uint8_t sensor;
645 
646  /*
647  * Each message can transfer a payload. We add one extra byte for string
648  * terminator \0 to be "printable" this is not transferred OTA
649  * This union is used to simplify the construction of the binary data types transferred.
650  */
651  union {
652  uint8_t bValue;
653  uint16_t uiValue;
654  int16_t iValue;
655  uint32_t ulValue;
656  int32_t lValue;
657  struct {
658  float fValue;
659  uint8_t fPrecision;
660  };
661  char data[MAX_PAYLOAD_SIZE + 1];
662  } __attribute__((packed));
663 #if defined(__cplusplus) || defined(DOXYGEN)
664 } __attribute__((packed));
665 #else
666 };
667 uint8_t array[HEADER_SIZE + MAX_PAYLOAD_SIZE + 1];
668 } __attribute__((packed)) MyMessage;
669 #endif
670 
671 #endif
672 
I_POST_SLEEP_NOTIFICATION
@ I_POST_SLEEP_NOTIFICATION
Message sent after node woke up (if enabled)
Definition: MyMessage.h:225
MyMessage::sender
uint8_t sender
8 bit - Id of sender node (origin)
Definition: MyMessage.h:625
I_INCLUSION_MODE
@ I_INCLUSION_MODE
Inclusion mode.
Definition: MyMessage.h:197
I_LOG_MESSAGE
@ I_LOG_MESSAGE
Log message.
Definition: MyMessage.h:201
ST_IMAGE
@ ST_IMAGE
Image.
Definition: MyMessage.h:235
I_BATTERY_LEVEL
@ I_BATTERY_LEVEL
Battery level.
Definition: MyMessage.h:192
mysensors_stream_t
mysensors_stream_t
Type of data stream (for streamed message)
Definition: MyMessage.h:229
MyMessage::getInt
int16_t getInt(void) const
Get signed 16-bit integer payload.
MyMessage::setSensor
MyMessage & setSensor(const uint8_t sensorId)
Set which child sensor this message belongs to.
I_NONCE_REQUEST
@ I_NONCE_REQUEST
Request for a nonce.
Definition: MyMessage.h:208
ST_FIRMWARE_RESPONSE
@ ST_FIRMWARE_RESPONSE
Response FW block.
Definition: MyMessage.h:233
mysensors_internal_t
mysensors_internal_t
Type of internal messages (for internal messages)
Definition: MyMessage.h:191
MAX_PAYLOAD_SIZE
#define MAX_PAYLOAD_SIZE
The maximum size of a payload depends on MAX_MESSAGE_SIZE and HEADER_SIZE.
Definition: MyMessage.h:61
MyMessage::fPrecision
uint8_t fPrecision
Number of decimals when serializing.
Definition: MyMessage.h:659
ST_FIRMWARE_RESPONSE_RLE
@ ST_FIRMWARE_RESPONSE_RLE
Response FW block with run length encoded data.
Definition: MyMessage.h:237
MyMessage::getString
const char * getString(void) const
Get payload as string.
MyMessage::getSensor
uint8_t getSensor(void) const
Get sensor ID of message.
I_NONCE_RESPONSE
@ I_NONCE_RESPONSE
Payload is nonce data.
Definition: MyMessage.h:209
I_CONFIG
@ I_CONFIG
Config (request/response)
Definition: MyMessage.h:198
C_INTERNAL
@ C_INTERNAL
Internal MySensors messages (also include common messages provided/generated by the library).
Definition: MyMessage.h:71
MyMessage::getExpectedMessageSize
uint8_t getExpectedMessageSize(void) const
getExpectedMessageSize
MyMessage::MyMessage
MyMessage(void)
I_LOCKED
@ I_LOCKED
Node is locked (reason in string-payload)
Definition: MyMessage.h:215
MyMessage::fValue
float fValue
< Float messages
Definition: MyMessage.h:658
I_SIGNAL_REPORT_REVERSE
@ I_SIGNAL_REPORT_REVERSE
Internal.
Definition: MyMessage.h:222
MyMessage::getCustom
void * getCustom(void) const
Get custom payload.
MyMessage::setSender
MyMessage & setSender(const uint8_t senderId)
Set sender ID.
I_DEBUG
@ I_DEBUG
Debug message.
Definition: MyMessage.h:220
P_ULONG32
@ P_ULONG32
Payload type is UINT32.
Definition: MyMessage.h:247
MyMessage::getMaxPayloadSize
uint8_t getMaxPayloadSize(void) const
getMaxPayloadSize
MyMessage::getPayloadType
mysensors_payload_t getPayloadType(void) const
Getter for payload type.
C_REQ
@ C_REQ
Requests a variable value (usually from an actuator destined for controller).
Definition: MyMessage.h:70
I_REBOOT
@ I_REBOOT
Reboot request.
Definition: MyMessage.h:205
I_FIND_PARENT_RESPONSE
@ I_FIND_PARENT_RESPONSE
Find parent response.
Definition: MyMessage.h:200
MyMessage::isProtocolVersionValid
bool isProtocolVersionValid(void) const
isProtocolVersionValid
I_DISCOVER_REQUEST
@ I_DISCOVER_REQUEST
Discover request.
Definition: MyMessage.h:212
ST_SOUND
@ ST_SOUND
Sound.
Definition: MyMessage.h:234
I_ID_RESPONSE
@ I_ID_RESPONSE
ID response.
Definition: MyMessage.h:196
MyMessage::getSigned
bool getSigned(void) const
Getter for sign field.
MyMessage::lValue
int32_t lValue
signed long value (32-bit)
Definition: MyMessage.h:656
MyMessage::setPayloadType
MyMessage & setPayloadType(const mysensors_payload_t payloadType)
Setter for payload type.
MyMessage
MyMessage(void)
MyMessage::getSender
uint8_t getSender(void) const
Get sender ID.
MyMessage::last
uint8_t last
8 bit - Id of last node this message passed
Definition: MyMessage.h:624
P_FLOAT32
@ P_FLOAT32
Payload type is float32.
Definition: MyMessage.h:249
MyMessage::getULong
uint32_t getULong(void) const
Get unsigned 32-bit integer payload.
mysensors_command_t
mysensors_command_t
The command field (message-type) defines the overall properties of a message.
Definition: MyMessage.h:67
I_SIGNAL_REPORT_RESPONSE
@ I_SIGNAL_REPORT_RESPONSE
Device signal strength response (RSSI)
Definition: MyMessage.h:223
MyMessage::setVersion
MyMessage & setVersion(void)
Setter for version.
P_UINT16
@ P_UINT16
Payload type is UINT16.
Definition: MyMessage.h:245
MyMessage::iValue
int16_t iValue
signed integer value (16-bit)
Definition: MyMessage.h:654
I_HEARTBEAT_REQUEST
@ I_HEARTBEAT_REQUEST
Heartbeat request.
Definition: MyMessage.h:210
MyMessage::getCommand
mysensors_command_t getCommand(void) const
Getter for command type.
I_SKETCH_VERSION
@ I_SKETCH_VERSION
Sketch version.
Definition: MyMessage.h:204
ST_FIRMWARE_REQUEST
@ ST_FIRMWARE_REQUEST
Request FW block.
Definition: MyMessage.h:232
MyMessage::setType
MyMessage & setType(const uint8_t messageType)
Set message type.
I_SIGNAL_REPORT_REQUEST
@ I_SIGNAL_REPORT_REQUEST
Device signal strength request.
Definition: MyMessage.h:221
MyMessage::getLong
int32_t getLong(void) const
Get signed 32-bit integer payload.
MyMessage::version_length
uint8_t version_length
Definition: MyMessage.h:633
MyMessage::set
MyMessage & set(const void *payload, const size_t length)
Set entire payload.
__attribute__
struct @4::@5 __attribute__
Doxygen will complain without this comment.
Definition: DigitalPin.h:65
MyMessage::getUInt
uint16_t getUInt(void) const
Get unsigned 16-bit integer payload.
MyMessage::getDestination
uint8_t getDestination(void) const
Get destination.
MyMessage::command_echo_payload
uint8_t command_echo_payload
Definition: MyMessage.h:641
C_INVALID_7
@ C_INVALID_7
C_INVALID_7.
Definition: MyMessage.h:75
P_STRING
@ P_STRING
Payload type is string.
Definition: MyMessage.h:242
MyMessage::getHeaderSize
uint8_t getHeaderSize(void) const
getHeaderSize
I_CHILDREN
@ I_CHILDREN
Children.
Definition: MyMessage.h:202
ST_FIRMWARE_CONFIG_REQUEST
@ ST_FIRMWARE_CONFIG_REQUEST
Request new FW, payload contains current FW details.
Definition: MyMessage.h:230
C_SET
@ C_SET
This message is sent from or to a sensor when a sensor value should be updated.
Definition: MyMessage.h:69
MyMessage::setLength
MyMessage & setLength(const uint8_t length)
Setter for length.
MyMessage::getType
uint8_t getType(void) const
Get message type.
MyMessage::setLast
MyMessage & setLast(const uint8_t lastId)
Set last ID.
ST_FIRMWARE_CONFIRM
@ ST_FIRMWARE_CONFIRM
Mark running firmware as valid (MyOTAFirmwareUpdateNVM + mcuboot)
Definition: MyMessage.h:236
C_RESERVED_5
@ C_RESERVED_5
C_RESERVED_5.
Definition: MyMessage.h:73
I_FIND_PARENT_REQUEST
@ I_FIND_PARENT_REQUEST
Find parent.
Definition: MyMessage.h:199
P_CUSTOM
@ P_CUSTOM
Payload type is binary.
Definition: MyMessage.h:248
MyMessage::setEcho
MyMessage & setEcho(const bool echo)
Setter for echo-flag.
I_TIME
@ I_TIME
Time (request/response)
Definition: MyMessage.h:193
C_RESERVED_6
@ C_RESERVED_6
C_RESERVED_6.
Definition: MyMessage.h:74
MyMessage::isAck
bool isAck(void) const
Getter for echo-flag.
MyMessage::setDestination
MyMessage & setDestination(const uint8_t destinationId)
Set final destination node id for this message.
MyMessage::getByte
uint8_t getByte(void) const
Get unsigned 8-bit integer payload.
I_PING
@ I_PING
Ping sent to node, payload incremental hop counter.
Definition: MyMessage.h:216
I_ID_REQUEST
@ I_ID_REQUEST
ID request.
Definition: MyMessage.h:195
MyMessage::data
char data[MAX_PAYLOAD_SIZE+1]
Buffer for raw payload data.
Definition: MyMessage.h:661
MyMessage::clear
void clear(void)
Clear message contents.
I_HEARTBEAT_RESPONSE
@ I_HEARTBEAT_RESPONSE
Heartbeat response.
Definition: MyMessage.h:214
MyMessage::getLast
uint8_t getLast(void) const
Get last ID.
I_PRE_SLEEP_NOTIFICATION
@ I_PRE_SLEEP_NOTIFICATION
Message sent before node is going to sleep.
Definition: MyMessage.h:224
MyMessage::setSigned
MyMessage & setSigned(const bool signedFlag)
Setter for sign field.
I_GATEWAY_READY
@ I_GATEWAY_READY
Gateway ready.
Definition: MyMessage.h:206
MyMessage::setCommand
MyMessage & setCommand(const mysensors_command_t command)
Setter for command type.
__attribute__
FW config structure, stored in eeprom.
Definition: MyOTAFirmwareUpdate.h:117
MyMessage::getStream
char * getStream(char *buffer) const
ST_FIRMWARE_CONFIG_RESPONSE
@ ST_FIRMWARE_CONFIG_RESPONSE
New FW details to initiate OTA FW update.
Definition: MyMessage.h:231
P_LONG32
@ P_LONG32
Payload type is INT32.
Definition: MyMessage.h:246
MyMessage::setRequestEcho
MyMessage & setRequestEcho(const bool requestEcho)
Setter for echo request.
I_VERSION
@ I_VERSION
Version.
Definition: MyMessage.h:194
MyMessage::sensor
uint8_t sensor
8 bit - Id of sensor that this message concerns.
Definition: MyMessage.h:644
MyMessage::getFloat
float getFloat(void) const
Get float payload.
I_PRESENTATION
@ I_PRESENTATION
Presentation message.
Definition: MyMessage.h:211
P_INT16
@ P_INT16
Payload type is INT16.
Definition: MyMessage.h:244
I_PONG
@ I_PONG
In return to ping, sent back to sender, payload incremental hop counter.
Definition: MyMessage.h:217
MyMessage::getRequestEcho
bool getRequestEcho(void) const
Getter for echo request.
mysensors_payload_t
mysensors_payload_t
Type of payload.
Definition: MyMessage.h:241
MyMessage::uiValue
uint16_t uiValue
unsigned integer value (16-bit)
Definition: MyMessage.h:653
MyMessage::isEcho
bool isEcho(void) const
Getter for echo-flag.
MyMessage::getVersion
uint8_t getVersion(void) const
Getter for version.
I_DISCOVER_RESPONSE
@ I_DISCOVER_RESPONSE
Discover response.
Definition: MyMessage.h:213
MyMessage::type
uint8_t type
8 bit - Type varies depending on command
Definition: MyMessage.h:643
I_REGISTRATION_RESPONSE
@ I_REGISTRATION_RESPONSE
Register response from GW.
Definition: MyMessage.h:219
MyMessage::bValue
uint8_t bValue
unsigned byte value (8-bit)
Definition: MyMessage.h:652
MyMessage::ulValue
uint32_t ulValue
unsigned long value (32-bit)
Definition: MyMessage.h:655
MyMessage::getBool
bool getBool(void) const
Get bool payload.
MyMessage
MyMessage is used to create, manipulate, send and read MySensors messages.
Definition: MyMessage.h:290
HEADER_SIZE
#define HEADER_SIZE
The size of the header.
Definition: MyMessage.h:60
I_SIGNING_PRESENTATION
@ I_SIGNING_PRESENTATION
Provides signing related preferences (first byte is preference version)
Definition: MyMessage.h:207
MyMessage::getLength
uint8_t getLength(void) const
Getter for length.
MyMessage::destination
uint8_t destination
8 bit - Id of destination node
Definition: MyMessage.h:626
C_STREAM
@ C_STREAM
For firmware and other larger chunks of data that need to be divided into pieces.
Definition: MyMessage.h:72
I_REGISTRATION_REQUEST
@ I_REGISTRATION_REQUEST
Register request to GW.
Definition: MyMessage.h:218
I_SKETCH_NAME
@ I_SKETCH_NAME
Sketch name.
Definition: MyMessage.h:203
P_BYTE
@ P_BYTE
Payload type is byte.
Definition: MyMessage.h:243
C_PRESENTATION
@ C_PRESENTATION
Sent by a node when they present attached sensors. This is usually done in presentation() at startup.
Definition: MyMessage.h:68