From 61d826363b28ef3b7990920703ffd087b1b6597a Mon Sep 17 00:00:00 2001 From: stli Date: Sat, 11 Apr 2026 08:36:18 +0800 Subject: [PATCH] Add GATT driver placeholder --- KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.cpp | 49 +++++++++++++++++++++++++ KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.h | 24 ++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.cpp create mode 100644 KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.h diff --git a/KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.cpp b/KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.cpp new file mode 100644 index 0000000..a0847ea --- /dev/null +++ b/KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.cpp @@ -0,0 +1,49 @@ +#include "DRI/GATT/Dri_Gatt.h" + +QVector Dri_Gatt_Enum() +{ + return {}; +} + +void Dri_Gatt_Deinit(Dri_Gatt_Struct_Port* p_Port) +{ + if (p_Port == nullptr) + { + return; + } + + *p_Port = Dri_Gatt_Struct_Port(); +} + +bool Dri_Gatt_Init(Dri_Gatt_Struct_Port* p_Port) +{ + if (p_Port == nullptr) + { + return false; + } + + Dri_Gatt_Deinit(p_Port); + return false; +} + +bool Dri_Gatt_Read(Dri_Gatt_Struct_Port* p_Port, QByteArray& ByteArray) +{ + ByteArray.clear(); + + if ((p_Port == nullptr) || !p_Port->IsOpened) + { + return false; + } + + return false; +} + +bool Dri_Gatt_Write(Dri_Gatt_Struct_Port* p_Port, const QByteArray& ByteArray) +{ + if ((p_Port == nullptr) || !p_Port->IsOpened) + { + return false; + } + + return !ByteArray.isEmpty(); +} diff --git a/KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.h b/KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.h new file mode 100644 index 0000000..18e9cdb --- /dev/null +++ b/KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include + +struct Dri_Gatt_Struct_PortInfo +{ + QString DeviceName; + QString DeviceAddress; +}; + +struct Dri_Gatt_Struct_Port +{ + bool IsOpened = false; + QString DeviceAddress; + QByteArray ReadBuffer; +}; + +QVector Dri_Gatt_Enum(); +void Dri_Gatt_Deinit(Dri_Gatt_Struct_Port* p_Port); +bool Dri_Gatt_Init(Dri_Gatt_Struct_Port* p_Port); +bool Dri_Gatt_Read(Dri_Gatt_Struct_Port* p_Port, QByteArray& ByteArray); +bool Dri_Gatt_Write(Dri_Gatt_Struct_Port* p_Port, const QByteArray& ByteArray);