24 #include <interfaces/SoccerPenaltyInterface.h> 26 #include <core/exceptions/software.h> 68 SoccerPenaltyInterface::SoccerPenaltyInterface() : Interface()
70 data_size =
sizeof(SoccerPenaltyInterface_data_t);
72 data = (SoccerPenaltyInterface_data_t *)
data_ptr;
78 unsigned char tmp_hash[] = {0xa0, 0xa1, 0xf0, 0xc2, 0x4e, 0x8c, 0xd1, 0xe1, 0xaf, 0x46, 0x11, 0xe9, 0xa0, 0xc8, 0xaf, 0x5d};
83 SoccerPenaltyInterface::~SoccerPenaltyInterface()
115 data->penalty = new_penalty;
126 return data->remaining;
146 data->remaining = new_remaining;
154 if ( strncmp(
"SetPenaltyMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
158 "message type for this interface type.", type);
174 memcpy(data, oi->data,
sizeof(SoccerPenaltyInterface_data_t));
196 data_size =
sizeof(SetPenaltyMessage_data_t);
199 data = (SetPenaltyMessage_data_t *)
data_ptr;
201 data->penalty = ini_penalty;
207 data_size =
sizeof(SetPenaltyMessage_data_t);
210 data = (SetPenaltyMessage_data_t *)
data_ptr;
229 data = (SetPenaltyMessage_data_t *)
data_ptr;
241 return data->penalty;
261 data->penalty = new_penalty;
virtual void copy_values(const Interface *other)
Copy values from other interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
static const uint16_t SPL_PENALTY_ILLEGAL_DEFENDER
SPL_PENALTY_ILLEGAL_DEFENDER constant.
void * data_ptr
Pointer to memory that contains local data.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
~SetPenaltyMessage()
Destructor.
uint16_t remaining() const
Get remaining value.
void set_hash(unsigned char *ihash)
Set hash.
uint16_t penalty() const
Get penalty value.
SetPenaltyMessage()
Constructor.
Fawkes library namespace.
uint16_t penalty() const
Get penalty value.
void set_penalty(const uint16_t new_penalty)
Set penalty value.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
static const uint16_t SPL_PENALTY_PLAYING_WITH_HANDS
SPL_PENALTY_PLAYING_WITH_HANDS constant.
16 bit unsigned integer field
Base class for all Fawkes BlackBoard interfaces.
static const uint16_t SPL_PENALTY_NONE
SPL_PENALTY_NONE constant.
size_t maxlenof_remaining() const
Get maximum length of remaining value.
SoccerPenaltyInterface Fawkes BlackBoard Interface.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
SetPenaltyMessage Fawkes BlackBoard Interface Message.
void set_penalty(const uint16_t new_penalty)
Set penalty value.
static const uint16_t SPL_PENALTY_INACTIVE_PLAYER
SPL_PENALTY_INACTIVE_PLAYER constant.
virtual Message * create_message(const char *type) const
Create message based on type name.
void add_messageinfo(const char *name)
Add an entry to the message info list.
bool data_changed
Indicator if data has changed.
static const uint16_t SPL_PENALTY_LEAVING_THE_FIELD
SPL_PENALTY_LEAVING_THE_FIELD constant.
const char * type() const
Get type of interface.
static const uint16_t SPL_PENALTY_REQ_FOR_PICKUP
SPL_PENALTY_REQ_FOR_PICKUP constant.
size_t maxlenof_penalty() const
Get maximum length of penalty value.
static const uint16_t SPL_PENALTY_MANUAL
SPL_PENALTY_MANUAL constant.
void set_remaining(const uint16_t new_remaining)
Set remaining value.
static const uint16_t SPL_PENALTY_PLAYER_PUSHING
SPL_PENALTY_PLAYER_PUSHING constant.
virtual Message * clone() const
Clone this message.
static const uint16_t SPL_PENALTY_BALL_HOLDING
SPL_PENALTY_BALL_HOLDING constant.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
static const uint16_t SPL_PENALTY_OBSTRUCTION
SPL_PENALTY_OBSTRUCTION constant.
const char * type() const
Get message type.
size_t maxlenof_penalty() const
Get maximum length of penalty value.