From 1823e5c63bac2246d066eb74318230952484c58a Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 19 三月 2025 16:41:07 +0800
Subject: [PATCH] 1.Pin的连接和发送数据。
---
SourceCode/Bond/Servo/CLoadPort.cpp | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/CLoadPort.cpp b/SourceCode/Bond/Servo/CLoadPort.cpp
index bda1be4..6386eec 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,27 @@
{
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");
+
+ CSample* pSample = new CSample();
+ pOutPin->sendSample(pSample);
+ }
}
--
Gitblit v1.9.3