device.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. syntax = "proto3";
  2. // package声明符,用来防止不同的消息类型有命名冲突
  3. package pb_v1;
  4. // 用于生成指定语言go的包名称
  5. option go_package = "property-device/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. // 白名单匹配
  360. message GateWhiteMatchRequest {
  361. string sn = 1;
  362. int32 protocol = 2;
  363. string code_val = 3;
  364. int32 code_type = 4;
  365. }
  366. message GateWhiteMatchReply {
  367. int32 status = 1;
  368. string uid = 2;
  369. string card_number = 3;
  370. string id_number = 4;
  371. string phone = 5;
  372. string device_name = 6;
  373. string location = 7;
  374. int32 direction = 8;
  375. string name = 9;
  376. string house_name = 10;
  377. int64 device_id = 11;
  378. int64 garden_id = 12;
  379. }
  380. // 门禁更新状态
  381. message GateOnlineRequest {
  382. string sn = 1;
  383. int32 protocol = 2;
  384. }
  385. message GateOnlineReply {
  386. bool has_task = 1;
  387. }
  388. // 添加进出场记录
  389. message GateRecordAddRequest {
  390. int64 device_id = 1;
  391. string sn = 2;
  392. string location = 3;
  393. int32 direction = 4;
  394. string household_user = 5;
  395. string household_id_number = 6;
  396. string household_housename = 7;
  397. string card_number = 8;
  398. string card_owner = 9;
  399. int32 online = 10;
  400. int64 garden_id = 11;
  401. // 1 访客 2 非访客
  402. int32 is_visitor = 12;
  403. // 开门时间
  404. int64 open_time = 13;
  405. int64 household_uid = 14;
  406. string visitor_name = 15;
  407. string visitor_phone = 16;
  408. int32 protocol = 17;
  409. // 1 二维码 2 刷卡 3 人脸
  410. int32 open_type = 18;
  411. }
  412. message GateRecordAddReply {
  413. }
  414. // 门禁进出场记录列表
  415. message GateRecordListRequest {
  416. int64 page = 1;
  417. int64 page_size = 2;
  418. string device_id = 3;
  419. int64 start = 4;
  420. int64 end = 5;
  421. int32 is_visitor = 6;
  422. }
  423. message GateRecordItem {
  424. string device_id = 1;
  425. int64 white_id = 2;
  426. string location = 3;
  427. int32 direction = 4;
  428. string household_user = 5;
  429. string household_id_number = 6;
  430. string household_housename = 7;
  431. string card_number = 8;
  432. string card_owner = 9;
  433. int32 online = 10;
  434. int64 garden_id = 11;
  435. // 1 访客 2 非访客
  436. int32 is_visitor = 12;
  437. // 开门时间
  438. int64 open_time = 13;
  439. int64 household_uid = 14;
  440. string visitor_name = 15;
  441. string visitor_phone = 16;
  442. // 1 二维码 2 刷卡 3 人脸
  443. int32 open_type = 17;
  444. string sn = 18;
  445. int32 protocol = 19;
  446. }
  447. message GateRecordListReply {
  448. int64 page = 1;
  449. int64 total = 2;
  450. repeated GateRecordItem list = 3;
  451. }
  452. message GateVisitorAddRequest {
  453. int64 uid = 1;
  454. string name = 2;
  455. string phone = 3;
  456. string visitor = 4;
  457. string visitor_phone = 5;
  458. int64 device_id = 6;
  459. int64 start = 7;
  460. int64 end = 8;
  461. int64 garden_id = 9;
  462. string comment = 10;
  463. }
  464. message GateVisitorAddReply {
  465. int64 id = 1;
  466. string qcode = 2;
  467. }
  468. message GateVisitorListRequest {
  469. int64 uid = 1;
  470. int64 device_id = 2;
  471. string name = 3;
  472. string visitor = 4;
  473. int64 start = 5;
  474. int64 end = 6;
  475. int64 page = 7;
  476. int64 page_size = 8;
  477. int64 id = 9;
  478. }
  479. message GateVisitorListItem {
  480. int64 uid = 1;
  481. string name = 2;
  482. string phone = 3;
  483. string visitor = 4;
  484. string visitor_phone = 5;
  485. int64 device_id = 6;
  486. int64 start = 7;
  487. int64 end = 8;
  488. // 1 未通行 2 已同行 3 已过期
  489. int64 status = 9;
  490. int64 open_time = 10;
  491. string gate_name = 11;
  492. int64 id = 12;
  493. string comment = 13;
  494. string qcode = 14;
  495. string location = 15;
  496. string garden_name = 16;
  497. }
  498. message GateVisitorListReply {
  499. int64 page = 1;
  500. int64 total = 2;
  501. repeated GateVisitorListItem list = 3;
  502. }
  503. message GateVisitorCheckRequest {
  504. int64 id = 1;
  505. int64 open_time = 2;
  506. int64 device_id = 3;
  507. }
  508. message GateVisitorCheckReply {
  509. }
  510. message GateVisitorDelRequest {
  511. int64 id = 1;
  512. int64 uid = 2;
  513. bool manager = 3;
  514. }
  515. message GateVisitorDelReply {
  516. }
  517. message MqttFaceGateRequest {
  518. }
  519. message MqttFaceGateReply {
  520. repeated string sns = 1;
  521. }
  522. message HouseholdGateSyncCheckRequest {
  523. int64 garden_id =1;
  524. int64 unit_id = 2;
  525. int64 uid = 3;
  526. }
  527. message HouseholdGateSyncCheckReply {
  528. }
  529. message GateProtocolsRequest {
  530. }
  531. message GateProtocolData {
  532. int32 protocol = 1;
  533. string desc = 2;
  534. int32 qcode_support = 3;
  535. int32 card_support = 4;
  536. int32 face_support = 5;
  537. }
  538. message GateProtocolsReply {
  539. repeated GateProtocolData list = 1;
  540. }
  541. message GateCardCanBindDevicesRequest {
  542. int64 garden_id = 1;
  543. string card_number = 2;
  544. }
  545. message GateCardCanBindDevicesReply {
  546. repeated GateItem 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. }