Communications Between Agent and AggreGate Server

Top  Previous  Next

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

Command-By-Command Structure of Communications

A. Learning About The Context of Agent

First, AggreGate Server gets information about context declared by the Agent. The following commands are sent:

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

B. Synchronizing REAL-TIME CLOCK

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

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

AggreGate Server 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 driver 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.

D. Finishing synchronization

1. Call function synchronized from Agent context

Commands Initiated By Agent

When Agent is connected to the AggreGate Server, it may send event commands to the server whenever events are generated.

note_warning-wt

AggreGate Server 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.