Files
coco df489d5640 a
2026-07-03 16:05:30 +08:00

69 lines
2.8 KiB
C++

// DevManager.h: interface for the CDevManager class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DEVMANAGER_H__5A1BC16E_527E_420B_81A6_93AF4D24335F__INCLUDED_)
#define AFX_DEVMANAGER_H__5A1BC16E_527E_420B_81A6_93AF4D24335F__INCLUDED_
#include "Device.h"
#include "CtrlProtocolDef.h"
#include "FileOperTools.h"
#include <set>
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CDevManager
{
public:
BOOL GetOLDevList(CPtrArray* pOLDevList); //取在线设备列表(pOLDevList---in:在线设备列表)
BOOL GetFLDevList(CPtrArray* pFLDevList); //取离线设备列表(pFLDevList---in:在线设备列表)
CDevice* GetDeviceByID(DWORD dwDevID); //通过ID取设备(dwDevID---in:设备ID)
CDevice* GetDevice(DWORD dwHandle); //取设备(dwHandle---in:设备句柄)
CDevice* GetDevice(CString szDevSN); //取设备(szDevSN---in:设备序列号)
CDevManager(_ConnectionPtr& pConnection);
virtual ~CDevManager();
CHandleProcessor m_handleProcessor;
void InitialDevLinkList(); //初始化设备连接列表
BOOL AddDevice(CDevice* const pDev); //增加设备(pDev---in:设备指针)
void DeleteObjInMem(DWORD dwHandle); //在内存中删除对象(dwHandle---in:设备句柄)
void DeleteObjInMem(CString szDevSN); //在内存中删除对象(szDevSN---in:设备序列号)
void AddObjInMem(CString szDevSN); //在内存中增加对象(szDevSN---in:设备序列号)
void AddOfflineObjInMem(CString szDevSN); //在内存中增加离线设备(szDevSN---in:设备序列号)
BOOL DeleteDevice(DWORD dwHandle); //删除设备(dwHandle---in:设备句柄)
void UpdateDevInfo(STSynDevParam stDevParam,BYTE bRemoteDeveTyp);
BOOL SetDeviceHandle(CDevice* const pDev); //设置设备句柄(pDev---in:设备指针)
//以szDevSN的值去数据库中的设备表中进行寻找,如果没找到返回NULL
CDevice* GetRegisterDevice(CString szDevSN, bool &bIsRegister);
BOOL DeleteDevice(CString strDev);
void DeleteRemoteDevice(STSigRemoteDev stDevice)
{
CString strLog;
strLog.Format(_T("zm:DeleteRemoteDevice DeviceID=%d, type=%d\n"), stDevice.uiDevID, stDevice.ucDevType);
CFileOperTools::GetInstance()->WriteComLog(strLog);
m_setRemoteDev.erase(stDevice);
}
void AddRemoteDevice(STSigRemoteDev stDevice)
{
CString strLog;
strLog.Format(_T("zm:AddRemoteDevice DeviceID=%d, type=%d\n"), stDevice.uiDevID, stDevice.ucDevType);
CFileOperTools::GetInstance()->WriteComLog(strLog);
m_setRemoteDev.insert(stDevice);
}
std::set<STSigRemoteDev> GetRemoteDeviceInfo(){return m_setRemoteDev;}
// void NotifyDevInfo(LPARAM lParam, LPARAM rParam, LPVOID pWnd);
private:
CLinkList<CDevice*> m_devLinkList;
_ConnectionPtr m_pConnection;
std::set<STSigRemoteDev> m_setRemoteDev;
};
#endif // !defined(AFX_DEVMANAGER_H__5A1BC16E_527E_420B_81A6_93AF4D24335F__INCLUDED_)