device.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. syntax = "proto3";
  2. // package声明符,用来防止不同的消息类型有命名冲突
  3. package pb_v1;
  4. // 用于生成指定语言go的包名称
  5. option go_package = "property-household-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. bool qcode_support = 6;
  19. bool pic_support = 7;
  20. bool card_support = 8;
  21. }
  22. message GateInReply {
  23. }
  24. message GateBatchInItem {
  25. // 设备名
  26. string device_name = 1;
  27. // 序列号
  28. string sn = 2;
  29. // 厂商
  30. string manufactor = 3;
  31. // 授权key
  32. string auth_key = 4;
  33. // 协议
  34. int32 protocol = 5;
  35. bool qcode_support = 6;
  36. bool pic_support = 7;
  37. bool card_support = 8;
  38. }
  39. message GateBatchInRequest {
  40. repeated GateBatchInItem list = 1;
  41. }
  42. message GateBatchInReply {
  43. }
  44. // 门禁出库
  45. message GateOutRequest {
  46. int64 device_id = 1;
  47. int64 garden_id = 2;
  48. string out_user = 3;
  49. }
  50. message GateOutReply {
  51. }
  52. // 门禁列表
  53. message GateItem {
  54. // 设备id
  55. int64 device_id = 1;
  56. // 设备名
  57. string device_name = 2;
  58. // 序列号
  59. string sn = 3;
  60. // 厂商
  61. string manufactor = 4;
  62. // 授权key
  63. string auth_key = 5;
  64. // 1支持二维码 2 不支持
  65. int32 qcode_support = 6;
  66. // 协议
  67. int32 protocol = 7;
  68. // 小区id
  69. int64 garden_id = 8;
  70. // 小区名
  71. string garden_name = 9;
  72. // 出库人
  73. string out_user = 10;
  74. // 出库时间
  75. int64 out_time = 11;
  76. // 1 在线 2 离线
  77. int32 status = 12;
  78. // true 已启用 false 已禁用
  79. bool enable = 13;
  80. // 1 进场 2 出场 3 进出场
  81. int32 direction = 14;
  82. string location = 15;
  83. string protocol_desc = 16;
  84. // 1 支持人脸 2 不支持
  85. int32 pic_support = 17;
  86. // 1 支持卡 2 不支持
  87. int32 card_support = 18;
  88. string user_name = 19;
  89. string password = 20;
  90. string ip = 21;
  91. string mac = 22;
  92. int64 port = 23;
  93. }
  94. message GateListRequest {
  95. int64 garden_id = 1;
  96. int64 page = 2;
  97. int64 page_size = 3;
  98. // 1 已出库 2 未出库
  99. int32 out = 4;
  100. int32 device_id = 5;
  101. string sn = 6;
  102. string device_name = 7;
  103. string manufactor = 8;
  104. repeated int64 unit_ids = 9;
  105. int32 qcode_support = 10;
  106. int32 pic_support = 11;
  107. int32 card_support = 12;
  108. }
  109. message GateListReply {
  110. int64 page = 1;
  111. int64 total = 2;
  112. repeated GateItem list = 3;
  113. }
  114. // 门禁信息
  115. message GateInfoRequest {
  116. int64 device_id = 1;
  117. string sn = 2;
  118. int32 protocol = 3;
  119. }
  120. message GateInfoReply {
  121. GateItem info = 1;
  122. }
  123. // 删除门禁
  124. message GateDelRequest {
  125. int64 device_id = 1;
  126. }
  127. message GateDelReply {
  128. }
  129. // 回收门禁
  130. message GateRecoveryRequest {
  131. int64 device_id = 1;
  132. }
  133. message GateRecoveryReply {
  134. }
  135. // 门禁启用停用
  136. message GateEnableRequest {
  137. int64 device_id = 1;
  138. int64 garden_id = 2;
  139. bool enable = 3;
  140. }
  141. message GateEnableReply {
  142. }
  143. // 小区端编辑位置或方向
  144. message GateSetRequest {
  145. int64 device_id = 1;
  146. int64 garden_id = 2;
  147. // 1 进场 2 出场 3 进出场
  148. int32 direction = 3;
  149. // 位置
  150. string location = 4;
  151. string gate_name = 5;
  152. string user_name = 6;
  153. string password = 7;
  154. string ip = 8;
  155. string mac = 9;
  156. int64 port = 10;
  157. }
  158. message GateSetReply {
  159. }
  160. // 门禁添加远程命令
  161. message GateCommandAddRequest {
  162. // 1 远程开门;
  163. // 2 重启设备;
  164. // 4 获取设备参数;
  165. // 5 设置设备参数; 6 下载白名单;
  166. // 7 清空本地所有白名单;
  167. // 8 清空本地所有刷卡记录;
  168. // 9 扫码显示参数;
  169. // 10 查询卡号是否存在白名单
  170. // 99 恢复出厂;
  171. int32 cmd_code = 1;
  172. string cmd_params = 2;
  173. int64 device_id = 3;
  174. }
  175. message GateCommandAddReply {
  176. }
  177. // 门禁命令列表
  178. message GateCommandListRequest {
  179. int64 device_id = 1;
  180. int32 status = 2;
  181. int64 start = 3;
  182. int64 end = 4;
  183. int64 page = 5;
  184. int64 page_size = 6;
  185. }
  186. message GateCommandItem {
  187. int64 device_id = 1;
  188. string desc = 2;
  189. // 1 待执行 2 执行中 3 执行完成
  190. int32 status = 3;
  191. int64 created_at = 4;
  192. // 1 成功 2 失败
  193. int32 result_status = 5;
  194. // 结果描述
  195. string result_status_desc = 6;
  196. int64 id = 7;
  197. }
  198. message GateCommandListReply {
  199. int64 page = 1;
  200. int64 total = 2;
  201. repeated GateCommandItem list = 3;
  202. }
  203. // 删除命令
  204. message GateCommandDelRequest {
  205. int64 id = 1;
  206. }
  207. message GateCommandDelReply {
  208. }
  209. // 命令结果
  210. message GateCommandResultRequest {
  211. int64 id = 1;
  212. int32 cmd_code = 2;
  213. int32 result_status = 3;
  214. string result_desc = 4;
  215. string sn = 5;
  216. int32 protocol = 6;
  217. string content = 7;
  218. }
  219. message GateCommandResultReply {
  220. bool has_task = 1;
  221. }
  222. // 获取一条命令用于执行
  223. message GateCommandUseRequest {
  224. string sn = 1;
  225. int32 protocol = 2;
  226. }
  227. message GateCommandUseReply {
  228. int64 id = 1;
  229. int32 cmd_code = 2;
  230. string cmd_params = 3;
  231. }
  232. message GateUnitAddRequest {
  233. int64 device_id = 1;
  234. repeated int64 unit_id = 2;
  235. int64 garden_id = 3;
  236. }
  237. message GateUnitAddReply {
  238. }
  239. message GateUnitListRequest {
  240. int64 device_id = 1;
  241. int64 garden_id = 2;
  242. }
  243. message GateUnitListReply {
  244. repeated int64 unit_id = 3;
  245. }
  246. message GateUnitDeviceRequest {
  247. int64 garden_id = 1;
  248. repeated int64 unit_id = 2;
  249. bool only_has = 3;
  250. }
  251. message GateUnitDeviceReply {
  252. repeated GateItem list = 1;
  253. bool has_device = 2;
  254. }
  255. message GateUserPicAddRequest {
  256. int64 garden_id = 1;
  257. int64 uid = 2;
  258. string id_number = 3;
  259. string name = 4;
  260. string pic_url = 5;
  261. string phone = 6;
  262. }
  263. message GateUserPicAddReply {
  264. }
  265. message GateUserPicInfoRequest {
  266. int64 garden_id = 1;
  267. int64 uid = 2;
  268. }
  269. message GateUserPicInfoReply {
  270. string pic_url = 1;
  271. // 1 待下发 2 已下发 3 下发失败
  272. int32 down_status = 2;
  273. // 1 待审核 2 审核通过 3 审核未通过
  274. int32 approve_status = 3;
  275. string feedback = 4;
  276. }
  277. message GateUserPicListRequest {
  278. int64 garden_id = 1;
  279. int32 down_status = 2;
  280. string name = 3;
  281. int64 page = 4;
  282. int64 page_size = 5;
  283. }
  284. message GateUserPicDevice {
  285. int64 device_id = 1;
  286. string device_name = 2;
  287. int32 down_status = 3;
  288. }
  289. message GateUserPicItem {
  290. int64 id = 1;
  291. int64 uid = 2;
  292. string name = 3;
  293. string id_number = 4;
  294. string house_name = 5;
  295. int64 created_at = 6;
  296. int64 approved_at = 7;
  297. int32 approve_status = 8;
  298. int32 down_status = 9;
  299. repeated GateUserPicDevice gate_permissions = 10;
  300. }
  301. message GateUserPicListReply {
  302. int64 page = 1;
  303. int64 total = 2;
  304. repeated GateUserPicItem list = 3;
  305. }
  306. message GateUserPicApproveRequest {
  307. int64 garden_id = 1;
  308. int64 id = 2;
  309. bool status = 3;
  310. string feedback = 4;
  311. }
  312. message GateUserPicApproveReply {
  313. }
  314. message GateUserPicSyncRequest {
  315. int64 id = 1;
  316. int64 garden_id = 2;
  317. }
  318. message GateUserPicSyncReply {
  319. }
  320. message GateCardAddRequest {
  321. string card_number = 1;
  322. int64 garden_id = 2;
  323. string name = 3;
  324. repeated int64 device_ids = 4;
  325. }
  326. message GateCardAddReply {
  327. }
  328. message GateCardListRequest {
  329. int64 garden_id = 1;
  330. int32 down_status = 2;
  331. string name = 3;
  332. int64 page = 4;
  333. int64 page_size = 5;
  334. }
  335. message GateCardDevice {
  336. int64 device_id = 1;
  337. string device_name = 2;
  338. int32 down_status = 3;
  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. }
  507. message GateVisitorCheckReply {
  508. }
  509. message GateVisitorDelRequest {
  510. int64 id = 1;
  511. int64 uid = 2;
  512. bool manager = 3;
  513. }
  514. message GateVisitorDelReply {
  515. }
  516. message MqttFaceGateRequest {
  517. }
  518. message MqttFaceGateReply {
  519. repeated string sns = 1;
  520. }
  521. message HouseholdGateSyncCheckRequest {
  522. int64 garden_id =1;
  523. int64 unit_id = 2;
  524. int64 uid = 3;
  525. }
  526. message HouseholdGateSyncCheckReply {
  527. }