MachineDevice.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. #include "pch.h"
  2. #include "DriverDefine.h"
  3. #include "MachineDevice.h"
  4. std::string DEV_GetGUID(DEVICE_HANDLE hDev)
  5. {
  6. return "";
  7. }
  8. std::string DEV_GetResource(DEVICE_HANDLE hDev) //这里定义了该设备的模型资源,含属性、方法
  9. {
  10. return "";
  11. }
  12. void DEV_CompleteInit(DEVICE_HANDLE hDev)
  13. {
  14. }
  15. bool DEV_Prepare(DEVICE_HANDLE hDev)
  16. {
  17. return true;
  18. }
  19. void DEV_CompleteUnInit(DEVICE_HANDLE hDev)
  20. {
  21. }
  22. void DEV_SubscribeSelf(DEVICE_HANDLE hDev)
  23. {
  24. }
  25. //设备导出函数,设备对象为第一个参数,实现者可以利用类对象多态或者自行判断
  26. //设备路径、函数名(资源名)来自行进行功能实现
  27. int DEV_Add(DEVICE_HANDLE hDev, const std::string funcName, std::string In, std::string& Out)
  28. {
  29. return RET_NOSUPPORT;
  30. }
  31. int DEV_Delete(DEVICE_HANDLE hDev, const std::string funcName, std::string In, std::string& Out)
  32. {
  33. return RET_NOSUPPORT;
  34. }
  35. int DEV_Update(DEVICE_HANDLE hDev, const std::string funcName, std::string In, std::string& Out)
  36. {
  37. return RET_NOSUPPORT;
  38. }
  39. int DEV_Action(DEVICE_HANDLE hDev, const std::string funcName, std::string In, std::string& Out)
  40. {
  41. return RET_NOSUPPORT;
  42. }
  43. int DEV_Get(DEVICE_HANDLE hDev, const std::string funcName, std::string& Out)
  44. {
  45. return RET_NOSUPPORT;
  46. }
  47. int DEV_Set(DEVICE_HANDLE hDev, const std::string funcName, std::string In)
  48. {
  49. return RET_NOSUPPORT;
  50. }
  51. //路径设备导出函数,设备相对路径作为第一个参数,实现者需要根据
  52. //设备路径、函数名(资源名)来自行进行功能实现
  53. int DEVPath_Add(const std::string devPath, const std::string funcName, std::string In, std::string& Out)
  54. {
  55. return RET_NOSUPPORT;
  56. }
  57. int DEVPath_Delete(const std::string devPath, const std::string funcName, std::string In, std::string& Out)
  58. {
  59. return RET_NOSUPPORT;
  60. }
  61. int DEVPath_Update(const std::string devPath, const std::string funcName, std::string In, std::string& Out)
  62. {
  63. return RET_NOSUPPORT;
  64. }
  65. int DEVPath_Action(const std::string devPath, const std::string funcName, std::string In, std::string& Out)
  66. {
  67. return RET_NOSUPPORT;
  68. }
  69. int DEVPath_Get(const std::string devPath, const std::string funcName, std::string& Out)
  70. {
  71. return RET_NOSUPPORT;
  72. }
  73. int DEVPath_Set(const std::string devPath, const std::string funcName, std::string In)
  74. {
  75. return RET_NOSUPPORT;
  76. }
  77. //////////////////////////////////////////////////////////////////
  78. ///
  79. /// 设备模型接口 Part3,各中设备的标准方法
  80. /// XXX为属性名或者方法名,用于区分行为的Key
  81. /// 各驱动可以根据自己特点,定义标准方法集合
  82. //////////////////////////////////////////////////////////////////
  83. //实现者需要为每一个创建的设备对象定义模型实现,入口参数为设备时创建的对象句柄,需要自行区分对象与方法的对应
  84. int DEV_Add_XXX(DEVICE_HANDLE hDev, std::string In, std::string& Out)
  85. {
  86. return RET_NOSUPPORT;
  87. }
  88. int DEV_Delete_XXX(DEVICE_HANDLE hDev, std::string In, std::string& Out)
  89. {
  90. return RET_NOSUPPORT;
  91. }
  92. int DEV_Update_XXX(DEVICE_HANDLE hDev, std::string In, std::string& Out)
  93. {
  94. return RET_NOSUPPORT;
  95. }
  96. int DEV_Action_XXX(DEVICE_HANDLE hDev, std::string In, std::string& Out)
  97. {
  98. return RET_NOSUPPORT;
  99. }
  100. int DEV_Get_XXX(DEVICE_HANDLE hDev, std::string& Out)
  101. {
  102. return RET_NOSUPPORT;
  103. }
  104. int DEV_Set_XXX(DEVICE_HANDLE hDev, std::string In)
  105. {
  106. return RET_NOSUPPORT;
  107. }
  108. //实现者需要为每一个逻辑对象的设备路径 定义模型实现,需要自行根据设备路径和 方法进行区分
  109. int DEVPath_Add_XXX(const std::string devPath, std::string In, std::string& Out)
  110. {
  111. return RET_NOSUPPORT;
  112. }
  113. int DEVPath_Delete_XXX(const std::string devPath, std::string In, std::string& Out)
  114. {
  115. return RET_NOSUPPORT;
  116. }
  117. int DEVPath_Update_XXX(const std::string devPath, std::string In, std::string& Out)
  118. {
  119. return RET_NOSUPPORT;
  120. }
  121. int DEVPath_Action_XXX(const std::string devPath, std::string In, std::string& Out)
  122. {
  123. return RET_NOSUPPORT;
  124. }
  125. int DEVPath_Get_XXX(const std::string devPath, std::string& Out)
  126. {
  127. return RET_NOSUPPORT;
  128. }
  129. int DEVPath_Set_XXX(const std::string devPath, std::string In)
  130. {
  131. return RET_NOSUPPORT;
  132. }
  133. //设备树的模型实现
  134. //根设备的模型方法一套 XXX,实现时需要自己根据需要进行扩展、增删
  135. int DEVPath_Add_XXX_(std::string In, std::string& Out)
  136. {
  137. return RET_NOSUPPORT;
  138. }
  139. int DEVPath_Delete_XXX_(std::string In, std::string& Out)
  140. {
  141. return RET_NOSUPPORT;
  142. }
  143. int DEVPath_Update_XXX_(std::string In, std::string& Out)
  144. {
  145. return RET_NOSUPPORT;
  146. }
  147. int DEVPath_Action_XXX_(std::string In, std::string& Out)
  148. {
  149. return RET_NOSUPPORT;
  150. }
  151. int DEVPath_Get_XXX_(std::string& Out)
  152. {
  153. return RET_NOSUPPORT;
  154. }
  155. int DEVPath_Set_XXX_(std::string In)
  156. {
  157. return RET_NOSUPPORT;
  158. }
  159. //自定义的Action方法,root设备的
  160. DIOS_DRIVER_C_API int DEVPath_Action_MoveHome_(std::string In, std::string& Out)
  161. {
  162. return 2;
  163. }
  164. DIOS_DRIVER_C_API int DEVPath_Action_Move2Table_(std::string In, std::string& Out)
  165. {
  166. return 2;
  167. }
  168. DIOS_DRIVER_C_API int DEVPath_Action_Move2Pillar_(std::string In, std::string& Out)
  169. {
  170. return 2;
  171. }
  172. DIOS_DRIVER_C_API int DEVPath_Action_StartStichMove_(std::string In, std::string& Out)
  173. {
  174. return 2;
  175. }
  176. //自定义Set方法
  177. /*
  178. * 只有一个root设备
  179. //每一个逻辑设备路径一套,如下 /Dev01/SubDev的
  180. int DEVPath_Add_XXX_Dev01_SubDev(std::string In, std::string& Out);
  181. int DEVPath_Delete_XXX_Dev01_SubDev(std::string In, std::string& Out);
  182. int DEVPath_Update_XXX_Dev01_SubDev(std::string In, std::string& Out);
  183. int DEVPath_Action_XXX_Dev01_SubDev(std::string In, std::string& Out);
  184. int DEVPath_Get_XXX_Dev01_SubDev(std::string& Out);
  185. int DEVPath_Set_XXX_Dev01_SubDev(std::string In);
  186. */