org.jSyncManager.API.Protocol
Class CMP_DLP
java.lang.Objectorg.jSyncManager.API.Protocol.CMP_DLP
public class CMP_DLP
extends java.lang.Object
CMP_DLP class.
This class provides the black-box for handling CMP and DLP packets.
CMP_DLP()- Construct an instance of the CMP_DLP class with no parameters.
|
CMP_DLP(CMPDLPTransferInterface padp)- Construct an instance of the CMP_DLP class using the specified underlying
CMPDLPTransferInterface protocol handler.
|
void | connect()- Attempt to listen for a connection to the remote CMP/DLP enabled device.
|
protected boolean | determinePacketType(GenericPacket genericpacket)- A method to determine the type of incoming packet.
|
void | disconnect()- A method to cause the protocol stack issue a disconnect request.
|
void | disconnect(char c)- A method to cause the protocol stack issue a disconnect request
with the specified disconnect reason code.
|
DLP_Packet | getDLPPacket(DLP_Packet dlp_packet)- Retreives a DLP packet from the underlying protocol in the stack.
|
int | getSpeed()- Retreives the speed of the connection.
|
boolean | isConnected()- Returns the connection status of this protocol layer.
|
byte[] | readRawPacket()- Retreives a raw packet from the underlying protocol in the stack.
|
protected void | rxHandshake()- USB Receive Handshake.
|
void | setSpeed(int newValue)- Sets the speed that this protocol should attempt to use for serial synchronization sessions.
|
void | suspend()- Suspends the synchronization.
|
void | writeRawPacket(byte[] data, byte srcSocket, byte destSocket)- Write a raw packet to the underlying protocol in the stack.
|
connected
protected boolean connected
The connection state.
Set to true if the protocol stack is connected to the remote end,
otherwise set to false.
padpHandler
protected CMPDLPTransferInterface padpHandler
The underlying CMPDLPTransferInterface object to use for packet I/O.
speed
protected int speed
The speed to use for serial synchronization.
This field is ignored for non-serial synchronizations.
The default is 9600bps.
CMP_DLP
protected CMP_DLP()
Construct an instance of the CMP_DLP class with no parameters.
This method is protected for use by subclasses.
CMP_DLP
public CMP_DLP(CMPDLPTransferInterface padp)
Construct an instance of the CMP_DLP class using the specified underlying
CMPDLPTransferInterface protocol handler.
padp - the underlying CMPDLPTransferInterface protocol handler to use for I/O.
connect
public void connect()
throws NotConnectedExceptionAttempt to listen for a connection to the remote CMP/DLP enabled device.
This method will block until a connection is initiated, so it's safe to call and
wait until a connection occurs. Interactive applications should call this method in
a seperate thread to allow the user to continue interacting with the application.
determinePacketType
protected boolean determinePacketType(GenericPacket genericpacket)
A method to determine the type of incoming packet.
- true if this packet is a PADP packet, false otherwise.
disconnect
public void disconnect()
A method to cause the protocol stack issue a disconnect request.
This method simply calls disconnect(char)
with a disconnect reason code of 0.
disconnect
public void disconnect(char c)
A method to cause the protocol stack issue a disconnect request
with the specified disconnect reason code.
c - the reason code for the disconnect.
getDLPPacket
public DLP_Packet getDLPPacket(DLP_Packet dlp_packet)
throws NotConnectedException,
DLPErrorRetreives a DLP packet from the underlying protocol in the stack.
This method uses a request/response format, so in order to get a packet of data, you have to
request the packet via a DLP Request packet.
dlp_packet - the packet containing the DLP request.
- the DLP_Packet containing the response from the remote end.
NotConnectedException - thrown if the connection is lost during
request/responce processing, or if this method was called prior to a connection
being initialized via connect().DLPError - if the request resulted in an error on the remote end, a DLPError is thrown.
getSpeed
public int getSpeed()
Retreives the speed of the connection.
This value is only valid for serial based connections. Other connections
will return the default speed value of 9600bps, and should be ignored.
- the speed of the serial connection.
isConnected
public boolean isConnected()
Returns the connection status of this protocol layer.
- true if we're connected to the remote device still, false otherwise.
readRawPacket
public byte[] readRawPacket()
throws NotConnectedExceptionRetreives a raw packet from the underlying protocol in the stack.
- the GenericPacket containing the data from the remote end.
NotConnectedException - thrown if the connection is lost during
request/responce processing, or if this method was called prior to a connection
being initialized via connect().
setSpeed
public void setSpeed(int newValue)
Sets the speed that this protocol should attempt to use for serial synchronization sessions.
This method has no effect for non-serial synchronization.
newValue - the speed that the synchronization should be attempted at.
suspend
public void suspend()
throws NotConnectedExceptionSuspends the synchronization.
Calling this method closes down the current synchronization session, while leaving the
protocol stack in tact so it can begin another synchronization session as
soon as this method returns. This method will alsa attempt to suspend the
protocol layer beneath it.
writeRawPacket
public void writeRawPacket(byte[] data,
byte srcSocket,
byte destSocket)
throws NotConnectedExceptionWrite a raw packet to the underlying protocol in the stack.
data - the byte array to be written to the handheld.srcSocket - the source socket (usually 3).destSocket - the destination socket (usually 3).
NotConnectedException - thrown if the connection is lost during
request/responce processing, or if this method was called prior to a connection
being initialized via connect().