From 0393d1ff2ebc378b3c4cff9b45f72ebc8a4ea516 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期二, 03 六月 2025 15:13:42 +0800
Subject: [PATCH] Merge branch 'master' into liuyang
---
SourceCode/Bond/Servo/CMaster.h | 63 +++++++++++++++++++++++++++----
1 files changed, 55 insertions(+), 8 deletions(-)
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index 073a460..ba4fd04 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -8,33 +8,56 @@
#include "CAligner.h"
#include "CVacuumBake.h"
#include "CBakeCooling.h"
+#include "CMeasurement.h"
+#include "CArm.h"
+#include "CArmTray.h"
#include "CCLinkIEControl.h"
+#include "CRobotTask.h"
namespace SERVO {
+ enum MASTERSTATE {
+ READY = 0,
+ STARTING,
+ RUNNING,
+ STOPPING
+ };
+
+ typedef std::function<void(void* pMaster, MASTERSTATE state)> ONMASTERSTATECHANGED;
typedef std::function<void(void* pMaster, CEquipment* pEiuipment, BOOL bAlive)> ONEQALIVE;
typedef std::function<void(CStep* pStep, int code, void* pData)> ONEQSTEPEVENT;
typedef std::function<void(void* pMaster, CEquipment* pEquipment, int state, int alarmId, int unitId, int level)> ONEQALARM;
typedef std::function<void(void* pMaster, CEquipment* pEquipment, CVcrEventReport* pReport)> ONEQVCREVENTREPORT;
+ typedef std::function<void(void* pMaster, CEquipment* pEquipment, int code)> ONEQDATACHANGED;
+ typedef std::function<void(void* pMaster, CRobotTask* pTask, int code)> ONROBOTTASKEVENT;
typedef struct _MasterListener
{
+ ONMASTERSTATECHANGED onMasterStateChanged;
ONEQALIVE onEqAlive;
ONEQALIVE onEqCimStateChanged;
ONEQALARM onEqAlarm;
ONEQVCREVENTREPORT onEqVcrEventReport;
+ ONEQDATACHANGED onEqDataChanged;
+ ONROBOTTASKEVENT onRobotTaskEvent;
} MasterListener;
class CMaster
{
public:
CMaster();
- ~CMaster();
+ virtual ~CMaster();
public:
void setListener(MasterListener listener);
+ CRobotTask* getActiveRobotTask();
int init();
int term();
+ int start();
+ int stop();
+ ULONGLONG getRunTime();
+ MASTERSTATE getState();
+ unsigned DispatchProc();
unsigned ReadBitsProc();
void onTimer(UINT nTimerid);
std::list<CEquipment*>& getEquipmentList();
@@ -42,21 +65,29 @@
void setCacheFilepath(const char* pszFilepath);
private:
+ inline void lock() { EnterCriticalSection(&m_criticalSection); }
+ inline void unlock() { LeaveCriticalSection(&m_criticalSection); }
int addToEquipmentList(CEquipment* pEquipment);
- int addLoadPort(int index);
- int addFliper();
- int addVacuumBake();
- int addAligner();
- int addEFEM();
- int addBonder(int index);
- int addBakeCooling();
+ CLoadPort* addLoadPort(int index);
+ CFliper* addFliper();
+ CVacuumBake* addVacuumBake();
+ CAligner* addAligner();
+ CEFEM* addEFEM();
+ CArm* addArm();
+ CArmTray* addArmTray(int index);
+ CBonder* addBonder(int index);
+ CBakeCooling* addBakeCooling();
+ CMeasurement* addMeasurement();
void connectEquipments();
int saveCache();
int saveCacheAndBackups();
int readCache();
void serialize(CArchive& ar);
+ void setState(MASTERSTATE state);
+ CRobotTask* createTransferTask(CEquipment* pSrcEq, CEquipment* pTarEq);
private:
+ CRITICAL_SECTION m_criticalSection;
MasterListener m_listener;
CCCLinkIEControl m_cclink;
std::list<CEquipment*> m_listEquipment;
@@ -64,9 +95,25 @@
BOOL m_bDataModify;
private:
+ /* 监控比特位的线程*/
HANDLE m_hEventReadBitsThreadExit[2];
HANDLE m_hReadBitsThreadHandle;
unsigned m_nReadBitsThreadAddr;
+
+ // 调度线程
+ HANDLE m_hDispatchEvent;
+ HANDLE m_hEventDispatchThreadExit[2];
+ HANDLE m_hDispatchThreadHandle;
+ unsigned m_nDispatchThreadAddr;
+
+ // 启动时间,运行时间,状态
+ ULONGLONG m_ullStartTime;
+ ULONGLONG m_ullRunTime;
+ MASTERSTATE m_state;
+
+ // 当前任务和已完成任务列表
+ CRobotTask* m_pActiveRobotTask;
+ std::list< CRobotTask* > m_listTask;
};
}
--
Gitblit v1.9.3