123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- #pragma once
- // 下列 ifdef 块是创建使从 DLL 导出更简单的
- // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 XRAYSUBSYSTEM_EXPORTS
- // 符号编译的。在使用此 DLL 的
- // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
- // XRAYSUBSYSTEM_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
- // 符号视为是被导出的。
- #ifndef XRAYSUBSYSTEM_EXPORTS
- #ifdef _WIN64
- #ifdef _DEBUG
- #pragma comment(lib, "XraySubSystemX64D.lib")
- #else
- #pragma comment(lib, "XraySubSystemX64.lib")
- #endif
- #else
- #ifdef _DEBUG
- #pragma comment(lib, "XraySubSystemD.lib")
- #else
- #pragma comment(lib, "XraySubSystem.lib")
- #endif
- #endif
- #endif
- #ifdef XRAYSUBSYSTEM_EXPORTS
- #define XRAYSUBSYSTEM_API __declspec(dllexport)
- #define XRAYSUBSYSTEM_C_API extern "C" __declspec(dllexport)
- #else
- #define XRAYSUBSYSTEM_API __declspec(dllimport)
- #define XRAYSUBSYSTEM_C_API extern "C" __declspec(dllimport)
- #endif
- #include "DiosSMachine.h"
- #include "..\..\deliver\include\AsnycAction.h"
- #include <map>
- using namespace std;
- //事件--------------------------
- //这些事件的值保留为空
- #define DiosEvtSeqReady "ReadySeqEvt"
- #define DiosEvtSeqEnd "EndSeqEvt"
- #define DiosEvtSeqPost "SeqPostEvt"
- #define DiosEvtFramePrep "FramePrepEvt"
- #define DiosEvtFrameReady "FrameReadyEvt"
- //#define DiosEvtFrameProcess "FrameProcEvt"
- #define DiosEvtFrameEnd "FrameEndEvt"
- #define DiosEvtSeqExit "ExitSeqEvt"
- //Recover相关
- #define DiosEvtSeqRecover "SeqRecoverEvt"
- #define DiosEvtFrameRecover "FrameRecoverEvt"
- //错误事件定义在DiosSMachine.h中
- //{"Error":"Frame"} 或 {"Error":"Seq"}
- //状态点--------------------------
- #define DiosPosSeqPrep "SeqPrep"
- #define DiosPosSeqPost "SeqPost"
- #define DiosPosSeqEnd "SeqEnd"
- #define DiosPosSeqReady "SeqReady"
- #define DiosPosFramePrep "FramePrep"
- #define DiosPosFrameReady "FrameReady"
- #define DiosPosFramePost "FramePost"
- #define DiosPosFrameError "FrameError"
- #define DiosPosFrameRecover "FrameRecover"
- #define DiosPosSeqError "SeqError"
- #define DiosPosSeqRecover "SeqRecover"
- //子状态机状态点--------------------------
- #define DiosSubAcqStateMachine "FrameAcquiring"
- #define DiosPosFrameStart "FrameStart"
- #define DiosPosFrameAcq "FrameAcq"
- #define DiosPosFrameIn "FrameIn"
- #define DiosPosFrameOut "FrameOut"
- #define DiosPosFrameEnd "FrameEnd"
- class XRAYSUBSYSTEM_API XrayAcqSystem : public DiosSubSMachine
- {
- void InitXrayAcqSystem();
- public:
- XrayAcqSystem(void);
- XrayAcqSystem(const char *pName);
- virtual ~XrayAcqSystem();
-
- //Active得根据设备单元的属性,自行调整了
- //Actions----------------------------------------------------------------------
- //Entry&Exit Action
- virtual DIOSSTMRET StateMachineEntry(DWORD timeout);//Begin状态点
- virtual DIOSSTMRET StateMachineExit(DWORD timeout);//End状态点
- //RoutePos Action
- virtual DIOSSTMRET StateMachineAction(const char *pAction, DWORD timeout);
- virtual DIOSSTMRET StateMachineGuard(const char *pGuard, DWORD timeout);
- //Real Actions
- DIOSSTMRET FrameStart(DWORD timeout);
- DIOSSTMRET FrameAcq(DWORD timeout);
- DIOSSTMRET FrameIn(DWORD timeout);
- DIOSSTMRET FrameOut(DWORD timeout);
- DIOSSTMRET FrameEnd(DWORD timeout);
- //Events----------------------------------------------------------------------
- virtual int StateMachineWaitForEvents(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FrameStart(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FrameAcq(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FrameIn(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FrameOut(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FrameEnd(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- };
- class XRAYSUBSYSTEM_API XraySubSystem : public DiosSMachine
- {
- HANDLE m_TransPosHandle;
- DiosSubSMachine *m_pAcqStateMachine;
- //map<string, vector<string>> m_mapStateList; //map<StateName,vector<Clientworkpath>>
- public:
- XraySubSystem(void);
- virtual ~XraySubSystem();
-
- virtual void StopStateMachine(DWORD timeout);
- HANDLE GetMachineNotifyHandle();
- //Actions----------------------------------------------------------------------
- //Entry&Exit Action
- virtual DIOSSTMRET StateMachineEntry(DWORD timeout);//Begin状态点
- virtual DIOSSTMRET StateMachineExit(DWORD timeout);//End状态点
- //RoutePos Action
- virtual DIOSSTMRET StateMachineAction(const char *pAction, DWORD timeout);
- virtual DIOSSTMRET StateMachineGuard(const char *pGuard, DWORD timeout);
- DIOSSTMRET AddtoStateList(const char *pClientAddress[],int count);
- DIOSSTMRET DeltoStateList();
- //Real Actions
- DIOSSTMRET SeqPrep(DWORD timeout);
- DIOSSTMRET SeqPost(DWORD timeout);
- DIOSSTMRET SeqReady(DWORD timeout);
- DIOSSTMRET SeqEnd(DWORD timeout);
- DIOSSTMRET FramePrep(DWORD timeout);
- DIOSSTMRET FrameReady(DWORD timeout);
- DIOSSTMRET FramePost(DWORD timeout);
- DIOSSTMRET FrameError(DWORD timeout);
- DIOSSTMRET FrameRecover(DWORD timeout);
- DIOSSTMRET SeqError(DWORD timeout);
- DIOSSTMRET SeqRecover(DWORD timeout);
- //Events----------------------------------------------------------------------
- virtual int StateMachineWaitForEvents(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_SeqPrep(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_SeqPost(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_SeqReady(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_SeqEnd(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FramePrep(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FrameReady(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FrameAcquiring(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FramePost(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FrameError(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_FrameRecover(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_SeqError(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- int WaitFrom_SeqRecover(
- DiosStMRouteLine *pLocalEvts[], DWORD CountOfLocal,
- DiosStMRouteLine *pExternalEvts[], DWORD CountOfExternal,
- DiosStMRouteLine *pOutpathEvts[], DWORD CountOfOutpath,
- DWORD timeout
- );
- DWORD Lock(DWORD timeout = INFINITE);
- void UnLock();
- virtual RET_STATUS SetAction(const char *ActionName, ResDataObject &Req, ResDataObject &Resp);
- private:
- HANDLE m_hMutex;
- };
|