新增复合管控器(pCCU) + 惯导数据解析 + 设备控制页增强 + 0824协议文档归档

- 新增 pCCU 复合管控器程序(src/pCCU):FC/PM 双链路(UDP)、协议编解码器
  (FcProtocol/PmProtocol/Frame/Message/MessageRegistry)、快照与落库(DbStore)、
  内置 WebServer;挂入 src/CMakeLists.txt 与板卡 mission(h100.moos)
- 惯导/深度数据:新增 uDevice_insData 消息解析,接入 UpperCommManager,
  pPowerMangerHost 注册监视,UpmsgTest 覆盖
- pPowerMangerHost 设备控制页增强(web/index.html)
- 部署/运维脚本改为 4 个 systemd 服务(moosdb/pPowerManger/pPowerMangerHost/pCCU):
  deploy/clean-data/fetch-data 同步适配
- 协议文档:归档 0824 控制主机与复合管控器通信协议 xlsx 及关联 docx,移除旧 md
- 测试:新增 pccu 单元/集成测试与 disSysTest Python 配电仿真
- 清理:移除未使用的 CCU 状态调试打印 coutMsg;.gitignore 补充编译产物/临时文件忽略
This commit is contained in:
zjk
2026-08-26 22:43:10 +08:00
parent e0488d513b
commit 54c32a180a
79 changed files with 8731 additions and 1398 deletions
+70
View File
@@ -0,0 +1,70 @@
#ifndef PCCU_DB_STORE_H
#define PCCU_DB_STORE_H
#include <cstdint>
#include <string>
#include <mutex>
#include <vector>
#include "../comm/LinkManager.h"
struct sqlite3;
struct sqlite3_stmt;
namespace ccu {
//============================================================================
// DbStore:SQLite 存储。
//
// 设计要点(应对协议变更):
// - 以“原始帧日志”为主表(comm_log),收发全部数据按帧落库,
// 协议字段变化不会导致建表失败。
// - 提供按 link / direction / msg_id 的查询接口供网页展示。
// 复用仓库内 src/pPowerManger/sqlit3/sqlite3.c 与 sqlite3.h。
//============================================================================
struct CommLogRow {
long long id;
double time;
std::string link; // fc / pm
int direction; // 0=收 1=发
uint16_t msgId;
std::string msgName;
int length;
int checksumOk;
std::string hex;
};
class DbStore : public ILinkLogSink {
public:
explicit DbStore(const std::string& dbPath);
~DbStore();
bool open();
void close();
bool isOpen() const { return m_db != nullptr; }
std::string lastError() const { return m_lastError; }
// 实现 ILinkLogSink:原始帧落库(收发双向)
void onRawFrame(int direction, uint16_t msgId, const std::string& link,
const std::vector<uint8_t>& data, bool checksumOk) override;
// 查询最近 N 条记录(可限定链路/方向/消息id;limit<=0 表示默认 100)
std::vector<CommLogRow> queryRecent(const std::string& link, int direction,
uint16_t msgId, int limit);
long long count() const;
private:
bool exec(const char* sql);
bool prepareInsert();
std::string m_dbPath;
sqlite3* m_db = nullptr;
sqlite3_stmt* m_stmtInsert = nullptr;
mutable std::mutex m_mutex;
std::string m_lastError;
};
} // namespace ccu
#endif // PCCU_DB_STORE_H