|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jwo.landserf.process.gps.garmin.GarminPacket
public class GarminPacket
Represents a packet of information sent to or from Garmin GPS. See Garmin Protocol Specification at www.garmin.com/support/commProtocol.html.
Field Summary | |
---|---|
static int |
APPLICATION_LAYER
Indicates an application layer packet (USB packets only). |
static int |
Cmnd_Abort_Transfer
Indicates A010 device command protocol id representing request to abort transfer. |
static int |
Cmnd_FlightBook_Transfer
Indicates A010 device command protocol id representing request to transfer flight records. |
static int |
Cmnd_Start_Pvt_Data
Indicates A010 device command protocol id representing request to start transmitting PVT (Position, velocity, time) data. |
static int |
Cmnd_Stop_Pvt_Data
Indicates A010 device command protocol id representing request to stop transmitting PVT (Position, velocity, time) data. |
static int |
Cmnd_Transfer_Alm
Indicates A010 device command protocol id representing request to transfer almanac. |
static int |
Cmnd_Transfer_Course_Laps
Indicates A010 device command protocol id representing request to transfer fitness course laps. |
static int |
Cmnd_Transfer_Course_Limits
Indicates A010 device command protocol id representing request to transfer fitness course limits. |
static int |
Cmnd_Transfer_Course_Points
Indicates A010 device command protocol id representing request to transfer fitness course points. |
static int |
Cmnd_Transfer_Course_Tracks
Indicates A010 device command protocol id representing request to transfer fitness course tracks. |
static int |
Cmnd_Transfer_Courses
Indicates A010 device command protocol id representing request to transfer fitness courses. |
static int |
Cmnd_Transfer_Fitness_User_Profile
Indicates A010 device command protocol id representing request to transfer fitness user profile. |
static int |
Cmnd_Transfer_Laps
Indicates A010 device command protocol id representing request to transfer fitness laps. |
static int |
Cmnd_Transfer_Posn
Indicates A010 device command protocol id representing request to transfer position. |
static int |
Cmnd_Transfer_Prx
Indicates A010 device command protocol id representing request to transfer proximity waypoints. |
static int |
Cmnd_Transfer_Rte
Indicates A010 device command protocol id representing request to rtansfer routes. |
static int |
Cmnd_Transfer_Runs
Indicates A010 device command protocol id representing request to transfer fitness runs. |
static int |
Cmnd_Transfer_Time
Indicates A010 device command protocol id representing request to transfer time data. |
static int |
Cmnd_Transfer_Trk
Indicates A010 device command protocol id representing request to transfer track log. |
static int |
Cmnd_Transfer_Workout_Limits
Indicates A010 device command protocol id representing request to transfer workout limits. |
static int |
Cmnd_Transfer_Workout_Occurrences
Indicates A010 device command protocol id representing request to transfer workout occurrences. |
static int |
Cmnd_Transfer_Workouts
Indicates A010 device command protocol id representing request to transfer workouts. |
static int |
Cmnd_Transfer_Wpt
Indicates A010 device command protocol id representing request to transfer waypoints. |
static int |
Cmnd_Transfer_Wpt_Cats
Indicates A010 device command protocol id representing request to transfer waypoint categories. |
static int |
Cmnd_Turn_Off_Pwr
Indicates A010 device command protocol id representing request to turn off power. |
static int |
DLE
Data link escape. |
static int |
ETX
End of text. |
static int |
Pid_Ack_Byte
Indicates successful serial transfer of a packet . |
static int |
Pid_Almanac_Data
Indicates L001 id representing almanac data. |
static int |
Pid_Command_Data
Indicates L001 id representing command data. |
static int |
Pid_Course
Indicates L001 id representing a course item. |
static int |
Pid_Course_CourseLimits
Indicates L001 id representing course limits. |
static int |
Pid_Course_Lap
Indicates L001 id representing a course lap item. |
static int |
Pid_Course_Point
Indicates L001 id representing a course point. |
static int |
Pid_Course_Trk_Data
Indicates L001 id representing course track data. |
static int |
Pid_Course_Trk_Hdr
Indicates L001 id representing a course track header. |
static int |
Pid_Data_Available
Indicates data are available for transfer. |
static int |
Pid_Date_Time_Data
Indicates L001 id representing date-time data. |
static int |
Pid_Ext_Product_Data
Indicates a basic packet containing extended product data. |
static int |
Pid_Fitness_User_Profile
Indicates L001 id representing a fitness profile item. |
static int |
Pid_FlightBook_Record
Indicates L001 id representing a flightbook record. |
static int |
Pid_Lap
Indicates L001 id representing a lap data item. |
static int |
Pid_Nak_Byte
Indicates a failed transfer of a serial packet. |
static int |
Pid_Position_Data
Indicates L001 id representing position data. |
static int |
Pid_Product_Data
Indicates a basic packet containing product data. |
static int |
Pid_Product_Rqst
Indicates a basic packet requesting device product information. |
static int |
Pid_Protocol_Array
Indicates a basic packet containing protocol availability. |
static int |
Pid_Prx_Wpt_Data
Indicates L001 id representing proximity waypoint data. |
static int |
Pid_Pvt_Data
Indicates L001 id representing position, velocity, time data. |
static int |
Pid_Records
Indicates L001 id representing record data. |
static int |
Pid_Rte_Hdr
Indicates L001 id representing route header. |
static int |
Pid_Rte_Link_Data
Indicates L001 id representing route link data. |
static int |
Pid_Rte_Wpt_Data
Indicates L001 id representing route waypoint data. |
static int |
Pid_Run
Indicates L001 id representing run data item. |
static int |
Pid_Session_Started
Indicates that a transfer session has started. |
static int |
Pid_Start_Session
Indicates the start of a GPS transfer session. |
static int |
Pid_Trk_Data
Indicates L001 id representing track data. |
static int |
Pid_Trk_Hdr
Indicates L001 id representing track header. |
static int |
Pid_Workout
Indicates L001 id representing a workout data item |
static int |
Pid_Workout_Limits
Indicates L001 id representing workout limits item (heart rate, climb etc.). |
static int |
Pid_WorkoutOccurrence
Indicates L001 id representing a workout occurrence item. |
static int |
Pid_Wpt_Cat
Indicates L001 id representing waypoint category item. |
static int |
Pid_Wpt_Data
Indicates L001 id representing waypoint data. |
static int |
Pid_Xfer_Cmplt
Indicates L001 id representing completed transfer. |
static float |
UNKNOWN_FLOAT
Indicates an an unsupported or unknown floating point value. |
static int |
USB_PROTOCOL_LAYER
Indicates a USB protocol layer packet (USB packets only). |
Constructor Summary | |
---|---|
GarminPacket(int connectionType)
Creates an empty packet. |
|
GarminPacket(int connectionType,
int[] packetBytes)
Creates a new GarminPacket with the given contents. |
|
GarminPacket(int connectionType,
int packetType,
int packetID,
int[] packetData)
Creates a new GarminPacket with the given contents. |
Method Summary | |
---|---|
static String |
commandToString(int command)
Reports the name of the given command ID. |
static GarminPacket |
createBasicPacket(int connectionType,
int basicType,
int[] data)
Factory method to create an instance of a basic packets from L000 (basic link protocol). |
static GarminPacket |
createCommandPacket(int connectionType,
int commandType)
Factory method to create an instance of a command packet from A010 (Device Command Protocol 1). |
int |
getChecksum()
Reports the checksum value currently stored in packet. |
int |
getConnectionType()
Reports the connection type associated with the packet. |
int[] |
getData()
Reports the packet data. |
int |
getDataLength()
Reports the number of bytes in the data field of this packet. |
int |
getID()
Reports the packet ID. |
String |
getRawPacketData()
Reports a text representation of the bytes in the packet data. |
int |
getType()
Reports the packet type. |
static String |
idToString(int id)
Reports the name of the given packet ID. |
protected short |
readDataByte(int pos)
Reads a single byte in the packet and returns it as a short. |
protected double |
readDataDouble(int pos)
Reads a Garmin 8-byte double value from the packet. |
protected float |
readDataFloat(int pos)
Reads a Garmin 4-byte float value from the packet. |
protected int |
readDataLong(int pos)
Reads a Garmin 4-byte word in the packet and returns it as an int. |
protected String |
readDataString(int pos)
Reads a null-terminated string at the given offset in the packet. |
protected int |
readDataWord(int pos)
Reads a Garmin 2-byte word from the data field of the packet and returns it as an integer. |
void |
setPacket(int packetType,
int packetID,
int[] packetData)
Sets the packet contents to the given given content. |
void |
setSerialPacket(int[] packetBytes)
Sets the packet contents based on the given serial content. |
String |
toString()
Reports a summary of the packet. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int Pid_Data_Available
public static final int Pid_Start_Session
public static final int Pid_Session_Started
public static final int Pid_Ack_Byte
public static final int Pid_Nak_Byte
public static final int Pid_Ext_Product_Data
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_Prx_Wpt_Data
public static final int Pid_Records
public static final int Pid_Rte_Hdr
public static final int Pid_Rte_Wpt_Data
public static final int Pid_Almanac_Data
public static final int Pid_Trk_Data
public static final int Pid_Wpt_Data
public static final int Pid_Pvt_Data
public static final int Pid_Rte_Link_Data
public static final int Pid_Trk_Hdr
public static final int Pid_FlightBook_Record
public static final int Pid_Lap
public static final int Pid_Wpt_Cat
public static final int Pid_Run
public static final int Pid_Workout
public static final int Pid_WorkoutOccurrence
public static final int Pid_Fitness_User_Profile
public static final int Pid_Workout_Limits
public static final int Pid_Course
public static final int Pid_Course_Lap
public static final int Pid_Course_Point
public static final int Pid_Course_Trk_Hdr
public static final int Pid_Course_Trk_Data
public static final int Pid_Course_CourseLimits
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 Cmnd_FlightBook_Transfer
public static final int Cmnd_Transfer_Laps
public static final int Cmnd_Transfer_Wpt_Cats
public static final int Cmnd_Transfer_Runs
public static final int Cmnd_Transfer_Workouts
public static final int Cmnd_Transfer_Workout_Occurrences
public static final int Cmnd_Transfer_Fitness_User_Profile
public static final int Cmnd_Transfer_Workout_Limits
public static final int Cmnd_Transfer_Courses
public static final int Cmnd_Transfer_Course_Laps
public static final int Cmnd_Transfer_Course_Points
public static final int Cmnd_Transfer_Course_Tracks
public static final int Cmnd_Transfer_Course_Limits
public static final int DLE
public static final int ETX
public static final int USB_PROTOCOL_LAYER
public static final int APPLICATION_LAYER
public static final float UNKNOWN_FLOAT
Constructor Detail |
---|
public GarminPacket(int connectionType)
connectionType
- Type of connection used to transfer packet.
Either GarminGPS.USB
or GarminGPS.SERIAL
.public GarminPacket(int connectionType, int[] packetBytes)
connectionType
- Type of connection used to transfer packet.
Either GarminGPS.USB
or GarminGPS.SERIAL
.packetBytes
- Contents to be placed in packet.
InvalidPacketException
- if packet is malformed.public GarminPacket(int connectionType, int packetType, int packetID, int[] packetData)
connectionType
- Type of connection used to transfer packet.
Either GarminGPS.USB
or GarminGPS.SERIAL
.packetType
- Type of Garmin packet (applies to USB packets only and should be one
of USB_PROTOCOL_LAYER
or APPLICATION_LAYER
).packetID
- Packet ID.packetData
- Packet data.
InvalidPacketException
- if packet is malformed.Method Detail |
---|
public void setPacket(int packetType, int packetID, int[] packetData)
packetType
- Type of Garmin packet (applies to USB packets only and should be one
of USB_PROTOCOL_LAYER
or APPLICATION_LAYER
).packetID
- Packet ID.packetData
- Packet data.
InvalidPacketException
- if packet is malformed.public void setSerialPacket(int[] packetBytes)
packetBytes
- Bytes representing entire serial packet.
InvalidPacketException
- if packet is malformed.public int getConnectionType()
GarminGPS.USB
or GarminGPS.SERIAL.
- Returns:
- Type connection associated with packet.
public int getType()
USB_PROTOCOL_LAYER
or APPLICATION_LAYER
.
public int getID()
public int getChecksum()
public int[] getData()
public int getDataLength()
protected int readDataWord(int pos)
pos
- Offset position in packet data field.
protected int readDataLong(int pos)
pos
- Offset position in packet data field.
protected short readDataByte(int pos)
pos
- Offset position in packet data field.
protected float readDataFloat(int pos)
pos
- Offset position in packet data field.
protected double readDataDouble(int pos)
pos
- Offset position in packet data field.
protected String readDataString(int pos)
pos
- Offset position in packet data field.
public String getRawPacketData()
public static GarminPacket createCommandPacket(int connectionType, int commandType)
type
can be one of the
following constants:
connectionType
- Type of connection used to transfer packet.
Either GarminGPS.USB
or GarminGPS.SERIAL
.commandType
- Type of command to create.
public static GarminPacket createBasicPacket(int connectionType, int basicType, int[] data)
type
should be one of the
following constants:
connectionType
- Type of connection used to transfer packet.
Either GarminGPS.USB
or GarminGPS.SERIAL
.basicType
- Type of basic packet to create.data
- Data that will be put in the data field of the packet.
public String toString()
toString
in class Object
public static String idToString(int id)
id
- ID to translate.
public static String commandToString(int command)
command
- Command ID to translate.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |