修复了配电系统校验码的问题
This commit is contained in:
@@ -25,6 +25,9 @@ SET(HTTP_SRC
|
||||
httpserver/mongoose.c
|
||||
httpserver/httpserver.cpp)
|
||||
|
||||
SET(LOG_SRC
|
||||
logc/loguru.cpp)
|
||||
|
||||
SET(UDP_COMM_SRC
|
||||
udpcomm/udpComm.cpp)
|
||||
|
||||
@@ -50,6 +53,7 @@ SET(SRC
|
||||
${SQLITE_SRC}
|
||||
${HTTP_SRC}
|
||||
${UDP_COMM_SRC}
|
||||
${LOG_SRC}
|
||||
PowerManger.cpp
|
||||
PowerManger_Info.cpp
|
||||
# udpComm.cpp
|
||||
@@ -58,7 +62,7 @@ SET(SRC
|
||||
driver.cpp
|
||||
LowerCommManager.cpp
|
||||
UpperCommManager.cpp
|
||||
loguru.cpp
|
||||
# loguru.cpp
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(pPowerManger ${SRC})
|
||||
|
||||
@@ -76,12 +76,11 @@ bool LowerCommManager::initUdpComm(){
|
||||
return true;
|
||||
}
|
||||
void LowerCommManager::processPeriodicTasks() {
|
||||
// sendCcuCommand(m_pm->m_CcuColCmd);
|
||||
sendCcuCommand(m_pm->m_CcuColCmd);
|
||||
//延时5ms
|
||||
usleep(5000);
|
||||
// sendDisSysCommand(m_pm->m_targetDisBreakerState);
|
||||
m_udpComm->clearMsgQueue();
|
||||
|
||||
}
|
||||
|
||||
bool LowerCommManager::sendCcuCommand(const ccuColCmd cmd){
|
||||
@@ -706,7 +705,7 @@ bool LowerCommManager::operate_LVA_mergencyLithiumBatteryGroup1Circuit_Breaker(c
|
||||
// 仪表母线断路器操作函数
|
||||
bool LowerCommManager::operate_LV_lithiumBatteryGroupInstrumentCircuit_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"lithiumBatteryGroupInstrumentCircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.lithiumBatteryGroupInstrumentCircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.lithiumBatteryGroupInstrumentCircuitBreaker; }
|
||||
@@ -714,7 +713,7 @@ bool LowerCommManager::operate_LV_lithiumBatteryGroupInstrumentCircuit_Breaker(c
|
||||
}
|
||||
bool LowerCommManager::operate_LV_bowLowVoltageDistributionBoxCircuit_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"bowLowVoltageDistributionBoxCircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.bowLowVoltageDistributionBoxCircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.bowLowVoltageDistributionBoxCircuitBreaker; }
|
||||
@@ -722,7 +721,7 @@ bool LowerCommManager::operate_LV_bowLowVoltageDistributionBoxCircuit_Breaker(ch
|
||||
}
|
||||
bool LowerCommManager::operate_LV_unit4Dc48V_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"unit4InstrumentDC48VCircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.unit4InstrumentDC48VCircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.unit4InstrumentDC48VCircuitBreaker; }
|
||||
@@ -730,7 +729,7 @@ bool LowerCommManager::operate_LV_unit4Dc48V_Breaker(char opt){
|
||||
}
|
||||
bool LowerCommManager::operate_LV_dcC1Panel_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"dcC1DCDistributionPanelCircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.dcC1DCDistributionPanelCircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.dcC1DCDistributionPanelCircuitBreaker; }
|
||||
@@ -738,7 +737,7 @@ bool LowerCommManager::operate_LV_dcC1Panel_Breaker(char opt){
|
||||
}
|
||||
bool LowerCommManager::operate_LV_reservedCircuit1_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"reservedCircuitBreaker1",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.reservedCircuitBreaker1 = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.reservedCircuitBreaker1; }
|
||||
@@ -746,7 +745,7 @@ bool LowerCommManager::operate_LV_reservedCircuit1_Breaker(char opt){
|
||||
}
|
||||
bool LowerCommManager::operate_LV_reservedCircuit2_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"reservedCircuitBreaker2",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.reservedCircuitBreaker2 = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.reservedCircuitBreaker2; }
|
||||
@@ -754,7 +753,7 @@ bool LowerCommManager::operate_LV_reservedCircuit2_Breaker(char opt){
|
||||
}
|
||||
bool LowerCommManager::operate_LV_mergencyLithiumBatteryGroup2Circuit_Breaker(char opt){
|
||||
return operateBreakerGeneric<disLowMainBusCmd, char>(
|
||||
"HV_fuelCellCircuit_Breaker",
|
||||
"emergencyLithiumBatteryGroup2CircuitBreaker",
|
||||
opt,
|
||||
[&](disLowMainBusCmd& c){ c.emergencyLithiumBatteryGroup2CircuitBreaker = getBreakerOption(opt); },
|
||||
[&](){ return m_pm->m_pmCurrentState.bus3State.emergencyLithiumBatteryGroup2CircuitBreaker; }
|
||||
@@ -771,31 +770,37 @@ bool LowerCommManager::operateBreakerGeneric(
|
||||
) {
|
||||
CmdT cmd{}; // 默认全零
|
||||
double t0 = MOOSTime();
|
||||
bool ok = false;
|
||||
LOG_F(INFO, "operate %s: opt=%d", name, opt);
|
||||
|
||||
// 第一次发包
|
||||
fillCmd(cmd);
|
||||
m_udpComm->sendDisSysCmd(cmd);
|
||||
MOOSPause(100);
|
||||
// 等待状态变更
|
||||
while ( readState() != getBreakerOption(opt) ) {
|
||||
while ( !ok ) {
|
||||
if( readState() == getBreakerOption(opt) )
|
||||
{
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
if (!m_udpComm->sendDisSysCmd(cmd)) {
|
||||
LOG_F(ERROR, "operate %s: sendDisSysCmd failed", name);
|
||||
return false;
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
if (MOOSTime() > t0 + 5) {
|
||||
if (MOOSTime() > t0 + 6) {
|
||||
LOG_F(ERROR, "operate %s: timeout", name);
|
||||
return false;
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
MOOSPause(1000);
|
||||
MOOSPause(200);
|
||||
}
|
||||
|
||||
// 清零再发三次
|
||||
//继电器复位
|
||||
CmdT clr{};
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
m_udpComm->sendDisSysCmd(clr);
|
||||
MOOSPause(100);
|
||||
MOOSPause(200);
|
||||
}
|
||||
return true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ public:
|
||||
bool operate_LVA_reservedCircuit1_Breaker(char opt);
|
||||
bool operate_LVA_reservedCircuit2_Breaker(char opt);
|
||||
bool operate_LVA_mergencyLithiumBatteryGroup1Circuit_Breaker(char opt);
|
||||
//========================================================================================
|
||||
//================================复合管控器操作函数====================================
|
||||
bool operate_CCU_fcmod(char opt);
|
||||
// 发送CCU控制命令
|
||||
bool sendCcuCommand(const ccuColCmd cmd);
|
||||
bool sendDisSysCommand(const disSysBreakerList& cmd); //已废弃,不同时操作多个继电器设备
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "MBUtils.h"
|
||||
#include "ACTable.h"
|
||||
#include "PowerManger.h"
|
||||
#include "loguru.hpp"
|
||||
#include "logc/loguru.hpp"
|
||||
#include <memory>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define JSON_USE_EXCEPTION 1
|
||||
|
||||
#include <queue>
|
||||
#include "loguru.hpp"
|
||||
#include "logc/loguru.hpp"
|
||||
#include "MOOS/libMOOS/Thirdparty/AppCasting/AppCastingMOOSApp.h"
|
||||
#include "MOOS/libMOOS/Utils/MOOSThread.h"
|
||||
#include "MOOS/libMOOS/Utils/MOOSUtilityFunctions.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "PowerManagerFsm.hpp"
|
||||
#include "../PowerManger.h"
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
#include <string>
|
||||
#include "MOOS/libMOOS/Utils/MOOSUtilityFunctions.h"
|
||||
#include "../faultCode.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef POWER_MANAGER_FSM_HPP
|
||||
#define POWER_MANAGER_FSM_HPP
|
||||
#include "tinyfsm.hpp"
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
#include <iostream>
|
||||
#include <chrono> // 新增头文件
|
||||
#include <iomanip> // 新增头文件
|
||||
|
||||
@@ -484,7 +484,7 @@ function sendCommand(type, id, action, value) {
|
||||
|
||||
// 启动5秒计时器
|
||||
if (timerEl) {
|
||||
let seconds = 6;
|
||||
let seconds = 8;
|
||||
timerEl.textContent = `等待反馈: ${seconds}秒`;
|
||||
timer = setInterval(() => {
|
||||
seconds--;
|
||||
|
||||
@@ -589,7 +589,7 @@ const std::string DATA_HTML = R"(
|
||||
<span class="data-value" id="instrument-main-bus-emergency-power-status">正在加载...</span>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<span class="data-label">仪表汇流排绝缘状态:</span>
|
||||
<span class="data-label">仪表母线排绝缘状态:</span>
|
||||
<span class="data-value" id="instrument-main-bus-insulation-status">正在加载...</span>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
|
||||
@@ -166,19 +166,72 @@ body {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
.message-cards {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
max-width: 600px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.message-card {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.data-table th, .data-table td {
|
||||
padding: 8px 12px;
|
||||
.message-card {
|
||||
background: white;
|
||||
border: 1px solid #e5e7eb;
|
||||
text-align: left;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.data-table th {
|
||||
background-color: #f3f4f6;
|
||||
.card-header {
|
||||
padding: 12px 16px;
|
||||
background: #f3f4f6;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card-header:hover {
|
||||
background: #e5e7eb;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.card-content pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
font-family: monospace;
|
||||
max-height: 150px;
|
||||
overflow: hidden;
|
||||
transition: max-height 0.3s ease;
|
||||
}
|
||||
|
||||
.card-content pre.expanded {
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.toggle-button {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #2563eb;
|
||||
cursor: pointer;
|
||||
font-size: 0.9em;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.toggle-button:hover {
|
||||
background: rgba(37, 99, 235, 0.1);
|
||||
}
|
||||
|
||||
.raw-data {
|
||||
@@ -239,32 +292,16 @@ body {
|
||||
|
||||
<div class="debug-section">
|
||||
<div class="section-title">订阅消息</div>
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>消息名称</th>
|
||||
<th>消息内容</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="subscribeDataTable">
|
||||
<div class="message-cards" id="subscribeDataTable">
|
||||
<!-- 订阅消息将通过JavaScript动态填充 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="debug-section">
|
||||
<div class="section-title">发布消息</div>
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>消息名称</th>
|
||||
<th>消息内容</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="publishDataTable">
|
||||
<div class="message-cards" id="publishDataTable">
|
||||
<!-- 发布消息将通过JavaScript动态填充 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="debug-section">
|
||||
@@ -296,8 +333,6 @@ function initWebSocket() {
|
||||
|
||||
// 更新订阅消息表格
|
||||
const subscribeTable = document.getElementById('subscribeDataTable');
|
||||
subscribeTable.innerHTML = '';
|
||||
if (data.debug) {
|
||||
const subscribeMessages = [
|
||||
'm_secdistStateMsg_fb_debug',
|
||||
'm_equStateMsg_cmd_debug',
|
||||
@@ -312,16 +347,22 @@ function initWebSocket() {
|
||||
];
|
||||
|
||||
subscribeMessages.forEach(msg => {
|
||||
if (data.debug[msg]) {
|
||||
if (data.debug && data.debug[msg] && data.debug[msg].name) {
|
||||
const msgName = data.debug[msg].name;
|
||||
const existingCard = Array.from(subscribeTable.children).find(card =>
|
||||
card.querySelector('.card-header').textContent === msgName
|
||||
);
|
||||
|
||||
if (existingCard) {
|
||||
existingCard.querySelector('pre').textContent = formatJsonContent(data.debug[msg].content || '无内容');
|
||||
} else if (msgName !== '未知消息') {
|
||||
addDebugRow(subscribeTable, data.debug[msg]);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 更新发布消息表格
|
||||
const publishTable = document.getElementById('publishDataTable');
|
||||
publishTable.innerHTML = '';
|
||||
if (data.debug) {
|
||||
const publishMessages = [
|
||||
'm_equInsStateMsg_fb_degub',
|
||||
'm_secdistStateMsg_cmd_debug',
|
||||
@@ -334,11 +375,19 @@ function initWebSocket() {
|
||||
];
|
||||
|
||||
publishMessages.forEach(msg => {
|
||||
if (data.debug[msg]) {
|
||||
if (data.debug && data.debug[msg] && data.debug[msg].name) {
|
||||
const msgName = data.debug[msg].name;
|
||||
const existingCard = Array.from(publishTable.children).find(card =>
|
||||
card.querySelector('.card-header').textContent === msgName
|
||||
);
|
||||
|
||||
if (existingCard) {
|
||||
existingCard.querySelector('pre').textContent = formatJsonContent(data.debug[msg].content || '无内容');
|
||||
} else if (msgName !== '未知消息') {
|
||||
addDebugRow(publishTable, data.debug[msg]);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.error('解析调试数据出错:', e);
|
||||
@@ -362,18 +411,50 @@ function updateStatus(status) {
|
||||
document.getElementById('wsStatus').textContent = status;
|
||||
}
|
||||
|
||||
function addDebugRow(table, msgObj) {
|
||||
const row = document.createElement('tr');
|
||||
function formatJsonContent(content) {
|
||||
try {
|
||||
const parsed = JSON.parse(content);
|
||||
return JSON.stringify(parsed, null, 2);
|
||||
} catch (e) {
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
||||
const nameCell = document.createElement('td');
|
||||
nameCell.textContent = msgObj.name || '未知消息';
|
||||
row.appendChild(nameCell);
|
||||
function addDebugRow(container, msgObj) {
|
||||
const card = document.createElement('div');
|
||||
card.className = 'message-card';
|
||||
|
||||
const valueCell = document.createElement('td');
|
||||
valueCell.textContent = msgObj.content || '无内容';
|
||||
row.appendChild(valueCell);
|
||||
const header = document.createElement('div');
|
||||
header.className = 'card-header';
|
||||
header.textContent = msgObj.name || '未知消息';
|
||||
|
||||
table.appendChild(row);
|
||||
const content = document.createElement('div');
|
||||
content.className = 'card-content';
|
||||
|
||||
const pre = document.createElement('pre');
|
||||
pre.textContent = formatJsonContent(msgObj.content || '无内容');
|
||||
|
||||
const toggleBtn = document.createElement('button');
|
||||
toggleBtn.className = 'toggle-button';
|
||||
toggleBtn.textContent = '展开';
|
||||
toggleBtn.onclick = function(e) {
|
||||
e.stopPropagation();
|
||||
pre.classList.toggle('expanded');
|
||||
this.textContent = pre.classList.contains('expanded') ? '收起' : '展开';
|
||||
};
|
||||
|
||||
header.onclick = function(e) {
|
||||
if(e.target !== toggleBtn) {
|
||||
pre.classList.toggle('expanded');
|
||||
toggleBtn.textContent = pre.classList.contains('expanded') ? '收起' : '展开';
|
||||
}
|
||||
};
|
||||
|
||||
content.appendChild(pre);
|
||||
content.appendChild(toggleBtn);
|
||||
card.appendChild(header);
|
||||
card.appendChild(content);
|
||||
container.appendChild(card);
|
||||
}
|
||||
|
||||
window.addEventListener('load', initWebSocket);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define HTTP_SERVER_H
|
||||
#include "MOOS/libMOOS/Utils/MOOSThread.h"
|
||||
#include "mongoose.h"
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
#include "../systemData.h"
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
|
||||
@@ -147,14 +147,14 @@ body {
|
||||
.data-panel {
|
||||
background: white;
|
||||
border-radius: 4px;
|
||||
padding: 6px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
height: calc(100vh - var(--header-height) + 3px);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.panel-title {
|
||||
font-size: 1rem;
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
color: #1a1a1a;
|
||||
margin-bottom: 8px;
|
||||
@@ -168,8 +168,9 @@ body {
|
||||
justify-content: center;
|
||||
height: calc(100% - 2rem);
|
||||
color: #6b7280;
|
||||
font-size: 1rem;
|
||||
margin-top: 8px;
|
||||
font-size: 1.1rem;
|
||||
margin-top: 24px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@@ -214,6 +215,10 @@ body {
|
||||
<span class="sidebar-icon">🧪</span>
|
||||
<span>测试页面</span>
|
||||
</a>
|
||||
<a href="/debug" class="sidebar-button">
|
||||
<span class="sidebar-icon">🐞</span>
|
||||
<span>调试页面</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "ColorParse.h"
|
||||
#include "PowerManger.h"
|
||||
#include "PowerManger_Info.h"
|
||||
#include "loguru.hpp"
|
||||
#include "logc/loguru.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "SQLite.h"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
|
||||
SQLite::SQLite(const std::string& dbPath)
|
||||
{
|
||||
|
||||
@@ -391,7 +391,7 @@ bool udpComm::popMsgFormQueue(double &time,msg_disLowBusFbMsg &m)
|
||||
bool udpComm::sendDisSysCmd(const disHighVolBusCmd cmd)
|
||||
{
|
||||
unsigned char* msgBuf;
|
||||
Checksum cc;
|
||||
cChecksum cc;
|
||||
msg_disHVBCmd* msg = new msg_disHVBCmd;
|
||||
msg->header.id = DIS_HVBUS_CMD_ID;
|
||||
msg->header.start1 = DIS_MSG_HEAD1;
|
||||
@@ -401,9 +401,8 @@ bool udpComm::sendDisSysCmd(const disHighVolBusCmd cmd)
|
||||
// msg->header.length = sizeof(disHighVolBusCmd);
|
||||
msg->data = cmd;
|
||||
msgBuf = reinterpret_cast<unsigned char *>(msg);
|
||||
cc = calculateChecksum(msgBuf,sizeof(msg_disHVBCmd));
|
||||
msg->checkCode = static_cast<cChecksum>(cc & 0xFF);
|
||||
// std::cout << (int)sizeof(msg_disHVBCmd) << endl;
|
||||
cc = calculateChecksum(msgBuf,sizeof(msg_disHVBCmd),sizeof(cChecksum));
|
||||
msg->checkCode = cc;
|
||||
try
|
||||
{
|
||||
sendMsg(msgBuf,sizeof(msg_disHVBCmd));
|
||||
@@ -419,7 +418,7 @@ bool udpComm::sendDisSysCmd(const disHighVolBusCmd cmd)
|
||||
bool udpComm::sendDisSysCmd(const disHighAVolBusCmd cmd)
|
||||
{
|
||||
unsigned char* msgBuf;
|
||||
Checksum cc;
|
||||
cChecksum cc;
|
||||
msg_disHVBACmd* msg = new msg_disHVBACmd;
|
||||
msg->header.id = DIS_HVBUSA_CMD_ID;
|
||||
msg->header.start1 = DIS_MSG_HEAD1;
|
||||
@@ -429,8 +428,8 @@ bool udpComm::sendDisSysCmd(const disHighAVolBusCmd cmd)
|
||||
// msg->header.length = sizeof(disHighAVolBusCmd);
|
||||
msg->data = cmd;
|
||||
msgBuf = reinterpret_cast<unsigned char *>(msg);
|
||||
cc = calculateChecksum(msgBuf,sizeof(msg_disHVBACmd));
|
||||
msg->checkCode = static_cast<cChecksum>(cc & 0xFF);
|
||||
cc = calculateChecksum(msgBuf,sizeof(msg_disHVBACmd),sizeof(cChecksum));
|
||||
msg->checkCode = cc;
|
||||
try
|
||||
{
|
||||
sendMsg(msgBuf,sizeof(msg_disHVBACmd));
|
||||
@@ -446,7 +445,7 @@ bool udpComm::sendDisSysCmd(const disHighAVolBusCmd cmd)
|
||||
bool udpComm::sendDisSysCmd(const disHighBVolBusCmd cmd)
|
||||
{
|
||||
unsigned char* msgBuf;
|
||||
Checksum cc;
|
||||
cChecksum cc;
|
||||
msg_disHVBBCmd* msg = new msg_disHVBBCmd;
|
||||
msg->header.id = DIS_HVBUSB_CMD_ID;
|
||||
msg->header.start1 = DIS_MSG_HEAD1;
|
||||
@@ -456,8 +455,8 @@ bool udpComm::sendDisSysCmd(const disHighBVolBusCmd cmd)
|
||||
// msg->header.length = sizeof(disHighBVolBusCmd);
|
||||
msg->data = cmd;
|
||||
msgBuf = reinterpret_cast<unsigned char *>(msg);
|
||||
cc = calculateChecksum(msgBuf,sizeof(msg_disHVBBCmd));
|
||||
msg->checkCode = static_cast<cChecksum>(cc & 0xFF);
|
||||
cc = calculateChecksum(msgBuf,sizeof(msg_disHVBBCmd),sizeof(cChecksum));
|
||||
msg->checkCode = cc;
|
||||
try
|
||||
{
|
||||
// cout << "=========" <<(int)sizeof(msg_disHVBBCmd) << endl;
|
||||
@@ -474,7 +473,7 @@ bool udpComm::sendDisSysCmd(const disHighBVolBusCmd cmd)
|
||||
bool udpComm::sendDisSysCmd(const disLowBusCmd cmd)
|
||||
{
|
||||
unsigned char* msgBuf;
|
||||
Checksum cc;
|
||||
cChecksum cc;
|
||||
msg_disLVBCmd* msg = new msg_disLVBCmd;
|
||||
msg->header.id = DIS_LVBUS_CMD_ID;
|
||||
msg->header.start1 = DIS_MSG_HEAD1;
|
||||
@@ -484,8 +483,10 @@ bool udpComm::sendDisSysCmd(const disLowBusCmd cmd)
|
||||
// msg->header.length = sizeof(disLowBusCmd);
|
||||
msg->data = cmd;
|
||||
msgBuf = reinterpret_cast<unsigned char *>(msg);
|
||||
cc = calculateChecksum(msgBuf,sizeof(msg_disLVBCmd));
|
||||
msg->checkCode = static_cast<cChecksum>(cc & 0xFF);
|
||||
cc = calculateChecksum(msgBuf,sizeof(msg_disLVBCmd),sizeof(cChecksum));
|
||||
// msg->checkCode = static_cast<cChecksum>(cc & 0xFF);
|
||||
msg->checkCode = cc;
|
||||
cout << "cc======disLowBusCmd=============================" << (int) msg->checkCode << endl;
|
||||
try
|
||||
{
|
||||
sendMsg(msgBuf,sizeof(msg_disLVBCmd));
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
using namespace std;
|
||||
#define QUENUE_SIZE 100
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#ifndef UDEVICE_DEPTH_ST_H
|
||||
#define UDEVICE_DEPTH_ST_H
|
||||
#include <string>
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
#define DB_TO_PM_DEEPTH "uDevice_depth_st"
|
||||
class uDevice_depthMsg
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <string>
|
||||
#include <json/json.h>
|
||||
#include "../driver.h"
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
|
||||
class uDevice_secdistStateMsg
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef UEXTERCOMM_SETOPCONDITION_CMD_H
|
||||
#define UEXTERCOMM_SETOPCONDITION_CMD_H
|
||||
#include <string>
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
#include "json/json.h"
|
||||
//外部通信消息
|
||||
#define DB_TO_PM_SETOPCONDITION "uExternComm_setOpCondition_cmd"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef UEXTERCOMM_SETOPMODE_CMD_H
|
||||
#define UEXTERCOMM_SETOPMODE_CMD_H
|
||||
#include <string>
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
|
||||
//外部通信消息
|
||||
#define DB_TO_PM_SETOPMODE "uExternComm_setOpMode_cmd"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef UEXTERNCONM_SETPMSYS_H
|
||||
#define UEXTERNCONM_SETPMSYS_H
|
||||
#include <string>
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
#define DB_TO_PM_SETPMSYS "uExternComm_setPowerSystem_cmd"
|
||||
class uExternComm_setPowerSystemMsg
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef UPLAN_PLANSTOP_CMD_H
|
||||
#define UPLAN_PLANSTOP_CMD_H
|
||||
#include <string>
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
#define DB_TO_PM_TASKSTOP "uPlan_planStop_cmd"
|
||||
class uPlan_planStopMsg
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define UPPERCOMMMANAGER_H
|
||||
#include <string>
|
||||
#include "../pmSysvariable.h"
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
//决策消息
|
||||
#define DB_TO_PM_MISSION "uPlan_taskStart_cmd"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "string"
|
||||
#include "json/json.h"
|
||||
#include <bitset>
|
||||
#include "../loguru.hpp"
|
||||
#include "../logc/loguru.hpp"
|
||||
class uPower_sysStateMsg
|
||||
{
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user