Skip to content

Commit 34ed379

Browse files
author
Julián Bermúdez Ortega
authored
Fix references creation mode. (#60)
1 parent 35b03a7 commit 34ed379

3 files changed

Lines changed: 28 additions & 18 deletions

File tree

rmw_microxrcedds_c/src/rmw_node.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,21 @@ rmw_node_t * create_node(const char * name, const char * namespace_, size_t doma
8181
return NULL;
8282
}
8383
participant_req =
84-
uxr_buffer_create_participant_xml(&node_info->context->session, node_info->context->reliable_output,
84+
uxr_buffer_create_participant_xml(
85+
&node_info->context->session,
86+
node_info->context->reliable_output,
8587
node_info->participant_id, (uint16_t)domain_id, participant_xml, UXR_REPLACE);
8688
#elif defined(MICRO_XRCEDDS_USE_REFS)
8789
char profile_name[RMW_UXRCE_REF_BUFFER_LENGTH];
8890
if (!build_participant_profile(profile_name, sizeof(profile_name))) {
8991
RMW_SET_ERROR_MSG("failed to generate xml request for node creation");
9092
return NULL;
9193
}
92-
participant_req = uxr_buffer_create_participant_ref(&node_info->context->context->session,
94+
participant_req =
95+
uxr_buffer_create_participant_ref(
96+
&node_info->context->session,
9397
node_info->context->reliable_output,
94-
node_info->participant_id, domain_id, profile_name, UXR_REPLACE);
98+
node_info->participant_id, (uint16_t)domain_id, profile_name, UXR_REPLACE);
9599
#endif
96100
uint8_t status[1];
97101
uint16_t requests[] = {participant_req};

rmw_microxrcedds_c/src/rmw_publisher.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,17 @@ rmw_create_publisher(
148148
RMW_SET_ERROR_MSG("failed to generate xml request for publisher creation");
149149
goto fail;
150150
}
151-
publisher_req = uxr_buffer_create_publisher_xml(&custom_publisher->owner_node->context->session,
152-
custom_node->context->reliable_output, custom_publisher->publisher_id,
153-
custom_node->participant_id, xml_buffer, UXR_REPLACE);
151+
publisher_req = uxr_buffer_create_publisher_xml(
152+
&custom_publisher->owner_node->context->session,
153+
custom_node->context->reliable_output,
154+
custom_publisher->publisher_id,
155+
custom_node->participant_id, xml_buffer, UXR_REPLACE);
154156
#elif defined(MICRO_XRCEDDS_USE_REFS)
155-
// TODO(BORJA) Publisher by reference does not make sense
156-
// in current micro XRCE-DDS implementation.
157-
publisher_req = uxr_buffer_create_publisher_xml(custom_publisher->context->session,
158-
custom_node->context->reliable_output, custom_publisher->publisher_id,
159-
custom_node->participant_id, "", UXR_REPLACE);
157+
publisher_req = uxr_buffer_create_publisher_xml(
158+
&custom_publisher->owner_node->context->session,
159+
custom_node->context->reliable_output,
160+
custom_publisher->publisher_id,
161+
custom_node->participant_id, "", UXR_REPLACE);
160162
#endif
161163

162164
custom_publisher->datawriter_id = uxr_object_id(custom_node->id_gen++, UXR_DATAWRITER_ID);
@@ -170,17 +172,21 @@ rmw_create_publisher(
170172
}
171173

172174
datawriter_req = uxr_buffer_create_datawriter_xml(
173-
&custom_publisher->owner_node->context->session, custom_node->context->reliable_output, custom_publisher->datawriter_id,
175+
&custom_publisher->owner_node->context->session,
176+
custom_node->context->reliable_output,
177+
custom_publisher->datawriter_id,
174178
custom_publisher->publisher_id, xml_buffer, UXR_REPLACE);
175179
#elif defined(MICRO_XRCEDDS_USE_REFS)
176180
if (!build_datawriter_profile(topic_name, profile_name, sizeof(profile_name))) {
177181
RMW_SET_ERROR_MSG("failed to generate xml request for node creation");
178182
goto fail;
179183
}
180184

181-
datawriter_req = uxr_buffer_create_datawriter_ref(custom_publisher->context->session,
182-
custom_node->context->reliable_output, custom_publisher->datawriter_id,
183-
custom_publisher->publisher_id, profile_name, UXR_REPLACE);
185+
datawriter_req = uxr_buffer_create_datawriter_ref(
186+
&custom_publisher->owner_node->context->session,
187+
custom_node->context->reliable_output,
188+
custom_publisher->datawriter_id,
189+
custom_publisher->publisher_id, profile_name, UXR_REPLACE);
184190
#endif
185191

186192
rmw_publisher->data = custom_publisher;

rmw_microxrcedds_c/src/utils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ bool build_participant_profile(char profile_name[], size_t buffer_size)
333333

334334
bool build_topic_profile(const char * topic_name, char profile_name[], size_t buffer_size)
335335
{
336-
const char * const format = "%s_t";
336+
const char * const format = "%s__t";
337337
topic_name++;
338338
bool ret = false;
339339
int written = snprintf(profile_name, buffer_size, format, topic_name);
@@ -343,7 +343,7 @@ bool build_topic_profile(const char * topic_name, char profile_name[], size_t bu
343343

344344
bool build_datawriter_profile(const char * topic_name, char profile_name[], size_t buffer_size)
345345
{
346-
const char * const format = "%s_p";
346+
const char * const format = "%s__dw";
347347
topic_name++;
348348
bool ret = false;
349349
int written = snprintf(profile_name, buffer_size, format, topic_name);
@@ -353,7 +353,7 @@ bool build_datawriter_profile(const char * topic_name, char profile_name[], size
353353

354354
bool build_datareader_profile(const char * topic_name, char profile_name[], size_t buffer_size)
355355
{
356-
const char * const format = "%s_s";
356+
const char * const format = "%s__dr";
357357
topic_name++;
358358
bool ret = false;
359359
int written = snprintf(profile_name, buffer_size, format, topic_name);

0 commit comments

Comments
 (0)