mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
|
|
#include <qqtbluetoothmanager.h>
|
|
#include <qqtcore.h>
|
|
QQtBluetoothManager* manager = NULL;
|
|
|
|
MainWindow::MainWindow(QWidget* parent) :
|
|
QMainWindow(parent),
|
|
ui(new Ui::MainWindow)
|
|
{
|
|
ui->setupUi(this);
|
|
// bluetooth example
|
|
// serialport example
|
|
// tcpsocket example
|
|
// websocket?
|
|
//
|
|
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;
|
|
}
|
|
|
|
void MainWindow::addDevice(QBluetoothDeviceInfo s)
|
|
{
|
|
ui->lw1->addItem(s.address().toString());
|
|
}
|
|
|
|
void MainWindow::addService(QBluetoothServiceInfo s)
|
|
{
|
|
pline() << s.serviceClassUuids();
|
|
}
|
|
|
|
void MainWindow::on_btnRefresh_clicked()
|
|
{
|
|
ui->lw1->clear();
|
|
manager->refresh();
|
|
}
|