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

JoystPacket Class Reference

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

Detailed Description

Packets for holding one directional command for the joystick.

Definition at line 12 of file JoystPacket.h.

Public Types

enum  {
  MOTORLEN = 1,
  SIGNLEN = 1,
  SPEEDLEN = 3,
  TOTLEN = SIGNLEN + MOTORLEN + SPEEDLEN + TIMELEN + TYPELEN
}
 enumeration for Joyst packet data More...


Public Member Functions

 JoystPacket ()
 Constructor for a new joystick packet.

 JoystPacket (char data[TOTLEN])
 Constructor for an incomming joystick packet.

 ~JoystPacket ()
 Destructor for the joystick packet.

void printPacket ()
 print out the packet

int setMotor (int newMotor)
 set the motor to controll

int setSpeed (int newSp)
 set the speed of the motor (sets the sign as well)

int getMotor ()
 get the motor

int getSpeed ()
 get the speed of the motor

virtual void registerPacket ()
 register the packet to be sent on the outgoing socket

virtual int sendPacket (int fd)
 set the packet over a file descriptor


Private Attributes

int motor
 the motor to control

char sign
 the sign of the speed

int speed
 the speed of the command


Member Enumeration Documentation

anonymous enum
 

enumeration for Joyst packet data

Enumeration values:
MOTORLEN  Length of the motor data.
SIGNLEN  Sign of the speed.
SPEEDLEN  Length of the speed data.
TOTLEN  Total length of a Joyst packet.

Definition at line 17 of file JoystPacket.h.


Member Function Documentation

int JoystPacket::getMotor  ) 
 

get the motor

Return values:
the motor

int JoystPacket::getSpeed  ) 
 

get the speed of the motor

Return values:
the speed

virtual int JoystPacket::sendPacket int  fd  )  [virtual]
 

set the packet over a file descriptor

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

Implements Packet.

int JoystPacket::setMotor int  newMotor  ) 
 

set the motor to controll

Parameters:
newMotor to set the motor to
Return values:
1 for success -1 for error

int JoystPacket::setSpeed int  newSp  ) 
 

set the speed of the motor (sets the sign as well)

Parameters:
newSp to set the speed to
Return values:
1 for success -1 for error


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