| 
									
										
										
										
											2017-04-27 20:26:05 +02:00
										 |  |  | // SPDX-License-Identifier: GPL-2.0
 | 
					
						
							| 
									
										
										
										
											2015-07-06 16:35:13 +03:00
										 |  |  | #ifndef BTDEVICESELECTIONDIALOG_H
 | 
					
						
							|  |  |  | #define BTDEVICESELECTIONDIALOG_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QDialog>
 | 
					
						
							|  |  |  | #include <QListWidgetItem>
 | 
					
						
							|  |  |  | #include <QPointer>
 | 
					
						
							|  |  |  | #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 12:33:20 +01:00
										 |  |  | 	QString getSelectedDeviceText(); | 
					
						
							|  |  |  | 	static QString formatDeviceText(const QString &address, const QString &name); | 
					
						
							| 
									
										
										
										
											2015-07-06 16:35:13 +03: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 15:09:07 +01:00
										 |  |  | 	void currentItemChanged(QListWidgetItem *item,QListWidgetItem *previous); | 
					
						
							| 
									
										
										
										
											2015-07-06 16:35:13 +03:00
										 |  |  | 	void displayPairingMenu(const QPoint &pos); | 
					
						
							|  |  |  | 	void pairingFinished(const QBluetoothAddress &address,QBluetoothLocalDevice::Pairing pairing); | 
					
						
							|  |  |  | 	void error(QBluetoothLocalDevice::Error error); | 
					
						
							| 
									
										
										
										
											2015-07-18 20:54:31 +03:00
										 |  |  | 	void deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error error); | 
					
						
							| 
									
										
										
										
											2015-07-18 17:50:18 +03:00
										 |  |  | 	void localDeviceChanged(int); | 
					
						
							| 
									
										
										
										
											2015-07-06 16:35:13 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	Ui::BtDeviceSelectionDialog *ui; | 
					
						
							|  |  |  | 	QBluetoothLocalDevice *localDevice; | 
					
						
							|  |  |  | 	QBluetoothDeviceDiscoveryAgent *remoteDeviceDiscoveryAgent; | 
					
						
							| 
									
										
										
										
											2017-11-11 22:12:21 +01:00
										 |  |  | 	QScopedPointer<QBluetoothDeviceInfo> selectedRemoteDeviceInfo; | 
					
						
							| 
									
										
										
										
											2015-07-18 17:50:18 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void updateLocalDeviceInformation(); | 
					
						
							| 
									
										
										
										
											2015-07-18 20:51:45 +03:00
										 |  |  | 	void initializeDeviceDiscoveryAgent(); | 
					
						
							| 
									
										
										
										
											2015-07-06 16:35:13 +03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // BTDEVICESELECTIONDIALOG_H
 |