24 #include <interfaces/GameStateInterface.h> 26 #include <core/exceptions/software.h> 76 GameStateInterface::GameStateInterface() : Interface()
78 data_size =
sizeof(GameStateInterface_data_t);
80 data = (GameStateInterface_data_t *)
data_ptr;
95 unsigned char tmp_hash[] = {0xf5, 0x19, 0x26, 0x77, 0x6, 0x54, 0x44, 0xb4, 0xe1, 0x61, 0x40, 0x2a, 0x65, 0xfc, 0xaf, 0xa1};
100 GameStateInterface::~GameStateInterface()
116 default:
return "UNKNOWN";
129 default:
return "UNKNOWN";
142 default:
return "UNKNOWN";
153 case ROLE_GOALIE:
return "ROLE_GOALIE";
154 case ROLE_DEFENDER:
return "ROLE_DEFENDER";
155 case ROLE_MID_LEFT:
return "ROLE_MID_LEFT";
156 case ROLE_MID_RIGHT:
return "ROLE_MID_RIGHT";
157 case ROLE_ATTACKER:
return "ROLE_ATTACKER";
158 default:
return "UNKNOWN";
169 return data->game_state;
189 data->game_state = new_game_state;
220 data->state_team = new_state_team;
251 data->our_team = new_our_team;
282 data->our_goal_color = new_our_goal_color;
313 data->half = new_half;
324 return data->kickoff;
344 data->kickoff = new_kickoff;
375 data->role = new_role;
386 return data->score_cyan;
406 data->score_cyan = new_score_cyan;
417 return data->score_magenta;
437 data->score_magenta = new_score_magenta;
445 if ( strncmp(
"SetTeamColorMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
447 }
else if ( strncmp(
"SetKickoffMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
449 }
else if ( strncmp(
"SetStateTeamMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
453 "message type for this interface type.", type);
469 memcpy(data, oi->data,
sizeof(GameStateInterface_data_t));
475 if (strcmp(enumtype,
"if_gamestate_team_t") == 0) {
478 if (strcmp(enumtype,
"if_gamestate_goalcolor_t") == 0) {
481 if (strcmp(enumtype,
"if_gamestate_half_t") == 0) {
484 if (strcmp(enumtype,
"if_gamestate_role_t") == 0) {
503 data_size =
sizeof(SetTeamColorMessage_data_t);
506 data = (SetTeamColorMessage_data_t *)
data_ptr;
508 data->our_team = ini_our_team;
514 data_size =
sizeof(SetTeamColorMessage_data_t);
517 data = (SetTeamColorMessage_data_t *)
data_ptr;
536 data = (SetTeamColorMessage_data_t *)
data_ptr;
568 data->our_team = new_our_team;
593 data_size =
sizeof(SetKickoffMessage_data_t);
596 data = (SetKickoffMessage_data_t *)
data_ptr;
598 data->kickoff = ini_kickoff;
604 data_size =
sizeof(SetKickoffMessage_data_t);
607 data = (SetKickoffMessage_data_t *)
data_ptr;
626 data = (SetKickoffMessage_data_t *)
data_ptr;
638 return data->kickoff;
658 data->kickoff = new_kickoff;
683 data_size =
sizeof(SetStateTeamMessage_data_t);
686 data = (SetStateTeamMessage_data_t *)
data_ptr;
688 data->state_team = ini_state_team;
694 data_size =
sizeof(SetStateTeamMessage_data_t);
697 data = (SetStateTeamMessage_data_t *)
data_ptr;
716 data = (SetStateTeamMessage_data_t *)
data_ptr;
748 data->state_team = new_state_team;
const char * tostring_if_gamestate_goalcolor_t(if_gamestate_goalcolor_t value) const
Convert if_gamestate_goalcolor_t constant to string.
~SetStateTeamMessage()
Destructor.
void set_state_team(const if_gamestate_team_t new_state_team)
Set state_team value.
void * data_ptr
Pointer to memory that contains local data.
static const uint32_t GS_FROZEN
GS_FROZEN constant.
size_t maxlenof_kickoff() const
Get maximum length of kickoff value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
if_gamestate_role_t role() const
Get role value.
void set_game_state(const uint32_t new_game_state)
Set game_state value.
void set_score_cyan(const uint32_t new_score_cyan)
Set score_cyan value.
static const uint32_t GS_DROP_BALL
GS_DROP_BALL constant.
size_t maxlenof_role() const
Get maximum length of role value.
size_t maxlenof_our_goal_color() const
Get maximum length of our_goal_color value.
void set_hash(unsigned char *ihash)
Set hash.
const char * type() const
Get message type.
if_gamestate_team_t state_team() const
Get state_team value.
void set_our_goal_color(const if_gamestate_goalcolor_t new_our_goal_color)
Set our_goal_color value.
SetStateTeamMessage()
Constructor.
No team, not team-specific.
static const uint32_t GS_THROW_IN
GS_THROW_IN constant.
size_t maxlenof_our_team() const
Get maximum length of our_team value.
Fawkes library namespace.
void set_state_team(const if_gamestate_team_t new_state_team)
Set state_team value.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
void set_our_team(const if_gamestate_team_t new_our_team)
Set our_team value.
const char * tostring_if_gamestate_half_t(if_gamestate_half_t value) const
Convert if_gamestate_half_t constant to string.
Base class for all Fawkes BlackBoard interfaces.
const char * tostring_if_gamestate_team_t(if_gamestate_team_t value) const
Convert if_gamestate_team_t constant to string.
void set_role(const if_gamestate_role_t new_role)
Set role value.
if_gamestate_goalcolor_t our_goal_color() const
Get our_goal_color value.
void set_kickoff(const bool new_kickoff)
Set kickoff value.
bool is_kickoff() const
Get kickoff value.
if_gamestate_role_t
Enumeration defining the different robot roles.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
static const uint32_t GS_SPL_READY
GS_SPL_READY constant.
void add_messageinfo(const char *name)
Add an entry to the message info list.
size_t maxlenof_state_team() const
Get maximum length of state_team value.
bool data_changed
Indicator if data has changed.
size_t maxlenof_half() const
Get maximum length of half value.
if_gamestate_team_t our_team() const
Get our_team value.
virtual Message * clone() const
Clone this message.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
static const uint32_t GS_SPL_PLAY
GS_SPL_PLAY constant.
SetTeamColorMessage()
Constructor.
SetTeamColorMessage Fawkes BlackBoard Interface Message.
static const uint32_t GS_FREE_KICK
GS_FREE_KICK constant.
size_t maxlenof_state_team() const
Get maximum length of state_team value.
size_t maxlenof_kickoff() const
Get maximum length of kickoff value.
if_gamestate_half_t
Enumeration defining the different teams.
static const uint32_t GS_SPL_FINISHED
GS_SPL_FINISHED constant.
if_gamestate_team_t our_team() const
Get our_team value.
if_gamestate_goalcolor_t
Enumeration defining the different teams.
size_t maxlenof_game_state() const
Get maximum length of game_state value.
static const uint32_t GS_KICK_OFF
GS_KICK_OFF constant.
~SetKickoffMessage()
Destructor.
SetKickoffMessage Fawkes BlackBoard Interface Message.
static const uint32_t GS_PLAY
GS_PLAY constant.
virtual Message * clone() const
Clone this message.
static const uint32_t GS_HALF_TIME
GS_HALF_TIME constant.
SetStateTeamMessage Fawkes BlackBoard Interface Message.
virtual void copy_values(const Interface *other)
Copy values from other interface.
const char * tostring_if_gamestate_role_t(if_gamestate_role_t value) const
Convert if_gamestate_role_t constant to string.
if_gamestate_team_t state_team() const
Get state_team value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_score_cyan() const
Get maximum length of score_cyan value.
SetKickoffMessage()
Constructor.
static const uint32_t GS_CORNER_KICK
GS_CORNER_KICK constant.
~SetTeamColorMessage()
Destructor.
virtual Message * create_message(const char *type) const
Create message based on type name.
GameStateInterface Fawkes BlackBoard Interface.
uint32_t game_state() const
Get game_state value.
static const uint32_t GS_GOAL_KICK
GS_GOAL_KICK constant.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0)
Add an entry to the info list.
size_t maxlenof_score_magenta() const
Get maximum length of score_magenta value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
void set_score_magenta(const uint32_t new_score_magenta)
Set score_magenta value.
if_gamestate_team_t
Enumeration defining the different teams.
if_gamestate_half_t half() const
Get half value.
bool is_kickoff() const
Get kickoff value.
uint32_t score_cyan() const
Get score_cyan value.
const char * type() const
Get type of interface.
static const uint32_t GS_SPL_SET
GS_SPL_SET constant.
static const uint32_t GS_SPL_INITIAL
GS_SPL_INITIAL constant.
32 bit unsigned integer field
field with interface specific enum type
uint32_t score_magenta() const
Get score_magenta value.
size_t maxlenof_our_team() const
Get maximum length of our_team value.
void set_kickoff(const bool new_kickoff)
Set kickoff value.
static const uint32_t GS_PENALTY
GS_PENALTY constant.
void set_half(const if_gamestate_half_t new_half)
Set half value.
void set_our_team(const if_gamestate_team_t new_our_team)
Set our_team value.