MySensors Library & Examples  2.3.2-121-g2834d0f8
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-2026 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  S_INPUT = 40,
123  S_SELECT = 41,
124  S_FAN = 42,
125  S_NUMBER = 43,
126  S_RGBWW = 44
127 } mysensors_sensor_t;
128 
130 typedef enum {
131  V_TEMP = 0,
132  V_HUM = 1,
133  V_STATUS = 2,
134  V_LIGHT = 2,
135  V_PERCENTAGE = 3,
136  V_DIMMER = 3,
137  V_PRESSURE = 4,
138  V_FORECAST = 5,
139  V_RAIN = 6,
140  V_RAINRATE = 7,
141  V_WIND = 8,
142  V_GUST = 9,
143  V_DIRECTION = 10,
144  V_UV = 11,
145  V_WEIGHT = 12,
146  V_DISTANCE = 13,
147  V_IMPEDANCE = 14,
148  V_ARMED = 15,
149  V_TRIPPED = 16,
150  V_WATT = 17,
151  V_KWH = 18,
152  V_SCENE_ON = 19,
153  V_SCENE_OFF = 20,
154  V_HVAC_FLOW_STATE = 21,
155  V_HEATER = 21,
156  V_HVAC_SPEED = 22,
157  V_LIGHT_LEVEL = 23,
158  V_VAR1 = 24,
159  V_VAR2 = 25,
160  V_VAR3 = 26,
161  V_VAR4 = 27,
162  V_VAR5 = 28,
163  V_UP = 29,
164  V_DOWN = 30,
165  V_STOP = 31,
166  V_IR_SEND = 32,
167  V_IR_RECEIVE = 33,
168  V_FLOW = 34,
169  V_VOLUME = 35,
170  V_LOCK_STATUS = 36,
171  V_LEVEL = 37,
172  V_VOLTAGE = 38,
173  V_CURRENT = 39,
174  V_RGB = 40,
175  V_RGBW = 41,
176  V_ID = 42,
177  V_UNIT_PREFIX = 43,
178  V_HVAC_SETPOINT_COOL = 44,
179  V_HVAC_SETPOINT_HEAT = 45,
180  V_HVAC_FLOW_MODE = 46,
181  V_TEXT = 47,
182  V_CUSTOM = 48,
183  V_POSITION = 49,
184  V_IR_RECORD = 50,
185  V_PH = 51,
186  V_ORP = 52,
187  V_EC = 53,
188  V_VAR = 54,
189  V_VA = 55,
190  V_POWER_FACTOR = 56,
191  V_MULTI_MESSAGE = 57,
192  V_TILT = 58,
193  V_RGBWW = 59,
194  V_SELECT = 60,
195  V_SELECTED = 61,
196  V_DIR = 62,
197  V_NUMBER = 63,
198  V_NUMBER_MIN = 64,
199  V_NUMBER_MAX = 65
200 } mysensors_data_t;
201 #endif
202 
204 typedef enum {
206  I_TIME = 1,
207  I_VERSION = 2,
211  I_CONFIG = 6,
215  I_CHILDREN = 10,
218  I_REBOOT = 13,
228  I_LOCKED = 23,
229  I_PING = 24,
230  I_PONG = 25,
233  I_DEBUG = 28,
240 
242 typedef enum {
247  ST_SOUND = 4,
248  ST_IMAGE = 5,
252 
254 typedef enum {
255  P_STRING = 0,
256  P_BYTE = 1,
257  P_INT16 = 2,
258  P_UINT16 = 3,
259  P_LONG32 = 4,
260  P_ULONG32 = 5,
261  P_CUSTOM = 6,
264 
265 
266 #ifndef BIT
267 #define BIT(n) ( 1<<(n) )
268 #endif
269 #define BIT_MASK(len) ( BIT(len)-1 )
270 #define BF_MASK(start, len) ( BIT_MASK(len)<<(start) )
271 
272 #define BF_PREP(x, start, len) ( ((x)&BIT_MASK(len)) << (start) )
273 #define BF_GET(y, start, len) ( ((y)>>(start)) & BIT_MASK(len) )
274 #define BF_SET(y, x, start, len) ( y= ((y) &~ BF_MASK(start, len)) | BF_PREP(x, start, len) )
275 
276 // Getters/setters for special bit fields in header
277 // deprecated in 3.0.0
278 #define mSetVersion(_message, _version) _message.setVersion(_version)
279 #define mGetVersion(_message) _message.getVersion()
280 
281 #define mSetSigned(_message, _signed) _message.setSigned(_signed)
282 #define mGetSigned(_message) _message.getSigned()
283 
284 #define mSetLength(_message,_length) _message.setLength(_length)
285 #define mGetLength(_message) _message.getLength()
286 
287 #define mSetCommand(_message, _command) _message.setCommand(_command)
288 #define mGetCommand(_message) _message.getCommand()
289 
290 #define mSetRequestEcho(_message, _requestEcho) _message.setRequestEcho(_requestEcho)
291 #define mGetRequestEcho(_message) _message.getRequestEcho()
292 
293 #define mSetEcho(_message, _echo) _message.setEcho(_echo)
294 #define mGetEcho(_message) _message.getEcho()
295 
296 #define mSetPayloadType(_message, _payloadType) _message.setPayloadType(_payloadType)
297 #define mGetPayloadType(_message) _message.getPayloadType()
298 
299 #if defined(__cplusplus) || defined(DOXYGEN)
300 
304 {
305 private:
306  char* getCustomString(char *buffer) const;
307 
308 public:
309 
313  MyMessage(void);
314 
320  MyMessage(const uint8_t sensorId, const mysensors_data_t dataType);
321 
325  void clear(void);
326 
333  char* getStream(char *buffer) const;
334 
338  char* getString(char *buffer) const;
339 
344  const char* getString(void) const;
345 
350  void* getCustom(void) const;
351 
356  bool getBool(void) const;
357 
362  uint8_t getByte(void) const;
363 
368  float getFloat(void) const;
369 
374  int16_t getInt(void) const;
375 
380  uint16_t getUInt(void) const;
381 
386  int32_t getLong(void) const;
387 
392  uint32_t getULong(void) const;
393 
398  uint8_t getHeaderSize(void) const;
399 
404  uint8_t getMaxPayloadSize(void) const;
405 
410  uint8_t getExpectedMessageSize(void) const;
411 
416  bool isProtocolVersionValid(void) const;
417 
422  bool getRequestEcho(void) const;
423 
428  MyMessage& setRequestEcho(const bool requestEcho);
429 
434  uint8_t getVersion(void) const;
435 
439  MyMessage& setVersion(void);
440 
445  uint8_t getLength(void) const;
446 
451  MyMessage& setLength(const uint8_t length);
452 
457  mysensors_command_t getCommand(void) const;
458 
463  MyMessage& setCommand(const mysensors_command_t command);
464 
470 
475  MyMessage& setPayloadType(const mysensors_payload_t payloadType);
476 
481  bool getSigned(void) const;
482 
487  MyMessage& setSigned(const bool signedFlag);
488 
494  bool isAck(void) const;
495 
500  bool isEcho(void) const;
501 
506  MyMessage& setEcho(const bool echo);
507 
512  uint8_t getType(void) const;
513 
518  MyMessage& setType(const uint8_t messageType);
519 
524  uint8_t getLast(void) const;
525 
530  MyMessage& setLast(const uint8_t lastId);
531 
536  uint8_t getSender(void) const;
537 
542  MyMessage& setSender(const uint8_t senderId);
543 
548  uint8_t getSensor(void) const;
549 
554  MyMessage& setSensor(const uint8_t sensorId);
555 
560  uint8_t getDestination(void) const;
561 
566  MyMessage& setDestination(const uint8_t destinationId);
567 
573  MyMessage& set(const void* payload, const size_t length);
574 
579  MyMessage& set(const char* value);
580 #if !defined(__linux__)
581 
585  MyMessage& set(const __FlashStringHelper* value);
586 #endif
587 
593  MyMessage& set(const float value, const uint8_t decimals);
594 
599  MyMessage& set(const bool value);
600 
605  MyMessage& set(const uint8_t value);
606 
611  MyMessage& set(const uint32_t value);
612 
617  MyMessage& set(const int32_t value);
618 
623  MyMessage& set(const uint16_t value);
624 
629  MyMessage& set(const int16_t value);
630 
631 #else
632 
633 typedef union {
634  struct {
635 
636 #endif
637  uint8_t last;
638  uint8_t sender;
639  uint8_t destination;
640 
646  uint8_t version_length;
647 
655 
656  uint8_t type;
657  uint8_t sensor;
658 
659  /*
660  * Each message can transfer a payload. We add one extra byte for string
661  * terminator \0 to be "printable" this is not transferred OTA
662  * This union is used to simplify the construction of the binary data types transferred.
663  */
664  union {
665  uint8_t bValue;
666  uint16_t uiValue;
667  int16_t iValue;
668  uint32_t ulValue;
669  int32_t lValue;
670  struct {
671  float fValue;
672  uint8_t fPrecision;
673  };
674  char data[MAX_PAYLOAD_SIZE + 1];
675  } __attribute__((packed));
676 #if defined(__cplusplus) || defined(DOXYGEN)
677 } __attribute__((packed));
678 #else
679 };
680 uint8_t array[HEADER_SIZE + MAX_PAYLOAD_SIZE + 1];
681 } __attribute__((packed)) MyMessage;
682 #endif
683 
684 #endif
685 
I_POST_SLEEP_NOTIFICATION
@ I_POST_SLEEP_NOTIFICATION
Message sent after node woke up (if enabled)
Definition: MyMessage.h:238
MyMessage::sender
uint8_t sender
8 bit - Id of sender node (origin)
Definition: MyMessage.h:638
I_INCLUSION_MODE
@ I_INCLUSION_MODE
Inclusion mode.
Definition: MyMessage.h:210
I_LOG_MESSAGE
@ I_LOG_MESSAGE
Log message.
Definition: MyMessage.h:214
ST_IMAGE
@ ST_IMAGE
Image.
Definition: MyMessage.h:248
I_BATTERY_LEVEL
@ I_BATTERY_LEVEL
Battery level.
Definition: MyMessage.h:205
mysensors_stream_t
mysensors_stream_t
Type of data stream (for streamed message)
Definition: MyMessage.h:242
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:221
ST_FIRMWARE_RESPONSE
@ ST_FIRMWARE_RESPONSE
Response FW block.
Definition: MyMessage.h:246
mysensors_internal_t
mysensors_internal_t
Type of internal messages (for internal messages)
Definition: MyMessage.h:204
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:672
ST_FIRMWARE_RESPONSE_RLE
@ ST_FIRMWARE_RESPONSE_RLE
Response FW block with run length encoded data.
Definition: MyMessage.h:250
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:222
I_CONFIG
@ I_CONFIG
Config (request/response)
Definition: MyMessage.h:211
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:228
MyMessage::fValue
float fValue
< Float messages
Definition: MyMessage.h:671
I_SIGNAL_REPORT_REVERSE
@ I_SIGNAL_REPORT_REVERSE
Internal.
Definition: MyMessage.h:235
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:233
P_ULONG32
@ P_ULONG32
Payload type is UINT32.
Definition: MyMessage.h:260
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:218
I_FIND_PARENT_RESPONSE
@ I_FIND_PARENT_RESPONSE
Find parent response.
Definition: MyMessage.h:213
MyMessage::isProtocolVersionValid
bool isProtocolVersionValid(void) const
isProtocolVersionValid
I_DISCOVER_REQUEST
@ I_DISCOVER_REQUEST
Discover request.
Definition: MyMessage.h:225
ST_SOUND
@ ST_SOUND
Sound.
Definition: MyMessage.h:247
I_ID_RESPONSE
@ I_ID_RESPONSE
ID response.
Definition: MyMessage.h:209
MyMessage::getSigned
bool getSigned(void) const
Getter for sign field.
MyMessage::lValue
int32_t lValue
signed long value (32-bit)
Definition: MyMessage.h:669
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:637
P_FLOAT32
@ P_FLOAT32
Payload type is float32.
Definition: MyMessage.h:262
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:236
MyMessage::setVersion
MyMessage & setVersion(void)
Setter for version.
P_UINT16
@ P_UINT16
Payload type is UINT16.
Definition: MyMessage.h:258
MyMessage::iValue
int16_t iValue
signed integer value (16-bit)
Definition: MyMessage.h:667
I_HEARTBEAT_REQUEST
@ I_HEARTBEAT_REQUEST
Heartbeat request.
Definition: MyMessage.h:223
MyMessage::getCommand
mysensors_command_t getCommand(void) const
Getter for command type.
I_SKETCH_VERSION
@ I_SKETCH_VERSION
Sketch version.
Definition: MyMessage.h:217
ST_FIRMWARE_REQUEST
@ ST_FIRMWARE_REQUEST
Request FW block.
Definition: MyMessage.h:245
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:234
MyMessage::getLong
int32_t getLong(void) const
Get signed 32-bit integer payload.
MyMessage::version_length
uint8_t version_length
Definition: MyMessage.h:646
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:654
C_INVALID_7
@ C_INVALID_7
C_INVALID_7.
Definition: MyMessage.h:75
P_STRING
@ P_STRING
Payload type is string.
Definition: MyMessage.h:255
MyMessage::getHeaderSize
uint8_t getHeaderSize(void) const
getHeaderSize
I_CHILDREN
@ I_CHILDREN
Children.
Definition: MyMessage.h:215
ST_FIRMWARE_CONFIG_REQUEST
@ ST_FIRMWARE_CONFIG_REQUEST
Request new FW, payload contains current FW details.
Definition: MyMessage.h:243
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:249
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:212
P_CUSTOM
@ P_CUSTOM
Payload type is binary.
Definition: MyMessage.h:261
MyMessage::setEcho
MyMessage & setEcho(const bool echo)
Setter for echo-flag.
I_TIME
@ I_TIME
Time (request/response)
Definition: MyMessage.h:206
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:229
I_ID_REQUEST
@ I_ID_REQUEST
ID request.
Definition: MyMessage.h:208
MyMessage::data
char data[MAX_PAYLOAD_SIZE+1]
Buffer for raw payload data.
Definition: MyMessage.h:674
MyMessage::clear
void clear(void)
Clear message contents.
I_HEARTBEAT_RESPONSE
@ I_HEARTBEAT_RESPONSE
Heartbeat response.
Definition: MyMessage.h:227
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:237
MyMessage::setSigned
MyMessage & setSigned(const bool signedFlag)
Setter for sign field.
I_GATEWAY_READY
@ I_GATEWAY_READY
Gateway ready.
Definition: MyMessage.h:219
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:244
P_LONG32
@ P_LONG32
Payload type is INT32.
Definition: MyMessage.h:259
MyMessage::setRequestEcho
MyMessage & setRequestEcho(const bool requestEcho)
Setter for echo request.
I_VERSION
@ I_VERSION
Version.
Definition: MyMessage.h:207
MyMessage::sensor
uint8_t sensor
8 bit - Id of sensor that this message concerns.
Definition: MyMessage.h:657
MyMessage::getFloat
float getFloat(void) const
Get float payload.
I_PRESENTATION
@ I_PRESENTATION
Presentation message.
Definition: MyMessage.h:224
P_INT16
@ P_INT16
Payload type is INT16.
Definition: MyMessage.h:257
I_PONG
@ I_PONG
In return to ping, sent back to sender, payload incremental hop counter.
Definition: MyMessage.h:230
MyMessage::getRequestEcho
bool getRequestEcho(void) const
Getter for echo request.
mysensors_payload_t
mysensors_payload_t
Type of payload.
Definition: MyMessage.h:254
MyMessage::uiValue
uint16_t uiValue
unsigned integer value (16-bit)
Definition: MyMessage.h:666
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:226
MyMessage::type
uint8_t type
8 bit - Type varies depending on command
Definition: MyMessage.h:656
I_REGISTRATION_RESPONSE
@ I_REGISTRATION_RESPONSE
Register response from GW.
Definition: MyMessage.h:232
MyMessage::bValue
uint8_t bValue
unsigned byte value (8-bit)
Definition: MyMessage.h:665
MyMessage::ulValue
uint32_t ulValue
unsigned long value (32-bit)
Definition: MyMessage.h:668
MyMessage::getBool
bool getBool(void) const
Get bool payload.
MyMessage
MyMessage is used to create, manipulate, send and read MySensors messages.
Definition: MyMessage.h:303
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:220
MyMessage::getLength
uint8_t getLength(void) const
Getter for length.
MyMessage::destination
uint8_t destination
8 bit - Id of destination node
Definition: MyMessage.h:639
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:231
I_SKETCH_NAME
@ I_SKETCH_NAME
Sketch name.
Definition: MyMessage.h:216
P_BYTE
@ P_BYTE
Payload type is byte.
Definition: MyMessage.h:256
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