24 #include <interfaces/DynamicReconfigureInterface.h>
26 #include <core/exceptions/software.h>
46 DynamicReconfigureInterface::DynamicReconfigureInterface() : Interface()
48 data_size =
sizeof(DynamicReconfigureInterface_data_t);
49 data_ptr = malloc(data_size);
50 data = (DynamicReconfigureInterface_data_t *)data_ptr;
51 data_ts = (interface_data_ts_t *)data_ptr;
52 memset(data_ptr, 0, data_size);
53 enum_map_LastMsgStatus[(int)Succeeded] =
"Succeeded";
54 enum_map_LastMsgStatus[(int)Failed] =
"Failed";
55 add_fieldinfo(IFT_STRING,
"last_service", 64, data->last_service);
56 add_fieldinfo(IFT_STRING,
"last_parameter", 64, data->last_parameter);
57 add_fieldinfo(IFT_BOOL,
"last_bool_value", 1, &data->last_bool_value);
58 add_fieldinfo(IFT_STRING,
"last_str_value", 64, data->last_str_value);
59 add_fieldinfo(IFT_UINT32,
"last_uint32_value", 1, &data->last_uint32_value);
60 add_fieldinfo(IFT_UINT64,
"last_uint64_value", 1, &data->last_uint64_value);
61 add_fieldinfo(IFT_FLOAT,
"last_float_value", 1, &data->last_float_value);
62 add_fieldinfo(IFT_UINT64,
"last_msg_id", 1, &data->last_msg_id);
63 add_fieldinfo(IFT_ENUM,
"last_msg_status", 1, &data->last_msg_status,
"LastMsgStatus", &enum_map_LastMsgStatus);
64 add_messageinfo(
"SetBoolMessage");
65 add_messageinfo(
"SetStringMessage");
66 add_messageinfo(
"SetUint32Message");
67 add_messageinfo(
"SetUint64Message");
68 add_messageinfo(
"SetFloatMessage");
69 unsigned char tmp_hash[] = {0xe2, 0xc2, 0x78, 0x4a, 0x9f, 0x90, 0x36, 0x57, 0xeb, 0x26, 0x9, 0xe0, 0xe8, 0x77, 0xcd, 0x9d};
74 DynamicReconfigureInterface::~DynamicReconfigureInterface()
83 DynamicReconfigureInterface::tostring_LastMsgStatus(
LastMsgStatus value)
const
86 case Succeeded:
return "Succeeded";
87 case Failed:
return "Failed";
88 default:
return "UNKNOWN";
97 DynamicReconfigureInterface::last_service()
const
99 return data->last_service;
107 DynamicReconfigureInterface::maxlenof_last_service()
const
117 DynamicReconfigureInterface::set_last_service(
const char * new_last_service)
119 data_changed |=
change_field(data->last_service, new_last_service);
127 DynamicReconfigureInterface::last_parameter()
const
129 return data->last_parameter;
137 DynamicReconfigureInterface::maxlenof_last_parameter()
const
147 DynamicReconfigureInterface::set_last_parameter(
const char * new_last_parameter)
149 data_changed |=
change_field(data->last_parameter, new_last_parameter);
157 DynamicReconfigureInterface::is_last_bool_value()
const
159 return data->last_bool_value;
167 DynamicReconfigureInterface::maxlenof_last_bool_value()
const
177 DynamicReconfigureInterface::set_last_bool_value(
const bool new_last_bool_value)
179 data_changed |=
change_field(data->last_bool_value, new_last_bool_value);
187 DynamicReconfigureInterface::last_str_value()
const
189 return data->last_str_value;
197 DynamicReconfigureInterface::maxlenof_last_str_value()
const
207 DynamicReconfigureInterface::set_last_str_value(
const char * new_last_str_value)
209 data_changed |=
change_field(data->last_str_value, new_last_str_value);
217 DynamicReconfigureInterface::last_uint32_value()
const
219 return data->last_uint32_value;
227 DynamicReconfigureInterface::maxlenof_last_uint32_value()
const
237 DynamicReconfigureInterface::set_last_uint32_value(
const uint32_t new_last_uint32_value)
239 data_changed |=
change_field(data->last_uint32_value, new_last_uint32_value);
247 DynamicReconfigureInterface::last_uint64_value()
const
249 return data->last_uint64_value;
257 DynamicReconfigureInterface::maxlenof_last_uint64_value()
const
267 DynamicReconfigureInterface::set_last_uint64_value(
const uint64_t new_last_uint64_value)
269 data_changed |=
change_field(data->last_uint64_value, new_last_uint64_value);
277 DynamicReconfigureInterface::last_float_value()
const
279 return data->last_float_value;
287 DynamicReconfigureInterface::maxlenof_last_float_value()
const
297 DynamicReconfigureInterface::set_last_float_value(
const float new_last_float_value)
299 data_changed |=
change_field(data->last_float_value, new_last_float_value);
307 DynamicReconfigureInterface::last_msg_id()
const
309 return data->last_msg_id;
317 DynamicReconfigureInterface::maxlenof_last_msg_id()
const
327 DynamicReconfigureInterface::set_last_msg_id(
const uint64_t new_last_msg_id)
329 data_changed |=
change_field(data->last_msg_id, new_last_msg_id);
337 DynamicReconfigureInterface::last_msg_status()
const
347 DynamicReconfigureInterface::maxlenof_last_msg_status()
const
357 DynamicReconfigureInterface::set_last_msg_status(
const LastMsgStatus new_last_msg_status)
359 data_changed |=
change_field(data->last_msg_status, new_last_msg_status);
364 DynamicReconfigureInterface::create_message(
const char *type)
const
366 if ( strncmp(
"SetBoolMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
368 }
else if ( strncmp(
"SetStringMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
370 }
else if ( strncmp(
"SetUint32Message", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
372 }
else if ( strncmp(
"SetUint64Message", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
374 }
else if ( strncmp(
"SetFloatMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
378 "message type for this interface type.", type);
387 DynamicReconfigureInterface::copy_values(
const Interface *other)
392 type(), other->
type());
394 memcpy(data, oi->data,
sizeof(DynamicReconfigureInterface_data_t));
398 DynamicReconfigureInterface::enum_tostring(
const char *enumtype,
int val)
const
400 if (strcmp(enumtype,
"LastMsgStatus") == 0) {
419 DynamicReconfigureInterface::SetBoolMessage::SetBoolMessage(
const char * ini_service,
const char * ini_parameter,
const bool ini_value) :
Message(
"SetBoolMessage")
421 data_size =
sizeof(SetBoolMessage_data_t);
424 data = (SetBoolMessage_data_t *)
data_ptr;
426 strncpy(data->service, ini_service, 64-1);
427 data->service[64-1] = 0;
428 strncpy(data->parameter, ini_parameter, 64-1);
429 data->parameter[64-1] = 0;
430 data->value = ini_value;
431 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
432 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
440 data_size =
sizeof(SetBoolMessage_data_t);
443 data = (SetBoolMessage_data_t *)
data_ptr;
445 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
446 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
466 data = (SetBoolMessage_data_t *)
data_ptr;
478 return data->service;
508 return data->parameter;
585 data_size =
sizeof(SetStringMessage_data_t);
588 data = (SetStringMessage_data_t *)
data_ptr;
590 strncpy(data->service, ini_service, 64-1);
591 data->service[64-1] = 0;
592 strncpy(data->parameter, ini_parameter, 64-1);
593 data->parameter[64-1] = 0;
594 strncpy(data->value, ini_value, 64-1);
595 data->value[64-1] = 0;
596 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
597 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
605 data_size =
sizeof(SetStringMessage_data_t);
608 data = (SetStringMessage_data_t *)
data_ptr;
610 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
611 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
631 data = (SetStringMessage_data_t *)
data_ptr;
643 return data->service;
673 return data->parameter;
750 data_size =
sizeof(SetUint32Message_data_t);
753 data = (SetUint32Message_data_t *)
data_ptr;
755 strncpy(data->service, ini_service, 64-1);
756 data->service[64-1] = 0;
757 strncpy(data->parameter, ini_parameter, 64-1);
758 data->parameter[64-1] = 0;
759 data->value = ini_value;
760 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
761 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
769 data_size =
sizeof(SetUint32Message_data_t);
772 data = (SetUint32Message_data_t *)
data_ptr;
774 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
775 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
795 data = (SetUint32Message_data_t *)
data_ptr;
807 return data->service;
837 return data->parameter;
914 data_size =
sizeof(SetUint64Message_data_t);
917 data = (SetUint64Message_data_t *)
data_ptr;
919 strncpy(data->service, ini_service, 64-1);
920 data->service[64-1] = 0;
921 strncpy(data->parameter, ini_parameter, 64-1);
922 data->parameter[64-1] = 0;
923 data->value = ini_value;
924 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
925 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
933 data_size =
sizeof(SetUint64Message_data_t);
936 data = (SetUint64Message_data_t *)
data_ptr;
938 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
939 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
959 data = (SetUint64Message_data_t *)
data_ptr;
971 return data->service;
1001 return data->parameter;
1078 data_size =
sizeof(SetFloatMessage_data_t);
1081 data = (SetFloatMessage_data_t *)
data_ptr;
1083 strncpy(data->service, ini_service, 64-1);
1084 data->service[64-1] = 0;
1085 strncpy(data->parameter, ini_parameter, 64-1);
1086 data->parameter[64-1] = 0;
1087 data->value = ini_value;
1088 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
1089 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
1097 data_size =
sizeof(SetFloatMessage_data_t);
1100 data = (SetFloatMessage_data_t *)
data_ptr;
1102 enum_map_LastMsgStatus[(int)
Succeeded] =
"Succeeded";
1103 enum_map_LastMsgStatus[(int)
Failed] =
"Failed";
1123 data = (SetFloatMessage_data_t *)
data_ptr;
1135 return data->service;
1165 return data->parameter;
Base class for all Fawkes BlackBoard interfaces.
const char * type() const
Get type of interface.
void * data_ptr
Pointer to local memory storage.
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.
@ IFT_UINT32
32 bit unsigned integer field
@ IFT_UINT64
64 bit unsigned integer field
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.
Timestamp data, must be present and first entries for each interface data structs!...