|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--dk.itu.haas.GPS.Garmin.GarminPacket
A class that encapsulates the basic functionality of a packet.
Field Summary | |
static int |
Cmnd_Abort_Transfer
Abort current transfer. |
static int |
Cmnd_Start_Pvt_Data
Start transmitting PVT (Position, velocity, time) Data. |
static int |
Cmnd_Stop_Pvt_Data
Stop transmitting PVT (Position, velocity, time) Data. |
static int |
Cmnd_Transfer_Alm
Transfer almanac. |
static int |
Cmnd_Transfer_Posn
Transfer position. |
static int |
Cmnd_Transfer_Prx
Transfer proximity waypoints. |
static int |
Cmnd_Transfer_Rte
Transfer routes. |
static int |
Cmnd_Transfer_Time
Transfer time. |
static int |
Cmnd_Transfer_Trk
Transfer track log. |
static int |
Cmnd_Transfer_Wpt
Transfer waypoints. |
static int |
Cmnd_Turn_Off_Pwr
Turn off power. |
static int |
DLE
Data link escape. |
static int |
ETX
End of text. |
protected int[] |
packet
The packet in byte-form. |
static int |
Pid_Ack_Byte
|
static int |
Pid_Command_Data
|
static int |
Pid_Date_Time_Data
|
static int |
Pid_Nak_Byte
|
static int |
Pid_Position_Data
|
static int |
Pid_Product_Data
|
static int |
Pid_Product_Rqst
|
static int |
Pid_Protocol_Array
|
static int |
Pid_Pvt_Data
|
static int |
Pid_Records
|
static int |
Pid_Wpt_Data
|
static int |
Pid_Xfer_Cmplt
|
Constructor Summary | |
GarminPacket(int[] p)
Creates a new GarminPacket with the contents of p. |
|
GarminPacket(int[] p,
boolean calcChecksum)
Creates a new GarminPacket with the contents of p. |
Method Summary | |
int |
calcChecksum()
Calculates the checksum for the packet. |
static GarminPacket |
createBasicPacket(int type,
int[] data)
This method is capable of making the data-packets from L000 (basic link protocol). |
static GarminPacket |
createCommandPacket(int type)
This is a factory-method capable of creating instances the commandpackets from A010. |
protected int |
getByte(int i)
Returns the packet-byte at position i. |
int |
getDataLength()
Returns the amount of bytes in the data-field of this packet. |
int |
getID()
Returns the ID (ie. type) of the packet. |
protected int |
getLength()
Returns the length of the entire packet in bytes. |
protected int[] |
getPacket()
Returns the packet in it's original byte-form. |
java.lang.String |
getRawPacket()
Debug-method. |
static java.lang.String |
idToString(int id)
Method that translates a packet-id into a human-readable string. |
int |
isLegal()
Checks if the packet is valid with regards to header, footer,data-field-length and checksum. |
protected short |
readByte(int packet_index)
Method that reads a Garmin-byte in the packet and returns it as a short. |
protected double |
readDouble(int packet_index)
Method that reads a Garmin-double in the packet and returns it as a double. |
protected float |
readFloat(int packet_index)
Method that reads a Garmin-float in the packet and returns it as a float. |
protected int |
readLong(int packet_index)
Method that reads a Garmin-long in the packet and returns it as an int. |
protected java.lang.String |
readNullTerminatedString(int packet_index)
Method that reads a null-terminated string. |
protected int |
readWord(int packet_index)
Method that reads a Garmin-word in the packet and returns it as an int. |
java.lang.String |
toString()
Returns a human-readable string with information to the packet's contents. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int Pid_Ack_Byte
public static final int Pid_Nak_Byte
public static final int Pid_Protocol_Array
public static final int Pid_Product_Rqst
public static final int Pid_Product_Data
public static final int Pid_Command_Data
public static final int Pid_Xfer_Cmplt
public static final int Pid_Date_Time_Data
public static final int Pid_Position_Data
public static final int Pid_Records
public static final int Pid_Wpt_Data
public static final int Pid_Pvt_Data
public static final int Cmnd_Abort_Transfer
public static final int Cmnd_Transfer_Alm
public static final int Cmnd_Transfer_Posn
public static final int Cmnd_Transfer_Prx
public static final int Cmnd_Transfer_Rte
public static final int Cmnd_Transfer_Time
public static final int Cmnd_Transfer_Trk
public static final int Cmnd_Transfer_Wpt
public static final int Cmnd_Turn_Off_Pwr
public static final int Cmnd_Start_Pvt_Data
public static final int Cmnd_Stop_Pvt_Data
public static final int DLE
public static final int ETX
protected int[] packet
Constructor Detail |
public GarminPacket(int[] p)
public GarminPacket(int[] p, boolean calcChecksum)
Method Detail |
public int calcChecksum()
public int getID()
public int getDataLength()
protected int getByte(int i)
protected int[] getPacket()
protected int getLength()
protected int readWord(int packet_index)
protected int readLong(int packet_index)
protected java.lang.String readNullTerminatedString(int packet_index)
public static java.lang.String idToString(int id)
public java.lang.String getRawPacket()
public static GarminPacket createCommandPacket(int type)
public static GarminPacket createBasicPacket(int type, int[] data)
public int isLegal()
protected short readByte(int packet_index)
protected double readDouble(int packet_index)
public java.lang.String toString()
toString
in class java.lang.Object
protected float readFloat(int packet_index)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |