00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __TOOL_WORLDINFO_VIEWER_BACKEND_THREAD_H_
00024 #define __TOOL_WORLDINFO_VIEWER_BACKEND_THREAD_H_
00025
00026 #include <netcomm/worldinfo/handler.h>
00027 #include <netcomm/utils/resolver.h>
00028 #include <netcomm/dns-sd/avahi_thread.h>
00029 #include <core/threading/thread.h>
00030
00031 #include <gtkmm.h>
00032 #include <string>
00033
00034 namespace fawkes {
00035 class WorldInfoTransceiver;
00036 class WorldInfoDataContainer;
00037 }
00038
00039 class WorldInfoViewerBackendThread
00040 : public fawkes::Thread,
00041 public fawkes::WorldInfoHandler
00042 {
00043 public:
00044 WorldInfoViewerBackendThread( fawkes::WorldInfoDataContainer* data_container,
00045 const char* addr, unsigned short port,
00046 const char* key, const char* iv );
00047
00048 virtual ~WorldInfoViewerBackendThread();
00049
00050 Glib::Dispatcher& new_worldinfo_data();
00051 Glib::Dispatcher& new_gamestate_data();
00052
00053
00054 void loop();
00055
00056
00057 virtual void pose_rcvd( const char *from_host,
00058 float x, float y, float theta,
00059 float *covariance );
00060
00061 virtual void velocity_rcvd( const char *from_host, float vel_x,
00062 float vel_y, float vel_theta, float *covariance );
00063
00064 virtual void ball_pos_rcvd( const char *from_host,
00065 bool visible, int visibility_history,
00066 float dist, float pitch, float yaw,
00067 float *covariance );
00068
00069 virtual void global_ball_pos_rcvd( const char *from_host,
00070 bool visible, int visibility_history,
00071 float x, float y, float z,
00072 float *covariance );
00073
00074 virtual void ball_velocity_rcvd( const char *from_host,
00075 float vel_x, float vel_y, float vel_z,
00076 float *covariance );
00077
00078 virtual void global_ball_velocity_rcvd(const char *from_host,
00079 float vel_x, float vel_y, float vel_z,
00080 float *covariance);
00081
00082 virtual void opponent_pose_rcvd( const char *from_host, unsigned int uid,
00083 float distance, float angle,
00084 float *covarianceconst );
00085
00086 virtual void opponent_disapp_rcvd( const char *from_host, unsigned int uid );
00087
00088 virtual void gamestate_rcvd( const char *from_host,
00089 unsigned int game_state,
00090 fawkes::worldinfo_gamestate_team_t state_team,
00091 unsigned int score_cyan, unsigned int score_magenta,
00092 fawkes::worldinfo_gamestate_team_t our_team,
00093 fawkes::worldinfo_gamestate_goalcolor_t our_goal_color,
00094 fawkes::worldinfo_gamestate_half_t half );
00095
00096 virtual void penalty_rcvd(const char *from_host,
00097 unsigned int player, unsigned int penalty,
00098 unsigned int seconds_remaining);
00099
00100 private:
00101 fawkes::WorldInfoTransceiver* m_transceiver;
00102 fawkes::WorldInfoDataContainer* m_data_container;
00103
00104 Glib::Dispatcher m_signal_new_worldinfo_data;
00105 Glib::Dispatcher m_signal_new_gamestate_data;
00106
00107 std::string m_addr;
00108 unsigned short m_port;
00109 std::string m_key;
00110 std::string m_iv;
00111
00112 fawkes::NetworkNameResolver* m_resolver;
00113 fawkes::AvahiThread* m_avahi;
00114
00115 };
00116
00117 #endif