ModelIF.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #pragma once
  2. #include <Windows.h>
  3. #include <string>
  4. using namespace std;
  5. class Mediator;
  6. class LogicDeviceManager;
  7. LogicDeviceManager* GetDeviceManager();
  8. void ReleaseDriverMgr(LogicDeviceManager* p);
  9. #define MGR_API
  10. #define DEV_API
  11. class LogicDeviceManager
  12. {
  13. public:
  14. LogicDeviceManager();
  15. virtual ~LogicDeviceManager();
  16. virtual void Prepare(Mediator *pMid);
  17. //入口
  18. virtual bool MGR_API DriverEntry(string &ConfigurationFile);
  19. //MAJOR,MINOR,PID,VID,SN
  20. virtual bool DEV_API Driver_Probe(string &DriverInfo);
  21. //GUID
  22. virtual bool DEV_API GetDriverType(string &DevType);
  23. //DeviceResource
  24. virtual bool DEV_API GetDriverResource(string &DeviceResource);
  25. //连接相关
  26. virtual bool DEV_API Connect();
  27. //MAJOR,MINOR,PID,VID,SN
  28. virtual bool DEV_API Device_Probe(string &HardwareInfo);
  29. //设备加载&卸载
  30. virtual DWORD MGR_API CreateDevice();
  31. //check connection
  32. virtual bool MGR_API GetConnectionStatus();
  33. //心跳
  34. virtual bool MGR_API OnHeartBeat();
  35. //断开设备命令
  36. virtual void MGR_API UnloadDevice(DWORD Handle);
  37. //断开连接
  38. virtual void DEV_API DisConnect();
  39. };
  40. //属性Action
  41. typedef enum _AttrAction{
  42. ATTRACTION_GET,
  43. ATTRACTION_SET,
  44. ATTRACTION_ADD,
  45. ATTRACTION_DEL,
  46. ATTRACTION_UPDATE,
  47. ATTRACTION_MAX
  48. }ATTRACTION;
  49. //回调func类型:类函数
  50. typedef bool(DEVICE_ACTION *NotifyCALLBACK)(PVOID pthis, ATTRACTION Cmd, string &key, string &Notify);
  51. class Mediator
  52. {
  53. public:
  54. Mediator();
  55. virtual ~Mediator();
  56. //GUID
  57. virtual bool DEV_API GetDeviceType(string &DevType);
  58. //回调通知接口
  59. void RegistNotifyCallBack(PVOID pTarget, NotifyCALLBACK callback);
  60. //获取设备资源
  61. virtual bool MGR_API GetDeviceResource(string &DeviceResource);
  62. //设备行为
  63. virtual INT MGR_API DeviceAction(string &ActionKey, string &Req, string &Res);
  64. //属性行为.
  65. virtual INT MGR_API AttributeAction(ATTRACTION Cmd, string &AttrKey, string &Context);
  66. //驱动回调
  67. virtual DWORD DEV_API OnNotify(HANDLE evtList[], DWORD count);
  68. };