#pragma once #include "printers.pb.h" #include "../external/SocketHandle/SocketHandle.h" #include "../config/ConfigManager.h" #include "../job/JobController.h" #include "../ScannerCtrl/ScannerCtrl.h" #include #include #include #include "../Communication/BaseClient.h" #include "../config/bean/AlarmCfg.h" #include "../camera/HBDCamera.h" using namespace std; class RemoteClient :public IConnect { public: RemoteClient(JobController* jobController, ScannerCtrl* sc); ~RemoteClient(); void Init(); void StartRemote(); void StopRemote(); bool AddSendMessage(PrinterMsg::HMessage* msg); void SendStateChangeMsg(); void SendAlarmMsg(AlarmShowInfo* info); //oid SendJobStateMsg(void); //void AddBinDataBlock(size_t layer_cnt, size_t layer, BPBinary::BinDataBlock* bdb); //void SendDataBlock(size_t layer_cnt, size_t layer); //void SendJobParamMsg(void); void CtrlStart() { StartRemote(); }; void CtrlStop() { StopRemote(); }; CommunicationCfg* GetConfig() { return m_Config; } void SetCamera(HBDCamera* camera) { m_Camera = camera; } bool IsLogined() { return m_IsLogin; } bool IsNeedSendAlarm() { return m_NeedSendAlarm; } void SetNeedSendAlarm(bool bv) { m_NeedSendAlarm = bv; } bool IsNeedSendFinish() { return m_NeedSendFinish; } void SetNeedSendFinish(bool bv) { m_NeedSendFinish = bv; } private: static DWORD WINAPI RemoteProc(RemoteClient* _this); void RemoteRun(); static DWORD WINAPI ReadProc(RemoteClient* _this); void ReadRun(); static DWORD WINAPI WriteProc(RemoteClient* _this); void WriteRun(); void StartWrite(); void StopWrite(); void StartRead(); void StopRead(); bool CheckLogin(); void PushError(PrinterMsg::MSG msg,string id); static void HandleStateRequest(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleJobInfoRequest(RemoteClient* client, PrinterMsg::HMessage* msg); //static void HandleJobStateRequest(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleLayerDataRequest(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleCtrlSystemPause(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleCtrlSystemStop(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleCameraDataRequest(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleCameraStopRequest(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleAlarmNotifyResponse(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleStateChangeResponse(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleRecordTasksMsg(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleRecordTasksListMsg(RemoteClient* client, PrinterMsg::HMessage* msg); //static void HandleRemoteJobResMsg(RemoteClient* client, PrinterMsg::HMessage* msg); static void HandleVersionResMsg(RemoteClient* client, PrinterMsg::HMessage* msg); private: CSocketHandle m_Client; HANDLE m_RemoteThread; HANDLE m_WriteThread; HANDLE m_ReadThread; bool m_RunFlag; bool m_WriteFlag; bool m_ReadFlag; bool m_IsLogin; CommunicationCfg* m_Config; MachineCfg* m_MachineCfg; RunCfg* m_RunCfg; ExtCfg* m_ExtCfg; queue m_MessageQueue; map> m_HandleMap; CRITICAL_SECTION m_MessageCS; // GTSController* m_GTSController; JobController* m_JobController; ScannerCtrl* m_ScannerCtrl; HBDCamera* m_Camera; vector m_BinDataBlocks; bool m_NeedSendAlarm; bool m_NeedSendFinish; AlarmShowInfo m_AlarmInfo; };