From 7b3161e949bb32f91d5cebc9d52147198e360b6b Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 06 六月 2025 09:03:25 +0800
Subject: [PATCH] 1.增加菜单项设置send able等信号,用于模拟测试;

---
 SourceCode/Bond/Servo/CRobotTask.cpp |  125 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 124 insertions(+), 1 deletions(-)

diff --git a/SourceCode/Bond/Servo/CRobotTask.cpp b/SourceCode/Bond/Servo/CRobotTask.cpp
index 26017c7..3112351 100644
--- a/SourceCode/Bond/Servo/CRobotTask.cpp
+++ b/SourceCode/Bond/Servo/CRobotTask.cpp
@@ -7,12 +7,75 @@
 	CRobotTask::CRobotTask()
 	{
 		generateId(m_strId);
-		m_timeCreate = CToolUnits::getTimestamp();
+		m_state = ROBOT_TASK_STATE::Ready;
+		m_timeCreate = CToolUnits::getUnixTimestamp();
+		m_timeFetchOut = 0;
+		m_timeStored = 0;
+		m_timeFinish = 0;
+		m_pContext = nullptr;
 	}
 
 	CRobotTask::~CRobotTask()
 	{
+		if (m_pContext != nullptr) {
+			m_pContext->release();
+			m_pContext = nullptr;
+		}
+	}
 
+	std::string CRobotTask::getDescription() const
+	{
+		std::string strOut = "CRobotTask<ID:";
+		strOut = strOut + std::to_string(m_robotCmdParam.sequenceNo);
+		strOut = strOut + ",Arm:";
+		strOut = strOut + std::to_string(m_robotCmdParam.armNo);
+		strOut = strOut + ",GetPossion:";
+		strOut = strOut + std::to_string(m_robotCmdParam.getPosition);
+		strOut = strOut + ",GetSlot:";
+		strOut = strOut + std::to_string(m_robotCmdParam.getSlotNo);
+		strOut = strOut + ",PutPossion:";
+		strOut = strOut + std::to_string(m_robotCmdParam.putPosition);
+		strOut = strOut + ",PutSlot:";
+		strOut = strOut + std::to_string(m_robotCmdParam.putSlotNo);
+		strOut = strOut + ">";
+
+		return strOut;
+	}
+
+	std::string CRobotTask::getSimpleDescription() const
+	{
+		std::string strOut = "CRobotTask<ID:";
+		strOut = strOut + std::to_string(m_robotCmdParam.sequenceNo);
+		strOut = strOut + ",Arm:";
+		strOut = strOut + std::to_string(m_robotCmdParam.armNo);
+		strOut = strOut + ",GetPossion:";
+		strOut = strOut + std::to_string(m_robotCmdParam.getPosition);
+		strOut = strOut + ",GetSlot:";
+		strOut = strOut + std::to_string(m_robotCmdParam.getSlotNo);
+		strOut = strOut + ",PutPossion:";
+		strOut = strOut + std::to_string(m_robotCmdParam.putPosition);
+		strOut = strOut + ",PutSlot:";
+		strOut = strOut + std::to_string(m_robotCmdParam.putSlotNo);
+		strOut = strOut + ">";
+
+		return strOut;
+	}
+
+	void CRobotTask::setContext(CContext* pContext)
+	{
+		if (m_pContext != nullptr) {
+			m_pContext->release();
+		}
+
+		m_pContext = pContext;
+		if (m_pContext != nullptr) {
+			m_pContext->addRef();
+		}
+	}
+
+	CContext* CRobotTask::getContext()
+	{
+		return m_pContext;
 	}
 
 	std::string& CRobotTask::generateId(std::string& out)
@@ -56,8 +119,68 @@
 		return m_timeCreate;
 	}
 
+	time_t CRobotTask::getFetchoutTime()
+	{
+		return m_timeFetchOut;
+	}
+
+	time_t CRobotTask::getStoredTime()
+	{
+		return m_timeStored;
+	}
+
 	time_t CRobotTask::getFinishTime()
 	{
 		return m_timeFinish;
 	}
+
+	ROBOT_TASK_STATE CRobotTask::getState()
+	{
+		return m_state;
+	}
+
+	void CRobotTask::completed()
+	{
+		m_state = ROBOT_TASK_STATE::Completed;
+	}
+
+	void CRobotTask::error()
+	{
+		m_state = ROBOT_TASK_STATE::Error;
+	}
+
+	void CRobotTask::abort()
+	{
+		m_state = ROBOT_TASK_STATE::Abort;
+	}
+
+	int CRobotTask::getSrcPosition()
+	{
+		return m_robotCmdParam.getPosition;
+	}
+
+	int CRobotTask::getTarPosition()
+	{
+		return m_robotCmdParam.putPosition;
+	}
+
+	int CRobotTask::getSrcSlot()
+	{
+		return m_robotCmdParam.getSlotNo;
+	}
+
+	int CRobotTask::getTarSlot()
+	{
+		return m_robotCmdParam.putSlotNo;
+	}
+
+	void CRobotTask::fetchOut()
+	{
+		m_timeFetchOut = CToolUnits::getUnixTimestamp();;
+	}
+
+	void CRobotTask::stored()
+	{
+		m_timeStored = CToolUnits::getUnixTimestamp();;
+	}
 }

--
Gitblit v1.9.3