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


p2os_driver
Author(s): Hunter Allen , David Feil-Seifer , Aris Synodinos , Brian Gerkey, Kasper Stoy, Richard Vaughan, Andrew Howard, Tucker Hermans, ActivMedia Robotics LLC, MobileRobots Inc.
autogenerated on Mon Oct 6 2014 03:12:45