asyncagent.h \
devicetypes.h \
bluetoothdevice.h \
- bluetoothdevicemodel.h
+ bluetoothdevicemodel.h \
+ audio.h
SOURCES += agentadaptor.cpp \
bluemanager.cpp \
bluedevice.cpp \
bluetoothbaseagent.cpp \
asyncagent.cpp \
bluetoothdevice.cpp \
- bluetoothdevicemodel.cpp
+ bluetoothdevicemodel.cpp \
+ audio.cpp
target.path = $$INSTALL_ROOT/usr/lib
headers.path = $$INSTALL_ROOT/usr/include/bluetooth-qt/
m_device->Disconnect();
}
+void BluetoothDevice::disconnectAudio()
+{
+ if(!audio) audio = new OrgBluezAudioInterface("org.bluez", m_device->path(), QDBusConnection::systemBus(), this);
+
+ audio->Disconnect();
+}
+
QStringList BluetoothDevice::profiles()
{
QVariantMap props = m_device->GetProperties();
void connectAudioSrc();
QString connectSerial();
void disconnect();
+ void disconnectAudio();
QStringList profiles();
bool isProfileSupported(QString profile);
if(device->path() == path)
return device;
}
+ qDebug()<<"Device not found for path: "<<path;
return NULL;
}
+void BluetoothDevicesModel::makeDiscoverable(bool discoverableValue)
+{
+ if(adapter) adapter->SetProperty("Discoverable", QDBusVariant(discoverableValue));
+}
+
+bool BluetoothDevicesModel::discoverable()
+{
+ if(adapter)
+ {
+ QVariantMap props = adapter->GetProperties();
+ return props["Discoverable"].toBool();
+ }
+
+ return false;
+}
+
void BluetoothDevicesModel::adapterAdded(QDBusObjectPath path)
{
if(adapter && adapter->path() == path.path()) return;
QDBusConnection::systemBus(), this);
connect(adapter,
+ SIGNAL(PropertyChanged(QString,QDBusVariant)),
+ this,
+ SLOT(adapterPropertyChanged(QString,QDBusVariant)));
+
+ connect(adapter,
SIGNAL(DeviceRemoved(QDBusObjectPath)),
this,
SLOT(deviceRemoved(QDBusObjectPath)));
dataChanged(createIndex(row, 0),createIndex(row, 0));
}
+
+
+void BluetoothDevicesModel::adapterPropertyChanged(QString name, QDBusVariant value)
+{
+ qDebug()<<"adapter property changed: "<<name<<" "<<value.variant();
+
+ if(name == "Discoverable")
+ {
+ discoverableChanged(value.variant().toBool());
+ }
+}
class BluetoothDevicesModel : public QAbstractListModel
{
Q_OBJECT
+ Q_PROPERTY(bool discoverable READ discoverable WRITE makeDiscoverable NOTIFY discoverableChanged);
+
public:
explicit BluetoothDevicesModel(QObject *parent = 0);
QList<BluetoothDevice*> devices(){ return m_devices; }
BluetoothDevice* device(QString path);
+ void makeDiscoverable(bool isDiscoverable);
+ bool discoverable();
private slots:
void adapterAdded(QDBusObjectPath);
void deviceRemoved(QDBusObjectPath);
void devicePropertyChanged(QString name, QVariant value);
+ void adapterPropertyChanged(QString name, QDBusVariant value);
signals:
void devicePaired(BluetoothDevice* device);
+ void discoverableChanged(bool discoverable);
private:
OrgBluezManagerInterface *manager;
const char opush[] = "00001105-0000-1000-8000-00805f9b34fb";
const char ftp[] = "00001106-0000-1000-8000-00805f9b34fb";
const char panu[] = "00001115-0000-1000-8000-00805f9b34fb";
+ const char nap[] = "00001116-0000-1000-8000-00805f9b34fb";
const char spp[] = "00001101-0000-1000-8000-00805f9b34fb";
}
#endif // BTPROFILES_H