QList<CapabilityEntry> DbusCapabilitiesAdapter::lookup(
        const QString& participantId,
        const DiscoveryQos& discoveryQos
) {
    dbusSkeletonWrapper->logMethodCall("lookup", "DbusCapabilitiesAdapter");
    QSharedPointer<DummyDbusCapabilitiesFuture> future(new DummyDbusCapabilitiesFuture());
    localCapabilitiesDirectory.getCapabilities(participantId, future, discoveryQos);
    return future->get(discoveryQos.getDiscoveryTimeout());
}
예제 #2
0
void DbusCapabilitiesUtil::copyJoynrDiscoveryQosToDbus(const DiscoveryQos& joynrDiscoveryQos, joynr::messaging::types::Types::DiscoveryQos& dbusDiscoveryQos) {
    // copy arbitration strategy
    switch (joynrDiscoveryQos.getArbitrationStrategy()) {
    case DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT:
        dbusDiscoveryQos.arbitrationStrategy = joynr::messaging::types::Types::ArbitrationStrategy::FIXED_CHANNEL;
        break;
    case DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY:
        dbusDiscoveryQos.arbitrationStrategy = joynr::messaging::types::Types::ArbitrationStrategy::HIGHEST_PRIORITY;
        break;
    case DiscoveryQos::ArbitrationStrategy::KEYWORD:
        dbusDiscoveryQos.arbitrationStrategy = joynr::messaging::types::Types::ArbitrationStrategy::KEYWORD;
        break;
    case DiscoveryQos::ArbitrationStrategy::LOCAL_ONLY:
        dbusDiscoveryQos.arbitrationStrategy = joynr::messaging::types::Types::ArbitrationStrategy::LOCAL_ONLY;
        break;
    case DiscoveryQos::ArbitrationStrategy::NOT_SET:
        dbusDiscoveryQos.arbitrationStrategy = joynr::messaging::types::Types::ArbitrationStrategy::NOT_SET;
        break;
    default:
        assert(false);
    }

    switch(joynrDiscoveryQos.getDiscoveryScope()) {
    case DiscoveryQos::DiscoveryScope::GLOBAL_ONLY:
        dbusDiscoveryQos.discoveryScope = joynr::messaging::types::Types::DiscoveryScope::GLOBAL_ONLY;
        break;
    case DiscoveryQos::DiscoveryScope::LOCAL_ONLY:
        dbusDiscoveryQos.discoveryScope = joynr::messaging::types::Types::DiscoveryScope::LOCAL_ONLY;
        break;
    case DiscoveryQos::DiscoveryScope::LOCAL_THEN_GLOBAL:
        dbusDiscoveryQos.discoveryScope = joynr::messaging::types::Types::DiscoveryScope::LOCAL_THEN_GLOBAL;
        break;
    case DiscoveryQos::DiscoveryScope::LOCAL_AND_GLOBAL:
        dbusDiscoveryQos.discoveryScope = joynr::messaging::types::Types::DiscoveryScope::LOCAL_AND_GLOBAL;
        break;
    default:
        assert(false);
    }

    dbusDiscoveryQos.cacheMaxAge = joynrDiscoveryQos.getCacheMaxAge();
    dbusDiscoveryQos.discoveryTimeout = joynrDiscoveryQos.getDiscoveryTimeout();
    dbusDiscoveryQos.providerMustSupportOnChange = joynrDiscoveryQos.getProviderMustSupportOnChange();
    dbusDiscoveryQos.retryInterval = joynrDiscoveryQos.getRetryInterval();

    // copy the custom parameter
    auto parameterMap = joynrDiscoveryQos.getCustomParameters();
    for(auto it = parameterMap.begin(); it != parameterMap.end(); it++) {
        types::CustomParameter parameter = *it;
        // initialize dbus parameter
        joynr::messaging::types::Types::CustomParameter dbusParam;
        dbusParam.name = parameter.getName().toStdString();
        dbusParam.value = parameter.getValue().toStdString();
        // add to the map
        dbusDiscoveryQos.customParameters[dbusParam.name] = dbusParam;
    }
}
QList<CapabilityEntry> DbusCapabilitiesAdapter::lookup(
        const QString& domain,
        const QString& interfaceName,
        const types::ProviderQosRequirements& qos,
        const DiscoveryQos& discoveryQos
){
    dbusSkeletonWrapper->logMethodCall("lookup", "DbusCapabilitiesAdapter");
    QSharedPointer<DummyDbusCapabilitiesFuture> future(new DummyDbusCapabilitiesFuture());
    localCapabilitiesDirectory.getCapabilities(domain,interfaceName, future, discoveryQos, qos);
    //this will block forever when no result is received.
    return future->get(discoveryQos.getDiscoveryTimeout());
}