dk.itu.haas.GPS.Garmin
Class TimeDataPacket

java.lang.Object
  |
  +--dk.itu.haas.GPS.Garmin.GarminPacket
        |
        +--dk.itu.haas.GPS.Garmin.TimeDataPacket
All Implemented Interfaces:
IDate, ITime

public class TimeDataPacket
extends GarminPacket
implements ITime, IDate

This class encapsulates the information of a Garmin-Date-Time-packet.


Field Summary
protected  short day
          Day (1-31)
protected  int hour
          Hour of the day.
protected  short minute
          Minute of the hour.
protected  short month
          Month (1-12)
protected  short second
          Second of the minute.
protected  int year
          Year.
 
Fields inherited from class dk.itu.haas.GPS.Garmin.GarminPacket
Cmnd_Abort_Transfer, Cmnd_Start_Pvt_Data, Cmnd_Stop_Pvt_Data, Cmnd_Transfer_Alm, Cmnd_Transfer_Posn, Cmnd_Transfer_Prx, Cmnd_Transfer_Rte, Cmnd_Transfer_Time, Cmnd_Transfer_Trk, Cmnd_Transfer_Wpt, Cmnd_Turn_Off_Pwr, DLE, ETX, packet, Pid_Ack_Byte, Pid_Command_Data, Pid_Date_Time_Data, Pid_Nak_Byte, Pid_Position_Data, Pid_Product_Data, Pid_Product_Rqst, Pid_Protocol_Array, Pid_Pvt_Data, Pid_Records, Pid_Wpt_Data, Pid_Xfer_Cmplt
 
Constructor Summary
TimeDataPacket(GarminPacket p)
          Treats the packet p as a packet containing Time-data.
TimeDataPacket(int[] p)
          Treats the packet p as a packet containing Time-data.
 
Method Summary
 short getDay()
          Returns the day of the month.
 int getHours()
          Returns the hour of the day.
 short getMinutes()
          Returns the minute of the hour.
 short getMonth()
          Returns the month.
 short getSeconds()
          Returns the second of the minute.
 int getYear()
          returns the year.
 java.lang.String toString()
          Returns the value of this packet in a human-readable format.
 
Methods inherited from class dk.itu.haas.GPS.Garmin.GarminPacket
calcChecksum, createBasicPacket, createCommandPacket, getByte, getDataLength, getID, getLength, getPacket, getRawPacket, idToString, isLegal, readByte, readDouble, readFloat, readLong, readNullTerminatedString, readWord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

month

protected short month
Month (1-12)


day

protected short day
Day (1-31)


year

protected int year
Year.


hour

protected int hour
Hour of the day.


minute

protected short minute
Minute of the hour.


second

protected short second
Second of the minute.

Constructor Detail

TimeDataPacket

public TimeDataPacket(int[] p)
Treats the packet p as a packet containing Time-data. Throws PacketNotRecognizedException if p is not a Time-packet. Throws InvalidPacketException if the packet contains too little data.


TimeDataPacket

public TimeDataPacket(GarminPacket p)
Treats the packet p as a packet containing Time-data. Throws PacketNotRecognizedException if p is not a Time-packet. Throws InvalidPacketException if the packet contains too little data.

Method Detail

getDay

public short getDay()
Returns the day of the month.

Specified by:
getDay in interface IDate

getMonth

public short getMonth()
Returns the month.

Specified by:
getMonth in interface IDate

getYear

public int getYear()
returns the year.

Specified by:
getYear in interface IDate

getHours

public int getHours()
Returns the hour of the day.

Specified by:
getHours in interface ITime

getMinutes

public short getMinutes()
Returns the minute of the hour.

Specified by:
getMinutes in interface ITime

getSeconds

public short getSeconds()
Returns the second of the minute.

Specified by:
getSeconds in interface ITime

toString

public java.lang.String toString()
Returns the value of this packet in a human-readable format.

Overrides:
toString in class GarminPacket