Campbell Scientific Java PakBus Software Development Kit User Manual

Page 13

Advertising
background image

Java PakBus® Software Development Kit

In this version, the class declaration was changed so that class

Example was

made to implement the

GetTableDefsClient interface and a new

on_complete() was added. We also added the line that adds a new instance of

GetTableDefsTran. When the newly added transaction has completed its

work, the client’s

on_complete() notification will be invoked. There is a

common pattern here used for all transactions:

1. The application adds a new transaction object to a station. The

constructor for most transaction objects is going to require an object

that implements a transaction-specific interface.

2. When the transaction is added, the

Datalogger object will generate a

unique transaction number that will identify all messages sent by the

transaction. It will also send a request to the network for the

transaction object to have “focus”. This “focus” mechanism is used to

serialize transaction access to the network and prevents the application

from flooding the PakBus® network with simultaneous requests.

3. Once the transaction has gained focus, it will usually send a command

message and then wait for the response associated with that command.

If too much time elapses (determined by the round trip time assigned

to the station) without receiving the response, the transaction will

automatically retry the command message up to three times before

reporting the transaction as a failure.

4. The transaction will post the message to the

Datalogger object which

will in turn post the message to the network after assigning the

destination neighbour and PakBus® addresses. The network will then

send the message using the output stream.

5. The datalogger (that is, the physical device) will process the message

and send a response.

6. The response is received by the network and is sent to the appropriate

Datalogger object based upon the source PakBus® address.

7. The device will route the response to the appropriate transaction based

upon the response message's transaction number.

8. Depending upon the transaction type, the transaction may or may not

be over when the first response is received. It may need to send

further commands before the entire operation can be considered

complete. The above steps will be repeated until the transaction is

complete. At that point, the transaction will send a notification signal

to the application by calling the client’s

on_complete() method and

removing itself from the

Datalogger object’s list of active

transactions.

The next sections will discuss specific types of transactions supported by the

API.

5

Advertising