ModelIF.h 1.9 KB

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