-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbluetoothdevicemodel.h
More file actions
49 lines (37 loc) · 1.13 KB
/
bluetoothdevicemodel.h
File metadata and controls
49 lines (37 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef BLUETOOTHDEVICEMODEL_H
#define BLUETOOTHDEVICEMODEL_H
#include <QAbstractItemModel>
#include <QList>
#include <QString>
#include "bluetoothdeviceinquiryinterface.h"
struct BluetoothDevice
{
QString name;
QString macAddress;
};
class BluetoothDeviceModel : public QAbstractItemModel, public BluetoothDeviceInquiryObserver
{
Q_OBJECT
public:
explicit BluetoothDeviceModel(QObject *parent = 0);
int deviceCount() const;
BluetoothDevice deviceAt(int index) const;
private:
void nameUpdated(const QString& name, const QString& macAddress, int numLeft);
private:
QModelIndex index(int row, int column, const QModelIndex & parent) const;
QModelIndex parent ( const QModelIndex & index ) const;
int rowCount ( const QModelIndex & parent ) const;
int columnCount ( const QModelIndex & parent ) const;
QVariant data ( const QModelIndex & index, int role ) const;
signals:
void devicesFound();
void found(int numFound);
void maximum(int maximum);
public slots:
private:
QList<BluetoothDevice> m_devices;
int m_totalDevices;
int m_lastNumLeft;
};
#endif // BLUETOOTHDEVICEMODEL_H