Communications Between Agent and LinkServer

Top  Previous  Next

This article describes how Agent communicates with LinkServer using AggreGate Communications Protocol. Communication takes place when Agent establishes a connection with LinkServer and logs in. At this point, control of the Agent is passed to the AggreGate Agent plugin. LinkServer then starts sending commands using AggreGate Communications Protocol to find out what data is provided by the Agent. These commands are processed by the Generic LinkServer Intercommunication Module.

Command-By-Command Structure of Communications

These are all commands LinkServer sends to Agent.

A. Learning About The Root Context of Agent

1. Get Variable info from root context
2. Get Variable children from root context
3. Get Variable variables from root context
4. Get Variable functions from root context
5. Get Variable events from root context

B. Synchronizing REAL-TIME CLOCK

1. Set Variable date of the root context to the current time in the Agent's Device Server Account timezone.

C. Learning About DEVICE Contexts PROVIDED BY Agent

LinkServer now gets information about every device context declared by the Device-Specific Module. See Methods Related To Contexts for more information on how Agent defines its device contexts.

For each device context provided by Device-Specific Modules, the following commands are sent by the LinkServer:

1. Get Variable info
2. Get Variable children
3. Get Variable variables
4. Get Variable functions
5. Get Variable events

D. SYNCHRONIZING DEVICE SETTINGS (VALUES OF VARIABLES OF DEVICE CONTEXTS)

LinkServer now synchronizes the values of all device setting variables between its cache and Agent. More information about synchronization and device settings caching may be found in the AggreGate Agent plugin article

1. Get Variable modtime. Server gets modification times of all device settings variables to detect the proper direction of synchronization (Device-to-Server or Server-to-Device) for each of them.
2. For each device setting variable, either a Get Variable or a Set Variable command is executed, depending to the direction of synchronization. These commands are used to update value of variable in the Agent's device context (for Server-To-Device synchronization) or in the server cache (for Device-To-Server synchronization).
3. Set Variable modtime. The server updates device modification times stored in Agent.

E. Finishing synchronization

1. Call function synchronized from every context provided by Agent

Commands Initiated By Agent

When Agent is connected to the LinkServer, it may send event commands to the server whenever events are generated by the Device-Specific Module.

note_warning-wt

LinkServer never explicitly starts or stops listening for Agent's events by sending Add Event Listener or Remove Event Listener commands of AggreGate Communication Protocol. It listens for events implicitly, without notifying Agent about that it has started listening. Therefore, Agent may start sending events of any defined type to the server immediately after synchronization is complete, i.e. after the server has called the synchronized function from Agent's root context.