调试修改

This commit is contained in:
徐海 2026-04-14 10:16:36 +08:00
parent 09be8c7efa
commit 871de1e005
3 changed files with 36 additions and 14 deletions

View File

@ -317,13 +317,13 @@ typedef void(__stdcall *ONUPDATE_DEVICE_STRUCT)(void* pHandle,void *pParent,int
DEVICEMANAGE_API(int) FindDeviceAsync(sFindDeviceConfig *fdc, ONFINDDEVICEFINISHED OnFindFinished);
DEVICEMANAGE_API(int) GetDeviceInfo(void *pHandle, sDeviceInfo *spDi, int budnum, int chnum);
DEVICEMANAGE_API(int) GetDeviceBoardTotalNum(void *pHandle);
DEVICEMANAGE_API(int) GetDeviceChTotalNum(void *pHandle, int bdidx);
DEVICEMANAGE_API(int) GetDeviceChTotalNum(void *pHandle, int bdidx);
// DEVICEMANAGE_API(int) GetDeviceUserInfo(void *pHandle, UserConfigInfo *pUCI);
// DEVICEMANAGE_API(int) SetDeviceUserInfo(void *pHandle, UserConfigInfo *pUCI);
// DEVICEMANAGE_API(int) GetDeviceBoardUserInfo(void *pHandle, UserConfigInfo *pUCI, int bdidx);
// DEVICEMANAGE_API(int) GetDeviceBoardChannelUserInfo(void *pHandle, UserConfigInfo *pUCI, int bdidx, int chidx);
// DEVICEMANAGE_API(int) SetDeviceBoardChannelUserInfo(void *pHandle, UserConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) GetDeviceUserInfo(void *pHandle, UserConfigInfo *pUCI);
DEVICEMANAGE_API(int) SetDeviceUserInfo(void *pHandle, UserConfigInfo *pUCI);
DEVICEMANAGE_API(int) GetDeviceBoardUserInfo(void *pHandle, UserConfigInfo *pUCI, int bdidx);
DEVICEMANAGE_API(int) GetDeviceBoardChannelUserInfo(void *pHandle, UserConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) SetDeviceBoardChannelUserInfo(void *pHandle, UserConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) GetDeviceBoardChannelConfiginfo(void *pHandle, OneChannelConfigInfo *pUCI, int bdidx, int chidx);
DEVICEMANAGE_API(int) DBCSetHightVoltage(void *pHandle, OneChannelConfigInfo *pUCI, int bdidx, int chidx);

View File

@ -125,6 +125,7 @@ bool MeasureDeviceController::SetDeviceMeasureConfigParams(const QString &device
ok = false;
return ok;
}
config.m_eTransferModel = eSpecturmMode;
config.m_iDeviceGain = cfg_params.value("DeviceGain", 1).toInt();
config.m_iDeviceGainSelectIndex = cfg_params.value("DeviceGainSelectIndex", 1).toInt();
config.m_iSoftGain = cfg_params.value("SoftGain", 3000).toInt();
@ -136,7 +137,6 @@ bool MeasureDeviceController::SetDeviceMeasureConfigParams(const QString &device
config.m_iMaxEnergy = cfg_params.value("MaxEnergy", 1).toInt();
config.m_iTotalMeasureTime = cfg_params.value("TotalMeasureTime", 10).toInt();
config.m_eTransferModel = eSpecturmMode;
config.m_iFormTime = 3;
config.m_iFastChannelTrigerValue = 10;
config.m_iHighVoltage = 0;
@ -257,9 +257,9 @@ QString MeasureDeviceController::GetMeasureGvfDataFilename()
if (measure_gvf_data_file_info.exists()) {
if ( measure_gvf_data_file_info.suffix() != QString("gvf") )
continue;
QString measure_gvf_data_file_base_name = measure_gvf_data_file_info.baseName();
QDateTime data_time = QDateTime::fromString(measure_gvf_data_file_base_name, "GVHD__YYYY_MM_dd_hh_mm_ss_zzz");
if ( qAbs(_measure_start_time.toMSecsSinceEpoch() - data_time.toMSecsSinceEpoch()) < 1000 ) {
QString measure_gvf_datetime_str = measure_gvf_data_file_info.baseName().remove("GVHD__");
QDateTime data_time = QDateTime::fromString(measure_gvf_datetime_str, "yyyy_MM_dd_hh_mm_ss_zzz");
if ( qAbs(_measure_start_time.toMSecsSinceEpoch() - data_time.toMSecsSinceEpoch()) < (1000 * 10) ) {
measure_gvf_data_filename = measure_gvf_data_file_info.absoluteFilePath();
}
}

View File

@ -6,8 +6,9 @@
#include <QSqlDatabase>
#include <QFileInfo>
#include "QsLogManage.h"
#include <QDebug>
#include <QString>
#include <QThread>
#include <QDebug>
MeasureTask::MeasureTask(int socketDescriptor, QObject *parent)
: QThread(parent), socketDescriptor(socketDescriptor)
@ -23,10 +24,19 @@ void MeasureTask::run()
return;
}
tcp_socket.setReadBufferSize(1024 * 1024);
tcp_socket.waitForReadyRead(500);
QByteArray buffer;
while (tcp_socket.bytesAvailable()) {
buffer.append(tcp_socket.readAll());
if ( tcp_socket.waitForReadyRead(500) ) {
while (tcp_socket.bytesAvailable() < 2 ) {
if ( tcp_socket.waitForReadyRead(100) ) {
QByteArray len_buf = tcp_socket.read(2);
quint16 total_len = (uchar)len_buf[0] | ((uchar)len_buf[1] << 8);
while (buffer.size() < total_len) {
if (tcp_socket.waitForReadyRead(500)) {
buffer.append(tcp_socket.readAll());
}
}
}
}
}
if ( buffer.size() ) {
QLOG_INFO() << QStringLiteral(u"请求数据长度:") << buffer.size();
@ -103,10 +113,21 @@ void MeasureTask::processStartMeasureCmd(QTcpSocket* socket, const QString &devi
const QString error = QStringLiteral(u"启动设置板卡%1通道%2测量参数失败").arg(board_id).arg(channel_id);
errors.append(error);
}
QThread::msleep(100);
}
for (auto channel_config : channel_config_list) {
if (!channel_config.isValid())
continue;
QVariantMap channel_config_info = channel_config.toMap();
if (!channel_config_info.contains("BoardId") || !channel_config_info.contains("ChannelId"))
continue;
int board_id = channel_config_info["BoardId"].toInt();
int channel_id = channel_config_info["ChannelId"].toInt();
if (!MeasureDeviceController::Instance()->StartMeasure(device_guid, board_id, channel_id)) {
const QString error = QStringLiteral(u"启动板卡%1通道%2测量失败").arg(board_id).arg(channel_id);
errors.append(error);
}
QThread::msleep(100);
}
QByteArray replay_data;
QDataStream replay_data_stream(&replay_data, QIODevice::Append);
@ -175,6 +196,7 @@ void MeasureTask::processSetDeviceMeasureConfigParamsCmd(QTcpSocket* socket, con
const QString error = QStringLiteral(u"设置板卡%1通道%2测量参数失败").arg(board_id).arg(channel_id);
errors.append(error);
}
QThread::msleep(100);
}
QByteArray replay_data;
QDataStream replay_data_stream(&replay_data, QIODevice::Append);