2 managing table definitions, 3 starting data collection, Managing table definitions – Campbell Scientific Java PakBus Software Development Kit User Manual

Page 16: Starting data collection

Advertising
background image

Java PakBus® Software Development Kit

5.2 Managing Table Definitions

In order for data collection to be able to work, a client to the datalogger must

have an up-to-date copy of the datalogger’s table definitions so that the binary

record objects can be properly interpreted. This can be done by using the

GetTableDefsTran transaction. The result of this transaction will be in storing

a “raw table definitions” buffer in the

Datalogger object which can be

accessed using the

get_raw_table_defs() method. The datalogger will also

parse these raw table definitions into a collection of

table definition objects

and their constituent

column definition objects.

It is possible for an application to cache the raw table definitions for a station

using

Datalogger.get_raw_table_defs() and to restore this using the

Datalogger.set_raw_table_defs(Packet) method. This can save the

application the considerable amount of time that it can take to download the

raw table definitions from the datalogger.

The application can access a station’s table definitions by using the

get_tables_count(), get_table(index), and get_table(name) methods.

5.3 Starting Data Collection

Data collection is handled by the

DataCollectTran class. This class manages

the details of forming the command message(s) and interpreting their results in

terms of records. The

DataCollectClient class declares a method that gets

called when a group of records has been collected (

on_records()) and also

when the transaction is complete (

on_complete()). The data collection

transaction is controlled by an application assigned “collect mode” object. The

following collect modes are available:

DataCollectModeAllRecords

Specifies that all of the records currently available in the table should be

collected.

DataCollectModeDateRange

Specifies that all of the records stored in the datalogger that have a time

stamp on or after a specified beginning time and earlier (but not including)

than a specified ending time should be collected.

DataCollectModeDateToNewest

Specifies that all records starting with the record at or newer than a

specified begin date up to the newest record in the table should be

collected.

DataCollectModeMostRecent

Specifies that the most recent number of records should be collected.

DataCollectModeRecordNoRange

Specifies that all records on or after the specified begin record number up

to but not including the end record number should be collected.

8

Advertising