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 #include "LocalDefinitions.h" 00016 00017 class DDPListEntry 00018 { 00019 public: 00020 IPAddress ip; 00021 Port port; 00022 unsigned long timeLastSeen; 00023 }; 00024 00025 class DDPPackage 00026 { 00027 public: 00028 char teamIdentifier[16]; 00029 Player::teamColor teamColor; 00030 Player::playerNumber playerNumber; 00031 #ifdef DDPwithBATTERIESTATUS 00032 unsigned char batterieStatus; 00033 #endif 00034 }; 00035 00036 class DDPHandler : public UDPEndpoint 00037 { 00038 public: 00039 DDPHandler(); 00040 ~DDPHandler() {} ; 00041 void initDDPHandler(); 00042 00043 void updateDDPList(); /* ka ob ich das wirklich brauch */ 00044 IPAddress getIPAddress(int number); 00045 00046 void sendDDPPackage(); 00047 bool activeTeamMembers(); 00048 00049 virtual void onReceive(void* data, int size); 00050 00051 public: 00052 DDPListEntry list[Player::numOfPlayerNumbers-1]; 00053 char teamIdentifier[16]; 00054 00055 private: 00056 DDPPackage thePackage; 00057 unsigned long timeLastPackage; 00058 00059 }; 00060 00061 00062 #endif
1.3.6