Working with domain partcipants.
More...
Working with domain partcipants.
Working with domain participants.
Turning off auto-enable of newly created participant(s)
- Change the value of the ENTITY_FACTORY for the DDS::DomainParticipantFactory
DomainParticipantFactoryQos factory_qos =
new DomainParticipantFactoryQos();
try {
factory.get_qos(factory_qos);
} catch (DDS.Exception) {
Console.WriteLine(
"***Error: failed to get domain participant factory qos");
}
factory_qos.entity_factory.autoenable_created_entities = false;
try {
factory.set_qos(factory_qos);
} catch (DDS.Exception) {
Console.WriteLine(
"***Error: failed to set domain participant factory qos");
}
Getting the factory
- Get the DomainParticipantFactory instance:
DomainParticipantFactory factory =
DomainParticipantFactory.get_instance();
if (factory == null) {
Console.WriteLine(
"***Error: failed to get domain participant factory");
}
Setting up a participant
- Create DomainParticipant:
DomainParticipantQos participant_qos = new DomainParticipantQos();
DomainParticipantListener participant_listener = null;
String[] NDDS_DISCOVERY_INITIAL_PEERS = {
"host1",
"10.10.30.192",
"1@localhost",
"2@host2",
"my://",
"2@shmem://",
"FF00:ABCD::0",
"sf://0/0/R",
"1@FF00:0:1234::0",
"225.1.2.3",
"3@225.1.0.55",
"FAA0::0#0/0/R",
};
try {
factory.get_default_participant_qos(participant_qos);
} catch (DDS.Exception) {
Console.WriteLine(
"***Error: failed to get default participant qos");
}
participant_qos.discovery.initial_peers.from_array(
NDDS_DISCOVERY_INITIAL_PEERS);
DomainParticipant participant = factory.create_participant(
domain_id,
participant_qos,
participant_listener,
if (participant == null) {
Console.WriteLine(
"***Error: failed to create domain participant");
}
Tearing down a participant
- Delete DomainParticipant:
try {
factory.delete_participant(ref participant);
} catch (DDS.Exception) {
Console.WriteLine(
"***Error: failed to delete domain participant");
}