MqttTopicConstants.java 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. package com.ruoyi.mqtt.constant;
  2. /**
  3. * MQTT主题常量类
  4. * 根据LD导航系统MQTT接口规范定义
  5. * 主题格式: /${ProductID}/${DeviceID}/${ShortTopic}
  6. */
  7. public class MqttTopicConstants {
  8. // ==================== 地图相关主题 ====================
  9. /**
  10. * 请求地图列表 (订阅)
  11. * QoS: 2, Retain: 0
  12. */
  13. public static final String MAP_SERVICE_MAPLIST_REQUEST = "/map/service/maplist/request";
  14. /**
  15. * 请求地图列表响应 (发布)
  16. * QoS: 2, Retain: 0
  17. */
  18. public static final String MAP_SERVICE_MAPLIST_RESPONSE = "/map/service/maplist/response";
  19. /**
  20. * 当前地图 (发布)
  21. * QoS: 2, Retain: 1
  22. */
  23. public static final String MAP_PROPERTY_CURRENT_MAP = "/map/property/current_map";
  24. // ==================== 定位相关主题 ====================
  25. /**
  26. * 机器人实时位姿 (发布)
  27. * QoS: 0, Retain: 0
  28. */
  29. public static final String LOCALIZATION_POSE = "/localization/pose";
  30. /**
  31. * 位姿初始化 (订阅)
  32. * QoS: 2, Retain: 0
  33. */
  34. public static final String LOCALIZATION_ACTION_INIT = "/localization/action/init";
  35. /**
  36. * 位姿初始化响应 (发布)
  37. * QoS: 2, Retain: 0
  38. */
  39. public static final String LOCALIZATION_ACTION_INIT_REPLY = "/localization/action/init/reply";
  40. // ==================== 导航相关主题 ====================
  41. /**
  42. * 开启导航 (订阅)
  43. * QoS: 2, Retain: 0
  44. */
  45. public static final String NAVIGATION_STACK_ACTION_START = "/navigation/stack/action/start";
  46. /**
  47. * 开启导航响应 (发布)
  48. * QoS: 2, Retain: 0
  49. */
  50. public static final String NAVIGATION_STACK_ACTION_START_REPLY = "/navigation/stack/action/start/reply";
  51. /**
  52. * 关闭导航 (订阅)
  53. * QoS: 2, Retain: 0
  54. */
  55. public static final String NAVIGATION_STACK_ACTION_STOP = "/navigation/stack/action/stop";
  56. /**
  57. * 关闭导航响应 (发布)
  58. * QoS: 2, Retain: 0
  59. */
  60. public static final String NAVIGATION_STACK_ACTION_STOP_REPLY = "/navigation/stack/action/stop/reply";
  61. /**
  62. * 重启导航 (订阅)
  63. * QoS: 2, Retain: 0
  64. */
  65. public static final String NAVIGATION_STACK_ACTION_RESTART = "/navigation/stack/action/restart";
  66. /**
  67. * 重启导航响应 (发布)
  68. * QoS: 2, Retain: 0
  69. */
  70. public static final String NAVIGATION_STACK_ACTION_RESTART_REPLY = "/navigation/stack/action/restart/reply";
  71. // ==================== 规划相关主题 ====================
  72. /**
  73. * 请求路径规划 (订阅)
  74. * QoS: 2, Retain: 0
  75. */
  76. public static final String PLANNING_SERVICE_PLAN_REQUEST = "/planning/service/plan/request";
  77. /**
  78. * 请求路径规划响应 (发布)
  79. * QoS: 2, Retain: 0
  80. */
  81. public static final String PLANNING_SERVICE_PLAN_RESPONSE = "/planning/service/plan/response";
  82. /**
  83. * 当前行驶轨迹 (发布)
  84. * QoS: 2, Retain: 1
  85. */
  86. public static final String PLANNING_TRAJECTORY = "/planning/trajectory";
  87. /**
  88. * 当前行驶轨迹-紧凑格式 (发布)
  89. * QoS: 2, Retain: 1
  90. */
  91. public static final String PLANNING_TRAJECTORY_2D_COMPACT = "/planning/trajectory/2d/compact";
  92. /**
  93. * 遇障重规划 (订阅)
  94. * QoS: 2, Retain: 0
  95. */
  96. public static final String PLANNING_ACTION_REPLAN = "/planning/action/replan";
  97. /**
  98. * 重规划响应 (发布)
  99. * QoS: 2, Retain: 0
  100. */
  101. public static final String PLANNING_ACTION_REPLAN_REPLY = "/planning/action/replan/reply";
  102. // ==================== 任务相关主题 ====================
  103. /**
  104. * 前往目标点 (订阅)
  105. * QoS: 2, Retain: 0
  106. */
  107. public static final String TASK_TARGET_ACTION_GOTO = "/task/target/action/goto";
  108. /**
  109. * 前往目标点响应 (发布)
  110. * QoS: 2, Retain: 0
  111. */
  112. public static final String TASK_TARGET_ACTION_GOTO_REPLY = "/task/target/action/goto/reply";
  113. /**
  114. * 到达目标点 (发布)
  115. * QoS: 2, Retain: 1
  116. */
  117. public static final String TASK_TARGET_EVENT_ARRIVE = "/task/target/event/arrive";
  118. /**
  119. * 任务实时状态信息 (发布)
  120. * QoS: 0, Retain: 0
  121. */
  122. public static final String TASK_REALTIME_INFO = "/task/realtime/info";
  123. /**
  124. * 暂停任务 (订阅)
  125. * QoS: 1, Retain: 0
  126. */
  127. public static final String TASK_PROCEDURE_ACTION_PAUSE = "/task/procedure/action/pause";
  128. /**
  129. * 暂停任务响应 (发布)
  130. * QoS: 2, Retain: 0
  131. */
  132. public static final String TASK_PROCEDURE_ACTION_PAUSE_REPLY = "/task/procedure/action/pause/reply";
  133. /**
  134. * 继续任务 (订阅)
  135. * QoS: 2, Retain: 0
  136. */
  137. public static final String TASK_PROCEDURE_ACTION_RESUME = "/task/procedure/action/resume";
  138. /**
  139. * 继续任务响应 (发布)
  140. * QoS: 2, Retain: 0
  141. */
  142. public static final String TASK_PROCEDURE_ACTION_RESUME_REPLY = "/task/procedure/action/resume/reply";
  143. /**
  144. * 取消任务 (订阅)
  145. * QoS: 1, Retain: 0
  146. */
  147. public static final String TASK_PROCEDURE_ACTION_CANCEL = "/task/procedure/action/cancel";
  148. /**
  149. * 启动任务 (订阅)
  150. * QoS: 2, Retain: 0
  151. */
  152. public static final String TASK_PROCEDURE_ACTION_START = "/task/procedure/action/start";
  153. /**
  154. * 取消任务响应 (发布)
  155. * QoS: 2, Retain: 0
  156. */
  157. public static final String TASK_PROCEDURE_ACTION_CANCEL_REPLY = "/task/procedure/action/cancel/reply";
  158. // ==================== ASM远程功能调用相关主题 ====================
  159. /**
  160. * 发起远程功能调用 (订阅)
  161. * QoS: 2, Retain: 0
  162. */
  163. public static final String ABILITY_FUNCTION_ACTION_EXEC = "/ability/function/action/exec";
  164. /**
  165. * 远程调用响应 (发布)
  166. * QoS: 2, Retain: 0
  167. */
  168. public static final String ABILITY_FUNCTION_ACTION_EXEC_REPLY = "/ability/function/action/exec/reply";
  169. /**
  170. * 远程调用进度反馈 (发布)
  171. * QoS: 0, Retain: 0
  172. */
  173. public static final String ABILITY_FUNCTION_ACTION_EXEC_PROGRESS = "/ability/function/action/exec/progress";
  174. /**
  175. * 远程调用状态反馈 (发布)
  176. * QoS: 2, Retain: 0
  177. */
  178. public static final String ABILITY_FUNCTION_ACTION_EXEC_STATE = "/ability/function/action/exec/state";
  179. // ==================== ASM功能名称常量 ====================
  180. /** 电池信息 (发布)
  181. * QoS: 0, Retain: 0
  182. */
  183. public static final String SENSOR_BATTERY = "/sensor/battery";
  184. /** 开始传感器录制 */
  185. public static final String ASM_SENSOR_RECORD_START = "ASM.sensor_record.start";
  186. /** 停止传感器录制 */
  187. public static final String ASM_SENSOR_RECORD_STOP = "ASM.sensor_record.stop";
  188. /** 开始地图构建 */
  189. public static final String ASM_MAP_BUILD_START = "ASM.map_build.start";
  190. /** 停止地图构建 */
  191. public static final String ASM_MAP_BUILD_STOP = "ASM.map_build.stop";
  192. /** 开始实时建图 */
  193. public static final String ASM_MAP_SLAM_START = "ASM.map_slam.start";
  194. /** 停止实时建图 */
  195. public static final String ASM_MAP_SLAM_STOP = "ASM.map_slam.stop";
  196. /** 启动标准导航 */
  197. public static final String ASM_NAV_STANDARD_START = "ASM.nav_standard.start";
  198. /** 结束标准导航 */
  199. public static final String ASM_NAV_STANDARD_STOP = "ASM.nav_standard.stop";
  200. // ==================== 车辆控制相关主题 ====================
  201. /**
  202. * 车辆急停控制 (订阅)
  203. * QoS: 2, Retain: 0
  204. */
  205. public static final String CONTROL_VEHICLE_ACTION_STOP = "/control/vehicle/action/stop";
  206. /**
  207. * 构建完整主题前缀(productId + deviceId)
  208. * @return 主题前缀: /${ProductID}/${DeviceID}
  209. */
  210. public static String buildPrefix(String productId, String deviceId) {
  211. return "/" + productId + "/" + deviceId;
  212. }
  213. /**
  214. * 构建完整主题(使用配置的前缀)
  215. * @param prefix 前缀(格式:/${productId}/${deviceId})
  216. * @param shortTopic 短主题名
  217. * @return 完整主题
  218. */
  219. public static String buildTopic(String prefix, String shortTopic) {
  220. return prefix + shortTopic;
  221. }
  222. /**
  223. * 构建完整主题
  224. * @param productId 产品ID
  225. * @param deviceId 设备ID
  226. * @param shortTopic 短主题名
  227. * @return 完整主题: /${ProductID}/${DeviceID}/${ShortTopic}
  228. */
  229. public static String buildTopic(String productId, String deviceId, String shortTopic) {
  230. return "/" + productId + "/" + deviceId + shortTopic;
  231. }
  232. /* *//**
  233. * 构建通配符订阅主题(使用配置的前缀,订阅所有设备)
  234. * @param prefix 前缀(格式:/${productId})
  235. * @param shortTopic 短主题名
  236. * @return 通配符主题: /${ProductID}/+/${ShortTopic}
  237. *//*
  238. public static String buildWildcardTopic(String prefix, String shortTopic) {
  239. return prefix + "/+" + shortTopic;
  240. }
  241. *//**
  242. * 构建通配符订阅主题(订阅所有设备)
  243. * @param productId 产品ID
  244. * @param shortTopic 短主题名
  245. * @return 通配符主题: /${ProductID}/+/${ShortTopic}
  246. *//*
  247. public static String buildWildcardTopic(String productId, String shortTopic) {
  248. return "/" + productId + "/+" + shortTopic;
  249. }*/
  250. }