jSyncManager

org.jSyncManager.API.Protocol.Util
Class CMP_CommunicationPrefs

java.lang.Object
  extended byorg.jSyncManager.API.Protocol.Util.CMP_CommunicationPrefs

public class CMP_CommunicationPrefs
extends java.lang.Object

This class provides acces to a CMP Communication Preferences block. CMP Communications Blocks are used by CMP Extended packets.

Version:
$Revision: 1.3 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>
Last modified by: $Author: yaztromo $ on $Date: 2004/08/05 07:54:50 $.

Field Summary
static int ENABLE_CRC16
          A constant flag to denote that the underlying transport should enable CRC-16.
static int ENABLE_LONG_OFFSETS
          A constant flag to denote that the underlying transport should use long offsets.
static int ENABLE_SHORT_OFFSETS
          A constant flag to denote that the underlying transport should use short offsets.
(package private)  int flags
          The flags associated with these preferences.
(package private)  int hardwareHandshakeAboveSpeed
          The speed at which to start using hardware handshaking.
(package private)  int maximumBaudRate
          The maximum bit/baud rate for communications in the underlying transport mechanism.
(package private)  int maximumDataBlockSize
          The maximum data block size in the underlying transport mechanism.
(package private)  int maximumPacketSize
          The maximum size of a packet in the underlying transport mechanism.
static int TRANSPORT_SUPPORTS_CRC16
          A constant flag to denote that the underlying transport supports CRC-16.
static int TRANSPORT_SUPPORTS_LONG_OFFSETS
          A constant flag to denote that the transport supports long 32-bit data offsets.
static int TRANSPORT_SUPPORTS_SHORT_OFFSETS
          A constant flag to denote that the transport supports short 16-bit data offsets.
(package private)  int version
          The version of this CMP implementation.
 
Constructor Summary
CMP_CommunicationPrefs()
          Create a new instance of the CMP Communication Preferences class.
CMP_CommunicationPrefs(byte[] inData)
          Construct a new CMP Communication Preferences instance from an array of bytes.
CMP_CommunicationPrefs(int maxPktSize, int maxBlkSize, int maxBaudRate, int hardHandAbove, int flgs, int ver)
          Create a new instance of the CMP Communication Preferences class using the specified parameters.
 
Method Summary
 int getFlags()
          Retrieves the communication flags as reported by this preferences object.
 int getHardwareHandshakeAboveSpeed()
          Retrieves the speed at which to start using hardware handshaking, as reported by this preferences object.
 int getMaximumBaudRate()
          Retrieves the maximum bit/baud rate as reported by this preferences object.
 int getMaximumDataBlockSize()
          Retrieves the maximum data block size as reported by this preferences object.
 int getMaximumPacketSize()
          Retrieves the maximum packet size as reported by this preferences object.
 int getVersion()
          Retrieves the CMP version as reported by this preferences object.
 boolean hasFlags(int testFlag)
          Tests to see if the specified flag(s) are enabled in this argument.
 byte[] object2Bytes()
          Converts this object to an array of bytes suitable for transmission.
 java.lang.String toString()
          Converts this object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRANSPORT_SUPPORTS_CRC16

public static final int TRANSPORT_SUPPORTS_CRC16
A constant flag to denote that the underlying transport supports CRC-16.

See Also:
Constant Field Values

ENABLE_CRC16

public static final int ENABLE_CRC16
A constant flag to denote that the underlying transport should enable CRC-16.

See Also:
Constant Field Values

TRANSPORT_SUPPORTS_SHORT_OFFSETS

public static final int TRANSPORT_SUPPORTS_SHORT_OFFSETS
A constant flag to denote that the transport supports short 16-bit data offsets.

See Also:
Constant Field Values

ENABLE_SHORT_OFFSETS

public static final int ENABLE_SHORT_OFFSETS
A constant flag to denote that the underlying transport should use short offsets.

See Also:
Constant Field Values

TRANSPORT_SUPPORTS_LONG_OFFSETS

public static final int TRANSPORT_SUPPORTS_LONG_OFFSETS
A constant flag to denote that the transport supports long 32-bit data offsets.

See Also:
Constant Field Values

ENABLE_LONG_OFFSETS

public static final int ENABLE_LONG_OFFSETS
A constant flag to denote that the underlying transport should use long offsets.

See Also:
Constant Field Values

maximumPacketSize

int maximumPacketSize
The maximum size of a packet in the underlying transport mechanism.


maximumDataBlockSize

int maximumDataBlockSize
The maximum data block size in the underlying transport mechanism.


maximumBaudRate

int maximumBaudRate
The maximum bit/baud rate for communications in the underlying transport mechanism.


hardwareHandshakeAboveSpeed

int hardwareHandshakeAboveSpeed
The speed at which to start using hardware handshaking.


flags

int flags
The flags associated with these preferences.


version

int version
The version of this CMP implementation.

Constructor Detail

CMP_CommunicationPrefs

public CMP_CommunicationPrefs()
Create a new instance of the CMP Communication Preferences class.


CMP_CommunicationPrefs

public CMP_CommunicationPrefs(int maxPktSize,
                              int maxBlkSize,
                              int maxBaudRate,
                              int hardHandAbove,
                              int flgs,
                              int ver)
Create a new instance of the CMP Communication Preferences class using the specified parameters.

Parameters:
maxPktSize - the maximum packet size.
maxBlkSize - the maximum data block size.
maxBaudRate - the maximum bit/baud rate for communications.
hardHandAbove - the speed at which hardware handshaking should be used.
flgs - the associated preferences flags.
ver - the version of the CMP implementation.

CMP_CommunicationPrefs

public CMP_CommunicationPrefs(byte[] inData)
Construct a new CMP Communication Preferences instance from an array of bytes.

Parameters:
inData - the data array to be parsed.
Method Detail

hasFlags

public boolean hasFlags(int testFlag)
Tests to see if the specified flag(s) are enabled in this argument.

Parameters:
testFlag - an int containing the bits to test.
Returns:
true if all the specified bits are present, false otherwise.

getMaximumPacketSize

public int getMaximumPacketSize()
Retrieves the maximum packet size as reported by this preferences object.

Returns:
the maximum packet size as reported by this preferences object.

getMaximumDataBlockSize

public int getMaximumDataBlockSize()
Retrieves the maximum data block size as reported by this preferences object.

Returns:
the maximum data block size as reported by this preferences object.

getMaximumBaudRate

public int getMaximumBaudRate()
Retrieves the maximum bit/baud rate as reported by this preferences object.

Returns:
the maximum bit/baud as reported by this preferences object.

getHardwareHandshakeAboveSpeed

public int getHardwareHandshakeAboveSpeed()
Retrieves the speed at which to start using hardware handshaking, as reported by this preferences object.

Returns:
the speed at which to start using hardware handshaking, as reported by this preferences object.

getFlags

public int getFlags()
Retrieves the communication flags as reported by this preferences object.

Returns:
the communication flags as reported by this preferences object.

getVersion

public int getVersion()
Retrieves the CMP version as reported by this preferences object.

Returns:
the CMP version as reported by this preferences object.

object2Bytes

public byte[] object2Bytes()
Converts this object to an array of bytes suitable for transmission.

Returns:
this object to an array of bytes suitable for transmission.

toString

public java.lang.String toString()
Converts this object to a human-readable String.

Returns:
This object as a String.

jSyncManager

Copyright (c) 1999 - 2004 Brad BARCLAY and others. All Rights Reserved.