How It Works

The Gateway is very powerful and configurable. You can use it out of the box with its default configuration, or you can configure it specifically for your application.

= Startup = On startup the Gateway first reads its configuration settings from its flash memory. These include: Most of these settings can be changed using the command line interface, and are all sent to the server in an Info Message. The current release only allows configuration to be changed via local command line interface. The Gateway has a default set of settings called the Factory Defaults that are used if no parameters have been changed. If you mis-configure your Gateway you can easily restore the Factory Defaults with the command line interface. See below.
 * Local Area Network settings - Whether to use DHCP, server hostname or IP address, etc.
 * Zigbee module settings - Channel, PANID, security, etc.
 * Zigbee application settings - Which endpoint, device ID, etc. to use.

Once the Gateway has loaded its configuration settings, it configures the Ethernet interface. If DHCP is used (default) then it retrieves an IP address from a DHCP server; if using static IP addressing then it starts immediately using the pre-configured IP address. Next the Gateway starts the Zigbee network. This typically takes a few seconds, as the module needs to scan for nearby networks. Once the startup process is complete then the Gateway sends an Info Message to the Server so that the Server knows it has started.

= When a Zigbee Device Joins = Now that the Zigbee network is up and running, the Gateway will allow devices to join. When a Zigbee device joins a network, the module module of the newly joined device sends a ZDO_END_DEVICE_ANNCE_IND. This contains information about the device, including its: Whenever the Gateway receives one of these messages it displays this information and sends the information to the server as a Device Announce Message
 * Short Address
 * Long Address
 * Device Type - whether it is a Router or End Device

= When a message is received on the Zigbee Interface = Zigbee messages must have the correct Device Communication Protocol (DCP) payload header to be processed by the Gateway so that the Gateway knows how to route the message. When the Zigbee module receives a message, the Gateway does the following:
 * 1) Parse the message, ensuring that the message has the proper header. If it does not then the message is discarded.
 * 2) Extract the short address and long address of the source node from the message.
 * 3) Store the short address and long address in the Gateway's Address Cache. This is just a small table used for matching up short addresses with long addresses.
 * 4) Wrap the Zigbee message contents in a DCP header for transport over Ethernet
 * 5) Adds the message to be sent to an outbound queue for the LAN interface
 * 6) Increment the sent message counter for the Ethernet Interface

= When a message is received on the Local Area Network Interface = Ethernet messages must have the correct header so that the Gateway knows how to route the message. When the LAN interface receives a message (for example over Ethernet), the Gateway does the following:
 * 1) Parse the message, ensuring that the message has the proper DCP header. If it does not then the message is discarded.
 * 2) Extract the long address of the destination node from the message.
 * 3) Find the short address of the destination node by looking in the Gateway's Address Cache for the destination's long address.
 * 4) Strip away the DCP header so that the message can be sent over Zigbee.
 * 5) Adds the message to be sent to an outbound queue for the Zigbee interface
 * 6) Increment the sent message counter for the Zigbee Interface

= Periodic Operations = The Gateway periodically:
 * Sends any queued messages out via Zigbee
 * Sends any queued messages out via UDP on the LAN interface.
 * Prunes its address cache - if entries are too old then it purges them
 * Updates its IP address (if using DHCP)
 * Resolves the server hostname to an IP address with DNS (in case the Server's IP address has changed)
 * Sends an Info Message to the server containing information about the Gateway