1 Star 0 Fork 2

Leonard/TelinkOTA

forked from nabian/TelinkOTA 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
qgpioble.h 2.04 KB
一键复制 编辑 原始数据 按行查看 历史
nabian 提交于 2021-07-11 09:38 . 修改UI界面
#ifndef QGPIO_BLE_H
#define QGPIO_BLE_H
#include <qbluetoothlocaldevice.h>
#include <QBluetoothDeviceDiscoveryAgent>
#include <QLowEnergyController>
#include <QBluetoothDeviceInfo>
QT_FORWARD_DECLARE_CLASS(QBluetoothDeviceDiscoveryAgent)
QT_FORWARD_DECLARE_CLASS(QBluetoothDeviceInfo)
class QGPIOBle : public QObject
{
Q_OBJECT
public slots:
void deviceConnected_cb();
void addLowEnergyService(const QBluetoothUuid &uuid);
void serviceScanDone_cb();
void serviceStateChanged_cb(QLowEnergyService::ServiceState s);
void CharaterNotify_cb(const QLowEnergyCharacteristic &c, const QByteArray &value);
void confirmedcharacteristicWrite(const QLowEnergyCharacteristic &d, const QByteArray &value);
void serviceStateErr_cb(QLowEnergyService::ServiceError newError);
void deviceDisconnected_cb();
void ControllerError_cb(QLowEnergyController::Error);
void FindDevice_cb(const QBluetoothDeviceInfo &info);
void deviceScanError_cb(QBluetoothDeviceDiscoveryAgent::Error error);
void scanFinished_cb();
protected:
public:
explicit QGPIOBle(QObject *parent = nullptr);
~QGPIOBle();
void connect_service(const QString Uuid);
void connectDevice();
void startScan();
bool writeCharacteristics(QLowEnergyService *ser,QLowEnergyCharacteristic &c, QByteArray &sendbuffer, bool rsp);
QBluetoothDeviceDiscoveryAgent *discoveryAgent;
QBluetoothLocalDevice *localDevice;
QLowEnergyController *controller = nullptr;
QBluetoothDeviceInfo currentDevice;
bool connected = false;
void disconnect_service(QLowEnergyService *service);
QLowEnergyService *m_service = nullptr;
QLowEnergyDescriptor m_notificationDesc;
QList<QObject *> m_services;
QList<QObject *> m_characteristics;
QList<QBluetoothDeviceInfo *> Devicelist;
QLowEnergyCharacteristic OtaChar;
signals:
void emit_scanfinish();
void emit_confirmedcharacteristicWrite(const QString uuid, const QByteArray &value);
void emit_CharaterNotify(const QString uuid, const QByteArray &value);
};
#endif // QGPIO_BLE_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/leonard33/TelinkOTA.git
git@gitee.com:leonard33/TelinkOTA.git
leonard33
TelinkOTA
TelinkOTA
master

搜索帮助