1 #ifndef NEARBYDEVICESMODEL_H
2 #define NEARBYDEVICESMODEL_H
5 #include <QAbstractListModel>
6 #include <QDBusObjectPath>
8 #include "bluemanager.h"
9 #include "blueadapter.h"
10 #include "asyncagent.h"
12 namespace NearbyDevicesModelRoles
16 name = Qt::UserRole + 1,
21 class NearbyDevicesModel : public QAbstractListModel
26 NearbyDevicesModel(QObject *parent = 0);
30 int columnCount(const QModelIndex &) const { return 1;}
31 int rowCount(const QModelIndex &parent = QModelIndex()) const;
32 QVariant data(const QModelIndex &index, int role) const;
34 QString hwAddress(int index) { return devicepathlist[index]; }
35 QString alias(int index){ return deviceAliasMap[devicepathlist[index]]; }
36 void pair(QString hwaddy);
37 void discover(bool start);
40 void replyRequestConfirmation(bool confirmed);
41 void replyPasskey(uint passkey);
42 void replyRequestPidCode(QString pidCode);
44 void setAdapterProperty(QString name, QVariant value);
47 void adapterAdded(QDBusObjectPath);
48 void adapterRemoved(QDBusObjectPath);
49 void deviceCreated(QString hwaddy, QVariantMap properties);
50 void deviceRemoved(QString hwaddy);
52 void adapterPropertiesChangedSlot(QString n,QDBusVariant v);
55 void requestConfirmation(QString device, uint code);
56 void requestPasskey(QString device);
57 void requestPidCode(QString device);
60 void nearbyDeviceFound(int index);
61 void nearbyDeviceRemoved(int index);
63 void adapterPropertiesChanged(QString name, QVariant value);
66 QList<QString> devicepathlist;
67 QMap<QString,QString> deviceAliasMap;
68 OrgBluezManagerInterface *manager;
69 OrgBluezAdapterInterface *adapter;
73 #endif // NEARBYDEVICESMODEL_H