@@ -41,7 +41,8 @@ rmw_connextdds_graph_add_entityEA(
4141 const DDS_LivelinessQosPolicy * const liveliness,
4242 const DDS_LifespanQosPolicy * const lifespan,
4343 const bool is_reader,
44- const bool local);
44+ const bool local,
45+ const rosidl_type_hash_t * ser_type_hash = nullptr );
4546
4647static rmw_ret_t
4748rmw_connextdds_graph_remove_entityEA (
@@ -53,13 +54,15 @@ static rmw_ret_t
5354rmw_connextdds_graph_add_local_publisherEA (
5455 rmw_context_impl_t * const ctx,
5556 const rmw_node_t * const node,
56- RMW_Connext_Publisher * const pub);
57+ RMW_Connext_Publisher * const pub,
58+ const rosidl_type_hash_t * ser_type_hash = nullptr );
5759
5860static rmw_ret_t
5961rmw_connextdds_graph_add_local_subscriberEA (
6062 rmw_context_impl_t * const ctx,
6163 const rmw_node_t * const node,
62- RMW_Connext_Subscriber * const sub);
64+ RMW_Connext_Subscriber * const sub,
65+ const rosidl_type_hash_t * ser_type_hash = nullptr );
6366
6467rmw_ret_t
6568rmw_connextdds_graph_initialize (rmw_context_impl_t * const ctx)
@@ -431,7 +434,8 @@ rmw_ret_t
431434rmw_connextdds_graph_on_service_created (
432435 rmw_context_impl_t * const ctx,
433436 const rmw_node_t * const node,
434- RMW_Connext_Service * const svc)
437+ RMW_Connext_Service * const svc,
438+ const rosidl_type_hash_t * ser_type_hash)
435439{
436440 std::lock_guard<std::mutex> guard (ctx->common_mutex );
437441 const rmw_gid_t pub_gid = *svc->publisher ()->gid (),
@@ -454,14 +458,14 @@ rmw_connextdds_graph_on_service_created(
454458 });
455459
456460 rmw_ret_t rc = rmw_connextdds_graph_add_local_subscriberEA (
457- ctx, node, svc->subscriber ());
461+ ctx, node, svc->subscriber (), ser_type_hash );
458462 if (RMW_RET_OK != rc) {
459463 return rc;
460464 }
461465 // set it so that it can be removed in the `scope_exit_entities_reset`
462466 added_sub = true ;
463467
464- rc = rmw_connextdds_graph_add_local_publisherEA (ctx, node, svc->publisher ());
468+ rc = rmw_connextdds_graph_add_local_publisherEA (ctx, node, svc->publisher (), ser_type_hash );
465469 if (RMW_RET_OK != rc) {
466470 return rc;
467471 }
@@ -509,7 +513,8 @@ rmw_ret_t
509513rmw_connextdds_graph_on_client_created (
510514 rmw_context_impl_t * const ctx,
511515 const rmw_node_t * const node,
512- RMW_Connext_Client * const client)
516+ RMW_Connext_Client * const client,
517+ const rosidl_type_hash_t * ser_type_hash)
513518{
514519 std::lock_guard<std::mutex> guard (ctx->common_mutex );
515520 const rmw_gid_t pub_gid = *client->publisher ()->gid (),
@@ -532,13 +537,13 @@ rmw_connextdds_graph_on_client_created(
532537 });
533538
534539 rmw_ret_t rc = rmw_connextdds_graph_add_local_subscriberEA (
535- ctx, node, client->subscriber ());
540+ ctx, node, client->subscriber (), ser_type_hash );
536541 if (RMW_RET_OK != rc) {
537542 return rc;
538543 }
539544 added_sub = true ;
540545
541- rc = rmw_connextdds_graph_add_local_publisherEA (ctx, node, client->publisher ());
546+ rc = rmw_connextdds_graph_add_local_publisherEA (ctx, node, client->publisher (), ser_type_hash );
542547 if (RMW_RET_OK != rc) {
543548 return rc;
544549 }
@@ -666,7 +671,8 @@ rmw_connextdds_graph_add_entityEA(
666671 const DDS_LivelinessQosPolicy * const liveliness,
667672 const DDS_LifespanQosPolicy * const lifespan,
668673 const bool is_reader,
669- const bool local)
674+ const bool local,
675+ const rosidl_type_hash_t * ser_type_hash)
670676{
671677 UNUSED_ARG (local);
672678 rmw_gid_t gid;
@@ -723,7 +729,8 @@ rmw_connextdds_graph_add_entityEA(
723729 type_hash,
724730 dp_gid,
725731 qos_profile,
726- is_reader))
732+ is_reader,
733+ ser_type_hash))
727734 {
728735 // This is downgraded to a debug message because we might
729736 // enter this path when asserting entities from discovery.
@@ -755,7 +762,8 @@ rmw_ret_t
755762rmw_connextdds_graph_add_local_publisherEA (
756763 rmw_context_impl_t * const ctx,
757764 const rmw_node_t * const node,
758- RMW_Connext_Publisher * const pub)
765+ RMW_Connext_Publisher * const pub,
766+ const rosidl_type_hash_t * ser_type_hash)
759767{
760768 UNUSED_ARG (node);
761769 RMW_CONNEXT_LOG_DEBUG_A (
@@ -820,14 +828,16 @@ rmw_connextdds_graph_add_local_publisherEA(
820828 nullptr /* Micro doesn't support LifespanQosPolicy */ ,
821829#endif /* RMW_CONNEXT_DDS_API */
822830 false /* is_reader */ ,
823- true /* local */ );
831+ true /* local */ ,
832+ ser_type_hash);
824833}
825834
826835rmw_ret_t
827836rmw_connextdds_graph_add_local_subscriberEA (
828837 rmw_context_impl_t * const ctx,
829838 const rmw_node_t * const node,
830- RMW_Connext_Subscriber * const sub)
839+ RMW_Connext_Subscriber * const sub,
840+ const rosidl_type_hash_t * ser_type_hash)
831841{
832842 UNUSED_ARG (node);
833843 RMW_CONNEXT_LOG_DEBUG_A (
@@ -888,7 +898,8 @@ rmw_connextdds_graph_add_local_subscriberEA(
888898 &dr_qos.liveliness ,
889899 nullptr /* Lifespan is a writer-only qos policy */ ,
890900 true /* is_reader */ ,
891- true /* local */ );
901+ true /* local */ ,
902+ ser_type_hash);
892903}
893904
894905rmw_ret_t
@@ -932,6 +943,13 @@ rmw_connextdds_graph_add_remote_entity(
932943 // We handled the error, so clear it out
933944 rmw_reset_error ();
934945 }
946+ rosidl_type_hash_t ser_type_hash;
947+ rosidl_type_hash_t * ser_type_hash_ptr = nullptr ;
948+ if (RMW_RET_OK == rmw_dds_common::parse_sertype_hash_from_user_data (
949+ reinterpret_cast <const uint8_t *>(user_data_data), user_data_size, ser_type_hash))
950+ {
951+ ser_type_hash_ptr = &ser_type_hash;
952+ }
935953
936954 rmw_ret_t rc = rmw_connextdds_graph_add_entityEA (
937955 ctx,
@@ -947,7 +965,8 @@ rmw_connextdds_graph_add_remote_entity(
947965 liveliness,
948966 lifespan,
949967 is_reader,
950- false /* local */ );
968+ false /* local */ ,
969+ ser_type_hash_ptr);
951970 if (RMW_RET_OK != rc) {
952971 return rc;
953972 }
0 commit comments