Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

packet.h

Go to the documentation of this file.
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000  
00004  *     Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
00005  *                      
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 /*
00024  * $Id: packet.h,v 1.2 2004/01/30 19:21:15 section314 Exp $
00025  *   GRASP version of the P2OS packet class.  this class has methods 
00026  *   for building, printing, sending and receiving GRASP Board packets.
00027  *
00028  */
00029 
00030 #ifndef _PACKET_H
00031 #define _PACKET_H
00032 
00033 #include <string.h>
00034 
00035 #define PACKET_LEN 12
00036 
00037 class GRASPPacket 
00038 {
00039  public:
00040   unsigned char packet[PACKET_LEN];
00041   unsigned int size;
00042   unsigned int retsize;
00043   void Print();
00044   void PrintHex();
00045   int Build(unsigned char command, unsigned char data);
00046   int Build(unsigned char command);
00047 
00048   int Send( int fd );
00049   int Receive( int fd,unsigned char command );
00050  
00051    bool operator!= ( GRASPPacket p ) {
00052     if ( size != p.size) return(true);
00053 
00054     if ( memcmp( packet, p.packet, size ) != 0 ) return (true);
00055 
00056     return(false);
00057   }
00058 };
00059 
00060 #endif

Generated on Tue May 3 14:15:35 2005 for Player by doxygen 1.3.6