device.proto 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. syntax = "proto3";
  2. // package声明符,用来防止不同的消息类型有命名冲突
  3. package pb_v1;
  4. // 用于生成指定语言go的包名称
  5. option go_package = "property-applete-gateway/pb/v1";
  6. // 门禁入库
  7. message GateInRequest {
  8. // 设备id
  9. string device_id = 1;
  10. // 设备名
  11. string device_name = 2;
  12. // 序列号
  13. string sn = 3;
  14. // 厂商
  15. string manufactor = 4;
  16. // 授权key
  17. string auth_key = 5;
  18. // 1 二维码门禁 2 人脸识别门禁
  19. int32 gate_type = 6;
  20. // 协议
  21. string protocol = 7;
  22. }
  23. message GateInReply {
  24. }
  25. // 门禁出库
  26. message GateOutRequest {
  27. string device_id = 1;
  28. int64 garden_id = 2;
  29. string out_user = 3;
  30. }
  31. message GateOutReply {
  32. }
  33. // 门禁列表
  34. message GateItem {
  35. // 设备id
  36. string device_id = 1;
  37. // 设备名
  38. string device_name = 2;
  39. // 序列号
  40. string sn = 3;
  41. // 厂商
  42. string manufactor = 4;
  43. // 授权key
  44. string auth_key = 5;
  45. // 1 二维码门禁 2 人脸识别门禁
  46. int32 gate_type = 6;
  47. // 协议
  48. string protocol = 7;
  49. // 小区id
  50. int64 garden_id = 8;
  51. // 小区名
  52. string garden_name = 9;
  53. // 出库人
  54. string out_user = 10;
  55. // 出库时间
  56. int64 out_time = 11;
  57. // 1 在线 2 离线
  58. int32 status = 12;
  59. // true 已启用 false 已禁用
  60. bool enable = 13;
  61. // 1 进场 2 出场 3 进出场
  62. int32 direction = 14;
  63. string location = 15;
  64. }
  65. message GateListRequest {
  66. int64 garden_id = 1;
  67. int64 page = 2;
  68. int64 page_size = 3;
  69. // 1 已出库 2 未出库
  70. int32 out = 4;
  71. string device_id = 5;
  72. }
  73. message GateListReply {
  74. int64 page = 1;
  75. int64 total = 2;
  76. repeated GateItem list = 3;
  77. }
  78. // 门禁信息
  79. message GateInfoRequest {
  80. string device_id = 1;
  81. }
  82. message GateInfoReply {
  83. GateItem info = 1;
  84. }
  85. // 删除门禁
  86. message GateDelRequest {
  87. string device_id = 1;
  88. }
  89. message GateDelReply {
  90. }
  91. // 回收门禁
  92. message GateRecoveryRequest {
  93. string device_id = 1;
  94. }
  95. message GateRecoveryReply {
  96. }
  97. // 门禁启用停用
  98. message GateEnableRequest {
  99. string device_id = 1;
  100. int64 garden_id = 2;
  101. bool enable = 3;
  102. }
  103. message GateEnableReply {
  104. }
  105. // 小区端编辑位置或方向
  106. message GateSetRequest {
  107. string device_id = 1;
  108. int64 garden_id = 2;
  109. // 1 进场 2 出场 3 进出场
  110. int32 direction = 3;
  111. // 位置
  112. string location = 4;
  113. }
  114. message GateSetReply {
  115. }
  116. // 门禁白名单添加用户或ic卡
  117. message GateCardInfo {
  118. string card_number = 1;
  119. string card_owner = 2;
  120. }
  121. message GateWhiteAddRequest {
  122. // 使用门禁列表中的id字段填充gate_id
  123. string device_id = 1;
  124. // 业主uid和ic卡二选一
  125. repeated int64 household_uids = 2;
  126. repeated GateCardInfo card_info= 3;
  127. }
  128. message GateWhiteAddReply {
  129. }
  130. // 门禁白名单删除记录
  131. message GateWhiteDelRequest {
  132. int64 id = 1;
  133. }
  134. message GateWhiteDelReply {
  135. }
  136. // 门禁白名单业主列表
  137. message GateWhiteHouseholdItem {
  138. int64 household_uid = 1;
  139. string id_number = 2;
  140. string house_name = 3;
  141. int64 id = 4;
  142. string household_name = 5;
  143. // 1.待同步 2 同步中 3 已同步 4 删除中
  144. int32 status = 6;
  145. }
  146. message GateWhiteHouseholdListRequest {
  147. int64 page = 1;
  148. int64 page_size = 2;
  149. string device_id = 3;
  150. int64 garden_id = 4;
  151. }
  152. message GateWhiteHouseholdListReply {
  153. int64 page = 1;
  154. int64 total = 2;
  155. repeated GateWhiteHouseholdItem list = 3;
  156. }
  157. // 门禁白名单ic卡列表
  158. message GateWhiteCardItem {
  159. string card_number = 1;
  160. string card_ower = 2;
  161. int64 id = 3;
  162. // 1.待同步 2 同步中 3 已同步 4 删除中
  163. int32 status = 6;
  164. }
  165. message GateWhiteCardListRequest {
  166. int64 page = 1;
  167. int64 page_size = 2;
  168. string device_id = 3;
  169. int64 garden_id = 4;
  170. }
  171. message GateWhiteCardListReply {
  172. int64 page = 1;
  173. int64 total = 2;
  174. repeated GateWhiteCardItem list = 3;
  175. }
  176. // 门禁更新状态
  177. message GateOnlineRequest {
  178. string device_id = 1;
  179. }
  180. message GateOnlineReply {
  181. }
  182. // 白名单匹配
  183. message GateWhiteMatchRequest {
  184. string device_id = 1;
  185. int64 garden_id = 2;
  186. string auth_key = 3;
  187. string code_val = 4;
  188. int32 code_type = 5;
  189. }
  190. message GateWhiteMatchReply {
  191. int32 status = 1;
  192. string status_desc = 2;
  193. GateItem device_info = 3;
  194. GateWhiteHouseholdItem household_info = 4;
  195. GateWhiteCardItem card_info = 5;
  196. }
  197. // 添加进出场记录
  198. message GateRecordAddRequest {
  199. string device_id = 1;
  200. int64 white_id = 2;
  201. string location = 3;
  202. int32 direction = 4;
  203. string household_user = 5;
  204. string household_id_number = 6;
  205. string household_housename = 7;
  206. string card_number = 8;
  207. string card_owner = 9;
  208. int32 online = 10;
  209. int64 garden_id = 11;
  210. // 1 访客 2 非访客
  211. int32 is_visitor = 12;
  212. // 开门时间
  213. int64 open_time = 13;
  214. int64 household_uid = 14;
  215. }
  216. message GateRecordAddReply {
  217. }
  218. // 门禁进出场记录列表
  219. message GateRecordListRequest {
  220. int64 page = 1;
  221. int64 page_size = 2;
  222. string device_id = 3;
  223. int64 start = 4;
  224. int64 end = 5;
  225. }
  226. message GateRecordItem {
  227. string device_id = 1;
  228. int64 white_id = 2;
  229. string location = 3;
  230. int32 direction = 4;
  231. string household_user = 5;
  232. string household_id_number = 6;
  233. string household_housename = 7;
  234. string card_number = 8;
  235. string card_owner = 9;
  236. int32 online = 10;
  237. int64 garden_id = 11;
  238. // 1 访客 2 非访客
  239. int32 is_visitor = 12;
  240. // 开门时间
  241. int64 open_time = 13;
  242. int64 household_uid = 14;
  243. }
  244. message GateRecordListReply {
  245. int64 page = 1;
  246. int64 total = 2;
  247. repeated GateRecordItem list = 3;
  248. }
  249. // 门禁添加远程命令
  250. message GateCommandAddRequest {
  251. // 1 远程开门;
  252. // 2 重启设备;
  253. // 4 获取设备参数;
  254. // 5 设置设备参数; 6 下载白名单;
  255. // 7 清空本地所有白名单;
  256. // 8 清空本地所有刷卡记录;
  257. // 9 扫码显示参数;
  258. // 10 查询卡号是否存在白名单
  259. // 99 恢复出厂;
  260. int32 cmd_code = 1;
  261. string cmd_params = 2;
  262. string device_id = 3;
  263. }
  264. message GateCommandAddReply {
  265. }
  266. // 门禁命令列表
  267. message GateCommandListRequest {
  268. string device_id = 1;
  269. int32 status = 2;
  270. int64 start = 3;
  271. int64 end = 4;
  272. int64 page = 5;
  273. int64 page_size = 6;
  274. }
  275. message GateCommandItem {
  276. string device_id = 1;
  277. string desc = 2;
  278. // 1 待执行 2 执行中 3 执行完成
  279. int32 status = 3;
  280. int64 created_at = 4;
  281. // 1 成功 2 失败
  282. int32 result_status = 5;
  283. // 结果描述
  284. string result_status_desc = 6;
  285. int64 id = 7;
  286. }
  287. message GateCommandListReply {
  288. int64 page = 1;
  289. int64 total = 2;
  290. repeated GateCommandItem list = 3;
  291. }
  292. // 删除命令
  293. message GateCommandDelRequest {
  294. int64 id = 1;
  295. }
  296. message GateCommandDelReply {
  297. }
  298. // 重新执行命令
  299. message GateCommandReuseRequest {
  300. int64 id = 1;
  301. }
  302. message GateCommandReuseReply {
  303. }
  304. message WhiteItem {
  305. string code_val = 1;
  306. int32 code_type = 2;
  307. }
  308. // 命令结果
  309. message GateCommandResultRequest {
  310. int64 id = 1;
  311. int32 cmd_code = 2;
  312. int32 result_status = 3;
  313. string result_desc = 4;
  314. string device_id = 5;
  315. repeated WhiteItem exists = 6;
  316. }
  317. message GateCommandResultReply {
  318. }
  319. // 获取一条命令用于执行
  320. message GateCommandUseRequest {
  321. string device_id = 1;
  322. }
  323. message GateCommandUseReply {
  324. int64 id = 1;
  325. int32 cmd_code = 2;
  326. string cmd_params = 3;
  327. }
  328. message GateWhiteSyncRequest {
  329. string device_id = 1;
  330. }
  331. message GateWhiteSyncReply {
  332. }