chenluhua1980
2026-01-08 f6cd6b95c9aa2ad17b199c32553c0b5e06b60bea
SourceCode/Bond/Servo/Model.h
@@ -1,4 +1,19 @@
#pragma once
#include "Configuration.h"
#include "HsmsPassive.h"
#include "CMaster.h"
#include "CGlassPool.h"
#include <cstdint>
enum class ControlState : uint8_t {
   OfflineEquipment = 0,
   OfflineAttempt = 1,
   Online = 2,
   OfflineHost = 3,
   OnlineLocal = 4,
   OnlineRemote = 5,
};
class CModel
{
public:
@@ -6,7 +21,46 @@
   ~CModel();
public:
   IObservable* getObservable();
   SERVO::CMaster& getMaster();
   void setWorkDir(const char* pszWorkDir);
   void loadPortParams();
   void setPortType(unsigned int index, SERVO::PortType type);;
   void setPortCassetteType(unsigned int index, SERVO::CassetteType type);
   void setPortEnable(unsigned int index, BOOL bEnable);
   int init();
   int term();
};
private:
   void refreshDerivedSVs();
   void setControlState(ControlState newState);
public:
   int notify(int code);
   int notifyPtr(int code, void* ptr = NULL);
   int notifyObj(int code, IRxObject* pObj);
   int notifyObjAndPtr(int code, IRxObject* pObj, void* ptr);
   int notifyObjAndInt(int code, IRxObject* pObj1, IRxObject* pObj2, int exCode);
   int notifyInt(int code, int exCode);
   int notifyInt2(int code, int exCode, int exCode2);
   int notifyDouble(int code, double dValue);
   int notifyText(int code, const char* pszText);
   int notifyPtrAndInt(int code, void* ptr1, void* ptr2, int exCode);
   int notifyTextAndInt(int code, const char* pszText, int exCode);
   int notifyMesMsg(int code, int stream, int function, const char* pszText);
public:
   CConfiguration m_configuration;
   CHsmsPassive m_hsmsPassive;
   SERVO::CGlassPool m_glassPool;
   SERVO::CMaster m_master;
private:
   IObservable* m_pObservable;
   IObservableEmitter* m_pObservableEmitter;
   CString m_strWorkDir;
   CString m_strDataDir;
private:
   ControlState m_currentControlState{ ControlState::OfflineEquipment };
};