25 #include <blackboard/remote.h>
26 #include <interfaces/GameStateInterface.h>
27 #include <logging/logger.h>
51 unsigned short int bb_port,
52 const char * iface_id)
53 : name_(
"RBBRefBoxRep")
59 message_shown_ =
false;
61 bb_host_ = strdup(bb_host);
63 iface_id_ = strdup(iface_id);
69 "Could not connect to remote blackboard, "
80 rbb_->
close(gamestate_if_);
87 RemoteBlackBoardRefBoxProcessor::reconnect()
90 rbb_->
close(gamestate_if_);
112 gamestate_if_->
read();
122 logger_->
log_warn(name_,
"Processing BB data failed, exception follows");
134 message_shown_ =
false;
136 if (!message_shown_) {
137 logger_->
log_warn(name_,
"Reconnect failed, exception follows");
139 message_shown_ =
true;
RefBoxStateHandler * _rsh
Refbox state handler, set via set_handler()
virtual void set_gamestate(int game_state, fawkes::worldinfo_gamestate_team_t state_team)=0
Set current game state.
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.
virtual void set_score(unsigned int score_cyan, unsigned int score_magenta)=0
Set score.
virtual void set_half(fawkes::worldinfo_gamestate_half_t half, bool kickoff=false)=0
Set current half of the game time.
bool check_connection()
Check if the connection is alive and reconnect.
~RemoteBlackBoardRefBoxProcessor()
Destructor.
RemoteBlackBoardRefBoxProcessor(fawkes::Logger *logger, const char *bb_host, unsigned short int bb_port, const char *iface_id)
Constructor.
void refbox_process()
Process incoming refbox communication.
virtual bool is_alive() const =0
Check if the BlackBoard is still alive.
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for reading.
virtual void close(Interface *interface)=0
Close interface.
Base class for exceptions in Fawkes.
GameStateInterface Fawkes BlackBoard Interface.
if_gamestate_team_t our_team() const
Get our_team value.
uint32_t game_state() const
Get game_state value.
uint32_t score_cyan() const
Get score_cyan value.
if_gamestate_team_t state_team() const
Get state_team value.
bool is_kickoff() const
Get kickoff value.
if_gamestate_half_t half() const
Get half value.
uint32_t score_magenta() const
Get score_magenta value.
if_gamestate_goalcolor_t our_goal_color() const
Get our_goal_color value.
bool is_valid() const
Check validity of interface.
void read()
Read from BlackBoard into local copy.
virtual void log_warn(const char *component, const char *format,...)=0
Log warning message.
Fawkes library namespace.
worldinfo_gamestate_goalcolor_t
Goal color.
worldinfo_gamestate_half_t
Game time half.
worldinfo_gamestate_team_t
Team.