123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #pragma once
- #include <Windows.h>
- #include <string>
- 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);
- };
|