From 8379d72c7f16fc8850d51d0d6ed7ec7238f26edc Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 14 三月 2025 15:26:42 +0800
Subject: [PATCH] 1.增加CEqDateTimeSetCmdStep; 2.相关dev读写地址用w+16进制展示;

---
 SourceCode/Bond/Servo/CReadStep.cpp              |    4 +
 SourceCode/Bond/Servo/Servo.vcxproj              |    2 +
 SourceCode/Bond/Servo/CEqDateTimeSetCmdStep.h    |   21 ++++++++++
 SourceCode/Bond/Servo/CWriteStep.cpp             |    3 +
 SourceCode/Bond/Servo/CEqModeChangeStep.cpp      |    3 +
 SourceCode/Bond/Servo/CEqModeStep.cpp            |    2 
 SourceCode/Bond/Servo/Servo.vcxproj.filters      |    2 +
 SourceCode/Bond/Servo/CStep.h                    |    1 
 SourceCode/Bond/Servo/ToolUnits.cpp              |   10 +++++
 SourceCode/Bond/Servo/CEqCimMessageCmdStep.cpp   |    3 +
 SourceCode/Bond/Servo/CEqStatusStep.cpp          |    3 +
 SourceCode/Bond/Servo/CEqCimMessageClearStep.cpp |    3 +
 SourceCode/Bond/Servo/CMaster.cpp                |   11 +++++
 SourceCode/Bond/Servo/CEqDateTimeSetCmdStep.cpp  |   36 ++++++++++++++++++
 SourceCode/Bond/Servo/CEqCimModeChangeStep.cpp   |    3 +
 SourceCode/Bond/Servo/CEquipment.h               |    1 
 SourceCode/Bond/Servo/ToolUnits.h                |    1 
 SourceCode/Bond/Servo/Common.h                   |    1 
 18 files changed, 101 insertions(+), 9 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEqCimMessageClearStep.cpp b/SourceCode/Bond/Servo/CEqCimMessageClearStep.cpp
index cb0d6c2..3a4acee 100644
--- a/SourceCode/Bond/Servo/CEqCimMessageClearStep.cpp
+++ b/SourceCode/Bond/Servo/CEqCimMessageClearStep.cpp
@@ -30,7 +30,8 @@
 	{
 		CWriteStep::getAttributeVector(attrubutes);
 
+		std::string strTemp;
 		attrubutes.addAttribute(new CAttribute("Clear Cim Message Dev",
-			std::to_string(m_nClearCimMessageDev).c_str(), ""));
+			("W" + CToolUnits::toHexString(m_nClearCimMessageDev, strTemp)).c_str(), ""));
 	}
 }
diff --git a/SourceCode/Bond/Servo/CEqCimMessageCmdStep.cpp b/SourceCode/Bond/Servo/CEqCimMessageCmdStep.cpp
index 6aa9d2e..3439d3a 100644
--- a/SourceCode/Bond/Servo/CEqCimMessageCmdStep.cpp
+++ b/SourceCode/Bond/Servo/CEqCimMessageCmdStep.cpp
@@ -31,7 +31,8 @@
 	{
 		CWriteStep::getAttributeVector(attrubutes);
 
+		std::string strTemp;
 		attrubutes.addAttribute(new CAttribute("Cim Message Dev",
-			std::to_string(m_nCimMessageDev).c_str(), ""));
+			("W" + CToolUnits::toHexString(m_nCimMessageDev, strTemp)).c_str(), ""));
 	}
 }
diff --git a/SourceCode/Bond/Servo/CEqCimModeChangeStep.cpp b/SourceCode/Bond/Servo/CEqCimModeChangeStep.cpp
index 9e2d40c..cbb8e17 100644
--- a/SourceCode/Bond/Servo/CEqCimModeChangeStep.cpp
+++ b/SourceCode/Bond/Servo/CEqCimModeChangeStep.cpp
@@ -39,7 +39,8 @@
 	{
 		CWriteStep::getAttributeVector(attrubutes);
 
+		std::string strTemp;
 		attrubutes.addAttribute(new CAttribute("Cim Mode Dev",
-			std::to_string(m_nCimModeDev).c_str(), ""));
+			("W" + CToolUnits::toHexString(m_nCimModeDev, strTemp)).c_str(), ""));
 	}
 }
diff --git a/SourceCode/Bond/Servo/CEqDateTimeSetCmdStep.cpp b/SourceCode/Bond/Servo/CEqDateTimeSetCmdStep.cpp
new file mode 100644
index 0000000..57a8d92
--- /dev/null
+++ b/SourceCode/Bond/Servo/CEqDateTimeSetCmdStep.cpp
@@ -0,0 +1,36 @@
+#include "stdafx.h"
+#include "CEqDateTimeSetCmdStep.h"
+
+
+namespace SERVO {
+	CEqDateTimeSetCmdStep::CEqDateTimeSetCmdStep() : CWriteStep()
+	{
+		m_nDateTimeDev = 0;
+	}
+
+	CEqDateTimeSetCmdStep::~CEqDateTimeSetCmdStep()
+	{
+
+	}
+
+	void CEqDateTimeSetCmdStep::setDateTimeDev(int nDev)
+	{
+		m_nDateTimeDev = nDev;
+	}
+
+	int CEqDateTimeSetCmdStep::setDateTime(short year, short month, short day, short hour, short minute, short second)
+	{
+		char szBuffer[16] = {0};
+		sprintf_s(szBuffer, 16, "%d%02d%02d%02d%02d%02d", year, month, day, hour, minute, second);
+		return writeData(m_nDateTimeDev, (const char*)szBuffer, 16);
+	}
+
+	void CEqDateTimeSetCmdStep::getAttributeVector(CAttributeVector& attrubutes)
+	{
+		CWriteStep::getAttributeVector(attrubutes);
+
+		std::string strTemp;
+		attrubutes.addAttribute(new CAttribute("DateTime Dev",
+			("W" + CToolUnits::toHexString(m_nDateTimeDev, strTemp)).c_str(), ""));
+	}
+}
diff --git a/SourceCode/Bond/Servo/CEqDateTimeSetCmdStep.h b/SourceCode/Bond/Servo/CEqDateTimeSetCmdStep.h
new file mode 100644
index 0000000..b110a05
--- /dev/null
+++ b/SourceCode/Bond/Servo/CEqDateTimeSetCmdStep.h
@@ -0,0 +1,21 @@
+#pragma once
+#include "CWriteStep.h"
+
+
+namespace SERVO {
+	class CEqDateTimeSetCmdStep : public CWriteStep
+	{
+	public:
+		CEqDateTimeSetCmdStep();
+		~CEqDateTimeSetCmdStep();
+
+	public:
+		void setDateTimeDev(int nDev);
+		int setDateTime(short year, short month, short day, short hour, short minute, short second);
+		void getAttributeVector(CAttributeVector& attrubutes);
+
+	private:
+		int m_nDateTimeDev;
+	};
+}
+
diff --git a/SourceCode/Bond/Servo/CEqModeChangeStep.cpp b/SourceCode/Bond/Servo/CEqModeChangeStep.cpp
index 4662008..6bb6f1e 100644
--- a/SourceCode/Bond/Servo/CEqModeChangeStep.cpp
+++ b/SourceCode/Bond/Servo/CEqModeChangeStep.cpp
@@ -39,7 +39,8 @@
 	{
 		CWriteStep::getAttributeVector(attrubutes);
 
+		std::string strTemp;
 		attrubutes.addAttribute(new CAttribute("Equipment Mode Dev",
-			std::to_string(m_nEqModeDev).c_str(), ""));
+			("W" + CToolUnits::toHexString(m_nEqModeDev, strTemp)).c_str(), ""));
 	}
 }
diff --git a/SourceCode/Bond/Servo/CEqModeStep.cpp b/SourceCode/Bond/Servo/CEqModeStep.cpp
index 3b416b2..8b21988 100644
--- a/SourceCode/Bond/Servo/CEqModeStep.cpp
+++ b/SourceCode/Bond/Servo/CEqModeStep.cpp
@@ -23,7 +23,7 @@
 		attrubutes.addAttribute(new CAttribute("Mode",
 			std::to_string(m_nMode).c_str(), getModeDescription(strTemp).c_str()));
 		attrubutes.addAttribute(new CAttribute("Mode Dev",
-			std::to_string(m_nModeDev).c_str(), ""));
+			("W" + CToolUnits::toHexString(m_nModeDev, strTemp)).c_str(), ""));
 	}
 
 	int CEqModeStep::onReadData()
diff --git a/SourceCode/Bond/Servo/CEqStatusStep.cpp b/SourceCode/Bond/Servo/CEqStatusStep.cpp
index b525e6f..52eaa0f 100644
--- a/SourceCode/Bond/Servo/CEqStatusStep.cpp
+++ b/SourceCode/Bond/Servo/CEqStatusStep.cpp
@@ -35,8 +35,9 @@
 				std::to_string(m_nReasonCode[i]).c_str(), ""));
 		}
 
+		std::string strTemp;
 		attrubutes.addAttribute(new CAttribute("Status Dev",
-			std::to_string(m_nStatusDev).c_str(), ""));
+			("W" + CToolUnits::toHexString(m_nStatusDev, strTemp)).c_str(), ""));
 	}
 
 	int CEqStatusStep::getStatus(unsigned int uint)
diff --git a/SourceCode/Bond/Servo/CEquipment.h b/SourceCode/Bond/Servo/CEquipment.h
index ea8078e..ac64bd3 100644
--- a/SourceCode/Bond/Servo/CEquipment.h
+++ b/SourceCode/Bond/Servo/CEquipment.h
@@ -9,6 +9,7 @@
 #include "CEqModeChangeStep.h"
 #include "CEqCimMessageCmdStep.h"
 #include "CEqCimMessageClearStep.h"
+#include "CEqDateTimeSetCmdStep.h"
 #include <map>
 
 
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index c954c14..6b16c44 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -274,7 +274,16 @@
 				delete pStep;
 			}
 		}
-
+		{
+			CEqDateTimeSetCmdStep* pStep = new CEqDateTimeSetCmdStep();
+			pStep->setName(STEP_DATETIME_SET_CMD);
+			pStep->setListener(listener);
+			pStep->setWriteSignalDev(0x55);
+			pStep->setDateTimeDev(0x16);
+			if (pEquipment->addStep(0x354, pStep) != 0) {
+				delete pStep;
+			}
+		}
 		pEquipment->init();
 		LOGE("已添加“EFEM(ROBOT)”.");
 		return 0;
diff --git a/SourceCode/Bond/Servo/CReadStep.cpp b/SourceCode/Bond/Servo/CReadStep.cpp
index 0a2474f..6c948de 100644
--- a/SourceCode/Bond/Servo/CReadStep.cpp
+++ b/SourceCode/Bond/Servo/CReadStep.cpp
@@ -129,10 +129,12 @@
 	void CReadStep::getAttributeVector(CAttributeVector& attrubutes)
 	{
 		CStep::getAttributeVector(attrubutes);
+		std::string strTemp;
+
 		attrubutes.addAttribute(new CAttribute("Current Step",
 			std::to_string(m_nCurStep).c_str(), ""));
 		attrubutes.addAttribute(new CAttribute("Signal Dev",
-			std::to_string(m_nWriteSignalDev).c_str(), ""));
+			("W" + CToolUnits::toHexString(m_nWriteSignalDev, strTemp)).c_str(), ""));
 	}
 
 	void CReadStep::init()
diff --git a/SourceCode/Bond/Servo/CStep.h b/SourceCode/Bond/Servo/CStep.h
index 04aa2c1..95ce06b 100644
--- a/SourceCode/Bond/Servo/CStep.h
+++ b/SourceCode/Bond/Servo/CStep.h
@@ -1,6 +1,7 @@
 #pragma once
 #include "CCLinkIEControl.h"
 #include "CAttributeVector.h"
+#include "ToolUnits.h"
 
 
 namespace SERVO {
diff --git a/SourceCode/Bond/Servo/CWriteStep.cpp b/SourceCode/Bond/Servo/CWriteStep.cpp
index 15f6a2a..34dc627 100644
--- a/SourceCode/Bond/Servo/CWriteStep.cpp
+++ b/SourceCode/Bond/Servo/CWriteStep.cpp
@@ -139,11 +139,12 @@
 	void CWriteStep::getAttributeVector(CAttributeVector& attrubutes)
 	{
 		CStep::getAttributeVector(attrubutes);
+		std::string temp;
 
 		attrubutes.addAttribute(new CAttribute("Current Step",
 			std::to_string(m_nCurStep).c_str(), ""));
 		attrubutes.addAttribute(new CAttribute("Signal Dev",
-			std::to_string(m_nWriteSignalDev).c_str(), ""));
+			("W" + CToolUnits::toHexString(m_nWriteSignalDev, temp)).c_str(), ""));
 	}
 
 	void CWriteStep::init()
diff --git a/SourceCode/Bond/Servo/Common.h b/SourceCode/Bond/Servo/Common.h
index fc0c568..c4e9244 100644
--- a/SourceCode/Bond/Servo/Common.h
+++ b/SourceCode/Bond/Servo/Common.h
@@ -67,6 +67,7 @@
 #define STEP_EQ_MODE_CHANGE		_T("EQModeChange")
 #define STEP_CIM_MESSAGE_CMD	_T("EQCimMessageCmd")
 #define STEP_CIM_MESSAGE_CLEAR	_T("EQCimMessageClear")
+#define STEP_DATETIME_SET_CMD	_T("EQDateTimeSetCmd")
 
 
 #define BASE_ALARM_EFEM		10000
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj b/SourceCode/Bond/Servo/Servo.vcxproj
index 4c7c4de..68eb757 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj
+++ b/SourceCode/Bond/Servo/Servo.vcxproj
@@ -208,6 +208,7 @@
     <ClInclude Include="CEqCimMessageClearStep.h" />
     <ClInclude Include="CEqCimMessageCmdStep.h" />
     <ClInclude Include="CEqCimModeChangeStep.h" />
+    <ClInclude Include="CEqDateTimeSetCmdStep.h" />
     <ClInclude Include="CEqModeChangeStep.h" />
     <ClInclude Include="CEqModeStep.h" />
     <ClInclude Include="CEqProcessStep.h" />
@@ -258,6 +259,7 @@
     <ClCompile Include="CEqCimMessageClearStep.cpp" />
     <ClCompile Include="CEqCimMessageCmdStep.cpp" />
     <ClCompile Include="CEqCimModeChangeStep.cpp" />
+    <ClCompile Include="CEqDateTimeSetCmdStep.cpp" />
     <ClCompile Include="CEqModeChangeStep.cpp" />
     <ClCompile Include="CEqModeStep.cpp" />
     <ClCompile Include="CEqProcessStep.cpp" />
diff --git a/SourceCode/Bond/Servo/Servo.vcxproj.filters b/SourceCode/Bond/Servo/Servo.vcxproj.filters
index a4aa804..deafbb5 100644
--- a/SourceCode/Bond/Servo/Servo.vcxproj.filters
+++ b/SourceCode/Bond/Servo/Servo.vcxproj.filters
@@ -56,6 +56,7 @@
     <ClCompile Include="CEqModeChangeStep.cpp" />
     <ClCompile Include="CEqCimMessageCmdStep.cpp" />
     <ClCompile Include="CEqCimMessageClearStep.cpp" />
+    <ClCompile Include="CEqDateTimeSetCmdStep.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="AlarmManager.h" />
@@ -110,6 +111,7 @@
     <ClInclude Include="CEqModeChangeStep.h" />
     <ClInclude Include="CEqCimMessageCmdStep.h" />
     <ClInclude Include="CEqCimMessageClearStep.h" />
+    <ClInclude Include="CEqDateTimeSetCmdStep.h" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="Servo.rc" />
diff --git a/SourceCode/Bond/Servo/ToolUnits.cpp b/SourceCode/Bond/Servo/ToolUnits.cpp
index a3e1725..b32362a 100644
--- a/SourceCode/Bond/Servo/ToolUnits.cpp
+++ b/SourceCode/Bond/Servo/ToolUnits.cpp
@@ -2,6 +2,7 @@
 #include "ToolUnits.h"
 #include <chrono>
 #include <memory>
+#include <sstream>
 
 
 CToolUnits::CToolUnits()
@@ -306,4 +307,13 @@
 bool CToolUnits::startsWith(const std::string& str, const std::string& prefix)
 {
 	return str.size() >= prefix.size() && str.compare(0, prefix.size(), prefix) == 0;
+}
+
+std::string& CToolUnits::toHexString(int value, std::string& strOut)
+{
+	std::stringstream ss;
+	ss << std::hex << value;
+	strOut = ss.str();
+
+	return strOut;
 }
\ No newline at end of file
diff --git a/SourceCode/Bond/Servo/ToolUnits.h b/SourceCode/Bond/Servo/ToolUnits.h
index d010744..fddb2e3 100644
--- a/SourceCode/Bond/Servo/ToolUnits.h
+++ b/SourceCode/Bond/Servo/ToolUnits.h
@@ -29,5 +29,6 @@
 	static std::string getRecipePath();
 	static std::string getCurrentTimeString();
 	static bool startsWith(const std::string& str, const std::string& prefix);
+	static std::string& toHexString(int value, std::string& strOut);
 };
 

--
Gitblit v1.9.3