From 3c387cc7bcd469938fbfac8bc5435bb1e846c70f Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 17 六月 2025 17:42:53 +0800
Subject: [PATCH] Merge branch 'liuyang' into clh
---
SourceCode/Bond/Servo/CBonder.cpp | 77 ++++++++++++++++++++++----------------
1 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/SourceCode/Bond/Servo/CBonder.cpp b/SourceCode/Bond/Servo/CBonder.cpp
index db7cf76..51c064b 100644
--- a/SourceCode/Bond/Servo/CBonder.cpp
+++ b/SourceCode/Bond/Servo/CBonder.cpp
@@ -244,7 +244,7 @@
{
// Received Job Report Upstream #1~9
char szBuffer[256];
- for (int i = 0; i < 9; i++) {
+ for (int i = 0; i < 1; i++) {
CEqReadStep* pStep = new CEqReadStep((m_nIndex == 0 ? 0x8c90 : 0xcc90) + 320 * i, 320 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
@@ -267,7 +267,7 @@
{
// Sent Out Job Report Downstream #1~9
char szBuffer[256];
- for (int i = 0; i < 9; i++) {
+ for (int i = 0; i < 1; i++) {
CEqReadStep* pStep = new CEqReadStep((m_nIndex == 0 ? 0x8000 : 0xc000) + 320 * i, 320 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
@@ -291,7 +291,7 @@
{
// Fetched Out Job Report #1~15
char szBuffer[256];
- for (int i = 0; i < 15; i++) {
+ for (int i = 0; i < 1; i++) {
CEqReadStep* pStep = new CEqReadStep((m_nIndex == 0 ? 0x9c31 : 0xdc31) + 18 * i, 18 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
@@ -315,7 +315,7 @@
{
// Stored Job Report #1~15
char szBuffer[256];
- for (int i = 0; i < 15; i++) {
+ for (int i = 0; i < 1; i++) {
CEqReadStep* pStep = new CEqReadStep((m_nIndex == 0 ? 0x9b23 : 0xdb23) + 18 * i, 18 * 2,
[&](void* pFrom, int code, const char* pszData, size_t size) -> int {
if (code == ROK && pszData != nullptr && size > 0) {
@@ -416,43 +416,54 @@
return m_nIndex;
}
+ BOOL CBonder::hasBondClass()
+ {
+ CGlass* pGlass = (CGlass*)m_slot[1].getContext();
+ if (pGlass == nullptr) return FALSE;
+ CGlass* pBuddy = pGlass->getBuddy();
+ return pBuddy != nullptr;
+ }
+
int CBonder::onProcessData(CProcessData* pProcessData)
{
CEquipment::onProcessData(pProcessData);
- // 检查数据,当前两片玻璃,一片为G1, 一片为G2, 且pProcessData中的id能匹配G1或G2
- Lock();
- CGlass* pGlass1 = getGlassFromSlot(1);
- CGlass* pGlass2 = getGlassFromSlot(2);
- if (pGlass1 == nullptr || pGlass2 == nullptr) {
- LOGE("<CBonder-%s>onProcessData,错误!不满足两片玻璃且分别为G1与G2的条件,请检查数据是否正确!", m_strName.c_str());
- Unlock();
- return -1;
- }
- if (pGlass1->getBuddy() != nullptr || pGlass2->getBuddy() != nullptr) {
- LOGE("<CBonder-%s>onProcessData,错误!玻璃较早前已被绑定,请检查数据是否正确!", m_strName.c_str());
- Unlock();
- return -1;
- }
+ return 0;
+ }
- if (pGlass1->getBuddy() != nullptr || pGlass2->getBuddy() != nullptr) {
- LOGE("<CBonder-%s>onProcessData,错误!玻璃较早前已被贴合,请检查数据是否正确!", m_strName.c_str());
- Unlock();
- return -1;
- }
+ int CBonder::onProcessStateChanged(PROCESS_STATE state)
+ {
+ CEquipment::onProcessStateChanged(state);
- if (pGlass1->getType() == pGlass2->getType()) {
- LOGE("<CBonder-%s>onProcessData,错误!两片玻璃未匹配,必须分别为G1和G2类型,请检查数据是否正确!", m_strName.c_str());
- Unlock();
- return -1;
- }
+ if (state == PROCESS_STATE::Complete) {
+ // 检查数据,当前两片玻璃,一片为G1, 一片为G2, 且pProcessData中的id能匹配G1或G2
+ Lock();
+ CGlass* pGlass2 = getGlassFromSlot(1);
+ CGlass* pGlass1 = getGlassFromSlot(2);
+ if (pGlass1 == nullptr || pGlass2 == nullptr) {
+ LOGE("<CBonder-%s>onProcessData,错误!不满足两片玻璃且分别为G1与G2的条件,请检查数据是否正确!", m_strName.c_str());
+ Unlock();
+ return -1;
+ }
+ if (pGlass1->getBuddy() != nullptr) {
+ LOGE("<CBonder-%s>onProcessData,错误!玻璃较早前已被绑定,请检查数据是否正确!", m_strName.c_str());
+ Unlock();
+ return -1;
+ }
- pGlass1->setBuddy(pGlass2);
- pGlass2->setBuddy(pGlass1);
- LOGE("<CBonder-%s>onProcessData,%s和%s已贴合!", m_strName.c_str(),
- pGlass1->getID().c_str(), pGlass2->getID().c_str());
- Unlock();
+ if (pGlass1->getType() != MaterialsType::G1 || pGlass2->getType() != MaterialsType::G2) {
+ LOGE("<CBonder-%s>onProcessData,错误!两片玻璃未匹配,必须分别为G1和G2类型,请检查数据是否正确!", m_strName.c_str());
+ Unlock();
+ return -1;
+ }
+
+ pGlass1->setBuddy(pGlass2);
+ getSlot(0)->setContext(nullptr);
+ LOGE("<CBonder-%s>onProcessStateChanged,%s和%s已贴合!", m_strName.c_str(),
+ pGlass1->getID().c_str(), pGlass2->getID().c_str());
+ Unlock();
+ }
return 0;
}
--
Gitblit v1.9.3