void LocalCapabilitiesDirectory::add(const joynr::types::DiscoveryEntry& discoveryEntry)
{
    bool isGlobal = discoveryEntry.getQos().getScope() == types::ProviderScope::GLOBAL;

    // register locally
    this->insertInCache(discoveryEntry, isGlobal, true, isGlobal);

    // Inform observers
    informObserversOnAdd(discoveryEntry);

    // register globally
    if (isGlobal) {
        types::CapabilityInformation capInfo(discoveryEntry.getDomain(),
                                             discoveryEntry.getInterfaceName(),
                                             discoveryEntry.getQos(),
                                             capabilitiesClient->getLocalChannelId(),
                                             discoveryEntry.getParticipantId());
        if (std::find(registeredGlobalCapabilities.begin(),
                      registeredGlobalCapabilities.end(),
                      capInfo) == registeredGlobalCapabilities.end()) {
            registeredGlobalCapabilities.push_back(capInfo);
        }
        this->capabilitiesClient->add(registeredGlobalCapabilities);
    }
}
Exemple #2
0
joynr::types::DiscoveryEntryWithMetaInfo convert(bool isLocal,
                                                 const joynr::types::DiscoveryEntry& entry)
{
    return joynr::types::DiscoveryEntryWithMetaInfo(entry.getProviderVersion(),
                                                    entry.getDomain(),
                                                    entry.getInterfaceName(),
                                                    entry.getParticipantId(),
                                                    entry.getQos(),
                                                    entry.getLastSeenDateMs(),
                                                    entry.getExpiryDateMs(),
                                                    entry.getPublicKeyId(),
                                                    isLocal);
}