LAPTOP-SNT8I5JK\Boounion
2025-01-07 fec3ff7b0bb0a4e53c2f9ff26cd06659a0c8aff9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <string>
#include <list>
#include "HsmsAction.h"
 
 
#define ER_NOERROR            0
#define ER_NOTSELECT        -1
#define ER_BUSY                -2
 
 
class CModel;
class CHsmsPassive
{
public:
    CHsmsPassive();
    ~CHsmsPassive();
 
public:
    unsigned OnCimWork();
    void OnTimer(UINT nTimerid);
    void setActionTimeout(int nSecond);
    int init(CModel* pModel, const char* pszName, unsigned int port);
    int term();
    int secsAreYouThereRequest();
    int secsAreYouThereReply(unsigned int sessionId, unsigned int systemBytes);
 
private:
    inline void Lock() { EnterCriticalSection(&m_criticalSection); }
    inline void Unlock() { LeaveCriticalSection(&m_criticalSection); }
    int onRecvMsg(IMessage* pMessage);
 
private:
    CModel* m_pModel;
    IPassive* m_pPassive;
    int m_nActionTimeout;
    unsigned int m_nSystemByte;
    BOOL m_bAreYouThereRequest;
    std::string m_strEquipmentModelType;
    std::string m_strSoftRev;
    CRITICAL_SECTION m_criticalSection;
    std::list<CHsmsAction*> m_listAction;
    std::list<CHsmsAction*> m_listActionSent;
 
private:
    BOOL m_bCimWorking;
    HANDLE m_hCimWorkEvent;
    HANDLE m_hCimWorkThreadHandle;
    unsigned m_nCimWorkThrdaddr;
};