Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Platform/Aperios1.3.2/DDPHandler.h

Go to the documentation of this file.
00001 /** 
00002 * @file  Platform/Aperios1.3.2/DDPHandler.h
00003 *
00004 * Handles the Dog Discovery Protocol (DDP) so that the robot
00005 * is able to find out the ip's of his teammates.
00006 *
00007 * @author <A href=mailto:robocup@m-wachter.de>Michael Wachter</A>
00008 */
00009 
00010 #ifndef _DDPHandler_H_
00011 #define _DDPHandler_H_
00012 
00013 #include "UDPEndpoint.h"
00014 #include "Tools/Player.h"
00015 
00016 /** 
00017   * @class DDPListEntry 
00018   * 
00019   * used to store the information of one discovered robot 
00020   */
00021 
00022 class DDPListEntry
00023 {
00024   public:
00025     IPAddress ip;  /**< The ip-address of the robot */
00026     Port port;     /**< port to send data to */
00027     unsigned long timeLastSeen; /**< Time when the last package from this robot was received */
00028 };
00029 
00030 
00031 /** @class DDPPackage
00032   * This class represents the data package which is send over the network
00033   */
00034 
00035 class DDPPackage
00036 {
00037    public:
00038       char teamIdentifier[16];  /**< a string discribing the team of the robot. 
00039                 Data is only send to robots with the same teamIdentifier and teamColor */
00040       Player::teamColor teamColor; /**< TeamColor of the Robot */
00041       Player::playerNumber playerNumber; /**< PlayerNumber of the Robot */
00042 };     
00043 
00044 /** @class DDPHandler 
00045   *
00046   * This class handles the Dog-Discovery-Protocol DDP. Its used to find out the IP-addresses of
00047   * the teammates and stors them in a list. This list is then used by the UDPHandler for the 
00048   * team-communication
00049   *
00050   */
00051 class DDPHandler : public UDPEndpoint
00052 {
00053   public:
00054     DDPHandler();
00055     ~DDPHandler() {} ;
00056     void initDDPHandler();  /**< does stuff which can only be done after aperios completly runs */
00057     void sendDDPPackage();  /**< sends a ddp-package. This is periodically called by the UDP-Handler */
00058     virtual void onReceive(void* data, int size);  /**< called by the framework if a package is recived on the DDP-Port */
00059 
00060   public:
00061     DDPListEntry list[Player::numOfPlayerNumbers-1]; /**< List of the other robots */
00062    
00063   private:
00064     DDPPackage thePackage; /**< Buffer for the DDPPackage to send **/
00065     unsigned long timeLastPackage; /**< Time when the last DDPPackage was send **/
00066 
00067 };
00068 
00069 
00070 #endif 
00071 
00072 /*
00073  *
00074  * Changelog :
00075  *
00076  * $Log: DDPHandler.h,v $
00077  * Revision 1.3  2004/09/12 20:10:47  wachter
00078  * Documentation-fixes
00079  *
00080  * Revision 1.2  2004/09/08 12:41:43  wachter
00081  * - Fixed some warnings
00082  * - Fixed some documentation in network-code
00083  *
00084  * Revision 1.1.1.1  2004/05/22 17:23:25  cvsadm
00085  * created new repository GT2004_WM
00086  *
00087  * Revision 1.3  2004/05/14 14:12:08  wachter
00088  * - Added communication support for 5 robots
00089  * - rewrote parts of team-communication to be faster and more stable
00090  *
00091  * Revision 1.2  2004/01/09 15:44:30  wachter
00092  * Worked on with the Dog-Discovery-Protocol
00093  *
00094  * Revision 1.1  2003/12/21 19:27:02  wachter
00095  * Added classes for Sender/Receiver over TCP and UDP.
00096  * ( PLEASE DO NOT USE THIS NOW ! )
00097  *
00098  *
00099  */

Generated on Thu Sep 23 19:57:34 2004 for GT2004 by doxygen 1.3.6