Layout Control System (LCS)
|
A class for handling UDP messages sent between controllers and the application server. More...
#include <UDPMessage.h>
Public Member Functions | |
UDPMessage (void) | |
UDPMessage (const UDPMessage &other) | |
UDPMessage (const UDPMessageStruct &other) | |
UDPMessage & | operator= (const UDPMessage &other) |
bool | isValid (void) const |
Returns true if the message is considered valid. At minimum, a valid message has its message ID set to a value greater than zero. | |
void | setMessageID (unsigned char value) |
void | setID (long value) |
void | setField (unsigned char fieldIndex, unsigned char value) |
int | getDeviceID (unsigned char index) const |
returns the device ID from the device entry at the given index. | |
void | setDeviceID (unsigned char index, int value) |
int | getDeviceStatus (unsigned char index) const |
returns the status from the device entry at the given index. | |
void | setDeviceStatus (unsigned char index, int value) |
char * | getRef (void) const |
returns a reference to the internal UDPMessageStruct | |
unsigned char | getMessageID (void) const |
returns the messageID. | |
long | getID (void) const |
returns the ID | |
unsigned char | getTransactionNumber (void) const |
returns the transaction number | |
void | setTransactionNumber (unsigned char value) |
unsigned char | getField (unsigned char fieldIndex) const |
void | copyFrom (const UDPMessage &other) |
A class for handling UDP messages sent between controllers and the application server.
UDPMessage This class along with the Message Structure contains the data layout of a UDP message. Messages are sent from controller-to-controller in a peer-to-peer fasion using UDP uni-cast. Each controller contains a list of "controllers to notify" in its configuration data. Each time a device needs to send a command or status message, the controller's Network Manager sends the message to all controllers contained in the notification list. Each controller listens for the SYS_CONTROLLER_ONLINE broadcast message which is sent by each controller upon startup. Upon resceiving this message, the controller checks to see if the controller's ID is contained in its notification list and, if so, stores the address of the sending controller which is stored in field[0] - field[3] and then responds by sending device status messages. If the controller misses this message, the controller sends a SYS_FIND_CONTROLLER broadcast message every 3 seconds for each controller in its notification list until it recieves a corresponding SYS_CONTROLLER_ONLINE message from each controller.
UDPMessage::UDPMessage | ( | void | ) |
Contstructor Creates a blank, invalid contsturctor auto-generating the transaction number by incrementing the static
|
inline |
Copy constructor Creates a new UDPMessage copying the information from other creating an exact copy (including the transaction number)
other | A UDPMessage to use as the soruce |
|
inline |
Convenience constructor Creates a new UDPMessage using the data supplied in the supplied UDPMessageStruct
other | A UDPMessageStruct to use as the soruce |
|
inline |
replaces the data of the message creating a copy Replaces the message data; copying the information from other. This function does NOT copy the transaction number, rather, a new transaction number is created.
other | A UDPMessage to use as the soruce |
|
inline |
Returns one of the bytes in the 32 byte payload.
fieldIndex | index of the field to retrieve. |
|
inline |
Assignment Replaces the message data; copying the information from other creating an exact copy (including the transaction number)
other | A UDPMessage to use as the soruce |
|
inline |
Setter function. Sets the device ID of one of the device entries.
index | index of the field to set |
value | an int containing the device ID. |
|
inline |
Setter function. Sets the status of one of the device entries.
index | index of the field to set |
value | an int containing the status of the device. |
|
inline |
Setter function. Sets one of the bytes in the 32 byte payload.
fieldIndex | index of the field to set |
value | a byte containing the new value. |
|
inline |
Setter function. Sets the ID.
value | an long integer value that represents the controller's ID, serial number or a route ID depending on the message. |
|
inline |
Setter function. Sets the message ID.
value | Message ID |
|
inline |
Setter function. Sets the transaction number overwriting the auto-generated number;
value | the new trasaction number. |