ADDING OUTPUT FORMATS - VERSION 1.0

Preface

In order to handle the vast range of input types Liquid is expected to, sensory data is constrained to a single format per sensor class called the output format.

The output format describes what kind of data (type) sensors from a given class should return, and how it should be formatted (constrained).

INFO: The component-based architecture of Liquid which is suppose to allow the toolkits output format library to be extended has not yet been fully finalized (as of version 1.0). The process of adding new output formats requires hard-coding the new medium into the toolkit at all levels of its hierarchy, Liquid, Liquid Device Drivers (LDD) and Liquid Client Applications (LCA).

TO ADD A NEW OUTPUT FORMAT

Before beginning this tutorial identity the type of your data your new output format will be facilitating and the constraints that can/will be placed upon it (see Output Descriptors for Developers). The process of adding a new output format to the toolkits library involves 6 stages:

STAGE 1: CREATE A NEW OUTPUT TYPE

The output type defines the type of data the output format supports e.g. binary, numeric and so on. Open a copy of the source file Device Driver.h and under the comment heading output types (maybe labeled as comparison or display type) create a new data type definition.

This is so the toolkit can identify how sensor input should be extracted and manipulated when passed from an LDD to Liquid to an LCA.

STAGE 2: UPDATE THE SENSOR DATA STRUCTURE

The structure SENSOR_DATA is used to facilitate the storage and transfer of sensory input. Still using the file Device Driver.h add a suitable input container to the structure to handle the storage of the new data type.

After updating Device Driver.h distribute it to all other members of the toolkit hierarchy and recompile the project spaces.

STAGE 3: UPDATE THE DISPLAY TYPES STRUCTURE

The structure DISPLAY_TYPES is used by the toolkit to quickly load the relevant input collect and rendering methods. Open a copy of the source file Utilities.h and add a new boolean to the structure describing the new data type.

STAGE 4: UPDATE parseTypeFlag(..)

The parseTypeFlag(..) method is used to switch the relevant elements of the DISPLAY_TYPES structure based on the value of the output type definition stored in an LDD. It also returns a description of the output type. Still using the file Utilities.h insert the necessary code to handle the new output type. Consult the source code on how to do this.

After updating Utilities.h distribute it to all other members of the toolkit hierarchy and recompile the project spaces.

STAGE 5: UPDATE LDD_DRIVER

Liquid uses a structure called LDD_DRIVER to command & control the sensors it has access to. Within this structure is a link to a variable called dataFormats of type FORMATS. It is here were the various parameters used to constrain sensor input are listed and set.

The FORMATS structure can be located in the source file Loader.h of the Liquid project space, download it here. Append the required parameter constraints to the structure using the format used in the source file. If no parameters are required do not alter the structure.

Do not recompile the Liquid project space yet, move onto the next step.

STAGE 6: UPDATE LOADFORMAT

Steps 1-5 have now added your output format (its type and parameter constraints) to the toolkit. The final step in this tutorial is to get Liquid to load the parameter constraints from the file format.ini and into the relevant elements of the FORMATS structure.

Open the source file Selection.cpp (located in the Liquid project space) and move to the LoadFormat() method. This method is called whenever the user selects a sensor from the sensor selection process GUI. The PPM key is extracted from the menu and converted into the section key where the constraint values will be listed.

Following the format used in the source file insert the necessary source code to find the section key and extract the constraint values from their respective keys and place them into the relevant elements of the FORMATS structure.

Technically you would need to complete stage 2 of the Adding Sensor Classes tutorial before doing this as the keys you would load don't currently exist. Therefore treat the names you associate with the constraint parameters in stage 5 as the parameter keys e.g. int rr_max; in the source becomes the parameter key rr_max= in the file format.ini.

If no constraint values are to be loaded set the method to automatically return TRUE (see base of method).

INFO: A basic knowledge of extracting information from ini files will be required in order to carry out this stage.

******************************************************************************************

Now you have completed this tutorial move onto Adding Visualization Modes.

. . back to Manual Index


Best Viewed in IE6
Copyright © 2003, Kiel Gilleade