device.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. syntax = "proto3";
  2. // package声明符,用来防止不同的消息类型有命名冲突
  3. package pb_v1;
  4. // 用于生成指定语言go的包名称
  5. option go_package = "property-system-gateway/pb/v1";
  6. // 门禁入库
  7. message GateInRequest {
  8. // 设备名
  9. string device_name = 1;
  10. // 序列号
  11. string sn = 2;
  12. // 厂商
  13. string manufactor = 3;
  14. // 授权key
  15. string auth_key = 4;
  16. // 协议
  17. int32 protocol = 5;
  18. }
  19. message GateInReply {
  20. }
  21. message GateBatchInItem {
  22. // 设备名
  23. string device_name = 1;
  24. // 序列号
  25. string sn = 2;
  26. // 厂商
  27. string manufactor = 3;
  28. // 授权key
  29. string auth_key = 4;
  30. // 协议
  31. int32 protocol = 5;
  32. }
  33. message GateBatchInRequest {
  34. repeated GateBatchInItem list = 1;
  35. }
  36. message GateBatchInReply {
  37. }
  38. // 门禁出库
  39. message GateOutRequest {
  40. int64 device_id = 1;
  41. int64 garden_id = 2;
  42. string out_user = 3;
  43. }
  44. message GateOutReply {
  45. }
  46. // 门禁列表
  47. message GateItem {
  48. // 设备id
  49. int64 device_id = 1;
  50. // 设备名
  51. string device_name = 2;
  52. // 序列号
  53. string sn = 3;
  54. // 厂商
  55. string manufactor = 4;
  56. // 授权key
  57. string auth_key = 5;
  58. // 1支持二维码 2 不支持
  59. int32 qcode_support = 6;
  60. // 协议
  61. int32 protocol = 7;
  62. // 小区id
  63. int64 garden_id = 8;
  64. // 小区名
  65. string garden_name = 9;
  66. // 出库人
  67. string out_user = 10;
  68. // 出库时间
  69. int64 out_time = 11;
  70. // 1 在线 2 离线
  71. int32 status = 12;
  72. // true 已启用 false 已禁用
  73. bool enable = 13;
  74. // 1 进场 2 出场 3 进出场
  75. int32 direction = 14;
  76. string location = 15;
  77. string protocol_desc = 16;
  78. // 1 支持人脸 2 不支持
  79. int32 pic_support = 17;
  80. // 1 支持卡 2 不支持
  81. int32 card_support = 18;
  82. string user_name = 19;
  83. string password = 20;
  84. string ip = 21;
  85. string mac = 22;
  86. int64 port = 23;
  87. }
  88. message GateListRequest {
  89. int64 garden_id = 1;
  90. int64 page = 2;
  91. int64 page_size = 3;
  92. // 1 已出库 2 未出库
  93. int32 out = 4;
  94. int32 device_id = 5;
  95. string sn = 6;
  96. string device_name = 7;
  97. string manufactor = 8;
  98. repeated int64 unit_ids = 9;
  99. int32 qcode_support = 10;
  100. int32 pic_support = 11;
  101. int32 card_support = 12;
  102. }
  103. message GateListReply {
  104. int64 page = 1;
  105. int64 total = 2;
  106. repeated GateItem list = 3;
  107. }
  108. // 门禁信息
  109. message GateInfoRequest {
  110. int64 device_id = 1;
  111. string sn = 2;
  112. int32 protocol = 3;
  113. }
  114. message GateInfoReply {
  115. GateItem info = 1;
  116. }
  117. // 删除门禁
  118. message GateDelRequest {
  119. int64 device_id = 1;
  120. }
  121. message GateDelReply {
  122. }
  123. // 回收门禁
  124. message GateRecoveryRequest {
  125. int64 device_id = 1;
  126. }
  127. message GateRecoveryReply {
  128. }
  129. // 门禁启用停用
  130. message GateEnableRequest {
  131. int64 device_id = 1;
  132. int64 garden_id = 2;
  133. bool enable = 3;
  134. }
  135. message GateEnableReply {
  136. }
  137. // 小区端编辑位置或方向
  138. message GateSetRequest {
  139. int64 device_id = 1;
  140. int64 garden_id = 2;
  141. // 1 进场 2 出场 3 进出场
  142. int32 direction = 3;
  143. // 位置
  144. string location = 4;
  145. string gate_name = 5;
  146. string user_name = 6;
  147. string password = 7;
  148. string ip = 8;
  149. string mac = 9;
  150. int64 port = 10;
  151. }
  152. message GateSetReply {
  153. }
  154. // 门禁添加远程命令
  155. message GateCommandAddRequest {
  156. // 1 远程开门;
  157. // 2 重启设备;
  158. // 4 获取设备参数;
  159. // 5 设置设备参数; 6 下载白名单;
  160. // 7 清空本地所有白名单;
  161. // 8 清空本地所有刷卡记录;
  162. // 9 扫码显示参数;
  163. // 10 查询卡号是否存在白名单
  164. // 99 恢复出厂;
  165. int32 cmd_code = 1;
  166. string cmd_params = 2;
  167. int64 device_id = 3;
  168. }
  169. message GateCommandAddReply {
  170. }
  171. // 门禁命令列表
  172. message GateCommandListRequest {
  173. int64 device_id = 1;
  174. int32 status = 2;
  175. int64 start = 3;
  176. int64 end = 4;
  177. int64 page = 5;
  178. int64 page_size = 6;
  179. }
  180. message GateCommandItem {
  181. int64 device_id = 1;
  182. string desc = 2;
  183. // 1 待执行 2 执行中 3 执行完成
  184. int32 status = 3;
  185. int64 created_at = 4;
  186. // 1 成功 2 失败
  187. int32 result_status = 5;
  188. // 结果描述
  189. string result_status_desc = 6;
  190. int64 id = 7;
  191. }
  192. message GateCommandListReply {
  193. int64 page = 1;
  194. int64 total = 2;
  195. repeated GateCommandItem list = 3;
  196. }
  197. // 删除命令
  198. message GateCommandDelRequest {
  199. int64 id = 1;
  200. }
  201. message GateCommandDelReply {
  202. }
  203. // 命令结果
  204. message GateCommandResultRequest {
  205. int64 id = 1;
  206. int32 cmd_code = 2;
  207. int32 result_status = 3;
  208. string result_desc = 4;
  209. string sn = 5;
  210. int32 protocol = 6;
  211. string content = 7;
  212. }
  213. message GateCommandResultReply {
  214. bool has_task = 1;
  215. }
  216. // 获取一条命令用于执行
  217. message GateCommandUseRequest {
  218. string sn = 1;
  219. int32 protocol = 2;
  220. }
  221. message GateCommandUseReply {
  222. int64 id = 1;
  223. int32 cmd_code = 2;
  224. string cmd_params = 3;
  225. }
  226. message GateUnitAddRequest {
  227. int64 device_id = 1;
  228. repeated int64 unit_id = 2;
  229. int64 garden_id = 3;
  230. }
  231. message GateUnitAddReply {
  232. }
  233. message GateUnitListRequest {
  234. int64 device_id = 1;
  235. int64 garden_id = 2;
  236. }
  237. message GateUnitListReply {
  238. repeated int64 unit_id = 3;
  239. }
  240. message GateUnitDeviceRequest {
  241. int64 garden_id = 1;
  242. repeated int64 unit_id = 2;
  243. bool only_has = 3;
  244. }
  245. message GateUnitDeviceReply {
  246. repeated GateItem list = 1;
  247. bool has_device = 2;
  248. }
  249. message GateUserPicAddRequest {
  250. int64 garden_id = 1;
  251. int64 uid = 2;
  252. string id_number = 3;
  253. string name = 4;
  254. string pic_url = 5;
  255. string phone = 6;
  256. }
  257. message GateUserPicAddReply {
  258. }
  259. message GateUserPicInfoRequest {
  260. int64 garden_id = 1;
  261. int64 uid = 2;
  262. }
  263. message GateUserPicInfoReply {
  264. string pic_url = 1;
  265. // 1 待下发 2 已下发 3 下发失败
  266. int32 down_status = 2;
  267. // 1 待审核 2 审核通过 3 审核未通过
  268. int32 approve_status = 3;
  269. string feedback = 4;
  270. }
  271. message GateUserPicListRequest {
  272. int64 garden_id = 1;
  273. int32 down_status = 2;
  274. string name = 3;
  275. int64 page = 4;
  276. int64 page_size = 5;
  277. }
  278. message GateUserPicDevice {
  279. int64 device_id = 1;
  280. string device_name = 2;
  281. int32 down_status = 3;
  282. string location = 4;
  283. int32 direction = 5;
  284. }
  285. message GateUserPicItem {
  286. int64 id = 1;
  287. int64 uid = 2;
  288. string name = 3;
  289. string id_number = 4;
  290. string house_name = 5;
  291. int64 created_at = 6;
  292. int64 approved_at = 7;
  293. int32 approve_status = 8;
  294. int32 down_status = 9;
  295. repeated GateUserPicDevice gate_permissions = 10;
  296. string pic_url = 11;
  297. int32 user_type = 12;
  298. }
  299. message GateUserPicListReply {
  300. int64 page = 1;
  301. int64 total = 2;
  302. repeated GateUserPicItem list = 3;
  303. }
  304. message GateUserPicApproveRequest {
  305. int64 garden_id = 1;
  306. int64 id = 2;
  307. bool status = 3;
  308. string feedback = 4;
  309. }
  310. message GateUserPicApproveReply {
  311. }
  312. message GateUserPicSyncRequest {
  313. int64 id = 1;
  314. int64 garden_id = 2;
  315. }
  316. message GateUserPicSyncReply {
  317. }
  318. message GateCardAddRequest {
  319. string card_number = 1;
  320. int64 garden_id = 2;
  321. string name = 3;
  322. repeated int64 device_ids = 4;
  323. }
  324. message GateCardAddReply {
  325. }
  326. message GateCardListRequest {
  327. int64 garden_id = 1;
  328. int32 down_status = 2;
  329. string name = 3;
  330. int64 page = 4;
  331. int64 page_size = 5;
  332. }
  333. message GateCardDevice {
  334. int64 device_id = 1;
  335. string device_name = 2;
  336. int32 down_status = 3;
  337. string location = 4;
  338. int32 direction = 5;
  339. }
  340. message GateCardItem {
  341. int64 id = 1;
  342. string name = 2;
  343. string card_number = 3;
  344. int64 created_at = 4;
  345. int32 down_status = 5;
  346. repeated GateCardDevice gate_permissions = 6;
  347. }
  348. message GateCardListReply {
  349. int64 page = 1;
  350. int64 total = 2;
  351. repeated GateCardItem list = 3;
  352. }
  353. message GateCardSyncRequest {
  354. int64 id = 1;
  355. int64 garden_id = 2;
  356. }
  357. message GateCardSyncReply {
  358. }
  359. message GateCardCanBindDevicesRequest {
  360. int64 garden_id = 1;
  361. string card_number = 2;
  362. }
  363. message GateCardCanBindDevicesReply {
  364. repeated GateItem list = 1;
  365. }
  366. // 白名单匹配
  367. message GateWhiteMatchRequest {
  368. string sn = 1;
  369. int32 protocol = 2;
  370. string code_val = 3;
  371. int32 code_type = 4;
  372. }
  373. message GateWhiteMatchReply {
  374. int32 status = 1;
  375. string uid = 2;
  376. string card_number = 3;
  377. string id_number = 4;
  378. string phone = 5;
  379. string device_name = 6;
  380. string location = 7;
  381. int32 direction = 8;
  382. string name = 9;
  383. string house_name = 10;
  384. int64 device_id = 11;
  385. int64 garden_id = 12;
  386. }
  387. // 门禁更新状态
  388. message GateOnlineRequest {
  389. string sn = 1;
  390. int32 protocol = 2;
  391. }
  392. message GateOnlineReply {
  393. bool has_task = 1;
  394. }
  395. // 添加进出场记录
  396. message GateRecordAddRequest {
  397. int64 device_id = 1;
  398. string sn = 2;
  399. string location = 3;
  400. int32 direction = 4;
  401. string household_user = 5;
  402. string household_id_number = 6;
  403. string household_housename = 7;
  404. string card_number = 8;
  405. string card_owner = 9;
  406. int32 online = 10;
  407. int64 garden_id = 11;
  408. // 1 访客 2 非访客
  409. int32 is_visitor = 12;
  410. // 开门时间
  411. int64 open_time = 13;
  412. int64 household_uid = 14;
  413. string visitor_name = 15;
  414. string visitor_phone = 16;
  415. int32 protocol = 17;
  416. // 1 二维码 2 刷卡 3 人脸
  417. int32 open_type = 18;
  418. }
  419. message GateRecordAddReply {
  420. }
  421. // 门禁进出场记录列表
  422. message GateRecordListRequest {
  423. int64 page = 1;
  424. int64 page_size = 2;
  425. string device_id = 3;
  426. int64 start = 4;
  427. int64 end = 5;
  428. int32 is_visitor = 6;
  429. }
  430. message GateRecordItem {
  431. string device_id = 1;
  432. int64 white_id = 2;
  433. string location = 3;
  434. int32 direction = 4;
  435. string household_user = 5;
  436. string household_id_number = 6;
  437. string household_housename = 7;
  438. string card_number = 8;
  439. string card_owner = 9;
  440. int32 online = 10;
  441. int64 garden_id = 11;
  442. // 1 访客 2 非访客
  443. int32 is_visitor = 12;
  444. // 开门时间
  445. int64 open_time = 13;
  446. int64 household_uid = 14;
  447. string visitor_name = 15;
  448. string visitor_phone = 16;
  449. // 1 二维码 2 刷卡 3 人脸
  450. int32 open_type = 17;
  451. string sn = 18;
  452. int32 protocol = 19;
  453. }
  454. message GateRecordListReply {
  455. int64 page = 1;
  456. int64 total = 2;
  457. repeated GateRecordItem list = 3;
  458. }
  459. message GateVisitorAddRequest {
  460. int64 uid = 1;
  461. string name = 2;
  462. string phone = 3;
  463. string visitor = 4;
  464. string visitor_phone = 5;
  465. int64 device_id = 6;
  466. int64 start = 7;
  467. int64 end = 8;
  468. int64 garden_id = 9;
  469. string comment = 10;
  470. }
  471. message GateVisitorAddReply {
  472. int64 id = 1;
  473. string qcode = 2;
  474. }
  475. message GateVisitorListRequest {
  476. int64 uid = 1;
  477. int64 device_id = 2;
  478. string name = 3;
  479. string visitor = 4;
  480. int64 start = 5;
  481. int64 end = 6;
  482. int64 page = 7;
  483. int64 page_size = 8;
  484. int64 id = 9;
  485. }
  486. message GateVisitorListItem {
  487. int64 uid = 1;
  488. string name = 2;
  489. string phone = 3;
  490. string visitor = 4;
  491. string visitor_phone = 5;
  492. int64 device_id = 6;
  493. int64 start = 7;
  494. int64 end = 8;
  495. // 1 未通行 2 已同行 3 已过期
  496. int64 status = 9;
  497. int64 open_time = 10;
  498. string gate_name = 11;
  499. int64 id = 12;
  500. string comment = 13;
  501. string qcode = 14;
  502. string location = 15;
  503. string garden_name = 16;
  504. }
  505. message GateVisitorListReply {
  506. int64 page = 1;
  507. int64 total = 2;
  508. repeated GateVisitorListItem list = 3;
  509. }
  510. message GateVisitorCheckRequest {
  511. int64 id = 1;
  512. int64 open_time = 2;
  513. int64 device_id = 3;
  514. }
  515. message GateVisitorCheckReply {
  516. }
  517. message GateVisitorDelRequest {
  518. int64 id = 1;
  519. int64 uid = 2;
  520. bool manager = 3;
  521. }
  522. message GateVisitorDelReply {
  523. }
  524. message MqttFaceGateRequest {
  525. }
  526. message MqttFaceGateReply {
  527. repeated string sns = 1;
  528. }
  529. message HouseholdGateSyncCheckRequest {
  530. int64 garden_id =1;
  531. int64 unit_id = 2;
  532. int64 uid = 3;
  533. }
  534. message HouseholdGateSyncCheckReply {
  535. }
  536. message GateProtocolsRequest {
  537. }
  538. message GateProtocolData {
  539. int32 protocol = 1;
  540. string desc = 2;
  541. int32 qcode_support = 3;
  542. int32 card_support = 4;
  543. int32 face_support = 5;
  544. }
  545. message GateProtocolsReply {
  546. repeated GateProtocolData list = 1;
  547. }
  548. message GateUserPicDelRequest {
  549. int64 garden_id = 1;
  550. int64 id = 2;
  551. }
  552. message GateUserPicDelReply {
  553. }
  554. message GateCardDelRequest {
  555. int64 garden_id = 1;
  556. int64 id = 2;
  557. }
  558. message GateCardDelReply {
  559. }