示例#1
0
v_result
v_readerGetTopicMatchStatus(
    v_reader _this,
    c_bool reset,
    v_statusAction action,
    c_voidp arg)
{
    v_result result;
    v_status status;

    assert(_this != NULL);
    assert(C_TYPECHECK(_this,v_reader));

    result = V_RESULT_PRECONDITION_NOT_MET;
    if (_this != NULL) {
        V_READER_LOCK(_this);
        status = v_entity(_this)->status;
        result = action(&v_readerStatus(status)->subscriptionMatch, arg);
        if (reset) {
            v_statusReset(status, V_EVENT_TOPIC_MATCHED);
        }
        v_readerStatus(status)->subscriptionMatch.totalChanged = 0;
        v_readerStatus(status)->subscriptionMatch.currentChanged = 0;
        V_READER_UNLOCK(_this);
    }
    return result;
}
示例#2
0
v_result
v_readerGetLivelinessChangedStatus(
    v_reader _this,
    c_bool reset,
    v_statusAction action,
    c_voidp arg)
{
    v_result result;
    v_status status;

    assert(_this != NULL);
    assert(C_TYPECHECK(_this,v_reader));

    result = V_RESULT_PRECONDITION_NOT_MET;
    if (_this != NULL) {
        V_READER_LOCK(_this);
        status = v_entity(_this)->status;
        result = action(&v_readerStatus(status)->livelinessChanged, arg);
        if (reset) {
            v_statusReset(status, V_EVENT_LIVELINESS_CHANGED);
        }
        v_readerStatus(status)->livelinessChanged.activeChanged = 0;
        v_readerStatus(status)->livelinessChanged.inactiveChanged = 0;
        V_READER_UNLOCK(_this);
    }
    return result;
}
示例#3
0
v_result
v_readerGetSampleLostStatus(
    v_reader _this,
    c_bool reset,
    v_statusAction action,
    c_voidp arg)
{
    v_result result;
    v_status status;

    assert(_this != NULL);
    assert(C_TYPECHECK(_this,v_reader));

    result = V_RESULT_PRECONDITION_NOT_MET;
    if (_this != NULL) {
        V_READER_LOCK(_this);
        status = v_entity(_this)->status;
        result = action(&v_readerStatus(status)->sampleLost, arg);
        if (reset) {
            v_statusReset(status, V_EVENT_SAMPLE_LOST);
        }
        v_readerStatus(status)->sampleLost.totalChanged = 0;
        V_READER_UNLOCK(_this);
    }
    return result;
}
示例#4
0
v_result
v_readerGetIncompatibleQosStatus(
    v_reader _this,
    c_bool reset,
    v_statusAction action,
    c_voidp arg)
{
    v_result result;
    v_status status;

    assert(_this != NULL);
    assert(C_TYPECHECK(_this,v_reader));

    result = V_RESULT_PRECONDITION_NOT_MET;
    if (_this != NULL) {
        V_READER_LOCK(_this);
        status = v_entity(_this)->status;
        result = action(&v_readerStatus(status)->incompatibleQos, arg);
        if (reset) {
            v_statusReset(status, V_EVENT_INCOMPATIBLE_QOS);
        }
        v_readerStatus(status)->incompatibleQos.totalChanged = 0;
        V_READER_UNLOCK(_this);
    }
    return result;
}
示例#5
0
v_result
v_readerGetDeadlineMissedStatus(
    v_reader _this,
    c_bool reset,
    v_statusAction action,
    c_voidp arg)
{
    v_result result;
    v_status status;

    assert(_this != NULL);
    assert(C_TYPECHECK(_this,v_reader));

    result = V_RESULT_PRECONDITION_NOT_MET;
    if (_this != NULL) {
        V_READER_LOCK(_this);
        status = v_entity(_this)->status;
        result = action(&v_readerStatus(status)->deadlineMissed, arg);
        if (reset) {
            v_statusReset(status, V_EVENT_DEADLINE_MISSED);
        }
        v_readerStatus(status)->deadlineMissed.totalChanged = 0;
        V_READER_UNLOCK(_this);
    }
    return result;
}
示例#6
0
void
DDS::OpenSplice::DataReader::nlReq_notify_listener (
    DDS::OpenSplice::Entity *sourceEntity,
    DDS::ULong               triggerMask,
    void                    *eventData)
{
    DDS::DataReaderListener_ptr listener;
    DDS::ReturnCode_t result;

    /* Using _narrow to cast Listener, this increases the refcount to ensure
     * the ListenerObject is not deleted while notifying. */
    listener = DDS::DataReaderListener::_narrow(this->listener);
    if (listener) {

        if (triggerMask & V_EVENT_DATA_AVAILABLE) {
            result = sourceEntity->reset_dataAvailable_status();
            if (result == DDS::RETCODE_OK) {
                listener->on_data_available(dynamic_cast<DDS::DataReader_ptr>(sourceEntity));
            }
        }

        if (triggerMask & V_EVENT_SAMPLE_REJECTED) {
            DDS::SampleRejectedStatus status;
            DDS::OpenSplice::Utils::copyStatusOut(v_readerStatus(eventData)->sampleRejected,
                                                  status);
            listener->on_sample_rejected(dynamic_cast<DDS::DataReader_ptr>(sourceEntity),
                                         status);
        }

        if (triggerMask & V_EVENT_LIVELINESS_CHANGED) {
            DDS::LivelinessChangedStatus status;
            DDS::OpenSplice::Utils::copyStatusOut(v_readerStatus(eventData)->livelinessChanged,
                                                  status);
            listener->on_liveliness_changed(dynamic_cast<DDS::DataReader_ptr>(sourceEntity),
                                            status);
        }

        if (triggerMask & V_EVENT_REQUESTED_DEADLINE_MISSED) {
            DDS::RequestedDeadlineMissedStatus status;
            DDS::OpenSplice::Utils::copyStatusOut(v_readerStatus(eventData)->deadlineMissed,
                                                  status);
            listener->on_requested_deadline_missed(dynamic_cast<DDS::DataReader_ptr>(sourceEntity),
                                                   status);
        }

        if (triggerMask & V_EVENT_REQUESTED_INCOMPATIBLE_QOS) {
            DDS::RequestedIncompatibleQosStatus status;
            DDS::OpenSplice::Utils::copyStatusOut(v_readerStatus(eventData)->incompatibleQos,
                                                  status);
            listener->on_requested_incompatible_qos(dynamic_cast<DDS::DataReader_ptr>(sourceEntity),
                                                    status);
        }

        if (triggerMask & V_EVENT_SAMPLE_LOST) {
            DDS::SampleLostStatus status;
            DDS::OpenSplice::Utils::copyStatusOut(v_readerStatus(eventData)->sampleLost,
                                                  status);
            listener->on_sample_lost(dynamic_cast<DDS::DataReader_ptr>(sourceEntity),
                                     status);
        }

        if (triggerMask & V_EVENT_SUBSCRIPTION_MATCHED) {
            DDS::SubscriptionMatchedStatus status;
            DDS::OpenSplice::Utils::copyStatusOut(v_readerStatus(eventData)->subscriptionMatch,
                                                  status);
            listener->on_subscription_matched(dynamic_cast<DDS::DataReader_ptr>(sourceEntity),
                                              status);
        }
        DDS::release(listener);
    }
}
示例#7
0
void
SubscriberDelegate::listener_notify(
        ObjectDelegate::ref_type source,
        uint32_t                 triggerMask,
        void                    *eventData,
        void                    *l)
{
    /* The EntityDelegate takes care of the thread safety and always
     * provides a listener and source. */
    dds::sub::SubscriberListener* listener =
            reinterpret_cast<dds::sub::SubscriberListener*>(l);
    assert(listener);

    /* Events that take an AnyDataReader. */
    if ((triggerMask & V_EVENT_DATA_AVAILABLE            ) ||
        (triggerMask & V_EVENT_SAMPLE_REJECTED           ) ||
        (triggerMask & V_EVENT_LIVELINESS_CHANGED        ) ||
        (triggerMask & V_EVENT_REQUESTED_DEADLINE_MISSED ) ||
        (triggerMask & V_EVENT_REQUESTED_INCOMPATIBLE_QOS) ||
        (triggerMask & V_EVENT_SAMPLE_LOST               ) ||
        (triggerMask & V_EVENT_SUBSCRIPTION_MATCHED      ) )
    {
        /* Get AnyDataReader from given source EntityDelegate. */
        AnyDataReaderDelegate::ref_type ref =
                OSPL_CXX11_STD_MODULE::dynamic_pointer_cast<AnyDataReaderDelegate>(source);
        dds::sub::AnyDataReader reader = ref->wrapper_to_any();

        if (triggerMask & V_EVENT_DATA_AVAILABLE) {
            ref->reset_data_available();
            listener->on_data_available(reader);
        }

        if (triggerMask & V_EVENT_SAMPLE_REJECTED) {
            dds::core::status::SampleRejectedStatus status;
            status.delegate().v_status(v_readerStatus(eventData)->sampleRejected);
            listener->on_sample_rejected(reader, status);
        }

        if (triggerMask & V_EVENT_LIVELINESS_CHANGED) {
            dds::core::status::LivelinessChangedStatus status;
            status.delegate().v_status(v_readerStatus(eventData)->livelinessChanged);
            listener->on_liveliness_changed(reader, status);
        }

        if (triggerMask & V_EVENT_REQUESTED_DEADLINE_MISSED) {
            dds::core::status::RequestedDeadlineMissedStatus status;
            status.delegate().v_status(v_readerStatus(eventData)->deadlineMissed);
            listener->on_requested_deadline_missed(reader, status);
        }

        if (triggerMask & V_EVENT_REQUESTED_INCOMPATIBLE_QOS) {
            dds::core::status::RequestedIncompatibleQosStatus status;
            status.delegate().v_status(v_readerStatus(eventData)->incompatibleQos);
            listener->on_requested_incompatible_qos(reader, status);
        }

        if (triggerMask & V_EVENT_SAMPLE_LOST) {
            dds::core::status::SampleLostStatus status;
            status.delegate().v_status(v_readerStatus(eventData)->sampleLost);
            listener->on_sample_lost(reader, status);
        }

        if (triggerMask & V_EVENT_SUBSCRIPTION_MATCHED) {
            dds::core::status::SubscriptionMatchedStatus status;
            status.delegate().v_status(v_readerStatus(eventData)->subscriptionMatch);
            listener->on_subscription_matched(reader, status);
        }
    }

    /* Events that take a Subscriber. */
    if (triggerMask & V_EVENT_ON_DATA_ON_READERS) {
        /* Only trigger when V_EVENT_DATA_AVAILABLE isn't triggered. */
        if (!(triggerMask & V_EVENT_DATA_AVAILABLE)) {
            org::opensplice::sub::SubscriberDelegate::ref_type ref =
                    OSPL_CXX11_STD_MODULE::dynamic_pointer_cast<org::opensplice::sub::SubscriberDelegate>(
                            source);
            ref->reset_data_on_readers();
            dds::sub::Subscriber subscriber(ref);
            listener->on_data_on_readers(subscriber);
        }
    }
}