#pragma once #include #include using namespace std; class Mediator; class LogicDeviceManager; LogicDeviceManager* GetDeviceManager(); void ReleaseDriverMgr(LogicDeviceManager* p); #define MGR_API #define DEV_API class LogicDeviceManager { public: LogicDeviceManager(); virtual ~LogicDeviceManager(); virtual void Prepare(Mediator *pMid); //入口 virtual bool MGR_API DriverEntry(string &ConfigurationFile); //MAJOR,MINOR,PID,VID,SN virtual bool DEV_API Driver_Probe(string &DriverInfo); //GUID virtual bool DEV_API GetDriverType(string &DevType); //DeviceResource virtual bool DEV_API GetDriverResource(string &DeviceResource); //连接相关 virtual bool DEV_API Connect(); //MAJOR,MINOR,PID,VID,SN virtual bool DEV_API Device_Probe(string &HardwareInfo); //设备加载&卸载 virtual DWORD MGR_API CreateDevice(); //check connection virtual bool MGR_API GetConnectionStatus(); //心跳 virtual bool MGR_API OnHeartBeat(); //断开设备命令 virtual void MGR_API UnloadDevice(DWORD Handle); //断开连接 virtual void DEV_API DisConnect(); }; //属性Action typedef enum _AttrAction{ ATTRACTION_GET, ATTRACTION_SET, ATTRACTION_ADD, ATTRACTION_DEL, ATTRACTION_UPDATE, ATTRACTION_MAX }ATTRACTION; //回调func类型:类函数 typedef bool(DEVICE_ACTION *NotifyCALLBACK)(PVOID pthis, ATTRACTION Cmd, string &key, string &Notify); class Mediator { public: Mediator(); virtual ~Mediator(); //GUID virtual bool DEV_API GetDeviceType(string &DevType); //回调通知接口 void RegistNotifyCallBack(PVOID pTarget, NotifyCALLBACK callback); //获取设备资源 virtual bool MGR_API GetDeviceResource(string &DeviceResource); //设备行为 virtual INT MGR_API DeviceAction(string &ActionKey, string &Req, string &Res); //属性行为. virtual INT MGR_API AttributeAction(ATTRACTION Cmd, string &AttrKey, string &Context); //驱动回调 virtual DWORD DEV_API OnNotify(HANDLE evtList[], DWORD count); };