00001 00002 /*************************************************************************** 00003 * refbox_state_writer.h - Fawkes RefBox state writer 00004 * 00005 * Created: Wed Apr 22 02:32:52 2009 00006 * Copyright 2009 Christpoh Schwering 00007 * 2008-2009 Tim Niemueller [www.niemueller.de] 00008 * 00009 ****************************************************************************/ 00010 00011 /* This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL file in the doc directory. 00022 */ 00023 00024 #ifndef __TOOLS_REFBOXREP_REFBOX_STATE_WRITER_H_ 00025 #define __TOOLS_REFBOXREP_REFBOX_STATE_WRITER_H_ 00026 00027 #include "refbox_state_sender.h" 00028 00029 #include <blackboard/remote.h> 00030 #include <interfaces/GameStateInterface.h> 00031 #include <netcomm/worldinfo/enums.h> 00032 00033 #include <vector> 00034 #include <string> 00035 #include <map> 00036 00037 class RefBoxStateBBWriter : public RefBoxStateSender 00038 { 00039 public: 00040 RefBoxStateBBWriter(std::vector<std::string> hosts, bool debug = false); 00041 virtual ~RefBoxStateBBWriter(); 00042 00043 virtual void send(); 00044 virtual void set_gamestate(int game_state, 00045 fawkes::worldinfo_gamestate_team_t state_team); 00046 virtual void set_score(unsigned int score_cyan, unsigned int score_magenta); 00047 virtual void set_team_goal(fawkes::worldinfo_gamestate_team_t our_team, 00048 fawkes::worldinfo_gamestate_goalcolor_t goal_color); 00049 virtual void set_half(fawkes::worldinfo_gamestate_half_t half); 00050 00051 private: 00052 void connect(const std::string &host); 00053 00054 unsigned int __counter; 00055 00056 std::map<fawkes::RemoteBlackBoard *, std::string> __rbbs; 00057 std::map<fawkes::RemoteBlackBoard *, fawkes::GameStateInterface *> __giss; 00058 00059 bool __debug; 00060 int __game_state; 00061 fawkes::worldinfo_gamestate_team_t __state_team; 00062 unsigned int __score_cyan; 00063 unsigned int __score_magenta; 00064 fawkes::worldinfo_gamestate_team_t __our_team; 00065 fawkes::worldinfo_gamestate_goalcolor_t __our_goal_color; 00066 fawkes::worldinfo_gamestate_half_t __half; 00067 }; 00068 00069 #endif