Step 1: The Embryo

This step corresponds to test_agg_lib_1.

In this step we are going to create an embryonic application. It will be able to connect to the AggreGate server and transmit the minimally necessary identifying information.

The success of this step depends on many factors. You have to correctly install and prepare the AggreGate Server and AggreGate Client software. You have to use matching account names on the server and on the device. Passwords must match. The IP address of your device must be correctly chosen. The IP address of the server must be specified correctly, and so on. In other words, pay attention to all the details!

The steps

We assume you are not going to type everything in from scratch and just open the test_agg_lib_1 project. Notice that...

  1. The project contains the SOCK and TIME libraries [not yet documented].

  2. Aggregate.tbs and aggregate.tbh are added to the project as well (from current_library_set\aggregate\trunk). There is also a necessary line in global.tbh: include "aggregate\trunk\aggregate.tbh".

  3. There is an aggregate.xtxt configuration file with type= configuration file, and format= AggreGate (AGG) library. There is a line in global.tbh that is required for the configuration file to work correctly: includepp "aggregate.xtxt".

  4. In the configuration file, Debug Printing is enabled. This allows you to "see what's going on". Don't forget to disable this later, after you've made sure that the library operates as expected.

  5. Also, the Description field is set to AGG_TEST_DEVICE. The Context Type is Apoint.

  6. AGG library event procedures are added to event handlers:

  1. There are empty callback procedures in device.tbs:

  1. Callback_agg_get_firmware_version() contains the code that returns the firmware version string. There is a #define FIRMWARE_VERSION in global.tbh.
  2. on_sys_init() calls agg_start() — this is required to make the library operational. Notice how we check the code returned by agg_start()!
  3. Ours is a simple demo and we are sure we won't have memory shortage. In large projects where a lot of things compete for memory you may get the callback_agg_pre_buffrq() call. This will indicate that the AGG library doesn't have enough memory for its buffers and that you need to clear up this memory right inside callback_agg_pre_buffrq(). Failure to do so will result in the EN_AGG_STATUS_INSUFFICIENT_BUFFER_SPACE code returned by agg_start().

The result

With debug printing enabled, you will see the following output in TIDE:

** Tibbo Basic **

AGG()> —-START---
AGG()> connection established
AGG()> Device synchronized with the server

At the same time your device will appear in AggreGate. Nothing fancy yet, just the basics: