补上之前缺失的
This commit is contained in:
@@ -90,10 +90,10 @@ target_include_directories(PiezoresistiveAPlugin PRIVATE
|
||||
target_link_libraries(PiezoresistiveAPlugin PRIVATE
|
||||
Qt6::Core
|
||||
)
|
||||
target_include_directories(TactileIpc3D PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdpart/OpenCV/include
|
||||
)
|
||||
if (WIN32)
|
||||
target_include_directories(TactileIpc3D PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdpart/OpenCV/include
|
||||
)
|
||||
target_link_directories(TactileIpc3D PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdpart/OpenCV/x64/mingw/lib
|
||||
)
|
||||
@@ -101,6 +101,10 @@ if (WIN32)
|
||||
opencv_core4140
|
||||
opencv_imgproc4140
|
||||
)
|
||||
else()
|
||||
find_package(OpenCV REQUIRED COMPONENTS core imgproc)
|
||||
target_include_directories(TactileIpc3D PRIVATE ${OpenCV_INCLUDE_DIRS})
|
||||
target_link_libraries(TactileIpc3D PRIVATE ${OpenCV_LIBS})
|
||||
endif()
|
||||
set(TS_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n/app_zh_CN.ts
|
||||
@@ -164,4 +168,3 @@ install(TARGETS PiezoresistiveAPlugin
|
||||
RUNTIME DESTINATION bin/plugins/decoders
|
||||
LIBRARY DESTINATION bin/plugins/decoders
|
||||
)
|
||||
|
||||
|
||||
@@ -671,6 +671,7 @@ classDiagram
|
||||
|
||||
## 更新记录
|
||||
|
||||
- 2026-02-02:补齐协议插件接口(`protocol_bundle.h` / `protocol_plugin.h`)并补充压阻 A 插件实现(`plugins/piezoresistive_a`)。
|
||||
- 2026-01-20:协议解码插件化(DLL),SerialBackend 启动时动态加载 `plugins/decoders`,安装器支持按组件选择协议插件。
|
||||
- 2026-01-11:新增 `QtSerialTransport`(`QSerialPort` 传输实现)并设为默认传输;补齐点选拾取逻辑;新增数据流/时序图并补充可视化 TODO 说明。
|
||||
- 2026-01-12:`LeftPanel` 新增颜色映射参数;`AppBackend`/`GLWidget` 增加颜色与范围接口,shader 使用三色渐变映射数据值。
|
||||
|
||||
11
plugins/piezoresistive_a/piezoresistive_a_plugin.cpp
Normal file
11
plugins/piezoresistive_a/piezoresistive_a_plugin.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "piezoresistive_a_plugin.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
ProtocolBundle PiezoresistiveAPlugin::createBundle() {
|
||||
ProtocolBundle bundle;
|
||||
bundle.codec = std::make_shared<PiezoresistiveACodec>();
|
||||
bundle.decoder = std::make_shared<PiezoresistiveADecoder>();
|
||||
bundle.format = std::make_shared<PiezoresistiveAFormat>();
|
||||
return bundle;
|
||||
}
|
||||
20
plugins/piezoresistive_a/piezoresistive_a_plugin.h
Normal file
20
plugins/piezoresistive_a/piezoresistive_a_plugin.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef TACTILEIPC3D_PIEZORESISTIVE_A_PLUGIN_H
|
||||
#define TACTILEIPC3D_PIEZORESISTIVE_A_PLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "serial/protocol_plugin.h"
|
||||
#include "serial/piezoresistive_a_protocol.h"
|
||||
|
||||
class PiezoresistiveAPlugin final : public QObject, public IProtocolPlugin {
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID PROTOCOL_PLUGIN_IID)
|
||||
Q_INTERFACES(IProtocolPlugin)
|
||||
|
||||
public:
|
||||
QString protocolName() const override { return QStringLiteral("piezoresistive_a"); }
|
||||
int apiVersion() const override { return kProtocolPluginApiVersion; }
|
||||
ProtocolBundle createBundle() override;
|
||||
};
|
||||
|
||||
#endif // TACTILEIPC3D_PIEZORESISTIVE_A_PLUGIN_H
|
||||
@@ -76,8 +76,10 @@ public slots:
|
||||
void setLightMode(bool on);
|
||||
void setShowBg(bool on);
|
||||
void setShowGrid(bool on);
|
||||
void setUseHeatmap(bool on);
|
||||
void setCol(int col);
|
||||
void setRow(int row);
|
||||
void setColorZero(const QColor& color);
|
||||
void setColorLow(const QColor& color);
|
||||
void setColorMid(const QColor& color);
|
||||
void setColorHigh(const QColor& color);
|
||||
@@ -213,6 +215,7 @@ private:
|
||||
unsigned int m_bgVbo = 0;
|
||||
bool m_lightMode = true;
|
||||
bool m_showBg = true;
|
||||
QVector3D m_colorZero{0.10f, 0.75f, 1.00f};
|
||||
QVector3D m_colorLow{0.10f, 0.75f, 1.00f};
|
||||
QVector3D m_colorMid{0.10f, 0.95f, 0.35f};
|
||||
QVector3D m_colorHigh{1.00f, 0.22f, 0.10f};
|
||||
|
||||
16
src/serial/protocol_bundle.h
Normal file
16
src/serial/protocol_bundle.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef TACTILEIPC3D_PROTOCOL_BUNDLE_H
|
||||
#define TACTILEIPC3D_PROTOCOL_BUNDLE_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "serial_codec.h"
|
||||
#include "serial_decoder.h"
|
||||
#include "serial_format.h"
|
||||
|
||||
struct ProtocolBundle {
|
||||
std::shared_ptr<ISerialCodec> codec;
|
||||
std::shared_ptr<ISerialDecoder> decoder;
|
||||
std::shared_ptr<ISerialFormat> format;
|
||||
};
|
||||
|
||||
#endif // TACTILEIPC3D_PROTOCOL_BUNDLE_H
|
||||
22
src/serial/protocol_plugin.h
Normal file
22
src/serial/protocol_plugin.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef TACTILEIPC3D_PROTOCOL_PLUGIN_H
|
||||
#define TACTILEIPC3D_PROTOCOL_PLUGIN_H
|
||||
|
||||
#include <QtPlugin>
|
||||
#include <QString>
|
||||
|
||||
#include "protocol_bundle.h"
|
||||
|
||||
constexpr int kProtocolPluginApiVersion = 1;
|
||||
#define PROTOCOL_PLUGIN_IID "com.tactileipc3d.ProtocolPlugin"
|
||||
|
||||
class IProtocolPlugin {
|
||||
public:
|
||||
virtual ~IProtocolPlugin() = default;
|
||||
virtual QString protocolName() const = 0;
|
||||
virtual int apiVersion() const = 0;
|
||||
virtual ProtocolBundle createBundle() = 0;
|
||||
};
|
||||
|
||||
Q_DECLARE_INTERFACE(IProtocolPlugin, PROTOCOL_PLUGIN_IID)
|
||||
|
||||
#endif // TACTILEIPC3D_PROTOCOL_PLUGIN_H
|
||||
Reference in New Issue
Block a user