1 #ifndef BLUETOOTHDEVICEMODEL_H
2 #define BLUETOOTHDEVICEMODEL_H
4 #include <QAbstractListModel>
5 #include "bluemanager.h"
6 #include "blueadapter.h"
7 #include "bluetoothdevice.h"
9 class BluetoothDevicesModel : public QAbstractListModel
12 Q_PROPERTY(bool discoverable READ discoverable WRITE makeDiscoverable NOTIFY discoverableChanged);
15 explicit BluetoothDevicesModel(QObject *parent = 0);
19 name = Qt::UserRole + 1,
26 int columnCount(const QModelIndex &) const { return 1; }
27 int rowCount(const QModelIndex &parent = QModelIndex()) const;
28 QVariant data(const QModelIndex &index, int role) const;
30 QString devicePath(QString name);
32 QList<BluetoothDevice*> devices(){ return m_devices; }
34 BluetoothDevice* device(QString path);
35 void makeDiscoverable(bool isDiscoverable);
39 void adapterAdded(QDBusObjectPath);
40 void adapterRemoved(QDBusObjectPath);
41 void deviceCreated(QDBusObjectPath);
42 void deviceRemoved(QDBusObjectPath);
44 void devicePropertyChanged(QString name, QVariant value);
45 void adapterPropertyChanged(QString name, QDBusVariant value);
48 void devicePaired(BluetoothDevice* device);
49 void discoverableChanged(bool discoverable);
52 OrgBluezManagerInterface *manager;
53 OrgBluezAdapterInterface *adapter;
54 QList<BluetoothDevice*> m_devices;
57 #endif // BLUETOOTHDEVICEMODEL_H