org.mbari.siam.devices.bbElec
Class BBElec

java.lang.Object
  extended by org.mbari.siam.devices.bbElec.BBElec
Direct Known Subclasses:
BB232SDD16

public class BBElec
extends java.lang.Object

Base class for Serial-to-whatever devices from B&B Electronics, Ottawa IL


Field Summary
protected  java.io.InputStream _in
           
protected static org.apache.log4j.Logger _log4j
           
protected  java.io.OutputStream _out
           
protected  gnu.io.SerialPort _serPort
           
protected  long _tmout
           
protected static long DFLT_TMOUT
           
 
Constructor Summary
BBElec(gnu.io.SerialPort serport)
          Constructor
BBElec(gnu.io.SerialPort serport, long tmout)
          Constructor
 
Method Summary
 int cmdWith16bitReply(byte[] cmd)
          Send a command, get 16 bit reply
 int cmdWith16bitReply(byte[] cmd, long tmout)
          Send a command, get 16 bit reply
 int cmdWith32bitReply(byte[] cmd)
          Send a command, get 32 bit reply
 int cmdWith32bitReply(byte[] cmd, long tmout)
          Send a command, get 32 bit reply
protected  void inFlush()
          Flush InputStream
 int readResponse(byte[] buf, int nbytes)
          Read a response from the device
 int readResponse(byte[] buf, int offset, int nbytes, long tmout)
          Read a response from the device
 int readResponse(byte[] buf, int nbytes, long tmout)
          Read a response from the device
 void send16bitCmd(byte[] cmd, int parm)
          Write a command with 16 bit parameter to the device
 void sendCmd(byte[] cmd)
          Write a command to the device
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log4j

protected static org.apache.log4j.Logger _log4j

DFLT_TMOUT

protected static final long DFLT_TMOUT
See Also:
Constant Field Values

_serPort

protected gnu.io.SerialPort _serPort

_in

protected java.io.InputStream _in

_out

protected java.io.OutputStream _out

_tmout

protected long _tmout
Constructor Detail

BBElec

public BBElec(gnu.io.SerialPort serport,
              long tmout)
       throws java.io.IOException
Constructor

Parameters:
serport - gnu.io.SerialPort that's connected to the device
tmout - Timeout for I/O in milliseconds
Throws:
java.io.IOException

BBElec

public BBElec(gnu.io.SerialPort serport)
       throws java.io.IOException
Constructor

Parameters:
serport - gnu.io.SerialPort that's connected to the device
Throws:
java.io.IOException
Method Detail

inFlush

protected void inFlush()
Flush InputStream


sendCmd

public void sendCmd(byte[] cmd)
             throws java.io.IOException
Write a command to the device

Parameters:
cmd - Command to send to device
Throws:
java.io.IOException

send16bitCmd

public void send16bitCmd(byte[] cmd,
                         int parm)
                  throws java.io.IOException
Write a command with 16 bit parameter to the device

Parameters:
cmd - Command to send to device
parm - 16 bit parameter
Throws:
java.io.IOException

readResponse

public int readResponse(byte[] buf,
                        int offset,
                        int nbytes,
                        long tmout)
                 throws java.io.IOException
Read a response from the device

Parameters:
buf - Byte buffer to receive response
offset - Where to start filling in buffer
nbytes - Number of bytes expected
tmout - Time to wait in milliseconds
Throws:
java.io.IOException

readResponse

public int readResponse(byte[] buf,
                        int nbytes,
                        long tmout)
                 throws java.io.IOException
Read a response from the device

Parameters:
buf - Byte buffer to receive response
nbytes - Number of bytes expected
tmout - Time to wait in milliseconds
Throws:
java.io.IOException

readResponse

public int readResponse(byte[] buf,
                        int nbytes)
                 throws java.io.IOException
Read a response from the device

Parameters:
buf - Byte buffer to receive response
nbytes - Number of bytes expected
Throws:
java.io.IOException

cmdWith16bitReply

public int cmdWith16bitReply(byte[] cmd,
                             long tmout)
                      throws java.io.IOException
Send a command, get 16 bit reply

Parameters:
cmd - Command to send
tmout - Time to wait in milliseconds
Throws:
java.io.IOException

cmdWith16bitReply

public int cmdWith16bitReply(byte[] cmd)
                      throws java.io.IOException
Send a command, get 16 bit reply

Parameters:
cmd - Command to send
Throws:
java.io.IOException

cmdWith32bitReply

public int cmdWith32bitReply(byte[] cmd,
                             long tmout)
                      throws java.io.IOException
Send a command, get 32 bit reply

Parameters:
cmd - Command to send
tmout - Time to wait in milliseconds
Throws:
java.io.IOException

cmdWith32bitReply

public int cmdWith32bitReply(byte[] cmd)
                      throws java.io.IOException
Send a command, get 32 bit reply

Parameters:
cmd - Command to send
Throws:
java.io.IOException


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.