Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Packet Class Reference

Inheritance diagram for Packet:
[legend]
List of all members.

Detailed Description

defines the data structure of a packet

Definition at line 10 of file Packet.h.

Public Types

enum  {
  IDLEN = 7,
  TIMELEN = 9,
  TYPELEN = 1,
  OVERHEAD = 2
}
 enumeration for generic packet data More...

enum  {
  END = 13,
  START = 58
}
 enumerations for the starts and ends of packets More...

enum  Type {
  HBEAT = 72,
  LOGIN = 76,
  JOYST = 74,
  NOSET = 0
}
 enumeration for the types of packets More...


Public Member Functions

virtual char getType ()
 get the type of the packet

virtual int getTime ()
 get the time the packet was registered if set to 0 it has not been registered

virtual int getID ()
 get the ID of the packet

virtual void setType (Type packetType)
 set the type of packet

virtual void registerPacket ()=0
 register the packet to be sent over the outNet

virtual int sendPacket (int fd)=0
 send the packet over the outNet or another file descritor

virtual void setTime ()
 set the time for the packet

virtual void setTime (int newTime)
 set the time for the packet

virtual void setID ()
 set the ID of the packet

virtual void setID (int newID)
 set the ID of the packet


Protected Attributes

char type
 type of packet

char cTime [TIMELEN]
 time packet was sent

char ID [IDLEN]
 the id of the packet


Member Enumeration Documentation

anonymous enum
 

enumeration for generic packet data

Enumeration values:
IDLEN  length of the id
TIMELEN  length of the time data
TYPELEN  type length
OVERHEAD  Packet overhead,.

Definition at line 15 of file Packet.h.

anonymous enum
 

enumerations for the starts and ends of packets

Enumeration values:
END  End character is a return carrage.
START  Start character is a ':'.

Definition at line 29 of file Packet.h.

enum Packet::Type
 

enumeration for the types of packets

Enumeration values:
HBEAT  Heart Beat packet 'H'.
LOGIN  LOGIN information 'L'.
JOYST  Joystick data 'J'.
NOSET  Type is not set.

Definition at line 38 of file Packet.h.


Member Function Documentation

virtual int Packet::getID  )  [virtual]
 

get the ID of the packet

Return values:
the packet ID

virtual int Packet::getTime  )  [virtual]
 

get the time the packet was registered if set to 0 it has not been registered

Return values:
the current time

virtual char Packet::getType  )  [virtual]
 

get the type of the packet

Return values:
the type of the packet

virtual int Packet::sendPacket int  fd  )  [pure virtual]
 

send the packet over the outNet or another file descritor

Parameters:
fd to write the packet to
Return values:
1 on success -1 on error

Implemented in HBeatPacket, JoystPacket, and LoginPacket.

virtual void Packet::setID int  newID  )  [virtual]
 

set the ID of the packet

Parameters:
newID to set the packet to

virtual void Packet::setTime int  newTime  )  [virtual]
 

set the time for the packet

Parameters:
newTime to set the time to

virtual void Packet::setType Type  packetType  )  [virtual]
 

set the type of packet

Parameters:
packetType to set the packet it


The documentation for this class was generated from the following file:
Generated on Fri Mar 25 23:48:46 2005 for CS498EmbeddedSystemsProgramming by doxygen 1.3.6