87 lines
2.7 KiB
C++
87 lines
2.7 KiB
C++
|
|
#ifndef TPS_DISTRIBUTION_MONITOR_HPP
|
|||
|
|
#define TPS_DISTRIBUTION_MONITOR_HPP
|
|||
|
|
|
|||
|
|
#include "app.hpp"
|
|||
|
|
#include <string>
|
|||
|
|
#include <vector>
|
|||
|
|
|
|||
|
|
// ============================================================
|
|||
|
|
// 方案分发与状态监控模块(SU-07 方案分发单元 & SU-08 状态监控单元)
|
|||
|
|
// ============================================================
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 方案分发与状态监控处理器。
|
|||
|
|
* 负责将任务方案分发至作战资产,以及接收遥测数据维护状态监控看板。
|
|||
|
|
*/
|
|||
|
|
class DistributionMonitor {
|
|||
|
|
public:
|
|||
|
|
DistributionMonitor() = default;
|
|||
|
|
~DistributionMonitor() = default;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 将任务方案分发至指定的作战资产。
|
|||
|
|
*
|
|||
|
|
* @requirement(name="方案驱动分发与状态响应", id="SRS-F-06-001")
|
|||
|
|
* 将任务方案分发至卫星、无人机、雷达等资产,监听ACK信号,
|
|||
|
|
* 更新状态指示灯。
|
|||
|
|
*
|
|||
|
|
* @param planId 方案ID
|
|||
|
|
* @param assetType 目标资产类型(如 "卫星" / "无人机" / "雷达")
|
|||
|
|
* @return 分发日志记录
|
|||
|
|
*/
|
|||
|
|
DistributionLog distributePlan(const std::string& planId,
|
|||
|
|
const std::string& assetType);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 处理接收到的 ACK 响应,更新分发状态。
|
|||
|
|
*
|
|||
|
|
* @param logId 分发日志ID
|
|||
|
|
* @param ackCode 响应码("ACK" / "NACK")
|
|||
|
|
*/
|
|||
|
|
void receiveAck(uint64_t logId, const std::string& ackCode);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 实时接收资产遥测数据并解析。
|
|||
|
|
*
|
|||
|
|
* @requirement(name="驱动状态监控与异常信息展示", id="SRS-F-06-002")
|
|||
|
|
* 实时接收资产遥测数据,解析后更新监控看板,
|
|||
|
|
* 检测异常状态码时触发报警。
|
|||
|
|
*
|
|||
|
|
* @param rawData 原始遥测数据包
|
|||
|
|
* @param source 数据来源标识
|
|||
|
|
* @return 解析后的状态日志
|
|||
|
|
*/
|
|||
|
|
StatusLog receiveTelemetry(const std::string& rawData,
|
|||
|
|
const std::string& source);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 检测状态码是否为异常,触发报警信号。
|
|||
|
|
*
|
|||
|
|
* @param statusCode 状态码
|
|||
|
|
* @return true 表示检测到异常并已触发报警
|
|||
|
|
*/
|
|||
|
|
bool triggerAlarm(const std::string& statusCode);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取所有分发日志。
|
|||
|
|
*/
|
|||
|
|
std::vector<DistributionLog> getDistributionLogs() const;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 获取所有状态日志。
|
|||
|
|
*/
|
|||
|
|
std::vector<StatusLog> getStatusLogs() const;
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
std::vector<DistributionLog> distLogs_; ///< 分发日志
|
|||
|
|
std::vector<StatusLog> statusLogs_; ///< 状态日志
|
|||
|
|
uint64_t nextLogId_{1}; ///< 自增日志ID
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 模拟发送数据到目标资产。
|
|||
|
|
*/
|
|||
|
|
bool sendToAsset(const std::string& planId, const std::string& assetType);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif // TPS_DISTRIBUTION_MONITOR_HPP
|