|
@@ -1,4 +1,4 @@
|
|
|
-// CCOS.Dev.GEN.PSGHR.cpp : ���� DLL Ӧ�ó���ĵ���������
|
|
|
+// CCOS.Dev.GEN.PSGHR.cpp
|
|
|
|
|
|
#include <assert.h>
|
|
|
#include <functional>
|
|
@@ -15,13 +15,6 @@ using namespace CCOS::Dev::Detail::Generator;
|
|
|
namespace nsGEN = CCOS::Dev::Detail::Generator;
|
|
|
|
|
|
static nsGEN::PSGHRDriver* pIODriver = nullptr;
|
|
|
-
|
|
|
-//�ر��ؾ���
|
|
|
-#pragma warning (disable:4244) // warning C4244: ����ʼ����: �ӡ�double��ת������float�������ܶ�ʧ����
|
|
|
-#pragma warning (disable:4305) // warning C4305: ��������: �ӡ�double������float���ض�
|
|
|
-#pragma warning (disable:4267) // warning C4267 : ����ʼ����: �ӡ�size_t��ת������int�������ܶ�ʧ����
|
|
|
-#pragma warning (disable:4805) // warning C4805: ��!=��: �ڲ����н����͡�bool�������͡�int����ϲ���ȫ
|
|
|
-
|
|
|
#define PSGHR_LARGE_POWER 5
|
|
|
#define PSGHR_SMALL_POWER 1.1
|
|
|
#define PSGHR_MAX_HEAT 225
|
|
@@ -30,26 +23,14 @@ static nsGEN::PSGHRDriver* pIODriver = nullptr;
|
|
|
#define PSGHR_MIN_MS 1.0
|
|
|
#define PSGHR_MAX_MS 10001.0
|
|
|
|
|
|
-//������س���
|
|
|
#define PSGHR_LoopDefHBTime 1000
|
|
|
#define PSGHR_LoopExpHBTime 500
|
|
|
-static const int msTimeOut_Lock = 500; //ͨѶ�ӿ�����ʱ��
|
|
|
+static const int msTimeOut_Lock = 500;
|
|
|
#define PSGHR_Com_NormalLen 150
|
|
|
#define PSGHR_ETX 0x03
|
|
|
#define PSGHR_RESOK "$"
|
|
|
#define Sleep(ms) std::this_thread::sleep_for(std::chrono::milliseconds(ms))
|
|
|
|
|
|
-/*
|
|
|
-
|
|
|
-<Command><Data><ETX><Checksum>
|
|
|
-����:
|
|
|
-<Command> = ASCII ��ĸ��������
|
|
|
-<Data> = ASCII ��������
|
|
|
-<ETX> = ASCII ��������
|
|
|
-<Checksum> = ����������ݺ� ETX �ֽڵĶ����� 1 �ֽ��ۼӺ�
|
|
|
-
|
|
|
-*/
|
|
|
-
|
|
|
static const auto COM_SCFDllName = "libSerialSCF.so";
|
|
|
static const auto TCP_SCFDllName = "libTcpipSCF.so";
|
|
|
|
|
@@ -58,17 +39,16 @@ static const auto TCP_SCFDllName = "libTcpipSCF.so";
|
|
|
|
|
|
struct tFrameMapping
|
|
|
{
|
|
|
- static const int MaxLen = 5; // ǰ���ܳ��� 5 ���ַ� !
|
|
|
+ static const int MaxLen = 5;
|
|
|
using cbFun = std::function <void(const char*, int)>;
|
|
|
|
|
|
char strHead[MaxLen];
|
|
|
int NbOfCharOfHead;
|
|
|
cbFun fun;
|
|
|
|
|
|
- // �ؼ��ģ���char*��Ϊconst char*�������ַ�������
|
|
|
tFrameMapping(const char* str, int len, cbFun f)
|
|
|
{
|
|
|
- assert(len < MaxLen); // len���ֻ����4
|
|
|
+ assert(len < MaxLen);
|
|
|
|
|
|
for (int i = 0; i < len; i++)
|
|
|
strHead[i] = str[i];
|
|
@@ -77,10 +57,8 @@ struct tFrameMapping
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// ��Ӧ�������ձ�
|
|
|
static std::list <tFrameMapping> arFrame;
|
|
|
|
|
|
-//������Ӧ�������ձ�ִ�ж�Ӧ����
|
|
|
static bool DecodeFrame(const char* strFrame, int length)
|
|
|
{
|
|
|
auto pr = [strFrame, length](const tFrameMapping& Item)
|
|
@@ -587,17 +565,16 @@ void nsGEN::PSGHRDevice::SubscribeSelf(ccos_mqtt_connection* conn)
|
|
|
//SubscribeTopic(conn, "CCOS/DEVICE/Generator/Action/#"); Moduld��Ĭ�϶��������Action��������Ҳ���ĵĻ��ͻ�ִ������Action�����ܻ������
|
|
|
}
|
|
|
|
|
|
-RET_STATUS nsGEN::PSGHRDevice::SetVibrationGrid(int value)//��������������
|
|
|
+RET_STATUS nsGEN::PSGHRDevice::SetVibrationGrid(int value)
|
|
|
{
|
|
|
FINFO("Enter StartVibrationGrid:[{$}]", value);
|
|
|
return RET_STATUS::RET_SUCCEED;
|
|
|
}
|
|
|
-RET_STATUS nsGEN::PSGHRDevice::GetVibrationGridMS(int& value) //��������������
|
|
|
+RET_STATUS nsGEN::PSGHRDevice::GetVibrationGridMS(int& value)
|
|
|
{
|
|
|
return RET_STATUS::RET_SUCCEED;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
RET_STATUS nsGEN::PSGHRDevice::SetAECDensity(int value)
|
|
|
{
|
|
|
if (!m_DoseUnit.m_AECDensity->Verify(value)) return RET_STATUS::RET_SUCCEED;
|
|
@@ -1005,7 +982,7 @@ RET_STATUS nsGEN::PSGHRDevice::PrepareAcquisition()
|
|
|
return RET_STATUS::RET_SUCCEED;
|
|
|
}
|
|
|
|
|
|
-void nsGEN::PSGHRDevice::SetSmartAEC(int value) //��������������
|
|
|
+void nsGEN::PSGHRDevice::SetSmartAEC(int value)
|
|
|
{
|
|
|
|
|
|
}
|
|
@@ -1115,32 +1092,27 @@ void nsGEN::PSGHRDevice::FireWarnMessage(const bool Act, const int Code, const c
|
|
|
|
|
|
void nsGEN::PSGHRDevice::OnCallBack()
|
|
|
{
|
|
|
- //�� ����
|
|
|
auto HWNotProcess = [](const char* value, int length) -> void
|
|
|
{
|
|
|
FINFO("This commands[{$}] didn't need to process", value);
|
|
|
};
|
|
|
|
|
|
- // ��ȡ���ַ���ת��Ϊ��ֵ�ĸ�������
|
|
|
auto extractValue = [](const char* src, int start, int len, bool isInt = false) -> double {
|
|
|
char buf[7] = { 0 };
|
|
|
- memcpy(buf + (7 - len), src + start, len); // ��䵽������β��
|
|
|
+ memcpy(buf + (7 - len), src + start, len);
|
|
|
return isInt ? atoi(buf) : atof(buf);
|
|
|
};
|
|
|
|
|
|
- // �ڲ����б������� extractValue ����ֵ����
|
|
|
auto HWKV = [this, extractValue](const char* value, int length) {
|
|
|
assert(value);
|
|
|
- if (length > 20) { // �������ַ�����ʽ: 070 MA00320 MS00063 MX00036
|
|
|
+ if (length > 20) {
|
|
|
FINFO("value:{$}", value);
|
|
|
|
|
|
- // ʹ�ò���� extractValue ����
|
|
|
int tmpkv = static_cast<int>(extractValue(value, 0, 3, true));
|
|
|
float tmpma = static_cast<float>(extractValue(value, 6, 5)) / 10.0f;
|
|
|
float tmpms = static_cast<float>(extractValue(value, 14, 7)) / 100.0f;
|
|
|
float tmpmx = static_cast<float>(extractValue(value, 24, 6)) / 100.0f;
|
|
|
|
|
|
- // ���²�֪ͨ
|
|
|
m_DoseUnit.m_KV->Update(tmpkv);
|
|
|
FireNotify(AttrKey::KV, m_DoseUnit.m_KV->JSGet());
|
|
|
|
|
@@ -1156,7 +1128,6 @@ void nsGEN::PSGHRDevice::OnCallBack()
|
|
|
FINFO("tmpkv={$}, tmpma={$}, tmpms={$}, tmpmx={$};", tmpkv, tmpma, tmpms, tmpmx);
|
|
|
}
|
|
|
else {
|
|
|
- // ���ַ�������
|
|
|
if (m_DoseUnit.m_KV->Update(atof(value))) {
|
|
|
FireNotify(AttrKey::KV, m_DoseUnit.m_KV->JSGet());
|
|
|
}
|
|
@@ -1982,7 +1953,6 @@ void nsGEN::PSGHRDevice::OnCallBack()
|
|
|
switch (genStatus)
|
|
|
{
|
|
|
case 1:
|
|
|
- //��ʼ��
|
|
|
FDEBUG("get Gen Status_1:GENSTATE {$} -> STATUS_INIT", m_DoseUnit.m_GenState->JSGet());
|
|
|
///*if (m_DoseUnit.m_GenState->Update(nsGEN::AttrKey::GENERATOR_STATUS_INIT))
|
|
|
// FireNotify(AttrKey::GENSTATE, m_DoseUnit.m_GenState->JSGet());*/
|
|
@@ -1990,14 +1960,12 @@ void nsGEN::PSGHRDevice::OnCallBack()
|
|
|
case 2:
|
|
|
FDEBUG("get Gen Status_2:GENSTATE {$} -> STATUS_STANDBY", m_DoseUnit.m_GenState->JSGet());
|
|
|
if (m_isFirstHWPhase) {
|
|
|
- //���÷�����
|
|
|
HWSend("RE", 2);
|
|
|
|
|
|
- //���½���Ĭ�����ã���Ҫע��Ĭ��ֵ�Ƿ���ȷ
|
|
|
// HWSend("RR", 2);
|
|
|
HWSend("RS", 2);
|
|
|
|
|
|
- HWSend("ET?", 3); //��ѯ2��3��ģʽ
|
|
|
+ HWSend("ET?", 3);
|
|
|
|
|
|
HWSend("ST?", 3);
|
|
|
m_isFirstHWPhase = false;
|
|
@@ -2010,7 +1978,7 @@ void nsGEN::PSGHRDevice::OnCallBack()
|
|
|
/*FDEBUG("get Gen Status_3:RAD_OFF(PR0) -> RAD_PREPARE(PR1)");
|
|
|
if (m_DoseUnit.m_GenSynState->Update(nsGEN::AttrKey::GENERATOR_RAD_PREPARE))
|
|
|
FireNotify(m_DoseUnit.m_GenSynState->GetKey(), m_DoseUnit.m_GenSynState->JSGet());*/
|
|
|
- if (m_iLoopTime != PSGHR_LoopExpHBTime) //�ӿ��ѯʱ��
|
|
|
+ if (m_iLoopTime != PSGHR_LoopExpHBTime)
|
|
|
{
|
|
|
FDEBUG("get Gen Status_3:quicken loopTime[{$}]->[{$}]", m_iLoopTime.load(), PSGHR_LoopExpHBTime);
|
|
|
m_iLoopTime = PSGHR_LoopExpHBTime;
|
|
@@ -2172,7 +2140,7 @@ bool nsGEN::PSGHRDevice::ReConnect()
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-int nsGEN::PSGHRDevice::GridMSMargin()//��������������
|
|
|
+int nsGEN::PSGHRDevice::GridMSMargin()
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
@@ -2212,7 +2180,7 @@ bool nsGEN::PSGHRDevice::CalculateAppropriateMA(float& inoutMAS, float& inoutMA,
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-void nsGEN::PSGHRDevice::ReSendFailedAction(string& cmdNum)//��������������
|
|
|
+void nsGEN::PSGHRDevice::ReSendFailedAction(string& cmdNum)
|
|
|
{
|
|
|
}
|
|
|
|
|
@@ -2443,17 +2411,17 @@ bool nsGEN::PSGHRDriver::Connect()
|
|
|
const auto currentState = m_connectionState.load();
|
|
|
auto now = std::chrono::steady_clock::now();
|
|
|
|
|
|
- // 1. ���������Ե�ʧ��״̬
|
|
|
+ // 1. 处理可重试的失败状态
|
|
|
if (currentState == ConnectionState::Failed) {
|
|
|
if ((now - m_lastConnectionAttempt) >= RETRY_INTERVAL && m_connectionRetryCount < MAX_RETRY_COUNT) {
|
|
|
m_connectionState = ConnectionState::Disconnected;
|
|
|
}
|
|
|
else {
|
|
|
- return false; // ����������������ֱ�ӷ���
|
|
|
+ return false; // 不满足重试条件,直接返回
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 2. �����Ч״̬����������/�����ӵ�ʵ����Ч��
|
|
|
+ // 2. 检查无效状态(正在连接/已连接但实际有效)
|
|
|
if (currentState == ConnectionState::Connecting) {
|
|
|
FINFO("Already connecting (type: {$})",
|
|
|
m_currentConnType == ConnectionType::Serial ? "Serial" : "Ethernet");
|
|
@@ -2465,7 +2433,7 @@ bool nsGEN::PSGHRDriver::Connect()
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- // 3. ������Լ��
|
|
|
+ // 3. 检查重试间隔
|
|
|
if (m_connectionRetryCount > 0 && (now - m_lastConnectionAttempt) < RETRY_INTERVAL) {
|
|
|
FINFO("Retry in {$}s (type: {$})",
|
|
|
std::chrono::duration_cast<std::chrono::seconds>(RETRY_INTERVAL - (now - m_lastConnectionAttempt)).count(),
|
|
@@ -2474,42 +2442,42 @@ bool nsGEN::PSGHRDriver::Connect()
|
|
|
}
|
|
|
|
|
|
ResDataObject connParam = GetConnectParam(m_ConfigFileName);
|
|
|
- std::string connTypeStr = (std::string)connParam["type"]; // �����ö�ȡtype�ֶ�
|
|
|
- std::string connPortStr = "";
|
|
|
+ std::string connPortStr = "";
|
|
|
+ std::string connTypeStr = (std::string)connParam["type"]; // 从配置读取type字段
|
|
|
m_currentConnType = (connTypeStr == "COM") ? ConnectionType::Serial : ConnectionType::Ethernet;
|
|
|
if (m_currentConnType == ConnectionType::Serial)
|
|
|
{
|
|
|
- connPortStr = (std::string)connParam["port"];// �����ö�ȡport�ֶ�
|
|
|
- // �������ö˿������ж˿��б��е�λ��
|
|
|
+ connPortStr = (std::string)connParam["port"];// 从配置读取port字段
|
|
|
+ // 查找配置端口在现有端口列表中的位置
|
|
|
auto it = std::find(m_serialPorts.begin(), m_serialPorts.end(), connPortStr);
|
|
|
|
|
|
if (it == m_serialPorts.end()) {
|
|
|
- // ���õĶ˿ڲ����б��У����ӵ���λ
|
|
|
+ // 配置的端口不在列表中,添加到首位
|
|
|
FINFO("Configured serial port {$} not found, adding to front of port list", connPortStr);
|
|
|
m_serialPorts.insert(m_serialPorts.begin(), connPortStr);
|
|
|
}
|
|
|
else if (it != m_serialPorts.begin()) {
|
|
|
- // ���õĶ˿ڴ��ڵ�������λ���ƶ�����λ
|
|
|
+ // 配置的端口存在但不在首位,移动到首位
|
|
|
FINFO("Moving configured serial port {$} to front of port list", connPortStr);
|
|
|
m_serialPorts.erase(it);
|
|
|
m_serialPorts.insert(m_serialPorts.begin(), connPortStr);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- // 4. ִ����������
|
|
|
+ // 4. 执行连接流程
|
|
|
m_connectionState = ConnectionState::Connecting;
|
|
|
m_lastConnectionAttempt = now;
|
|
|
|
|
|
std::string connInfo;
|
|
|
try {
|
|
|
if (m_currentConnType == ConnectionType::Serial) {
|
|
|
- // �������ӣ�ʹ�õ�ǰ�����Ķ˿�
|
|
|
+ // 串口连接:使用当前索引的端口
|
|
|
std::string currentPort = m_serialPorts[m_currentSerialPortIndex];
|
|
|
- connParam.update("port", currentPort.c_str()); // ����ǰ���ԵĶ˿�д�����
|
|
|
+ connParam.update("port", currentPort.c_str()); // 将当前尝试的端口写入参数
|
|
|
connInfo = "Serial (port: " + currentPort + ")";
|
|
|
}
|
|
|
else {
|
|
|
- // �������ӣ�ֱ��ʹ�����ò���
|
|
|
+ // 网口连接:直接使用配置参数
|
|
|
connInfo = "Ethernet (ip: " + std::string(connParam["ip"]) + ")";
|
|
|
}
|
|
|
|
|
@@ -2530,21 +2498,21 @@ bool nsGEN::PSGHRDriver::Connect()
|
|
|
FINFO("Connect failed (code: {$}) for {$}", erCode, connInfo);
|
|
|
m_scfWrapper->Disconnect();
|
|
|
m_connectionState = ConnectionState::Failed;
|
|
|
- // �������ӣ�δ���������ж˿�ʱ�������л��˿����ԣ������������Դ�����
|
|
|
+ // 串口连接:未遍历完所有端口时,优先切换端口重试(不计入总重试次数)
|
|
|
if (m_currentConnType == ConnectionType::Serial) {
|
|
|
int nextIndex = (m_currentSerialPortIndex + 1) % m_serialPorts.size();
|
|
|
- // �ж��Ƿ��ѱ������ж˿ڣ���ǰ���������һ��ʱ��nextIndex��ص�0��
|
|
|
+ // 判断是否已遍历所有端口(当前索引是最后一个时,nextIndex会回到0)
|
|
|
bool allPortsTried = (nextIndex == 0);
|
|
|
|
|
|
if (!allPortsTried) {
|
|
|
- // δ���������ж˿ڣ��л�����һ�˿ڣ����������Լ���
|
|
|
+ // 未遍历完所有端口:切换到下一端口,不增加重试计数
|
|
|
m_currentSerialPortIndex = nextIndex;
|
|
|
m_connectionRetryCount = 0;
|
|
|
FINFO("Trying next serial port: {$}", m_serialPorts[nextIndex]);
|
|
|
- return false; // �����ⲿ�߳�����������һ�˿�
|
|
|
+ return false; // 触发外部线程立即尝试下一端口
|
|
|
}
|
|
|
else {
|
|
|
- // �ѱ������ж˿ڣ����õ���һ���˿ڣ��������Լ������������ȴ���
|
|
|
+ // 已遍历所有端口:重置到第一个端口,增加重试计数(进入间隔等待)
|
|
|
m_currentSerialPortIndex = 0;
|
|
|
m_connectionRetryCount++;
|
|
|
FINFO("All serial ports tried, retry count: {$}/{$}", m_connectionRetryCount, MAX_RETRY_COUNT);
|
|
@@ -2552,15 +2520,15 @@ bool nsGEN::PSGHRDriver::Connect()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // ���ж˿�ʧ�ܣ����ڣ�������ʧ�ܣ������������Լ���
|
|
|
+ // 所有端口失败(串口)或网口失败,才增加总重试计数
|
|
|
m_connectionRetryCount++;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // ���ӳɹ�������״̬
|
|
|
+ // 连接成功:重置状态
|
|
|
m_connectionState = ConnectionState::Connected;
|
|
|
m_connectionRetryCount = 0;
|
|
|
- m_currentSerialPortIndex = 0; // ���ô��ڶ˿�����
|
|
|
+ m_currentSerialPortIndex = 0; // 重置串口端口索引
|
|
|
FINFO("Connected successfully ({$})", connInfo);
|
|
|
return true;
|
|
|
}
|
|
@@ -2588,30 +2556,29 @@ void nsGEN::PSGHRDriver::FireNotify(int code, std::string key, std::string conte
|
|
|
EventCenter->OnNotify(code, key, content);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
bool nsGEN::PSGHRDriver::isConnected() const
|
|
|
{
|
|
|
const auto state = m_connectionState.load();
|
|
|
|
|
|
- // 1. ������/ʵ�������ӣ�����true������������
|
|
|
+ // 1. 连接中/实际已连接:返回true(无需重连)
|
|
|
if (state == ConnectionState::Connecting || (m_scfWrapper && m_scfWrapper->IsConnected())) {
|
|
|
FINFO(state == ConnectionState::Connecting ? "Connecting in progress" : "Already connected");
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- // 2. ʧ��״̬�������ж��Ƿ���������
|
|
|
+ // 2. 失败状态处理:判断是否允许重试
|
|
|
if (state == ConnectionState::Failed) {
|
|
|
auto now = std::chrono::steady_clock::now();
|
|
|
const auto timeSinceLast = now - m_lastConnectionAttempt;
|
|
|
|
|
|
- // 2.1 �ﵽ������Դ��������������ü�������ü�����������������
|
|
|
+ // 2.1 达到最大重试次数,但超过重置间隔:重置计数,允许重新重试
|
|
|
if (m_connectionRetryCount >= MAX_RETRY_COUNT && timeSinceLast >= RESET_RETRY_AFTER) {
|
|
|
FINFO("Max retries reached, resetting count after {$}s",
|
|
|
std::chrono::duration_cast<std::chrono::seconds>(timeSinceLast).count());
|
|
|
- m_connectionRetryCount = 0; // ���ü�������mutable���Σ�const�������ģ�
|
|
|
+ m_connectionRetryCount = 0; // 重置计数(因mutable修饰,const函数可修改)
|
|
|
}
|
|
|
|
|
|
- // 2.2 ���ʺ�������ʱ��δ�� �� �����Գ��ޣ�������true��ֹ����
|
|
|
+ // 2.2 不适合重连(时间未到 或 次数仍超限):返回true阻止重连
|
|
|
if (timeSinceLast < RETRY_INTERVAL || m_connectionRetryCount >= MAX_RETRY_COUNT) {
|
|
|
FINFO(timeSinceLast < RETRY_INTERVAL ?
|
|
|
"Retry later ({$}s)" : "Max retries, waiting {$}s to reset",
|
|
@@ -2623,7 +2590,7 @@ bool nsGEN::PSGHRDriver::isConnected() const
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 3. ����������ʺ�������������false����Connect()
|
|
|
+ // 3. 其他情况(适合重连):返回false触发Connect()
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -2645,12 +2612,12 @@ std::string nsGEN::PSGHRDriver::GetResource()
|
|
|
ResDataObject DescriptionSend;
|
|
|
ResDataObject m_DescriptionSend;
|
|
|
ResDataObject ListTemp;
|
|
|
- string strTemp = ""; //���ڶ�ȡ�ַ���������Ϣ
|
|
|
- string strIndex = ""; //���ڶ�ȡ������Ϣ�е�List��
|
|
|
- int nTemp = -1; //���ڶ�ȡ����������Ϣ
|
|
|
- char sstream[10] = { 0 }; //����ת��ֵ
|
|
|
- string strValue = ""; //���ڴ洢���õ�ֵ
|
|
|
- string strType = ""; //���ڴ洢���õ����� int/float/string...
|
|
|
+ string strTemp = "";
|
|
|
+ string strIndex = "";
|
|
|
+ int nTemp = -1;
|
|
|
+ char sstream[10] = { 0 };
|
|
|
+ string strValue = "";
|
|
|
+ string strType = "";
|
|
|
|
|
|
/***
|
|
|
* 1. ͨ��ѭ����������������д��pDeviceConfig
|
|
@@ -2658,7 +2625,6 @@ std::string nsGEN::PSGHRDriver::GetResource()
|
|
|
***/
|
|
|
try
|
|
|
{
|
|
|
- //����ConfigToolInfo �� ���е�AttributeInfo ���Զ�
|
|
|
int nConfigInfoCount = (int)m_Configurations["ConfigToolInfo"].GetKeyCount("AttributeInfo");
|
|
|
m_pAttribute->clear();
|
|
|
m_pDescription->clear();
|
|
@@ -2673,17 +2639,15 @@ std::string nsGEN::PSGHRDriver::GetResource()
|
|
|
DescriptionTemp.add(ConfKey::CcosType, strTemp.c_str());//CcosGeneratorAttribute
|
|
|
DescriptionSend.add(ConfKey::CcosType, strTemp.c_str());//CcosGeneratorAttribute
|
|
|
|
|
|
- strType = strTemp; //��¼�����������
|
|
|
+ strType = strTemp;
|
|
|
|
|
|
//AttributeKey
|
|
|
- //1. ����AttributeType���ڲ�key������·�����õ���ǰ����ʵֵ
|
|
|
strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["InnerKey"];
|
|
|
nTemp = (int)m_Configurations["ConfigToolInfo"][nInfoIndex]["PathID"];
|
|
|
- GetDeviceConfigValue(r_config, strTemp.c_str(), nTemp, strValue); //�õ�strValue��ֵ
|
|
|
+ GetDeviceConfigValue(r_config, strTemp.c_str(), nTemp, strValue);
|
|
|
|
|
|
//printf("********************************innerkey=%s --strValue = %s\n", strTemp.c_str(), strValue.c_str());
|
|
|
|
|
|
- //2. ��ֵ
|
|
|
strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeKey"];
|
|
|
|
|
|
|
|
@@ -2695,7 +2659,7 @@ std::string nsGEN::PSGHRDriver::GetResource()
|
|
|
{
|
|
|
(*m_pAttribute).add(strTemp.c_str(), atoi(strValue.c_str()));
|
|
|
}
|
|
|
- else //�����Ȱ�string���ʹ���
|
|
|
+ else
|
|
|
{
|
|
|
(*m_pAttribute).add(strTemp.c_str(), strValue.c_str());
|
|
|
}
|
|
@@ -2726,7 +2690,7 @@ std::string nsGEN::PSGHRDriver::GetResource()
|
|
|
|
|
|
//AttributeList
|
|
|
nTemp = m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["ListNum"];
|
|
|
- if (nTemp > 0) //ListNum������0ʱ˵������Ҫlist����
|
|
|
+ if (nTemp > 0)
|
|
|
{
|
|
|
for (int nListIndex = 0; nListIndex < nTemp; nListIndex++)
|
|
|
{
|
|
@@ -2745,7 +2709,7 @@ std::string nsGEN::PSGHRDriver::GetResource()
|
|
|
|
|
|
//AttributeDefaultValue
|
|
|
strTemp = (string)m_Configurations["ConfigToolInfo"][nInfoIndex]["AttributeDescripition"]["DefaultValue"];
|
|
|
- if (strTemp != "") //����Ҫ��������Ϊ��
|
|
|
+ if (strTemp != "")
|
|
|
{
|
|
|
DescriptionTemp.add(ConfKey::CcosDefaultValue, strTemp.c_str());
|
|
|
DescriptionSend.add(ConfKey::CcosDefaultValue, strTemp.c_str());
|
|
@@ -2796,7 +2760,6 @@ std::string nsGEN::PSGHRDriver::GetResource()
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
std::string nsGEN::PSGHRDriver::DeviceProbe()
|
|
|
{
|
|
|
FINFO("std::string nsGEN::PSGHRDriver::DeviceProbe() in\n");
|
|
@@ -2822,7 +2785,6 @@ std::string nsGEN::PSGHRDriver::DeviceProbe()
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
void nsGEN::PSGHRDriver::Disconnect()
|
|
|
{
|
|
|
if (m_scfWrapper) {
|
|
@@ -2831,7 +2793,6 @@ void nsGEN::PSGHRDriver::Disconnect()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
void nsGEN::PSGHRDriver::Dequeue(const char* Packet, DWORD Length)
|
|
|
{
|
|
|
DecodeFrame(Packet, Length);
|
|
@@ -2841,7 +2802,7 @@ PACKET_RET nsGEN::PSGHRDriver::callbackPackageProcess(const char* RecData, uint3
|
|
|
{
|
|
|
if (nLength < 1)
|
|
|
{
|
|
|
- FINFO("nLength < 1, nLength=={} \n", nLength);
|
|
|
+ FINFO("nLength < 1, nLength=={$} \n", nLength);
|
|
|
return PACKET_USELESS;
|
|
|
}
|
|
|
|
|
@@ -2855,7 +2816,6 @@ PACKET_RET nsGEN::PSGHRDriver::callbackPackageProcess(const char* RecData, uint3
|
|
|
char strtemp[100] = { 0 };
|
|
|
memcpy(strtemp, RecData, i);
|
|
|
strtemp[PacketLength + 1] = 0;
|
|
|
- printf("==IN error data ==:%s,PacketLength=%d,nLength=%d\n", strtemp, PacketLength, nLength);
|
|
|
|
|
|
return PACKET_USELESS;
|
|
|
}
|
|
@@ -3039,20 +2999,18 @@ bool nsGEN::PSGHRDriver::SetDeviceConfigValue(ResDataObject& config, const char*
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// GetIODriver & CreateIODriver
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
static nsGEN::PSGHRDriver gIODriver;
|
|
|
|
|
|
-extern "C" CCOS::Dev::IODriver * GetIODriver() // ���ؾ�̬���������, �����߲���ɾ�� !
|
|
|
+extern "C" CCOS::Dev::IODriver * GetIODriver()
|
|
|
{
|
|
|
return &gIODriver;
|
|
|
}
|
|
|
|
|
|
-extern "C" CCOS::Dev::IODriver * CreateIODriver() // �����¶���, �����߱�������ɾ���˶��� !
|
|
|
+extern "C" CCOS::Dev::IODriver * CreateIODriver()
|
|
|
{
|
|
|
pIODriver = new nsGEN::PSGHRDriver();
|
|
|
return pIODriver;
|