协能can协议
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

HardwareI.h 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /**
  2. * @content:HardwareI接口定义文件
  3. * @time:2016-9-7
  4. * @author:Mr_zhu
  5. * @version: V1.0
  6. * @describe:
  7. * 1#2016-9-7#V1.0#首次生成
  8. */
  9. #ifndef INCLUDE_IHARDWARE_H_
  10. #define INCLUDE_IHARDWARE_H_
  11. #include <map>
  12. #include <string>
  13. #include "../common/IUnknown.h"
  14. #include "../common/Type.h"
  15. struct CallBackHandleI;
  16. interface HardwareI:IUnknown{
  17. /**
  18. * 设置硬件参数
  19. */
  20. virtual HRESULT setParam(
  21. std::map<std::string,std::string>::iterator param,
  22. const int length
  23. ) = 0;
  24. /**
  25. * 打开硬件
  26. */
  27. virtual HRESULT openHW() = 0;
  28. /**
  29. * 初始化硬件
  30. */
  31. virtual HRESULT init() = 0;
  32. /**
  33. * 启动硬件
  34. */
  35. virtual HRESULT start() = 0;
  36. /**
  37. * 停止硬件
  38. */
  39. virtual HRESULT stop() = 0;
  40. /**
  41. * 挂起硬件
  42. */
  43. virtual HRESULT hang() = 0;
  44. /**
  45. * 恢复硬件
  46. */
  47. virtual HRESULT resume() = 0;
  48. /**
  49. * 硬件是否处于运行
  50. */
  51. virtual HRESULT isRun() = 0;
  52. /**
  53. * 硬件是否挂起
  54. */
  55. virtual HRESULT isHang() = 0;
  56. /**
  57. * 注册硬件回调接口
  58. */
  59. virtual HRESULT registerHandler(
  60. CallBackHandleI *pfunc
  61. ) = 0;
  62. /**
  63. * 同步写操作
  64. */
  65. virtual HRESULT syncRead(
  66. PBYTE preadbuf,
  67. const unsigned int length,
  68. int& len,
  69. const unsigned int timeout
  70. ) = 0;
  71. /**
  72. * 异步读操作
  73. */
  74. virtual HRESULT asyncRead(
  75. PBYTE preadbuf,
  76. const unsigned int length,
  77. int& len
  78. ) = 0;
  79. /**
  80. * 同步写操作
  81. */
  82. virtual HRESULT syncWrite(
  83. PBYTE pwritebuf,
  84. const unsigned int length,
  85. int& len,
  86. const unsigned int timeout
  87. ) = 0;
  88. /**
  89. * 异步写操作
  90. */
  91. virtual HRESULT asyncWrite(
  92. PBYTE pwritebuf,
  93. const unsigned int length,
  94. int& len
  95. ) = 0;
  96. /**
  97. * 释放硬件
  98. */
  99. virtual HRESULT realeseHW() = 0;
  100. virtual ~HardwareI(){}
  101. };
  102. #endif /* INCLUDE_IHARDWARE_H_ */