liuxiaolong
2020-07-13 2105f11967f02caf32e8ec3c7019226e3d565236
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
syntax = "proto3";
 
package protomsg;
 
import "base.proto";
 
 
//Area结构体
message Area{
    int32 id = 1;
    int32 parentid = 2;
    string name = 3;
}
 
//Camera结构体
message Camera {
    string id = 1;
    string name = 2;
    string alias = 3;
    string snapshot_url = 4;//摄像机底图快照
    int32 type = 5;
    string addr = 6;
    float longitude = 7;
    float latitude = 8;
    int32 floor = 9;
    string rtsp = 10;
    string ip = 11;
    int32 port = 12;
    string username = 13;
    string password = 14;
    string brand = 15;
    string reserved = 16;
 
    bool is_running = 17;//是否正在做任务(0:否,1:是)
    bool run_enable = 18;//是否启用实时或轮询(0:否,1:是)
    int32 run_type = 19;//做任务的类型(0:轮询,1:实时)
    string run_server_id = 20;//当前正在哪台服务器上做任务
 
    int32 resolution_width = 21; //分辨率宽
    int32 resolution_height = 22; //分辨率高
    int32 fps = 23; //fps设置
 
    repeated Sensor sensors = 24; //传感器
}
 
message Sensor {
    string id = 1;
    string type = 2;
    string ip = 3;
    int32 port = 4;
    string username = 5;
    string password = 6;
    int32 threshold = 7;
    bool enable = 8;
}
 
//摄像机联动
message CameraLink {
    string camera_ids = 1;
    string link_task_id = 2;
}
 
message SdkRun {
    string ipc_id = 1;
    string sdk_type = 2;
    bool isTriggerByPreSdk = 3;
    int32 confidence = 4;
}
 
 
//摄像机布防的时间规则,可以设置多个,用id关联到具体的规则配置中
message CameraTimerule {
    string id = 1;//id
    string name = 2;//规则名称
    string time_rule = 3;//具体时间规则设置
}
 
//DayCtl struct   每天的时间控制规则
message DayCtl {
    int32 day = 1;//1-7表示星期一到星期日
    repeated TimeRange time_range = 2;
}
 
//时间起始范围
message TimeRange {
    string start = 1;//开始
    string end = 2;//结束
}
 
//Polygon struct
message Polygon {
    string id = 1;//形状id
    string name = 2;//形状的名称
    repeated Point points = 3;//点的集合
}
 
message CameraInfo {
    string runServerName = 1;
    string id = 2;
    string name = 3;
    int32 run_type= 4;
}
message CameraAndRules {
    CameraInfo cameraInfo = 1;
    repeated GroupRule rules = 2;
}
 
message GroupRule {
    repeated string cameraIds = 1;
    string id = 2;
 
    string group_text = 3;
    int32 alarm_level = 4;
    repeated Rule rules = 5;
    string set_type = 6;
 
    string template_id = 7;
    string template_rule = 8;
    string time_rule_id = 9;
    string scene_name = 10;
    string desc = 11;
    bool enable = 12;
}
 
message GroupRuleSdks {
    string id = 1;
    string scene_name = 2;
    repeated SdkRun sdks = 3;
    repeated string sdkIds = 4;
}
 
message Rule {
    string id =1;
    string camera_id =2;
    string polygon_id =3;
    string sdk_id = 4;
    repeated SdkSetBase sdk_set = 5;
    string rule_with_pre = 6;
    string group_id =7;
    int32 sort = 8;
}
 
message RuleTemplate {
    string id = 1;
    string name = 2;
    string desc = 3;
    string txt = 4;
    repeated TemplateArg rules = 5;
}
 
message RuleTemplateList {
    repeated RuleTemplate list = 1;
}
 
message TemplateArg {
    string sdk_id = 1;
    string sdk_arg_alias = 2;
    string operator = 3;
    string sdk_arg_value = 4;
    string sort = 5;
    string rule_with_pre = 6;
}
 
message SdkSetBase {
    string sdk_arg_alias = 1;
    string operator = 2;
    string sdk_arg_value = 3;
    string sort = 4;
}
 
//Sdk struct
message Sdk {
    string id = 1;
    string ipc_id = 2;
    string sdk_type = 3;//算法类型
    string sdk_name = 4;//sdk名称
    repeated SdkArg args = 5;//算法参数
    string icon = 6;//算法图标
    string url = 7;//算法下载地址
    string create_time = 8;
    string update_time = 9;
    string create_by = 10;
    bool enable = 11;//是否启用
    int32 del_flag = 12;//是否删除
    string iconBlob = 13; //图片二进制
    string version = 14; //版本
    bool enTrack = 15; //是否开启跟踪
    string argDef = 16; //默认参数
}
 
//SdkArg struct
message SdkArg {
    string alias = 1;//参数别名
    string name = 2;//参数名称
    string type = 3;//参数类型
    bool must = 4;//参数是否必填
    string unit = 5;//单位
    string range = 6;//参数的范围
    string default_value = 7;//参数默认值
    string default_operator = 8;//参数默认计算符号
    int32 sort = 9;//参数排序
}
 
message SdkChanSet {
    string sdk_type = 1;
    int32 chan_num = 2;
    int32 confidenceInc = 3;
    int32 minMovePos = 4;
}
 
 
 
//TableChanged enum
enum TableChanged {
    T_Camera = 0;//摄像机变化
    T_CameraRule = 1;//摄像机任务参数变化
    T_Sdk = 2;//sdk变化
    T_CameraPolygon = 3;//摄像机多边形变化
    T_TimeRule = 4;//时间规则变化
    T_Server = 5;//服务器信息变化
    T_PollConfig = 6;//轮询配置变化
    T_File = 7;//本地文件变化
    T_FileSetting = 8;//本地文件分析设置
    T_SdkChanSet = 9;//算法通道设置变化
    T_FileStack = 10;//数据栈变化
}
 
enum DbAction {
    Insert = 0;//Insert
    Update = 1;//Update
    Delete = 2;//Delete
}
 
//publish db change message
message DbChangeMessage {
    TableChanged table = 1;//变化的表
    string id = 2;//变化数据id
    DbAction action = 3;//action
    string info = 4;//变化内容
}
 
message CameraPolygon {
    string id = 1;
    string camera_id = 2;//摄像机id
    string name = 3;//名称
    string polygon = 4;//坐标点集合
    string trigger_line = 5;
    string direction_line = 6;
    string type = 7;
    int32 defence_state = 8;
}
 
message VideotapeInfo {
    string esDataId = 1;
    string cameraId = 2;
    string taskId = 3;
    int64 imgId = 4;
    string videoUrl = 5;
    repeated string sdkIds = 6;
    int32 type = 7;
}
 
message Voice {
    string id = 1;
    string name = 2;
    string path = 3;
}
 
message VoiceList {
    repeated Voice list = 1;
}
 
message CompareArgs {
    repeated string tableIds = 1;
    float compareThreshold = 2;
    bytes faceFeature = 3;
    repeated string tasks = 4;
    repeated string treeNodes = 5;
    repeated string tabs = 6;
    string alarmLevel = 7;
    repeated string searchTime = 8;
    string inputValue = 9;
    string collection = 10;
    bool source = 11;
    string analyServerId = 12;
    string compareTarget = 13;//比对的目标
}
 
message CompareEvent {
    CompareEventType eventType =1;
    bytes payload = 2;
}
 
enum CompareEventType {
    ReInitCache = 0; // 重新初始化底库缓存(加入集群后执行)
    UpdateCache = 1; // 更新底库和人员缓存
    Compare = 2; // 做比对请求
}
 
message SdkCompareEach {
    string id           = 1;
    string tableid      = 2;
    float  compareScore = 3;
}
 
message SdkCompareResult {
    repeated SdkCompareEach compareResult = 1;
}
 
message EventPush {
    string id = 1;
    string name = 2;
    string time_start = 3;
    string time_end = 4;
    bool is_satisfy_all = 5;
    string rule_text = 6;
    bool enable = 7;
    string link_type = 8;
    string link_device = 9;
    repeated PushIpPort ip_ports = 10;
    repeated PushUrl urls = 11;
    repeated EventPushRule rules = 12;
}
 
message EventPushRule {
    string id = 1;
    string topic_type = 2;
    string topic_arg = 3;
    string operator = 4;
    string operator_type = 5;
    string rule_value = 6;
    string event_push_id = 7;
}
 
message PushIpPort {
    string server_ip = 1;
    int32 port = 2;
    bool enable = 3;
}
 
message PushUrl {
    string url = 1;
    bool enable = 2;
}
 
message PushAttach {
    string push_id = 1;
    Camera cam = 2;
    string server_id = 3;
    string server_name = 4;
    string local_ip = 5;
    string video_url = 6;
}
 
enum EsCacheChanged {
    T_DbTable = 0;//底库有效状态变化
    T_DbTablePerson = 1;//底库人员有效状态变化
}
 
message EsPersonCacheChange {
    EsCacheChanged type = 1;
    repeated string table_id = 2;//底库id
    string person_id = 3;//人员id
    string feature = 4;//特征值base64
    DbAction action = 5;
    int32 enable = 6;
    string carNo = 7;
}