org.jSyncManager.API.Protocol.Util

Class 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.

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.
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.

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.
String
toString()
Converts this object to a human-readable String.

Field Details

ENABLE_CRC16

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

ENABLE_LONG_OFFSETS

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

ENABLE_SHORT_OFFSETS

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

TRANSPORT_SUPPORTS_CRC16

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

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.
Field Value:
536870912

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.
Field Value:
1073741824

Constructor Details

CMP_CommunicationPrefs

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

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.

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.

Method Details

getFlags

public int getFlags()
Retrieves the communication flags as reported by this preferences object.
Returns:
the communication flags 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.

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.

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.

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.

getVersion

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

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.

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 String toString()
Converts this object to a human-readable String.
Returns:
This object as a String.