bool Profile::processApplicationDescriptor( bool &serviceBound, BYTE &visibility, BYTE &priority, std::vector<BYTE> &transports ) { desc::MapOfDescriptors::const_iterator it; // Check application descriptor if (!findDesc( AIT_APP_DESC, it )) { printf( "[Profile] Warning, Application Descriptor not present\n" ); return false; } const ait::ApplicationDescriptor &appDesc = (*it).second.get<ait::ApplicationDescriptor>(); // Check profile: ETSI TS 102 812 v1.2.1 // The MHP terminal shall only launch applications if the following // expression is true for one of the singalled profiles bool appSupported=false; BOOST_FOREACH( const ait::ApplicationProfile &appProfile, appDesc.profiles ) { // If profile is supported if (isProfileSupported( appProfile )) { appSupported=true; break; } } if (!appSupported) { printf( "[Profile] Warning, Application profile not supported\n" ); return false; } serviceBound = appDesc.serviceBoundFlag; visibility = appDesc.visibility; priority = appDesc.priority; transports = appDesc.transports; return true; }
void BluetoothDevice::connectAudioSrc() { if(isProfileSupported(BluetoothProfiles::a2src)) { OrgBluezAudioSourceInterface source("org.bluez",m_device->path(), QDBusConnection::systemBus()); source.Connect(); } }
QString BluetoothDevice::connectSerial() { if(isProfileSupported(BluetoothProfiles::spp)) { QDBusInterface interface("org.bluez",m_device->path(),"org.bluez.Serial",QDBusConnection::systemBus()); QDBusReply<QString> reply = interface.call(QDBus::AutoDetect, "Connect","spp"); if(reply.isValid()) return reply; else qDebug()<<"Error connecting spp profile: "<<reply.error().message(); } return ""; }
void BluetoothDevice::setupProfiles() { if(isProfileSupported(BluetoothProfiles::hid)) { if(!input) { input = new OrgBluezInputInterface("org.bluez", m_device->path(), QDBusConnection::systemBus(), this); connect(input,SIGNAL(PropertyChanged(QString,QDBusVariant)),this, SLOT(inputPropertiesChanged(QString,QDBusVariant))); } } else { if(input) { input->deleteLater(); input = NULL; } } if(isProfileSupported(BluetoothProfiles::a2sink) || isProfileSupported(BluetoothProfiles::hs)) { if(!audio) audio = new OrgBluezAudioInterface("org.bluez", m_device->path(), QDBusConnection::systemBus(), this); connect(audio,SIGNAL(PropertyChanged(QString,QDBusVariant)),this,SLOT(audioPropertiesChanged(QString,QDBusVariant))); } else { if(audio) { audio->deleteLater(); audio = NULL; } } }