24 #include <interfaces/HardwareModelsInterface.h>
26 #include <core/exceptions/software.h>
46 HardwareModelsInterface::HardwareModelsInterface() : Interface()
48 data_size =
sizeof(HardwareModelsInterface_data_t);
49 data_ptr = malloc(data_size);
50 data = (HardwareModelsInterface_data_t *)data_ptr;
51 data_ts = (interface_data_ts_t *)data_ptr;
52 memset(data_ptr, 0, data_size);
53 add_fieldinfo(IFT_STRING,
"error", 1024, data->error);
54 add_fieldinfo(IFT_BOOL,
"busy", 1, &data->busy);
55 add_messageinfo(
"StateChangeMessage");
56 unsigned char tmp_hash[] = {0x55, 0xa2, 0xe2, 0xba, 0xd2, 0x11, 0xbc, 0x8, 0x8c, 0x21, 0xe, 0x9d, 0xaf, 0x39, 0x8f, 0xf2};
61 HardwareModelsInterface::~HardwareModelsInterface()
71 HardwareModelsInterface::error()
const
81 HardwareModelsInterface::maxlenof_error()
const
91 HardwareModelsInterface::set_error(
const char * new_error)
93 set_field(data->error, new_error);
101 HardwareModelsInterface::is_busy()
const
111 HardwareModelsInterface::maxlenof_busy()
const
121 HardwareModelsInterface::set_busy(
const bool new_busy)
123 set_field(data->busy, new_busy);
128 HardwareModelsInterface::create_message(
const char *type)
const
130 if ( strncmp(
"StateChangeMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
134 "message type for this interface type.", type);
143 HardwareModelsInterface::copy_values(
const Interface *other)
148 type(), other->
type());
150 memcpy(data, oi->data,
sizeof(HardwareModelsInterface_data_t));
154 HardwareModelsInterface::enum_tostring(
const char *enumtype,
int val)
const
171 HardwareModelsInterface::StateChangeMessage::StateChangeMessage(
const char * ini_component,
const char * ini_transition) :
Message(
"StateChangeMessage")
173 data_size =
sizeof(StateChangeMessage_data_t);
176 data = (StateChangeMessage_data_t *)
data_ptr;
178 strncpy(data->component, ini_component, 1024-1);
179 data->component[1024-1] = 0;
180 strncpy(data->transition, ini_transition, 1024-1);
181 data->transition[1024-1] = 0;
188 data_size =
sizeof(StateChangeMessage_data_t);
191 data = (StateChangeMessage_data_t *)
data_ptr;
211 data = (StateChangeMessage_data_t *)
data_ptr;
223 return data->component;
243 set_field(data->component, new_component);
253 return data->transition;
273 set_field(data->transition, new_transition);
StateChangeMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
char * component() const
Get component value.
void set_component(const char *new_component)
Set component value.
void set_transition(const char *new_transition)
Set transition value.
~StateChangeMessage()
Destructor.
char * transition() const
Get transition value.
size_t maxlenof_transition() const
Get maximum length of transition value.
StateChangeMessage()
Constructor.
size_t maxlenof_component() const
Get maximum length of component value.
HardwareModelsInterface Fawkes BlackBoard Interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Base class for all Fawkes BlackBoard interfaces.
const char * type() const
Get type of interface.
void * data_ptr
Pointer to local memory storage.
void set_field(FieldT &field, DataT &data)
Set a field, set data_changed to true and update data_changed accordingly.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
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.
void * data_ptr
Pointer to memory that contains local data.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
Fawkes library namespace.
Timestamp data, must be present and first entries for each interface data structs!...