24 #include <logging/logger.h> 26 #include <blackboard/remote.h> 27 #include <interfaces/GameStateInterface.h> 52 unsigned short int bb_port,
54 : __name(
"RBBRefBoxRep")
58 __gamestate_if = NULL;
60 __message_shown =
false;
62 __bb_host = strdup(bb_host);
64 __iface_id = strdup(iface_id);
69 __logger->
log_warn(__name,
"Could not connect to remote blackboard, " 81 __rbb->
close(__gamestate_if);
89 RemoteBlackBoardRefBoxProcessor::reconnect()
92 __rbb->
close(__gamestate_if);
114 __gamestate_if->
read();
125 __logger->
log_warn(__name,
"Processing BB data failed, exception follows");
137 __message_shown =
false;
139 if (! __message_shown) {
140 __logger->
log_warn(__name,
"Reconnect failed, exception follows");
142 __message_shown =
true;
bool is_kickoff() const
Get kickoff value.
if_gamestate_team_t our_team() const
Get our_team value.
Fawkes library namespace.
virtual void set_gamestate(int game_state, fawkes::worldinfo_gamestate_team_t state_team)=0
Set current game state.
RefBoxStateHandler * _rsh
Refbox state handler, set via set_handler()
bool is_valid() const
Check validity of interface.
virtual void set_half(fawkes::worldinfo_gamestate_half_t half, bool kickoff=false)=0
Set current half of the game time.
worldinfo_gamestate_half_t
Game time half.
void refbox_process()
Process incoming refbox communication.
uint32_t score_cyan() const
Get score_cyan value.
Base class for exceptions in Fawkes.
virtual void set_score(unsigned int score_cyan, unsigned int score_magenta)=0
Set score.
void read()
Read from BlackBoard into local copy.
virtual bool is_alive() const =0
Check if the BlackBoard is still alive.
RemoteBlackBoardRefBoxProcessor(fawkes::Logger *logger, const char *bb_host, unsigned short int bb_port, const char *iface_id)
Constructor.
bool check_connection()
Check if the connection is alive and reconnect.
if_gamestate_goalcolor_t our_goal_color() const
Get our_goal_color value.
virtual void log_warn(const char *component, const char *format,...)=0
Log warning message.
if_gamestate_half_t half() const
Get half value.
if_gamestate_team_t state_team() const
Get state_team value.
worldinfo_gamestate_team_t
Team.
uint32_t game_state() const
Get game_state value.
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for reading.
GameStateInterface Fawkes BlackBoard Interface.
worldinfo_gamestate_goalcolor_t
Goal color.
virtual void set_team_goal(fawkes::worldinfo_gamestate_team_t our_team, fawkes::worldinfo_gamestate_goalcolor_t goal_color)=0
Set team and goal info.
uint32_t score_magenta() const
Get score_magenta value.
~RemoteBlackBoardRefBoxProcessor()
Destructor.
virtual void close(Interface *interface)=0
Close interface.