Message Header

The messages use a common header over the air, which includes sender's MAC Address, deviceType information, and an array of parameters as described below. A common message header format is used to make the messages easier to parse, especially by other systems (server, Gateway, etc.) The fields include: This makes it easy to route messages from Zigbee to other networks, and so that the server knows what device originated the message. In a large system with multiple Zigbee networks, you could have two Zigbee devices on different networks having the same short address. But the MAC address is guaranteed to be globally unique, so we use that.
 * [MAC Address]: While this can be obtained by querying the network, including it in every message makes it easier when passing through a Gateway to another network (e.g. Ethernet):
 * For messages FROM the device to the server, the MAC Address field is the MAC of the SOURCE (this device)
 * For messages TO the device from the server, the MAC Address field is the MAC of the DESTINATION
 * Protocol Version: Since in any design, Things Change, this makes it easy to change the message formats without a lot of headache; just increment the Protocol Version field whenever you change the existing message. On the receiving device just  based on this version field.
 * Flags: Generic field to indicate various conditions; could be used for anything; low battery condition, firmware update pending, etc. Just be consistent in your use. Currently flag 0x01 indicates that the message is requesting a response from the server.
 * Sequence Number: Used when sending sequential data, e.g. a heart rate waveform, new firmware image, etc. If this message will go on another non-deterministic network (e.g. Ethernet) then this can be used to re-order messages should they get out of order, and easily verify that no messages were missed.