1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/test/qqtbtfileserver/mainwindow.cpp

42 lines
1022 B
C++
Raw Normal View History

#include "mainwindow.h"
#include "ui_mainwindow.h"
2017-11-23 19:12:48 +08:00
#include <qqtbluetoothmanager.h>
#include <qqtcore.h>
QQtBluetoothManager* manager = NULL;
2017-11-23 19:12:48 +08:00
MainWindow::MainWindow ( QWidget* parent ) :
QMainWindow ( parent ),
ui ( new Ui::MainWindow )
{
2017-11-23 19:12:48 +08:00
ui->setupUi ( this );
// bluetooth example
manager = QQtBluetoothManager::Instance ( this );
connect ( manager, SIGNAL ( addDevice ( QBluetoothDeviceInfo ) ), this, SLOT ( addDevice ( QBluetoothDeviceInfo ) ) );
connect ( manager, SIGNAL ( addService ( QBluetoothServiceInfo ) ), this,
SLOT ( addService ( QBluetoothServiceInfo ) ) );
ui->lw0->addItem ( manager->address().toString() );
}
MainWindow::~MainWindow()
{
delete ui;
}
2017-11-23 19:12:48 +08:00
void MainWindow::on_btnRefresh_clicked()
{
ui->lw1->clear();
manager->refresh();
}
void MainWindow::addDevice ( QBluetoothDeviceInfo s )
{
ui->lw1->addItem ( s.address().toString() );
}
void MainWindow::addService ( QBluetoothServiceInfo s )
{
pline() << s.serviceClassUuids();
}