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
13 explicit BluetoothDevicesModel(QObject *parent = 0);
17 name = Qt::UserRole + 1,
24 int columnCount(const QModelIndex &) const { return 1; }
25 int rowCount(const QModelIndex &parent = QModelIndex()) const;
26 QVariant data(const QModelIndex &index, int role) const;
28 QString devicePath(QString name);
30 QList<BluetoothDevice*> devices(){ return m_devices; }
32 BluetoothDevice* device(QString path);
35 void adapterAdded(QDBusObjectPath);
36 void adapterRemoved(QDBusObjectPath);
37 void deviceCreated(QDBusObjectPath);
38 void deviceRemoved(QDBusObjectPath);
40 void devicePropertyChanged(QString name, QVariant value);
43 void devicePaired(BluetoothDevice*);
46 OrgBluezManagerInterface *manager;
47 OrgBluezAdapterInterface *adapter;
48 QList<BluetoothDevice*> m_devices;
51 #endif // BLUETOOTHDEVICEMODEL_H