use enum with values log2(STATUS) for identifying status/listener
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
ba46cb1140
commit
54b5bed8d2
9 changed files with 103 additions and 71 deletions
|
@ -81,31 +81,47 @@ extern DDS_EXPORT const dds_entity_t DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION;
|
|||
/** @name Communication Status definitions
|
||||
@{**/
|
||||
/** Another topic exists with the same name but with different characteristics. */
|
||||
#define DDS_INCONSISTENT_TOPIC_STATUS 1u
|
||||
typedef enum dds_status_id {
|
||||
DDS_INCONSISTENT_TOPIC_STATUS_ID,
|
||||
DDS_OFFERED_DEADLINE_MISSED_STATUS_ID,
|
||||
DDS_REQUESTED_DEADLINE_MISSED_STATUS_ID,
|
||||
DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID,
|
||||
DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS_ID,
|
||||
DDS_SAMPLE_LOST_STATUS_ID,
|
||||
DDS_SAMPLE_REJECTED_STATUS_ID,
|
||||
DDS_DATA_ON_READERS_STATUS_ID,
|
||||
DDS_DATA_AVAILABLE_STATUS_ID,
|
||||
DDS_LIVELINESS_LOST_STATUS_ID,
|
||||
DDS_LIVELINESS_CHANGED_STATUS_ID,
|
||||
DDS_PUBLICATION_MATCHED_STATUS_ID,
|
||||
DDS_SUBSCRIPTION_MATCHED_STATUS_ID
|
||||
}
|
||||
dds_status_id_t;
|
||||
#define DDS_INCONSISTENT_TOPIC_STATUS (1u << DDS_INCONSISTENT_TOPIC_STATUS_ID)
|
||||
/** The deadline that the writer has committed through its deadline QoS policy was not respected for a specific instance. */
|
||||
#define DDS_OFFERED_DEADLINE_MISSED_STATUS 2u
|
||||
#define DDS_OFFERED_DEADLINE_MISSED_STATUS (1u << DDS_OFFERED_DEADLINE_MISSED_STATUS_ID)
|
||||
/** The deadline that the reader was expecting through its deadline QoS policy was not respected for a specific instance. */
|
||||
#define DDS_REQUESTED_DEADLINE_MISSED_STATUS 4u
|
||||
#define DDS_REQUESTED_DEADLINE_MISSED_STATUS (1u << DDS_REQUESTED_DEADLINE_MISSED_STATUS_ID)
|
||||
/** A QoS policy setting was incompatible with what was requested. */
|
||||
#define DDS_OFFERED_INCOMPATIBLE_QOS_STATUS 32u
|
||||
#define DDS_OFFERED_INCOMPATIBLE_QOS_STATUS (1u << DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID)
|
||||
/** A QoS policy setting was incompatible with what is offered. */
|
||||
#define DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS 64u
|
||||
#define DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS (1u << DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS_ID)
|
||||
/** A sample has been lost (never received). */
|
||||
#define DDS_SAMPLE_LOST_STATUS 128u
|
||||
#define DDS_SAMPLE_LOST_STATUS (1u << DDS_SAMPLE_LOST_STATUS_ID)
|
||||
/** A (received) sample has been rejected. */
|
||||
#define DDS_SAMPLE_REJECTED_STATUS 256u
|
||||
#define DDS_SAMPLE_REJECTED_STATUS (1u << DDS_SAMPLE_REJECTED_STATUS_ID)
|
||||
/** New information is available. */
|
||||
#define DDS_DATA_ON_READERS_STATUS 512u
|
||||
#define DDS_DATA_ON_READERS_STATUS (1u << DDS_DATA_ON_READERS_STATUS_ID)
|
||||
/** New information is available. */
|
||||
#define DDS_DATA_AVAILABLE_STATUS 1024u
|
||||
#define DDS_DATA_AVAILABLE_STATUS (1u << DDS_DATA_AVAILABLE_STATUS_ID)
|
||||
/** The liveliness that the DDS_DataWriter has committed through its liveliness QoS policy was not respected; thus readers will consider the writer as no longer "alive". */
|
||||
#define DDS_LIVELINESS_LOST_STATUS 2048u
|
||||
#define DDS_LIVELINESS_LOST_STATUS (1u << DDS_LIVELINESS_LOST_STATUS_ID)
|
||||
/** The liveliness of one or more writers, that were writing instances read through the readers has changed. Some writers have become "alive" or "not alive". */
|
||||
#define DDS_LIVELINESS_CHANGED_STATUS 4096u
|
||||
#define DDS_LIVELINESS_CHANGED_STATUS (1u << DDS_LIVELINESS_CHANGED_STATUS_ID)
|
||||
/** The writer has found a reader that matches the topic and has a compatible QoS. */
|
||||
#define DDS_PUBLICATION_MATCHED_STATUS 8192u
|
||||
#define DDS_PUBLICATION_MATCHED_STATUS (1u << DDS_PUBLICATION_MATCHED_STATUS_ID)
|
||||
/** The reader has found a writer that matches the topic and has a compatible QoS. */
|
||||
#define DDS_SUBSCRIPTION_MATCHED_STATUS 16384u
|
||||
#define DDS_SUBSCRIPTION_MATCHED_STATUS (1u << DDS_SUBSCRIPTION_MATCHED_STATUS_ID)
|
||||
/** @}*/
|
||||
|
||||
/** Read state for a data value */
|
||||
|
|
|
@ -80,7 +80,7 @@ inline dds_entity_kind_t dds_entity_kind_from_handle (dds_entity_t hdl) {
|
|||
|
||||
void dds_entity_status_signal (dds_entity *e);
|
||||
|
||||
void dds_entity_invoke_listener (const dds_entity *entity, uint32_t status, const void *vst);
|
||||
void dds_entity_invoke_listener (const dds_entity *entity, enum dds_status_id which, const void *vst);
|
||||
|
||||
_Check_return_ dds__retcode_t
|
||||
dds_valid_hdl(
|
||||
|
|
|
@ -424,71 +424,71 @@ dds_return_t dds_get_listener (dds_entity_t entity, dds_listener_t *listener)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void dds_entity_invoke_listener (const dds_entity *entity, uint32_t status, const void *vst)
|
||||
void dds_entity_invoke_listener (const dds_entity *entity, enum dds_status_id which, const void *vst)
|
||||
{
|
||||
struct dds_listener const * const lst = &entity->m_listener;
|
||||
switch (status)
|
||||
switch (which)
|
||||
{
|
||||
case DDS_INCONSISTENT_TOPIC_STATUS: {
|
||||
case DDS_INCONSISTENT_TOPIC_STATUS_ID: {
|
||||
struct dds_inconsistent_topic_status const * const st = vst;
|
||||
lst->on_inconsistent_topic (entity->m_hdl, *st, lst->on_inconsistent_topic_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_REQUESTED_DEADLINE_MISSED_STATUS: {
|
||||
case DDS_REQUESTED_DEADLINE_MISSED_STATUS_ID: {
|
||||
struct dds_requested_deadline_missed_status const * const st = vst;
|
||||
lst->on_requested_deadline_missed (entity->m_hdl, *st, lst->on_requested_deadline_missed_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS: {
|
||||
case DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS_ID: {
|
||||
struct dds_requested_incompatible_qos_status const * const st = vst;
|
||||
lst->on_requested_incompatible_qos (entity->m_hdl, *st, lst->on_requested_incompatible_qos_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_SAMPLE_LOST_STATUS: {
|
||||
case DDS_SAMPLE_LOST_STATUS_ID: {
|
||||
struct dds_sample_lost_status const * const st = vst;
|
||||
lst->on_sample_lost (entity->m_hdl, *st, lst->on_sample_lost_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_SAMPLE_REJECTED_STATUS: {
|
||||
case DDS_SAMPLE_REJECTED_STATUS_ID: {
|
||||
struct dds_sample_rejected_status const * const st = vst;
|
||||
lst->on_sample_rejected (entity->m_hdl, *st, lst->on_sample_rejected_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_LIVELINESS_CHANGED_STATUS: {
|
||||
case DDS_LIVELINESS_CHANGED_STATUS_ID: {
|
||||
struct dds_liveliness_changed_status const * const st = vst;
|
||||
lst->on_liveliness_changed (entity->m_hdl, *st, lst->on_liveliness_changed_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_SUBSCRIPTION_MATCHED_STATUS: {
|
||||
case DDS_SUBSCRIPTION_MATCHED_STATUS_ID: {
|
||||
struct dds_subscription_matched_status const * const st = vst;
|
||||
lst->on_subscription_matched (entity->m_hdl, *st, lst->on_subscription_matched_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_OFFERED_DEADLINE_MISSED_STATUS: {
|
||||
case DDS_OFFERED_DEADLINE_MISSED_STATUS_ID: {
|
||||
struct dds_offered_deadline_missed_status const * const st = vst;
|
||||
lst->on_offered_deadline_missed (entity->m_hdl, *st, lst->on_offered_deadline_missed_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_LIVELINESS_LOST_STATUS: {
|
||||
case DDS_LIVELINESS_LOST_STATUS_ID: {
|
||||
struct dds_liveliness_lost_status const * const st = vst;
|
||||
lst->on_liveliness_lost (entity->m_hdl, *st, lst->on_liveliness_lost_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_OFFERED_INCOMPATIBLE_QOS_STATUS: {
|
||||
case DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID: {
|
||||
struct dds_offered_incompatible_qos_status const * const st = vst;
|
||||
lst->on_offered_incompatible_qos (entity->m_hdl, *st, lst->on_offered_incompatible_qos_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_PUBLICATION_MATCHED_STATUS: {
|
||||
case DDS_PUBLICATION_MATCHED_STATUS_ID: {
|
||||
struct dds_publication_matched_status const * const st = vst;
|
||||
lst->on_publication_matched (entity->m_hdl, *st, lst->on_publication_matched_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_DATA_AVAILABLE_STATUS: {
|
||||
case DDS_DATA_AVAILABLE_STATUS_ID: {
|
||||
lst->on_data_available (entity->m_hdl, lst->on_data_available_arg);
|
||||
break;
|
||||
}
|
||||
case DDS_DATA_ON_READERS_STATUS: {
|
||||
case DDS_DATA_ON_READERS_STATUS_ID: {
|
||||
lst->on_data_on_readers (entity->m_hdl, lst->on_data_on_readers_arg);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -229,12 +229,13 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
}
|
||||
|
||||
struct dds_listener const * const lst = &entity->m_listener;
|
||||
enum dds_status_id status_id = (enum dds_status_id) data->raw_status_id;
|
||||
bool invoke = false;
|
||||
void *vst = NULL;
|
||||
int32_t *reset[2] = { NULL, NULL };
|
||||
|
||||
/* DATA_AVAILABLE is handled by dds_reader_data_available_cb */
|
||||
assert (data->status != DDS_DATA_AVAILABLE_STATUS);
|
||||
assert (status_id != DDS_DATA_AVAILABLE_STATUS_ID);
|
||||
|
||||
/* Serialize listener invocations -- it is somewhat sad to do this,
|
||||
but then it may also be unreasonable to expect the application to
|
||||
|
@ -251,8 +252,8 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
|
||||
/* Update status metrics. */
|
||||
dds_reader * const rd = (dds_reader *) entity;
|
||||
switch (data->status) {
|
||||
case DDS_REQUESTED_DEADLINE_MISSED_STATUS: {
|
||||
switch (status_id) {
|
||||
case DDS_REQUESTED_DEADLINE_MISSED_STATUS_ID: {
|
||||
struct dds_requested_deadline_missed_status * const st = vst = &rd->m_requested_deadline_missed_status;
|
||||
st->last_instance_handle = data->handle;
|
||||
st->total_count++;
|
||||
|
@ -261,7 +262,7 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[0] = &st->total_count_change;
|
||||
break;
|
||||
}
|
||||
case DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS: {
|
||||
case DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS_ID: {
|
||||
struct dds_requested_incompatible_qos_status * const st = vst = &rd->m_requested_incompatible_qos_status;
|
||||
st->total_count++;
|
||||
st->total_count_change++;
|
||||
|
@ -270,7 +271,7 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[0] = &st->total_count_change;
|
||||
break;
|
||||
}
|
||||
case DDS_SAMPLE_LOST_STATUS: {
|
||||
case DDS_SAMPLE_LOST_STATUS_ID: {
|
||||
struct dds_sample_lost_status * const st = vst = &rd->m_sample_lost_status;
|
||||
st->total_count++;
|
||||
st->total_count_change++;
|
||||
|
@ -278,7 +279,7 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[0] = &st->total_count_change;
|
||||
break;
|
||||
}
|
||||
case DDS_SAMPLE_REJECTED_STATUS: {
|
||||
case DDS_SAMPLE_REJECTED_STATUS_ID: {
|
||||
struct dds_sample_rejected_status * const st = vst = &rd->m_sample_rejected_status;
|
||||
st->total_count++;
|
||||
st->total_count_change++;
|
||||
|
@ -288,7 +289,7 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[0] = &st->total_count_change;
|
||||
break;
|
||||
}
|
||||
case DDS_LIVELINESS_CHANGED_STATUS: {
|
||||
case DDS_LIVELINESS_CHANGED_STATUS_ID: {
|
||||
struct dds_liveliness_changed_status * const st = vst = &rd->m_liveliness_changed_status;
|
||||
if (data->add) {
|
||||
st->alive_count++;
|
||||
|
@ -307,7 +308,7 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[1] = &st->not_alive_count_change;
|
||||
break;
|
||||
}
|
||||
case DDS_SUBSCRIPTION_MATCHED_STATUS: {
|
||||
case DDS_SUBSCRIPTION_MATCHED_STATUS_ID: {
|
||||
struct dds_subscription_matched_status * const st = vst = &rd->m_subscription_matched_status;
|
||||
if (data->add) {
|
||||
st->total_count++;
|
||||
|
@ -324,14 +325,20 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[1] = &st->current_count_change;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case DDS_DATA_ON_READERS_STATUS_ID:
|
||||
case DDS_DATA_AVAILABLE_STATUS_ID:
|
||||
case DDS_INCONSISTENT_TOPIC_STATUS_ID:
|
||||
case DDS_LIVELINESS_LOST_STATUS_ID:
|
||||
case DDS_PUBLICATION_MATCHED_STATUS_ID:
|
||||
case DDS_OFFERED_DEADLINE_MISSED_STATUS_ID:
|
||||
case DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID:
|
||||
assert (0);
|
||||
}
|
||||
|
||||
if (invoke)
|
||||
{
|
||||
os_mutexUnlock (&entity->m_observers_lock);
|
||||
dds_entity_invoke_listener(entity, data->status, vst);
|
||||
dds_entity_invoke_listener(entity, status_id, vst);
|
||||
os_mutexLock (&entity->m_observers_lock);
|
||||
*reset[0] = 0;
|
||||
if (reset[1])
|
||||
|
@ -339,7 +346,7 @@ void dds_reader_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
}
|
||||
else
|
||||
{
|
||||
dds_entity_status_set (entity, data->status);
|
||||
dds_entity_status_set (entity, 1u << status_id);
|
||||
}
|
||||
|
||||
entity->m_cb_count--;
|
||||
|
|
|
@ -644,7 +644,7 @@ static bool add_sample
|
|||
|
||||
if (rhc->reader && rhc->max_samples != DDS_LENGTH_UNLIMITED && rhc->n_vsamples >= (uint32_t) rhc->max_samples)
|
||||
{
|
||||
cb_data->status = DDS_SAMPLE_REJECTED_STATUS;
|
||||
cb_data->raw_status_id = (int) DDS_SAMPLE_REJECTED_STATUS_ID;
|
||||
cb_data->extra = DDS_REJECTED_BY_SAMPLES_LIMIT;
|
||||
cb_data->handle = inst->iid;
|
||||
cb_data->add = true;
|
||||
|
@ -655,7 +655,7 @@ static bool add_sample
|
|||
|
||||
if (rhc->reader && rhc->max_samples_per_instance != DDS_LENGTH_UNLIMITED && inst->nvsamples >= (uint32_t) rhc->max_samples_per_instance)
|
||||
{
|
||||
cb_data->status = DDS_SAMPLE_REJECTED_STATUS;
|
||||
cb_data->raw_status_id = (int) DDS_SAMPLE_REJECTED_STATUS_ID;
|
||||
cb_data->extra = DDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT;
|
||||
cb_data->handle = inst->iid;
|
||||
cb_data->add = true;
|
||||
|
@ -1108,7 +1108,7 @@ static rhc_store_result_t rhc_store_new_instance
|
|||
|
||||
if (rhc->reader && rhc->max_instances != DDS_LENGTH_UNLIMITED && rhc->n_instances >= (uint32_t) rhc->max_instances)
|
||||
{
|
||||
cb_data->status = DDS_SAMPLE_REJECTED_STATUS;
|
||||
cb_data->raw_status_id = (int) DDS_SAMPLE_REJECTED_STATUS_ID;
|
||||
cb_data->extra = DDS_REJECTED_BY_INSTANCES_LIMIT;
|
||||
cb_data->handle = tk->m_iid;
|
||||
cb_data->add = true;
|
||||
|
@ -1177,7 +1177,7 @@ bool dds_rhc_store
|
|||
|
||||
dummy_instance.iid = tk->m_iid;
|
||||
stored = RHC_FILTERED;
|
||||
cb_data.status = 0;
|
||||
cb_data.raw_status_id = -1;
|
||||
|
||||
os_mutexLock (&rhc->lock);
|
||||
|
||||
|
@ -1229,7 +1229,7 @@ bool dds_rhc_store
|
|||
}
|
||||
/* notify sample lost */
|
||||
|
||||
cb_data.status = DDS_SAMPLE_LOST_STATUS;
|
||||
cb_data.raw_status_id = (int) DDS_SAMPLE_LOST_STATUS_ID;
|
||||
cb_data.extra = 0;
|
||||
cb_data.handle = 0;
|
||||
cb_data.add = true;
|
||||
|
@ -1411,7 +1411,7 @@ error_or_nochange:
|
|||
|
||||
/* Make any reader status callback */
|
||||
|
||||
if (cb_data.status && rhc->reader && rhc->reader->m_entity.m_status_enable)
|
||||
if (cb_data.raw_status_id >= 0 && rhc->reader && rhc->reader->m_entity.m_status_enable)
|
||||
{
|
||||
os_atomic_inc32 (&rhc->n_cbs);
|
||||
dds_reader_status_cb (&rhc->reader->m_entity, &cb_data);
|
||||
|
|
|
@ -106,7 +106,7 @@ static void dds_topic_status_cb (struct dds_topic *tp)
|
|||
if (lst->on_inconsistent_topic)
|
||||
{
|
||||
os_mutexUnlock (&tp->m_entity.m_observers_lock);
|
||||
dds_entity_invoke_listener(&tp->m_entity, DDS_INCONSISTENT_TOPIC_STATUS, &tp->m_inconsistent_topic_status);
|
||||
dds_entity_invoke_listener(&tp->m_entity, DDS_INCONSISTENT_TOPIC_STATUS_ID, &tp->m_inconsistent_topic_status);
|
||||
os_mutexLock (&tp->m_entity.m_observers_lock);
|
||||
tp->m_inconsistent_topic_status.total_count_change = 0;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
}
|
||||
|
||||
struct dds_listener const * const lst = &entity->m_listener;
|
||||
enum dds_status_id status_id = (enum dds_status_id) data->raw_status_id;
|
||||
bool invoke = false;
|
||||
void *vst = NULL;
|
||||
int32_t *reset[2] = { NULL, NULL };
|
||||
|
@ -90,13 +91,13 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
|
||||
/* Reset the status for possible Listener call.
|
||||
* When a listener is not called, the status will be set (again). */
|
||||
dds_entity_status_reset (entity, data->status);
|
||||
dds_entity_status_reset (entity, 1u << status_id);
|
||||
|
||||
/* Update status metrics. */
|
||||
dds_writer * const wr = (dds_writer *) entity;
|
||||
switch (data->status)
|
||||
switch (status_id)
|
||||
{
|
||||
case DDS_OFFERED_DEADLINE_MISSED_STATUS: {
|
||||
case DDS_OFFERED_DEADLINE_MISSED_STATUS_ID: {
|
||||
struct dds_offered_deadline_missed_status * const st = vst = &wr->m_offered_deadline_missed_status;
|
||||
st->total_count++;
|
||||
st->total_count_change++;
|
||||
|
@ -105,7 +106,7 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[0] = &st->total_count_change;
|
||||
break;
|
||||
}
|
||||
case DDS_LIVELINESS_LOST_STATUS: {
|
||||
case DDS_LIVELINESS_LOST_STATUS_ID: {
|
||||
struct dds_liveliness_lost_status * const st = vst = &wr->m_liveliness_lost_status;
|
||||
st->total_count++;
|
||||
st->total_count_change++;
|
||||
|
@ -113,7 +114,7 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[0] = &st->total_count_change;
|
||||
break;
|
||||
}
|
||||
case DDS_OFFERED_INCOMPATIBLE_QOS_STATUS: {
|
||||
case DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID: {
|
||||
struct dds_offered_incompatible_qos_status * const st = vst = &wr->m_offered_incompatible_qos_status;
|
||||
st->total_count++;
|
||||
st->total_count_change++;
|
||||
|
@ -122,7 +123,7 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[0] = &st->total_count_change;
|
||||
break;
|
||||
}
|
||||
case DDS_PUBLICATION_MATCHED_STATUS: {
|
||||
case DDS_PUBLICATION_MATCHED_STATUS_ID: {
|
||||
struct dds_publication_matched_status * const st = vst = &wr->m_publication_matched_status;
|
||||
if (data->add) {
|
||||
st->total_count++;
|
||||
|
@ -139,14 +140,22 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
reset[1] = &st->current_count_change;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case DDS_DATA_AVAILABLE_STATUS_ID:
|
||||
case DDS_INCONSISTENT_TOPIC_STATUS_ID:
|
||||
case DDS_SAMPLE_LOST_STATUS_ID:
|
||||
case DDS_DATA_ON_READERS_STATUS_ID:
|
||||
case DDS_SAMPLE_REJECTED_STATUS_ID:
|
||||
case DDS_LIVELINESS_CHANGED_STATUS_ID:
|
||||
case DDS_SUBSCRIPTION_MATCHED_STATUS_ID:
|
||||
case DDS_REQUESTED_DEADLINE_MISSED_STATUS_ID:
|
||||
case DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS_ID:
|
||||
assert (0);
|
||||
}
|
||||
|
||||
if (invoke)
|
||||
{
|
||||
os_mutexUnlock (&entity->m_observers_lock);
|
||||
dds_entity_invoke_listener(entity, data->status, vst);
|
||||
dds_entity_invoke_listener(entity, status_id, vst);
|
||||
os_mutexLock (&entity->m_observers_lock);
|
||||
*reset[0] = 0;
|
||||
if (reset[1])
|
||||
|
@ -154,7 +163,7 @@ static void dds_writer_status_cb (void *ventity, const status_cb_data_t *data)
|
|||
}
|
||||
else
|
||||
{
|
||||
dds_entity_status_set (entity, data->status);
|
||||
dds_entity_status_set (entity, 1u << status_id);
|
||||
}
|
||||
|
||||
entity->m_cb_count--;
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef void (*ddsi2direct_directread_cb_t) (const struct nn_rsample_info *sampl
|
|||
|
||||
typedef struct status_cb_data
|
||||
{
|
||||
uint32_t status;
|
||||
int raw_status_id;
|
||||
uint32_t extra;
|
||||
uint64_t handle;
|
||||
bool add;
|
||||
|
|
|
@ -1350,7 +1350,7 @@ static void writer_drop_connection (const struct nn_guid * wr_guid, const struct
|
|||
if (m != NULL && wr->status_cb)
|
||||
{
|
||||
status_cb_data_t data;
|
||||
data.status = DDS_PUBLICATION_MATCHED_STATUS;
|
||||
data.raw_status_id = (int) DDS_PUBLICATION_MATCHED_STATUS_ID;
|
||||
data.add = false;
|
||||
data.handle = prd->e.iid;
|
||||
(wr->status_cb) (wr->status_cb_entity, &data);
|
||||
|
@ -1378,7 +1378,7 @@ static void writer_drop_local_connection (const struct nn_guid *wr_guid, struct
|
|||
if (m != NULL && wr->status_cb)
|
||||
{
|
||||
status_cb_data_t data;
|
||||
data.status = DDS_PUBLICATION_MATCHED_STATUS;
|
||||
data.raw_status_id = (int) DDS_PUBLICATION_MATCHED_STATUS_ID;
|
||||
data.add = false;
|
||||
data.handle = rd->e.iid;
|
||||
(wr->status_cb) (wr->status_cb_entity, &data);
|
||||
|
@ -1412,10 +1412,10 @@ static void reader_drop_connection (const struct nn_guid *rd_guid, const struct
|
|||
data.add = false;
|
||||
data.handle = pwr->e.iid;
|
||||
|
||||
data.status = DDS_LIVELINESS_CHANGED_STATUS;
|
||||
data.raw_status_id = (int) DDS_LIVELINESS_CHANGED_STATUS_ID;
|
||||
(rd->status_cb) (rd->status_cb_entity, &data);
|
||||
|
||||
data.status = DDS_SUBSCRIPTION_MATCHED_STATUS;
|
||||
data.raw_status_id = (int) DDS_SUBSCRIPTION_MATCHED_STATUS_ID;
|
||||
(rd->status_cb) (rd->status_cb_entity, &data);
|
||||
}
|
||||
}
|
||||
|
@ -1447,10 +1447,10 @@ static void reader_drop_local_connection (const struct nn_guid *rd_guid, const s
|
|||
data.add = false;
|
||||
data.handle = wr->e.iid;
|
||||
|
||||
data.status = DDS_LIVELINESS_CHANGED_STATUS;
|
||||
data.raw_status_id = (int) DDS_LIVELINESS_CHANGED_STATUS_ID;
|
||||
(rd->status_cb) (rd->status_cb_entity, &data);
|
||||
|
||||
data.status = DDS_SUBSCRIPTION_MATCHED_STATUS;
|
||||
data.raw_status_id = (int) DDS_SUBSCRIPTION_MATCHED_STATUS_ID;
|
||||
(rd->status_cb) (rd->status_cb_entity, &data);
|
||||
}
|
||||
}
|
||||
|
@ -1587,7 +1587,7 @@ static void writer_add_connection (struct writer *wr, struct proxy_reader *prd)
|
|||
if (wr->status_cb)
|
||||
{
|
||||
status_cb_data_t data;
|
||||
data.status = DDS_PUBLICATION_MATCHED_STATUS;
|
||||
data.raw_status_id = (int) DDS_PUBLICATION_MATCHED_STATUS_ID;
|
||||
data.add = true;
|
||||
data.handle = prd->e.iid;
|
||||
(wr->status_cb) (wr->status_cb_entity, &data);
|
||||
|
@ -1667,7 +1667,7 @@ static void writer_add_local_connection (struct writer *wr, struct reader *rd)
|
|||
if (wr->status_cb)
|
||||
{
|
||||
status_cb_data_t data;
|
||||
data.status = DDS_PUBLICATION_MATCHED_STATUS;
|
||||
data.raw_status_id = (int) DDS_PUBLICATION_MATCHED_STATUS_ID;
|
||||
data.add = true;
|
||||
data.handle = rd->e.iid;
|
||||
(wr->status_cb) (wr->status_cb_entity, &data);
|
||||
|
@ -1730,7 +1730,7 @@ static void reader_add_connection (struct reader *rd, struct proxy_writer *pwr,
|
|||
if (rd->status_cb)
|
||||
{
|
||||
status_cb_data_t data;
|
||||
data.status = DDS_SUBSCRIPTION_MATCHED_STATUS;
|
||||
data.raw_status_id = (int) DDS_SUBSCRIPTION_MATCHED_STATUS_ID;
|
||||
data.add = true;
|
||||
data.handle = pwr->e.iid;
|
||||
(rd->status_cb) (rd->status_cb_entity, &data);
|
||||
|
@ -1765,10 +1765,10 @@ static void reader_add_local_connection (struct reader *rd, struct writer *wr)
|
|||
data.add = true;
|
||||
data.handle = wr->e.iid;
|
||||
|
||||
data.status = DDS_LIVELINESS_CHANGED_STATUS;
|
||||
data.raw_status_id = (int) DDS_LIVELINESS_CHANGED_STATUS_ID;
|
||||
(rd->status_cb) (rd->status_cb_entity, &data);
|
||||
|
||||
data.status = DDS_SUBSCRIPTION_MATCHED_STATUS;
|
||||
data.raw_status_id = (int) DDS_SUBSCRIPTION_MATCHED_STATUS_ID;
|
||||
(rd->status_cb) (rd->status_cb_entity, &data);
|
||||
}
|
||||
}
|
||||
|
@ -1875,7 +1875,7 @@ static void proxy_writer_add_connection (struct proxy_writer *pwr, struct reader
|
|||
if (rd->status_cb)
|
||||
{
|
||||
status_cb_data_t data;
|
||||
data.status = DDS_LIVELINESS_CHANGED_STATUS;
|
||||
data.raw_status_id = (int) DDS_LIVELINESS_CHANGED_STATUS_ID;
|
||||
data.add = true;
|
||||
data.handle = pwr->e.iid;
|
||||
(rd->status_cb) (rd->status_cb_entity, &data);
|
||||
|
@ -1997,7 +1997,7 @@ static void writer_qos_mismatch (struct writer * wr, uint32_t reason)
|
|||
if (wr->status_cb)
|
||||
{
|
||||
status_cb_data_t data;
|
||||
data.status = DDS_OFFERED_INCOMPATIBLE_QOS_STATUS;
|
||||
data.raw_status_id = (int) DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID;
|
||||
data.extra = reason;
|
||||
(wr->status_cb) (wr->status_cb_entity, &data);
|
||||
}
|
||||
|
@ -2018,7 +2018,7 @@ static void reader_qos_mismatch (struct reader * rd, uint32_t reason)
|
|||
if (rd->status_cb)
|
||||
{
|
||||
status_cb_data_t data;
|
||||
data.status = DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS;
|
||||
data.raw_status_id = (int) DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS_ID;
|
||||
data.extra = reason;
|
||||
(rd->status_cb) (rd->status_cb_entity, &data);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue