try { entity.enable(); } catch (DDS.Exception) { Console.WriteLine("***Error: failed to enable entity"); }
StatusMask status_changes_mask = entity.get_status_changes();
status_kind
was changed since the last time it was cleared. A plain communication status change is cleared when the status is read using the entity's get_<plain communication status>()
method. A read communication status change is cleared when the data is taken from the middleware via a TDataReader_take() call [see Changes in Status for details]. if (((int) status_changes_mask & (int) status_kind) != 0) { return true; } else { /* ... YES, status_kind changed ... */ return false; /* ... NO, status_kind did NOT change ... */ }
try { entity.get_qos(qos); } catch (DDS.Exception) { Console.WriteLine("***Error: failed to get qos"); }
// Change the desired qos policies // qos.policy.field = ...
try { entity.set_qos(qos); } catch (Retcode_ImmutablePolicy) { Console.WriteLine( "***Error: tried changing a policy that can only be" + " set at entity creation time"); } catch (Retcode_InconsistentPolicy) { Console.WriteLine( "***Error: tried changing a policy to a value inconsistent" + " with other policy settings"); } catch (DDS.Exception) { Console.WriteLine("***Error: some other failure"); }
Once an entity has been created, its listener and/or the statuses for which it is enabled can be manipulated as follows.
// ... methods defined by <Entity>Listener ... public class MyEntityListener : Listener { // ... methods defined by <Entity>Listener ... };
entity_listener = entity.get_listener();
status_kind
for the listener
enabled_status_list |= status_kind;
status_kind
for the listener
enabled_status_list &= ~status_kind;
entity_listener
using set_listener (abstract). Only enable the listener for the statuses specified by the enabled_status_list
. try { entity.set_listener(entity_listener, enabled_status_list); } catch (DDS.Exception) { Console.WriteLine("***Error: setting entity listener"); }
Once an entity has been created, the list of statuses for which the DDS_StatusCondition is triggered can be manipulated as follows.
entity
, a status_kind
, and the associated status_condition:
statuscondition = entity.get_statuscondition();
status_condition
enabled_status_list = statuscondition.get_enabled_statuses();
status_kind
is enabled for the status_condition
if (((int) enabled_status_list & (int) status_kind) != 0) { //... YES, status_kind is enabled ... } else { // ... NO, status_kind is NOT enabled ... }
status_kind
for the status_condition
try { statuscondition.set_enabled_statuses( (StatusMask) ((int) enabled_status_list | (int) status_kind)); } catch (DDS.Exception) { /* ... check for cause of failure */ }
status_kind
for the status_condition
try { statuscondition.set_enabled_statuses( (StatusMask) ((int) enabled_status_list & ~(int) status_kind)); } catch (DDS.Exception) { /* ... check for cause of failure */ }