Phone:(705) 671-2652
    Fax:(705) 671-6127
   Email: tom@ontrak.net
Home Products Programming Applications Custom Designs Ordering News
    
AduJava - Line-by-line Description 

This page describes the operation of the AduJava.java program.
The AduJava.c program is simply a wrapper around the AduHid.dll function calls so it is not described here.

You may want to open the AduJava source code in a separate tab or window of your browser.

Running the program results in the following output:
output.jpg (8066 bytes)

The java launcher starts up the main function in the AduJava.class file.
The main function instantiates an AduJava object naming it "me".

    AduJava me = new AduJava();

The displayVersion method is invoked to retrieve the version number.

    iVersion = me.displayVersion()

This causes the wrapper to print out the version number onto the console and return the version number to the caller.
wrapper.version.bw.24.jpg (3406 bytes)

The main function formats and prints out the version number that it receives.
main.version.bw.24.jpg (2914 bytes)

The main function invokes the OpenAduDevice method to open a connection to the ADU200. The handle must be retained and used in all subsequent calls to the wrapper.

    handle = me.OpenAduDevice(500);

The WriteAduDevice method is used to send commands to the ADU200. An mk0 command is sent to zero all the relays followed by an mk1 command to set relay K0 on.

   iRC = me.WriteAduDevice(handle, "mk0", 3, 500);
   iRC = me.WriteAduDevice(handle, "mk1", 3, 500);

If an argument was present then it is sent to the ADU200 as a command.

   if (args.length > 0)
   {
       iRC = me.WriteAduDevice(handle, args[0], args[0].length(), 500);
   }

An rpk command instructs the ADU200 to transmit the state of all relays. The ReadAduDevice method is used to retrieve the reponse from the ADU200.

    iRC = me.WriteAduDevice(handle, "rpk", 3, 500);
    String sResponse = me.ReadAduDevice(handle, 4, 500);

The response from the ADU200 is displayed on the console. Relays K1, K2 and K3 are off and show as zeroes. Relay K0 is on and shows as a one.
response.bw.24.jpg (2805 bytes)

Finally the CloseAduDevice method is used to release the ADU device.

In summary:
The AduJava.dll converts the Java types into C types and calls the appropriate entry point in AduHid.dll.
The AduHid.dll communicates with the ADU device.
The responses are passed back through AduJava.dll to the main function in AduJava.class.

 


AduJava Help File Version 1.0.0.0
Copyright 2005 Ontrak Control Systems Inc.

 
    
Contact Information
Address Telephone Electronic Mail
Ontrak Control Systems Inc.
764 Notre Dame Ave., Unit #1
Tel: (705) 671-2652 General Information Sales or Support
Sudbury,Ontario Fax:(705) 671-6127 tom@ontrak.net
CANADA P3A 2T2    
              
Next-Day shipping anywhere in Continental U.S. via Fed-Ex
Copyright 2012 ONTRAK CONTROL SYSTEMS 764 Notre Dame Ave, Unit #1 , Sudbury, Ontario, CANADA P3A 2T2  
"Quality serial Data Acquisition Interfaces"           PH. (705) 671-2652 FAX (705) 671-6127