2017-04-27 18:26:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-07-06 13:35:13 +00:00
|
|
|
#ifndef BTDEVICESELECTIONDIALOG_H
|
|
|
|
#define BTDEVICESELECTIONDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QListWidgetItem>
|
|
|
|
#include <QtBluetooth/QBluetoothLocalDevice>
|
|
|
|
#include <QtBluetooth/QBluetoothDeviceDiscoveryAgent>
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class BtDeviceSelectionDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
class BtDeviceSelectionDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit BtDeviceSelectionDialog(QWidget *parent = 0);
|
|
|
|
~BtDeviceSelectionDialog();
|
|
|
|
QString getSelectedDeviceAddress();
|
|
|
|
QString getSelectedDeviceName();
|
2017-11-12 11:33:20 +00:00
|
|
|
QString getSelectedDeviceText();
|
|
|
|
static QString formatDeviceText(const QString &address, const QString &name);
|
2015-07-06 13:35:13 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_changeDeviceState_clicked();
|
|
|
|
void on_save_clicked();
|
|
|
|
void on_clear_clicked();
|
|
|
|
void on_scan_clicked();
|
|
|
|
void remoteDeviceScanFinished();
|
|
|
|
void hostModeStateChanged(QBluetoothLocalDevice::HostMode mode);
|
|
|
|
void addRemoteDevice(const QBluetoothDeviceInfo &remoteDeviceInfo);
|
2017-11-04 14:09:07 +00:00
|
|
|
void currentItemChanged(QListWidgetItem *item,QListWidgetItem *previous);
|
2015-07-06 13:35:13 +00:00
|
|
|
void displayPairingMenu(const QPoint &pos);
|
|
|
|
void pairingFinished(const QBluetoothAddress &address,QBluetoothLocalDevice::Pairing pairing);
|
|
|
|
void error(QBluetoothLocalDevice::Error error);
|
2015-07-18 17:54:31 +00:00
|
|
|
void deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error error);
|
2015-07-18 14:50:18 +00:00
|
|
|
void localDeviceChanged(int);
|
2015-07-06 13:35:13 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::BtDeviceSelectionDialog *ui;
|
|
|
|
QBluetoothLocalDevice *localDevice;
|
|
|
|
QBluetoothDeviceDiscoveryAgent *remoteDeviceDiscoveryAgent;
|
2017-11-11 21:12:21 +00:00
|
|
|
QScopedPointer<QBluetoothDeviceInfo> selectedRemoteDeviceInfo;
|
2015-07-18 14:50:18 +00:00
|
|
|
|
|
|
|
void updateLocalDeviceInformation();
|
2015-07-18 17:51:45 +00:00
|
|
|
void initializeDeviceDiscoveryAgent();
|
2015-07-06 13:35:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BTDEVICESELECTIONDIALOG_H
|