jSyncManager

org.jSyncManager.API.Protocol
Class DLP_Packet

java.lang.Object
  |
  +--org.jSyncManager.API.Protocol.DLP_Packet
All Implemented Interfaces:
java.io.Serializable

public class DLP_Packet
extends java.lang.Object
implements java.io.Serializable

DLPPacket class. This class provides the class representation of a DLP packet.

Version:
$Revision: 1.9 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>
Last modified by: $Author: yaztromo $ on $Date: 2003/05/29 17:46:54 $.
See Also:
Serialized Form

Field Summary
static byte ADD_SYNC_LOG_ENTRY
          DLP function code to add an entry to the handheld sync log.
static byte CALL_APPLICATION
          DLP function code to call a handheld application.
static byte CLEANUP_DATABASE
          DLP function code for cleaning up a database.
static byte CLOSE_DATABASE
          DLP function code for closing a database.
static byte CREATE_DATABASE
          DLP function code for creating a database.
static byte DELETE_DATABASE
          DLP function code for deleting a database.
static byte DELETE_RECORD
          DLP function code for deleting a record to a database.
static byte DELETE_RESOURCE
          DLP function code for deleting a resource from a database.
static byte DLP_FIRST_ARG_ID
          The ID number for the first argument in any DLP packet containing arguments.
static byte END_OF_SYNC
          DLP function code to end a synchronization operation.
static char ERR_ALREADY_EXISTS
          An error code signifying that an element being created already exists (9).
static char ERR_ARG_MISSING
          An error code signifying that an argument was missing from a request (20).
static char ERR_BAD_WRAPPER
          An error code signifying that a bad wrapper was detected (19).
static char ERR_CANCEL_SYNC
          An error code signifying that the synchronization has been cancelled by the user on the handheld end of the sync (18).
static char ERR_DATABASE_OPEN
          An error code signifying that a database is already open (7).
static char ERR_ILLEGAL_REQUEST
          An error code signifying that an illegal request was made (2).
static char ERR_INSUFFICIENT_SPACE
          An error code signifying that there is insufficient space to process the request (16).
static char ERR_INVALID_ARG_SIZE
          An error code signifying that an invalid argument size was detected (21).
static char ERR_INVALID_PARAMETER
          An error code signifying that an invalid parameter was passed (4).
static char ERR_LIMIT_EXCEEDED
          An error code signifying that a limit has been exceeded (17).
static char ERR_MEMORY_ERROR
          An error code signifying that a memory error has occurred on the handheld (3).
static char ERR_NONE
          An error code signifying that no error has occured (0).
static char ERR_NONE_OPEN
          An error code signifying that no databases are open (6).
static char ERR_NOT_FOUND
          An error code signifying that the requested item could not be found (5).
static char ERR_NOT_SUPPORTED
          An error code signifying that a request is not supported (13).
static char ERR_READ_ONLY
          An error code signifying that a write attempt was made to a read-only piece of data (15).
static char ERR_RECORD_BUSY
          An error code signifying that the requested record is busy (12).
static char ERR_RECORD_DELETED
          An error code signifying that a requested record has been deleted (11).
static char ERR_ROM_BASED
          An error code signifying that the database to be written to is ROM based, and thus isn't writable (14).
static char ERR_SYSTEM_ERROR
          An error code signifying that the handheld encountered a system error (1).
static char ERR_TOO_MANY_OPEN_DBS
          An error code signifying that too many databases are already open (8).
static char ERR_UNABLE_TO_OPEN
          An error code signifying that the handheld was unable to open a database (10).
static byte FIND_DB
          DLP function code to find a database.
static byte GET_TIME
          DLP function code for reading the time on the handheld
 byte hostSocket
          The socket being used by the host system for data I/O.
static byte MOVE_CATEGORY
          DLP function code to move a category from one ID to another.
static byte OPEN_CONDUIT
          DLP function code to open a conduit.
static byte OPEN_DATABASE
          DLP function code for opening a database.
static byte PROCESS_RPC
          DLP function code to process a Remote Procedure Call request.
static byte READ_APP_BLOCK
          DLP function code for reading an open databases application block.
static byte READ_APP_PREFERENCE
          DLP function code to read an application preference.
static byte READ_DATABASE_LIST
          DLP function code for reading the database list.
static byte READ_FEATURE
          DLP function code to read a feature from the handheld.
static byte READ_NET_SYNC_INFO
          DLP function code to read the network HotSync information.
static byte READ_NEXT_MOD_REC
          DLP function code for reading the next modified record from a database.
static byte READ_NEXT_MOD_REC_IN_CAT
          DLP function code to read the next modified record in a category.
static byte READ_NEXT_REC_IN_CAT
          DLP function code to read the next category in a record.
static byte READ_OPEN_DB_INFO
          DLP function code to read the information on an open database.
static byte READ_REC_ID_LIST
          DLP function code to read a databases record ID list.
static byte READ_RECORD
          DLP function code for reading a record from a database.
static byte READ_RESOURCE
          DLP function code for reading a resource from a database.
static byte READ_SORT_BLOCK
          DLP function code for reading a sort databases application block.
static byte READ_STORAGE_INFO
          DLP function code for reading the storage information.
static byte READ_SYSTEM_INFO
          DLP function code for reading the system information.
static byte READ_USER_INFO
          DLP function code for reading the user information.
static byte RESET_RECORD_INDEX
          DLP function code to reset the record index for all "get next" calls.
static byte RESET_SYNC_FLAGS
          DLP function code to reset all the synchronization flags.
static byte RESET_SYSTEM
          DLP function code to force a handheld soft reset after the synchronization.
 byte serverSocket
          The socket being used by the server (the handheld) for data I/O.
static byte SET_DB_INFO
          DLP function code to set the database information.
static byte SET_TIME
          DLP function code for setting the time on the handheld
static byte WRITE_APP_BLOCK
          DLP function code for writing an open databases application block.
static byte WRITE_APP_PREFERENCE
          DLP function code to write an application preference.
static byte WRITE_NET_SYNC_INFO
          DLP function code to write the network HotSync information.
static byte WRITE_RECORD
          DLP function code for writing a record to a database.
static byte WRITE_RESOURCE
          DLP function code for writing a resource from a database.
static byte WRITE_SORT_BLOCK
          DLP function code for writing a sort databases application block.
static byte WRITE_USER_INFO
          DLP function code for writing the user information.
 
Constructor Summary
(package private) DLP_Packet(byte funcID, byte[][] args)
          Creates a new DLP Request Packet using the specified values.
(package private) DLP_Packet(byte funcID, byte[][] args, int argID)
          Creates a new DLP Request Packet using the specified values.
(package private) DLP_Packet(byte funcID, char error, byte[][] args)
          Creates a new DLP Response Packet using the specified settings.
 
Method Summary
(package private) static DLP_Packet bytes2Packet(byte[] pkt)
          Converts a byte array into a DLP packet object.
(package private)  int getArgCount()
          Returns the number of arguments in this DLP Packet.
(package private)  char getErrorCode()
          Retreives the error code associated with this packet.
(package private)  byte getFunctionID()
          Retreives the function ID for this DLP packet.
(package private)  boolean getPacketType()
          Returns a boolean representing the packet type of this DLP packet.
(package private)  byte[] packet2Bytes()
          Converts this packet to a byte array suitable for transmission.
(package private)  byte[] readArgument(int i)
          Returns the data in the specified argument.
 java.lang.String toString()
          Converts this packet into a human readable hex dump, suitable for tracing and debugging protocol issues.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

READ_USER_INFO

public static final byte READ_USER_INFO
DLP function code for reading the user information.

WRITE_USER_INFO

public static final byte WRITE_USER_INFO
DLP function code for writing the user information.

READ_SYSTEM_INFO

public static final byte READ_SYSTEM_INFO
DLP function code for reading the system information.

GET_TIME

public static final byte GET_TIME
DLP function code for reading the time on the handheld

SET_TIME

public static final byte SET_TIME
DLP function code for setting the time on the handheld

READ_STORAGE_INFO

public static final byte READ_STORAGE_INFO
DLP function code for reading the storage information.

READ_DATABASE_LIST

public static final byte READ_DATABASE_LIST
DLP function code for reading the database list.

OPEN_DATABASE

public static final byte OPEN_DATABASE
DLP function code for opening a database.

CREATE_DATABASE

public static final byte CREATE_DATABASE
DLP function code for creating a database.

CLOSE_DATABASE

public static final byte CLOSE_DATABASE
DLP function code for closing a database.

DELETE_DATABASE

public static final byte DELETE_DATABASE
DLP function code for deleting a database.

READ_APP_BLOCK

public static final byte READ_APP_BLOCK
DLP function code for reading an open databases application block.

WRITE_APP_BLOCK

public static final byte WRITE_APP_BLOCK
DLP function code for writing an open databases application block.

READ_SORT_BLOCK

public static final byte READ_SORT_BLOCK
DLP function code for reading a sort databases application block.

WRITE_SORT_BLOCK

public static final byte WRITE_SORT_BLOCK
DLP function code for writing a sort databases application block.

READ_NEXT_MOD_REC

public static final byte READ_NEXT_MOD_REC
DLP function code for reading the next modified record from a database.

READ_RECORD

public static final byte READ_RECORD
DLP function code for reading a record from a database.

WRITE_RECORD

public static final byte WRITE_RECORD
DLP function code for writing a record to a database.

DELETE_RECORD

public static final byte DELETE_RECORD
DLP function code for deleting a record to a database.

READ_RESOURCE

public static final byte READ_RESOURCE
DLP function code for reading a resource from a database.

WRITE_RESOURCE

public static final byte WRITE_RESOURCE
DLP function code for writing a resource from a database.

DELETE_RESOURCE

public static final byte DELETE_RESOURCE
DLP function code for deleting a resource from a database.

CLEANUP_DATABASE

public static final byte CLEANUP_DATABASE
DLP function code for cleaning up a database. "Cleaning up" involves removing all records that were flagged as deleted, and resetting all modified flags in the database.

RESET_SYNC_FLAGS

public static final byte RESET_SYNC_FLAGS
DLP function code to reset all the synchronization flags.

CALL_APPLICATION

public static final byte CALL_APPLICATION
DLP function code to call a handheld application.

RESET_SYSTEM

public static final byte RESET_SYSTEM
DLP function code to force a handheld soft reset after the synchronization.

ADD_SYNC_LOG_ENTRY

public static final byte ADD_SYNC_LOG_ENTRY
DLP function code to add an entry to the handheld sync log.

READ_OPEN_DB_INFO

public static final byte READ_OPEN_DB_INFO
DLP function code to read the information on an open database.

MOVE_CATEGORY

public static final byte MOVE_CATEGORY
DLP function code to move a category from one ID to another.

PROCESS_RPC

public static final byte PROCESS_RPC
DLP function code to process a Remote Procedure Call request.

OPEN_CONDUIT

public static final byte OPEN_CONDUIT
DLP function code to open a conduit. Calling this DLP function allows the Palm to update its display when a Conduit is initialized for synchronization.

END_OF_SYNC

public static final byte END_OF_SYNC
DLP function code to end a synchronization operation.

RESET_RECORD_INDEX

public static final byte RESET_RECORD_INDEX
DLP function code to reset the record index for all "get next" calls.

READ_REC_ID_LIST

public static final byte READ_REC_ID_LIST
DLP function code to read a databases record ID list.

READ_NEXT_REC_IN_CAT

public static final byte READ_NEXT_REC_IN_CAT
DLP function code to read the next category in a record.

READ_NEXT_MOD_REC_IN_CAT

public static final byte READ_NEXT_MOD_REC_IN_CAT
DLP function code to read the next modified record in a category.

READ_APP_PREFERENCE

public static final byte READ_APP_PREFERENCE
DLP function code to read an application preference.

WRITE_APP_PREFERENCE

public static final byte WRITE_APP_PREFERENCE
DLP function code to write an application preference.

READ_NET_SYNC_INFO

public static final byte READ_NET_SYNC_INFO
DLP function code to read the network HotSync information.

WRITE_NET_SYNC_INFO

public static final byte WRITE_NET_SYNC_INFO
DLP function code to write the network HotSync information.

READ_FEATURE

public static final byte READ_FEATURE
DLP function code to read a feature from the handheld.

FIND_DB

public static final byte FIND_DB
DLP function code to find a database.

SET_DB_INFO

public static final byte SET_DB_INFO
DLP function code to set the database information.

ERR_NONE

public static final char ERR_NONE
An error code signifying that no error has occured (0).

ERR_SYSTEM_ERROR

public static final char ERR_SYSTEM_ERROR
An error code signifying that the handheld encountered a system error (1).

ERR_ILLEGAL_REQUEST

public static final char ERR_ILLEGAL_REQUEST
An error code signifying that an illegal request was made (2).

ERR_MEMORY_ERROR

public static final char ERR_MEMORY_ERROR
An error code signifying that a memory error has occurred on the handheld (3).

ERR_INVALID_PARAMETER

public static final char ERR_INVALID_PARAMETER
An error code signifying that an invalid parameter was passed (4).

ERR_NOT_FOUND

public static final char ERR_NOT_FOUND
An error code signifying that the requested item could not be found (5).

ERR_NONE_OPEN

public static final char ERR_NONE_OPEN
An error code signifying that no databases are open (6).

ERR_DATABASE_OPEN

public static final char ERR_DATABASE_OPEN
An error code signifying that a database is already open (7).

ERR_TOO_MANY_OPEN_DBS

public static final char ERR_TOO_MANY_OPEN_DBS
An error code signifying that too many databases are already open (8).

ERR_ALREADY_EXISTS

public static final char ERR_ALREADY_EXISTS
An error code signifying that an element being created already exists (9).

ERR_UNABLE_TO_OPEN

public static final char ERR_UNABLE_TO_OPEN
An error code signifying that the handheld was unable to open a database (10).

ERR_RECORD_DELETED

public static final char ERR_RECORD_DELETED
An error code signifying that a requested record has been deleted (11).

ERR_RECORD_BUSY

public static final char ERR_RECORD_BUSY
An error code signifying that the requested record is busy (12).

ERR_NOT_SUPPORTED

public static final char ERR_NOT_SUPPORTED
An error code signifying that a request is not supported (13).

ERR_ROM_BASED

public static final char ERR_ROM_BASED
An error code signifying that the database to be written to is ROM based, and thus isn't writable (14).

ERR_READ_ONLY

public static final char ERR_READ_ONLY
An error code signifying that a write attempt was made to a read-only piece of data (15).

ERR_INSUFFICIENT_SPACE

public static final char ERR_INSUFFICIENT_SPACE
An error code signifying that there is insufficient space to process the request (16).

ERR_LIMIT_EXCEEDED

public static final char ERR_LIMIT_EXCEEDED
An error code signifying that a limit has been exceeded (17).

ERR_CANCEL_SYNC

public static final char ERR_CANCEL_SYNC
An error code signifying that the synchronization has been cancelled by the user on the handheld end of the sync (18).

ERR_BAD_WRAPPER

public static final char ERR_BAD_WRAPPER
An error code signifying that a bad wrapper was detected (19).

ERR_ARG_MISSING

public static final char ERR_ARG_MISSING
An error code signifying that an argument was missing from a request (20).

ERR_INVALID_ARG_SIZE

public static final char ERR_INVALID_ARG_SIZE
An error code signifying that an invalid argument size was detected (21).

DLP_FIRST_ARG_ID

public static final byte DLP_FIRST_ARG_ID
The ID number for the first argument in any DLP packet containing arguments.

hostSocket

public byte hostSocket
The socket being used by the host system for data I/O. This is typically set to 3, the Desktop Socket.

serverSocket

public byte serverSocket
The socket being used by the server (the handheld) for data I/O. This is typically set to 3, the Desktop Socket.
Constructor Detail

DLP_Packet

DLP_Packet(byte funcID,
           char error,
           byte[][] args)
Creates a new DLP Response Packet using the specified settings.
Parameters:
funcID - the function ID for this request packet.
the - error code to be associated with this response packet.
args - a 2-dimensional byte array containing the arguments for this packet.

DLP_Packet

DLP_Packet(byte funcID,
           byte[][] args)
Creates a new DLP Request Packet using the specified values.
Parameters:
funcID - the function ID for this request packet.
args - a 2-dimensional byte array containing the arguments for this packet.

DLP_Packet

DLP_Packet(byte funcID,
           byte[][] args,
           int argID)
Creates a new DLP Request Packet using the specified values.
Parameters:
funcID - the function ID for this request packet.
args - a 2-dimensional byte array containing the arguments for this packet.
argID - the ID value for the first argument in the set.
Method Detail

bytes2Packet

static DLP_Packet bytes2Packet(byte[] pkt)
Converts a byte array into a DLP packet object.
Parameters:
pkt - the byte array representing the packet.
Returns:
the DLP_Packet object for the input byte array.

getArgCount

int getArgCount()
Returns the number of arguments in this DLP Packet.
Returns:
the number of arguments in this DLP Packet.

getErrorCode

char getErrorCode()
Retreives the error code associated with this packet. Only response packets have an error code. If this object represents any other packet type, it will return 0 for NO ERROR.
Returns:
the error code associated with this packet.

getFunctionID

byte getFunctionID()
Retreives the function ID for this DLP packet.
Returns:
the function ID for this DLP packet.

getPacketType

boolean getPacketType()
Returns a boolean representing the packet type of this DLP packet.
Returns:
true if this packet is a Request Packet, false otherwise.

packet2Bytes

byte[] packet2Bytes()
Converts this packet to a byte array suitable for transmission.
Returns:
a byte array representing this packet.

readArgument

byte[] readArgument(int i)
Returns the data in the specified argument.
Parameters:
i - the index of the argument to read the data from.
Returns:
the byte array containing data in the specified argument.

toString

public java.lang.String toString()
Converts this packet into a human readable hex dump, suitable for tracing and debugging protocol issues.
Overrides:
toString in class java.lang.Object

jSyncManager

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