11#include " shape_micro.h"
22#include " shape_microSupport.h"
33
4- #ifndef rti_me_cpp_hxx
5- #include "rti_me_cpp.hxx"
6- #endif
4+ #include " rti_me_cpp.hxx"
5+ #include " dds_cpp/dds_cpp_netio.hxx"
6+
7+ #include < map>
8+ #include < cstring>
79
810#define CONFIGURE_PARTICIPANT_FACTORY config_micro ();
911#define LISTENER_STATUS_MASK_ALL (DDS_STATUS_MASK_ALL)
1618 #define XCDR2_DATA_REPRESENTATION DDS_XCDR2_DATA_REPRESENTATION
1719#endif
1820
21+ #ifndef PresentationQosPolicyAccessScopeKind
22+ #define PresentationQosPolicyAccessScopeKind DDS_PresentationQosPolicyAccessScopeKind
23+ #endif
24+
25+ #ifndef INSTANCE_PRESENTATION_QOS
26+ #define INSTANCE_PRESENTATION_QOS DDS_INSTANCE_PRESENTATION_QOS
27+ #endif
28+
29+ #ifndef TOPIC_PRESENTATION_QOS
30+ #define TOPIC_PRESENTATION_QOS DDS_TOPIC_PRESENTATION_QOS
31+ #endif
32+
33+ #ifndef GROUP_PRESENTATION_QOS
34+ #define GROUP_PRESENTATION_QOS DDS_GROUP_PRESENTATION_QOS
35+ #endif
36+
37+
1938#define DataRepresentationId_t DDS_DataRepresentationId_t
2039#define DataRepresentationIdSeq DDS_DataRepresentationIdSeq
2140
@@ -106,7 +125,13 @@ static void config_micro()
106125 return ;
107126 }
108127
109- udp_property -> allow_interface [0 ] = DDS_String_dup ("lo" );
128+ #if defined(RTI_LINUX)
129+ udp_property->allow_interface [0 ] = DDS_String_dup (" lo" );
130+ printf (" Configured UDP to allow interface lo\n " );
131+ #elif defined(RTI_DARWIN)
132+ udp_property->allow_interface [0 ] = DDS_String_dup (" lo0" );
133+ printf (" Configured UDP to allow interface lo0\n " );
134+ #endif
110135 // udp_property->allow_interface[1] = DDS_String_dup("eth0");
111136
112137 if (!registry->register_component (
@@ -119,22 +144,73 @@ static void config_micro()
119144 return ;
120145 }
121146
122- DPDE ::DiscoveryPluginProperty discovery_plugin_properties ;
147+ DPDE::DiscoveryPluginProperty * discovery_plugin_properties = new DPDE::DiscoveryPluginProperty () ;
123148
124149 /* Configure properties */
125- discovery_plugin_properties . participant_liveliness_assert_period .sec = 5 ;
126- discovery_plugin_properties . participant_liveliness_assert_period .nanosec = 0 ;
127- discovery_plugin_properties . participant_liveliness_lease_duration .sec = 30 ;
128- discovery_plugin_properties . participant_liveliness_lease_duration .nanosec = 0 ;
150+ discovery_plugin_properties-> participant_liveliness_assert_period .sec = 5 ;
151+ discovery_plugin_properties-> participant_liveliness_assert_period .nanosec = 0 ;
152+ discovery_plugin_properties-> participant_liveliness_lease_duration .sec = 30 ;
153+ discovery_plugin_properties-> participant_liveliness_lease_duration .nanosec = 0 ;
129154
130155
131156 if (!registry->register_component (
132157 " dpde" ,
133158 DPDEDiscoveryFactory::get_interface (),
134- & discovery_plugin_properties . _parent ,
159+ &discovery_plugin_properties-> _parent ,
135160 NULL ))
136161 {
137162 printf (" ERROR: unable to register dpde\n " );
138163 return ;
139164 }
140165}
166+
167+ static bool configure_dp_qos (DDS::DomainParticipantQos &dp_qos)
168+ {
169+ if (!dp_qos.discovery .discovery .name .set_name (" dpde" ))
170+ {
171+ printf (" ERROR: unable to set discovery plugin name\n " );
172+ return false ;
173+ }
174+
175+ dp_qos.discovery .initial_peers .maximum (1 );
176+ dp_qos.discovery .initial_peers .length (1 );
177+ dp_qos.discovery .initial_peers [0 ] = DDS_String_dup (" 127.0.0.1" );
178+ /* if there are more remote or local endpoints, you need to increase these limits */
179+ dp_qos.resource_limits .max_destination_ports = 32 ;
180+ dp_qos.resource_limits .max_receive_ports = 32 ;
181+ dp_qos.resource_limits .local_topic_allocation = 2 ;
182+ dp_qos.resource_limits .local_type_allocation = 2 ;
183+ // TODO we need to increase this
184+ dp_qos.resource_limits .local_reader_allocation = 2 ;
185+ dp_qos.resource_limits .local_writer_allocation = 2 ;
186+ dp_qos.resource_limits .remote_participant_allocation = 8 ;
187+ dp_qos.resource_limits .remote_reader_allocation = 8 ;
188+ dp_qos.resource_limits .remote_writer_allocation = 8 ;
189+ return true ;
190+ }
191+
192+ uint64_t DDS_UInt8Seq_get_length (DDS_OctetSeq * seq)
193+ {
194+ return seq->length ();
195+ }
196+
197+ void DDS_UInt8Seq_ensure_length (DDS_OctetSeq * seq, uint64_t length, uint64_t max)
198+ {
199+ seq->ensure_length (length, max);
200+ }
201+
202+ unsigned char * DDS_UInt8Seq_get_reference (DDS_OctetSeq * seq, uint64_t index)
203+ {
204+ return DDS_OctetSeq_get_reference (seq, index);
205+ }
206+
207+ const unsigned char * DDS_UInt8Seq_get_reference (const DDS_OctetSeq * seq, uint64_t index)
208+ {
209+ return DDS_OctetSeq_get_reference (seq, index);
210+ }
211+
212+ struct InstanceHandle_t_less_op {
213+ bool operator ()(const DDS::InstanceHandle_t& a, const DDS::InstanceHandle_t& b) const {
214+ return std::memcmp (a.octet , b.octet , 16 );
215+ }
216+ };
0 commit comments