From f631abac11b6d7c8091ed28b838a5d1f50e24825 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 19 三月 2025 18:03:37 +0800
Subject: [PATCH] 1.把CSample替换为CIntent

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

diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index bda1be4..b455e4f 100644
--- a/SourceCode/Bond/Servo/CLoadPort.cpp
+++ b/SourceCode/Bond/Servo/CLoadPort.cpp
@@ -34,6 +34,8 @@
 	{
 		// 加入Pin初始化代码
 		LOGI("<CLoadPort>initPins");
+		addPin(SERVO::PinType::INPUT, _T("In"));
+		addPin(SERVO::PinType::OUTPUT, _T("Out"));
 	}
 
 	void CLoadPort::onTimer(UINT nTimerid)
@@ -45,4 +47,29 @@
 	{
 		CEquipment::serialize(ar);
 	}
+
+	void CLoadPort::getAttributeVector(CAttributeVector& attrubutes)
+	{
+		__super::getAttributeVector(attrubutes);
+
+		for (auto item : m_inputPins) {
+			attrubutes.addAttribute(new CAttribute(item->getName().c_str(),
+				std::to_string((int)item->getType()).c_str(), ""));
+		}
+
+		for (auto item : m_outputPins) {
+			attrubutes.addAttribute(new CAttribute(item->getName().c_str(),
+				std::to_string((int)item->getType()).c_str(), ""));
+		}
+	}
+
+	void CLoadPort::outputPanel()
+	{
+		CPin* pOutPin = getPin("Out");
+
+		CIntent intent;
+		intent.setCode(1);
+		intent.setMsg("Hello");
+		pOutPin->sendIntent(&intent);
+	}
 }

--
Gitblit v1.9.3