Esempio n. 1
0
void
_SubscriberNotifyListener(
    _Subscriber _this,
    gapi_statusMask triggerMask)
{
    gapi_object source;
    _Status status;

    if ( _this && (triggerMask & GAPI_DATA_ON_READERS_STATUS) ) {
        status = _EntityStatus(_this);
        source = _EntityHandle(_this);
        _StatusNotifyDataOnReaders(status, source);
    }
}
Esempio n. 2
0
void
_DataReaderNotifyListener(
    _DataReader _this,
    gapi_statusMask triggerMask)
{
    _Status status;
    gapi_object source;
    gapi_returnCode_t result;

    if (_this == NULL) {
        OS_REPORT(OS_ERROR,
                  "_DataReaderNotifyListener",0,
                  "Specified DataReader = NULL.");
        return;
    }
    status = _EntityStatus(_this);
    source = _EntityHandle(_this);

    while ( _this && (triggerMask != GAPI_STATUS_KIND_NULL) ) {
        if ( triggerMask & GAPI_DATA_AVAILABLE_STATUS ) {
            /* The behaviour for the triggering of data_on_readers and
             * data_available is described in the DDS specification:
             * first, the middleware tries to trigger the SubscriberListener
             * operation on_data_on_readers with a parameter of the related
             * Subscriber;
             * if this does not succeed (no listener or operation non-enabled),
             * it tries to trigger on_data_available on all the related
             * DataReaderListener objects, with as parameter the related DataReader.
             * This is implemented by the following if else block.
             */
            if (!_StatusNotifyDataOnReaders(status, source)) {
                _StatusNotifyDataAvailable(status, source);
            }
            triggerMask &= ~GAPI_DATA_AVAILABLE_STATUS;
        }
        if ( triggerMask & GAPI_SAMPLE_REJECTED_STATUS ) {
            gapi_sampleRejectedStatus info;

            result = _DataReader_get_sample_rejected_status(_this, &info);
            /* Only allow the callback if there is a change since the last
             * callback, i.e if total_count_change is non zero
             */
            if (result == GAPI_RETCODE_OK && info.total_count_change != 0) {
                _StatusNotifySampleRejected(status, source, &info);
            }
            triggerMask &= ~GAPI_SAMPLE_REJECTED_STATUS;
        }
        if ( triggerMask & GAPI_LIVELINESS_CHANGED_STATUS ) {
            gapi_livelinessChangedStatus info;

            result = _DataReader_get_liveliness_changed_status(_this, &info);
            /* Only allow the callback if there is a change since the last
             * callback, i.e if either alive_count_change or
             * not_alive_count_change are non zero.
             */
            if (result == GAPI_RETCODE_OK &&
                (info.alive_count_change != 0 ||
                 info.not_alive_count_change != 0))
            {
                _StatusNotifyLivelinessChanged(status, source, &info);
            }
            triggerMask &= ~GAPI_LIVELINESS_CHANGED_STATUS;
        }
        if ( triggerMask & GAPI_REQUESTED_DEADLINE_MISSED_STATUS ) {
            gapi_requestedDeadlineMissedStatus info;

            result = _DataReader_get_requested_deadline_missed_status(_this, &info);
            /* Only allow the callback if there is a change since the last
             * callback, i.e if total_count_change is non zero
             */
            if (result == GAPI_RETCODE_OK && info.total_count_change != 0) {
                _StatusNotifyRequestedDeadlineMissed(status, source, &info);
            }
            triggerMask &= ~GAPI_REQUESTED_DEADLINE_MISSED_STATUS;
        }
        if ( triggerMask & GAPI_REQUESTED_INCOMPATIBLE_QOS_STATUS ) {
            gapi_requestedIncompatibleQosStatus info;
            gapi_qosPolicyCount policyCount[MAX_POLICY_COUNT_ID];

            info.policies._maximum = MAX_POLICY_COUNT_ID;
            info.policies._length  = 0;
            info.policies._buffer  = policyCount;

            result = _DataReader_get_requested_incompatible_qos_status(_this, &info);
            /* Only allow the callback if there is a change since the last
             * callback, i.e if total_count_change is non zero
             */
            if (result == GAPI_RETCODE_OK && info.total_count_change != 0) {
                _StatusNotifyRequestedIncompatibleQos(status, source, &info);
            }
            triggerMask &= ~GAPI_REQUESTED_INCOMPATIBLE_QOS_STATUS;
        }
        if ( triggerMask & GAPI_SAMPLE_LOST_STATUS ) {
            gapi_sampleLostStatus info;

            result = _DataReader_get_sample_lost_status (_this, &info);
            /* Only allow the callback if there is a change since the last
             * callback, i.e if total_count_change is non zero
             */
            if (result == GAPI_RETCODE_OK && info.total_count_change != 0) {
                _StatusNotifySampleLost(status, source, &info);
            }
            triggerMask &= ~GAPI_SAMPLE_LOST_STATUS;
        }
        if ( triggerMask & GAPI_SUBSCRIPTION_MATCH_STATUS ) {
            gapi_subscriptionMatchedStatus info;

            result = _DataReader_get_subscription_matched_status (_this, &info);
            /* Only allow the callback if there is a change since the last
             * callback, i.e if total_count_change is non zero
             */
            if (result == GAPI_RETCODE_OK && info.current_count_change != 0) {
                _StatusNotifySubscriptionMatch(status, source, &info);
            }
            triggerMask &= ~GAPI_SUBSCRIPTION_MATCH_STATUS;
        }
    }
}