From e51c6d1360f9679dd8e4dd3379ce0db1886badbf Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 28 七月 2025 17:36:57 +0800
Subject: [PATCH] Merge branch 'EAPSimulator' into clh

---
 SourceCode/Bond/Servo/CVariable.cpp |   90 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/CVariable.cpp b/SourceCode/Bond/Servo/CVariable.cpp
new file mode 100644
index 0000000..21ddb44
--- /dev/null
+++ b/SourceCode/Bond/Servo/CVariable.cpp
@@ -0,0 +1,90 @@
+#include "stdafx.h"
+#include "CVariable.h"
+
+
+namespace SERVO {
+	CVariable::CVariable()
+	{
+		m_nVarialbeId = 0;
+		m_format = SVFromat::U1;
+	}
+
+	CVariable::CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark)
+	{
+		m_nVarialbeId = atoi(pszId);
+		m_strName = pszName;
+		m_format = toFormat(pszFormat);
+		m_strRemark = pszRemark;
+		TRACE("CVariable .....%d,%s,%d,%s\n", m_nVarialbeId, m_strName.c_str(),
+			m_format, m_strRemark.c_str());
+
+	}
+
+	CVariable::~CVariable()
+	{
+
+	}
+
+	SVFromat CVariable::toFormat(const char* pszFormat)
+	{
+		if (_strcmpi("U1", pszFormat) == 0) {
+			return SVFromat::U1;
+		}
+		if (_strcmpi("U2", pszFormat) == 0) {
+			return SVFromat::U2;
+		}
+		if (_strcmpi("I2", pszFormat) == 0) {
+			return SVFromat::I2;
+		}
+		if (_strcmpi("A50", pszFormat) == 0) {
+			return SVFromat::A50;
+		}
+		if (_strcmpi("A20", pszFormat) == 0) {
+			return SVFromat::A20;
+		}
+
+		return SVFromat::U1;
+	}
+
+
+	std::string CVariable::formatToString(SVFromat format)
+	{
+		if (SVFromat::U1 == format) {
+			return "U1";
+		}
+		if (SVFromat::U2 == format) {
+			return "U1";
+		}
+		if (SVFromat::I2 == format) {
+			return "I2";
+		}
+		if (SVFromat::A50 == format) {
+			return "A50";
+		}
+		if (SVFromat::A20 == format) {
+			return "A20";
+		}
+
+		return "U1";
+	}
+
+	unsigned int CVariable::getVarialbleId()
+	{
+		return m_nVarialbeId;
+	}
+
+	std::string& CVariable::getName()
+	{
+		return m_strName;
+	}
+
+	SVFromat CVariable::getFormat()
+	{
+		return m_format;
+	}
+
+	std::string& CVariable::getRemark()
+	{
+		return m_strRemark;
+	}
+}
\ No newline at end of file

--
Gitblit v1.9.3