| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 | 
							- #pragma once
 
- #include "LNBuffer.h"
 
- #include "LNHandle.h"
 
- #include "LNAcceptor.h"
 
- #include <ProactorTask.h>
 
- #include <thread>
 
- #include <chrono>
 
- #include <Simplelog.h>
 
- #include <map>
 
- #include <time.h>
 
- #include <UDPSocket.h>
 
- #include <ace/Init_ACE.h>
 
- //#include "LWSServer.h"
 
- #include <httplib.h>
 
- #include "MGWSServer.h"
 
- #include "SuperManager.h"
 
- #include <RWLockImpl.h>
 
- class C315ClientManager;
 
- extern bool g_bLog;
 
- extern time_t g_stStart;
 
- extern string g_strExepath; //程序目录
 
- extern string g_strVersion; //程序版本
 
- extern C315ClientManager* g_p315ClientManager;
 
- extern uint32_t g_tReminderInterval;
 
- extern string g_strMoMp;
 
- extern CMyRWLock g_lockSync;
 
- extern bool  g_bDataCompression;
 
- extern bool  g_bExternalData;  //是否启用外部数据
 
- extern CString g_strIniPath;
 
- typedef struct tagFileData
 
- {
 
-     char* data = nullptr;
 
- 	uint32_t len = 0;
 
-     uint32_t crc = 0;
 
-     time_t ctime = 0;
 
- public:
 
-     tagFileData()
 
-     {
 
-         ctime = time(NULL);
 
-     }
 
-     void Join();
 
- private:
 
-     ~tagFileData()
 
-     {
 
-         delete[] data;
 
-         len = 0;
 
-         crc = 0;
 
-         ctime = 0;
 
-     }
 
- }UPGRADE_FILE_DATA, *LPUPGRADE_FILE_DATA;
 
- class CAppService
 
- {
 
- public:
 
-     CAppService();
 
-     virtual ~CAppService();
 
- public:
 
-     static CAppService* Instance() { return &obj; };
 
-     bool Start();
 
-     void Stop();
 
-     CLNHandle* GetHandle()  { return m_pHandle; };
 
-     CLNAcceptor* GetAcceptor()  { return m_pAcceptor; };
 
-     CUDPSocket* GetUdpSocket()  { return m_pUdpSocket; };
 
-     //inline CLWSServer* GetLwsServer() { return m_lwsServer; };
 
-     inline CMGWSServer* GetMgServer() { return m_mgServer; }
 
-     //type filedata
 
-     std::map<CString, LPUPGRADE_FILE_DATA> m_mapTypeData;
 
-     //临时
 
-     std::map<CString, LPUPGRADE_FILE_DATA> m_mapTempTypeData;
 
-     static BOOL    FileDataConvertCharData(const uint8_t* filedata, const int filelen, char* strData);
 
-     BOOL m_bHaveDeviceUpgrade = FALSE;
 
-     time_t m_tDeviceUpgrade = 0;
 
-     inline uint32_t GetPackNo()
 
-     {
 
-         return m_packno++;
 
-     }
 
-     void  SetSycnSuperTime()
 
-     {
 
-         m_tmLastSyncSuper = 0;
 
-         m_index = 0;
 
-     }
 
- private:
 
-     static void ThreadProc(DWORD_PTR);
 
- 	static void ThreadProcForHTTP10088(DWORD_PTR);
 
-     static void ThreadProcForHTTP10087(DWORD_PTR);
 
- 	static void ThreadProcCreateTable(DWORD_PTR);
 
-     static uint32_t GeneralMovePack(uint8_t** pack, int* len);
 
- private:
 
-     CString m_strIniPath;
 
-     static CAppService obj;
 
-     bool m_bRun = false;
 
-     CLNHandle*  m_pHandle = nullptr;
 
-     CLNAcceptor* m_pAcceptor = nullptr;
 
-     CUDPSocket* m_pUdpSocket = nullptr;
 
-     //CLWSServer* m_lwsServer = nullptr;
 
-     CMGWSServer* m_mgServer = nullptr;
 
-     CProactorTask   *m_pProactorTask = nullptr;
 
-     std::thread *m_pThreadClearConn = nullptr;
 
- 	std::thread *m_pCreateTableThread = nullptr;
 
-     bool m_bWork = false;
 
- 	std::thread *m_pHttpThread = nullptr;
 
-     std::thread* m_pHttpThread2 = nullptr;
 
- 	static httplib::Server m_svr10088;
 
-     static httplib::Server m_svr10087;
 
-     uint32_t m_packno = 1;
 
-     //磁盘告警
 
-     static void ThreadProcForSpace(DWORD_PTR);
 
-     std::thread* m_pThreadSpace = nullptr;
 
-     int m_nInterval = 3600; //间隔一个小时执行一次磁盘判断
 
-     time_t m_tmLastSpaceTime = 0;
 
-     //下发设备同步时间
 
-     static void ThreadProcForTime(DWORD_PTR);
 
-     std::thread* m_pThreadTime = nullptr;
 
-     time_t m_tmLastSyncTime = 0;
 
-     //同步到上级
 
- 	static void ThreadProcSync(DWORD_PTR);
 
-     int m_nIntervalSync = 1800; //间隔半个小时执行一次同步
 
- 	std::thread* m_pThreadSync = nullptr;
 
- 	time_t m_tmLastSyncSuper = 0;
 
- 	uint64_t m_index = 0;
 
- };
 
 
  |