QVariantMap NetworkManager::VlanSetting::toMap() const { QVariantMap setting; if (!interfaceName().isEmpty()) { setting.insert(QLatin1String(NM_SETTING_VLAN_INTERFACE_NAME), interfaceName()); } if (!parent().isEmpty()) { setting.insert(QLatin1String(NM_SETTING_VLAN_PARENT), parent()); } if (id()) { setting.insert(QLatin1String(NM_SETTING_VLAN_ID), id()); } if (flags() != None) { setting.insert(QLatin1String(NM_SETTING_VLAN_FLAGS), (int)flags()); } if (!ingressPriorityMap().isEmpty()) { setting.insert(QLatin1String(NM_SETTING_VLAN_INGRESS_PRIORITY_MAP), ingressPriorityMap()); } if (!egressPriorityMap().isEmpty()) { setting.insert(QLatin1String(NM_SETTING_VLAN_EGRESS_PRIORITY_MAP), egressPriorityMap()); } return setting; }
bool DBusAddressTranslator::translate(const DBusAddress &_key, CommonAPI::Address &_value) { bool result(true); std::lock_guard<std::mutex> itsLock(mutex_); const auto it = backwards_.find(_key); if (it != backwards_.end()) { _value = it->second; } else if (isDefault_) { if (isValid(_key.getObjectPath(), '/', true) && isValid(_key.getInterface(), '.')) { std::string interfaceName(_key.getInterface()); std::string instance(_key.getObjectPath().substr(1)); std::replace(instance.begin(), instance.end(), '/', '.'); _value.setDomain(defaultDomain_); _value.setInterface(interfaceName); _value.setInstance(instance); std::string service = _key.getService(); if(isValid(service, '.', (service.length() > 0 && service[0] == ':'), (service.length() > 0 && service[0] == ':'), true)) { forwards_.insert({_value, _key}); backwards_.insert({_key, _value}); } } else { result = false; } } else { result = false; } return result; }
BOOL CGatewayCANopenToEpos::SetDeviceTimeout(CDeviceCommandSetManagerBase* p_pManager, HANDLE p_hHandle, DWORD p_ulTimeout) { WORD usTimeout(0); BOOL oResult(FALSE); CErrorInfo errorInfo; HANDLE hTransactionHandle(NULL); BYTE ubNodeId(0); CStdString interfaceName(_T("")); if(p_pManager) { if(p_pManager->DCS_GetInterfaceName(p_hHandle, &interfaceName)) { //Init usTimeout = (WORD)p_ulTimeout; if(GetAddressParameter(p_pManager, p_hHandle, ubNodeId, &errorInfo)) { if(interfaceName == INTERFACE_RS232) { //RS232 Frame Timeout oResult = DCS_WriteObject(p_pManager, p_hHandle, hTransactionHandle, ubNodeId, INDEX_RS232_FRAME_TIMEOUT, SUBINDEX_RS232_FRAME_TIMEOUT, (BYTE*)&usTimeout, sizeof(usTimeout), &errorInfo); } } } } return oResult; }
std::string UdpComm::getWifiBroadcastAddress() { std::string wifiAddress("255.255.255.255"); #ifdef TARGET_ROBOT char addressBuffer[INET_ADDRSTRLEN]; ifaddrs* ifAddrStruct = nullptr; ifaddrs* ifa = nullptr; //determine ip address getifaddrs(&ifAddrStruct); for(ifa = ifAddrStruct; ifa != nullptr; ifa = ifa->ifa_next) { // manpage getifaddrs // check it is IP4 if(ifa->ifa_addr != nullptr && ifa->ifa_addr->sa_family == AF_INET) { std::string interfaceName(ifa->ifa_name); if(interfaceName.find("wlan") != std::string::npos) { in_addr_t mask = ((sockaddr_in*)ifa->ifa_netmask)->sin_addr.s_addr; in_addr_t addr = ((sockaddr_in*)ifa->ifa_addr)->sin_addr.s_addr; in_addr_t bcastAddr = ~mask | addr; in_addr bcast_addr; bcast_addr.s_addr = bcastAddr; inet_ntop(AF_INET, &bcast_addr, addressBuffer, INET_ADDRSTRLEN); wifiAddress = std::string(&addressBuffer[0]); break; } } } #endif return wifiAddress; }
void Dictionary::ConversionContext::throwTypeError(const String& detail) { if (forConstructor()) { exceptionState().throwTypeError(detail); } else { ASSERT(!methodName().isEmpty()); exceptionState().throwTypeError(ExceptionMessages::failedToExecute(interfaceName(), methodName(), detail)); } }
void JoynrClusterControllerRuntime::registerDiscoveryProvider() { std::string domain(systemServicesSettings.getDomain()); std::shared_ptr<joynr::system::DiscoveryProvider> discoveryProvider(localCapabilitiesDirectory); std::string interfaceName(discoveryProvider->getInterfaceName()); std::string participantId(systemServicesSettings.getCcDiscoveryProviderParticipantId()); // provision the participant ID for the discovery provider participantIdStorage->setProviderParticipantId(domain, interfaceName, participantId); registerProvider<joynr::system::DiscoveryProvider>(domain, discoveryProvider); }
void JoynrClusterControllerRuntime::registerRoutingProvider() { std::string domain(systemServicesSettings.getDomain()); std::shared_ptr<joynr::system::RoutingProvider> routingProvider(messageRouter); std::string interfaceName(routingProvider->getInterfaceName()); std::string participantId(systemServicesSettings.getCcRoutingProviderParticipantId()); // provision the participant ID for the routing provider participantIdStorage->setProviderParticipantId(domain, interfaceName, participantId); registerProvider<joynr::system::RoutingProvider>(domain, routingProvider); }
bool EventTarget::addEventListenerInternal(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, const EventListenerOptions& options) { if (!listener) return false; V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld(); if (activityLogger) { Vector<String> argv; argv.append(toNode() ? toNode()->nodeName() : interfaceName()); argv.append(eventType); activityLogger->logEvent("blinkAddEventListener", argv.size(), argv.data()); } return ensureEventTargetData().eventListenerMap.add(eventType, listener, options); }
bool EventTarget::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) { // FIXME: listener null check should throw TypeError (and be done in // generated bindings), but breaks legacy content. http://crbug.com/249598 if (!listener) return false; V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld(); if (activityLogger) { Vector<String> argv; argv.append(toNode() ? toNode()->nodeName() : interfaceName()); argv.append(eventType); activityLogger->logEvent("blinkAddEventListener", argv.size(), argv.data()); } return ensureEventTargetData().eventListenerMap.add(eventType, listener, useCapture); }
/** * Emit PropertiesChanged signal on object org.freedesktop.DBus.Properties interface * with the property \a propertyName. * * \param propertyName The name of the changed property. * \param propertyValue The actual value of the changed property. * \return \c false if the signal can not be emmited or \a true otherwise. */ bool AbstractDBusServiceInterface::notifyPropertyChanged(const QString &propertyName, const QVariant &propertyValue) { if (!isRegistered()) { return false; } QDBusMessage signal = QDBusMessage::createSignal(dbusObject()->objectPath(), TP_QT_IFACE_PROPERTIES, QLatin1String("PropertiesChanged")); QVariantMap changedProperties; changedProperties.insert(propertyName, propertyValue); signal << interfaceName(); signal << changedProperties; signal << QStringList(); return dbusObject()->dbusConnection().send(signal); }
unsigned char UdpComm::getLastByteOfIP() { #ifdef TARGET_ROBOT ifaddrs* ifAddrStruct = nullptr; ifaddrs* ifa = nullptr; getifaddrs(&ifAddrStruct); for(ifa = ifAddrStruct; ifa != nullptr; ifa = ifa->ifa_next) { if(ifa->ifa_addr != nullptr && ifa->ifa_addr->sa_family == AF_INET) { std::string interfaceName(ifa->ifa_name); if(interfaceName.find("wlan") != std::string::npos) { in_addr_t addr = ((sockaddr_in*)ifa->ifa_addr)->sin_addr.s_addr; return static_cast<unsigned char>(addr >> 24); // Because NetworkByteOrder } }
Foam::scalar Foam::multiMaterialCohesiveLaw::interfaceID ( const label mat1, const label mat2 ) const { word mat1name = (*this)[mat1].name(); word mat2name = (*this)[mat2].name(); word interfaceName("interface_"+mat1name+"_"+mat2name); label interfaceLawID = -1; forAll(interfaceCohesiveLaws_, lawI) { if (interfaceCohesiveLaws_[lawI].name() == interfaceName) { interfaceLawID = lawI; break; } } if (interfaceLawID == -1) { // flip name interfaceName = word("interface_"+mat2name+"_"+mat1name); forAll(interfaceCohesiveLaws_, lawI) { if (interfaceCohesiveLaws_[lawI].name() == interfaceName) { interfaceLawID = lawI; break; } } if (interfaceLawID == -1) { FatalError << "Cannot find cohesive interfaceLaw " << word("interface_"+mat1name+"_"+mat2name) << " or " << interfaceName << nl << "One of these should be defined!" << exit(FatalError); } }
bool Event::hasInterface(const AtomicString& name) const { return interfaceName() == name; }
String ExceptionState::addExceptionContext(const String& message) const { if (message.isEmpty()) return message; String processedMessage = message; if (propertyName() && interfaceName() && m_context != UnknownContext) { if (m_context == DeletionContext) processedMessage = ExceptionMessages::failedToDelete(propertyName(), interfaceName(), message); else if (m_context == ExecutionContext) processedMessage = ExceptionMessages::failedToExecute(propertyName(), interfaceName(), message); else if (m_context == GetterContext) processedMessage = ExceptionMessages::failedToGet(propertyName(), interfaceName(), message); else if (m_context == SetterContext) processedMessage = ExceptionMessages::failedToSet(propertyName(), interfaceName(), message); } else if (!propertyName() && interfaceName()) { if (m_context == ConstructionContext) processedMessage = ExceptionMessages::failedToConstruct(interfaceName(), message); else if (m_context == EnumerationContext) processedMessage = ExceptionMessages::failedToEnumerate(interfaceName(), message); else if (m_context == IndexedDeletionContext) processedMessage = ExceptionMessages::failedToDeleteIndexed(interfaceName(), message); else if (m_context == IndexedGetterContext) processedMessage = ExceptionMessages::failedToGetIndexed(interfaceName(), message); else if (m_context == IndexedSetterContext) processedMessage = ExceptionMessages::failedToSetIndexed(interfaceName(), message); } return processedMessage; }