240717班级,工业化控制系统,煤矿相关行业,昆仑系统
1
zhuhang
2024-11-01 87ef42b4f156750f9a80878b7cb15d75b67bf2b1
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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
#ifndef COMMON_H
#define COMMON_H
 
#include <string.h>
 
enum TypeInfo{
 
    //注册登录
    LOGIN_REQ, // 登录请求
    LOGIN_RES, // 登录响应
    REGISTER_REQ, //注册请求
    REGISTER_RES, //注册响应
    RESET_REQ, //重置密码请求
    RESET_RES, //重置密码响应
 
 
    //权限管理
    QUERY_PMS_REQ,      // 按员工编号、名字或职位查询人员权限信息请求
    UPDATE_PMS_REQ,     // 按角色id更新权限信息请求
    QUERY_PMS_RES,      // 查询人员和角色信息的响应结构体
    UPDATE_PMS_RES,     // 权限更新结果响应体
 
    //设备管理
    AD_Req,//添加设备请求
    AD_Res,//添加设备响应
    CD_Req,//关闭设备请求
    CD_Res,//关闭设备请求
    PD_Req,//暂停设备请求
    PD_Res,//暂停设备请求
 
    //地图标注
    MAPMARK_REQ,//地图标注请求
    MAPMARK_RES//地图标注响应
 
    //大屏显示
    ENVIRONMENT_REQ,//环境数据请求
    ENVIRONMENT_RES,//环境数据响应
    DEVICESTATUS_REQ,//设备状态请求
    DEVICESTATUS_RES,//设备状态响应
    MOVEMENTRECORD_REQ,//操作日志请求
    MOVEMENTRECORD_RES,//操作日志响应
    ALARMRECORD_REQ,//警报记录请求
    ALARMRECORD_RES,//警报记录响应
    YIELD_REQ,//煤矿产量请求
    YIELD_RES,//煤矿产量响应
 
    //警报管理
    WARNING_REQ, // 警报请求
    WARNING_RES, // 警报响应
 
 
    //生产计划管理
    ADD_PRODUCTION_PLAN_REQ,//添加一行数据的请求结构体
    ADD_PRODUCTION_PLAN_RES,//添加一行数据的响应结构体
    UPDATE_PRODUCTION_PLAN_QUANTITY_REQ,// 更新生产计划(计划生产量)的请求结构体
    UPDATE_PRODUCTION_PLAN_QUANTITY_RES,// 更新生产计划(计划生产量)的响应结构体
    UPDATE_PRODUCTION_PLAN_LOG_REQ,//更新生产计划(日志)的请求结构体
    UPDATE_PRODUCTION_PLAN_LOG_RES,//更新生产计划(日志)的响应结构体
    PRODUCTION_PLAN_REQ,// 查询生产计划信息的请求结构体
    PRODUCTION_PLAN_RES,// 查询生产计划信息的响应结构体
    FORRECENT_FOURTEEN_PRODUCTION_PLANS_REQ,//查询近十四条的请求结构体
    FORRECENT_FOURTEEN_PRODUCTION_PLANS_RES //查询近十四条的响应结构体
 
 
    //历史查询分析
    HISTORY_QUERY_REQ, // 历史查询请求
    HISTORY_QUERY_RES, // 历史查询响应
 
    //自动升级
    VERSIONNUM_REQ,  // 版本号请求
    VERSIONNUM_RES,   // 版本号响应
    UPLOAD_FILE_REQ, // 上传文件的请求
    UPLOAD_FILE_RES, // 上传文件的响应
    VERSIONINFOENTRY_REQ,       // 版本信息录入请求
    VERSIONINFOENTRY_RES,       //版本信息录入响应
    VERSIONUPDATE_REQ, // 版本更新请求
    VERSIONUPDATE_RES, // 版本更新响应
    FILEDOWNLOADS_REQ, // 版本更新文件下载请求
    FILEDOWNLOADS_RES, // 版本更新文件下载响应
    DOWNLOADSUCCESSFULLY_RES        // 更新文件下载成功的响应
 
    //日志
    LOGSEARCH_REQ;//日志查询请求
    LOGSEARCH_RES;//日志查询响应
 
        
};
 
struct Head{
    int type;
    int len;
};
 
//注册登录
//登录请求 
    struct LoginReq
    {
        Head head;
        char user_name[32];
        char password[32];
        LoginReq(){
            head.type = LOGIN_REQ;
            head.len = sizeof(LoginReq);
        }
    };
    
    struct Permission
    {
        int admin;
        int log_search; //日志查询
        int history; //历史记录
        int map_change;//地图
        int version_manage; // 版本管理
        int warning; //警报
        int device_manage; //设备管理
        int pro_plan;//生产计划
        char role_name[32]; // 角色名
    };
    
    //登录响应
    struct LoginRes
    {
        Head head;
        char user_name[32];
        int status; // 登录状态
        // 登录成功时,该账号对应的权限组合
        Permission per;
        LoginRes()
        {
            head.type = LOGIN_RES;
            head.len = sizeof(LoginRes);
        };
    };
 
    //注册请求 
    struct RegisterReq
    {
        Head head;
        char user_name[32];
        char password[32];
        char email[50];
        int telephone;
        RegisterReq(){
            head.type = REGISTER_REQ;
            head.len = sizeof(RegisterReq);
        }
    };
 
    //注册响应
    struct RegisterRes
    {
        Head head;
        char user_name[32];
        int status; // 注册状态
        //注册成功,默认最小权限组合
        Permission per;
        RegisterRes()
        {
            head.type = REGISTER_RES;
            head.len = sizeof(RegisterRes);
        };
    };
 
    //重置密码请求 
    struct ResetReq
    {
        Head head;
        char email[50];
        char password[32];
        ResetReq(){
            head.type = RESET_REQ;
            head.len = sizeof(ResetReq);
        }
    };
 
    //重置密码响应
    struct ResetRes
    {
        Head head;
        char user_name[32];
        int status; // 重置密码状态
        ResetRes()
        {
            head.type = RESET_RES;
            head.len = sizeof(ResetRes);
        };
    };
 
 
//权限管理
// 按员工编号、名字或职位查询人员权限信息请求
typedef struct QueryPmsRequest{
    Head head;
    char userNo[32];
    char name[32];
    char permissonType[32];
    QueryPmsRequest(){
        head.type=QUERY_PMS_REQ;
        memset(userNo,0,32);
        memset(permissonType,0,32);
        memset(name,0,32);
        head.len = sizeof(QueryPmsRequest);
    }
} QueryPmsRequest;
 
// 按角色id更新权限信息请求
typedef struct UpdatePmsRequest{
    Head head;
    int roleId;
    int queryHistory;
    int loggerSearch;
    int mapMark;
    int devManage;
    int productPlan;
    UpdatePmsRequest(){
        head.type=QUERY_PMS_RES;
        head.len = sizeof(UpdatePmsRequest);
    }
} UpdatePmsRequest;
 
// 单个人员权限结构体
typedef struct PmsRes{
    int queryHistory;
    int loggerSearch;
    int mapMark;
    int devManage;
    int productPlan;
    int roleId;
    char userNo[32];
    char name[32];
    char permissonType[32];
    char startDateTime[32];
    char endDateTime[32];
} PmsRes;
 
// 查询人员和角色信息的响应结构体
typedef struct QueryPmsResponse{
    Head head;
    int success; // 1为成功 ,0为失败
    char pmsList[0];
    QueryPmsResponse(){
        head.type=QUERY_PMS_RES;
    }
} QueryPmsResponse;
 
// 权限更新结果响应体
struct UpdatePmsResponse{
    Head head;
    int success; // 1为成功 ,0为失败
    UpdatePmsResponse(){
        head.type = UPDATE_PMS_RES;
        head.len = sizeof(UpdatePmsResponse);
    }
 
} UpdatePmsResponse ;
 
 
//设备管理
//添加设备
struct ADReq
{
    Head head;
    char Device_Name[32];
    ADReq() {
        head.type = AD_Req;
        head.len = sizeof(AD_Req);
    }
 
};
struct ADPermission
{
    char Device_Name[32];
    char Device_Status[32];
    char Manufacturer[100];
    char Devices_Type[32];
    double Longitude;
    double Latitude;
};
struct ADRes
{
    Head head;
    char Device_Name[32];
    char Device_Status[32];
    char Start_Time[32];
    char Work_Time[32];
    char Manufacturer[100];
    char Devices_Type[32];
    double Longitude;
    double Latitude;
    ADPermission per;
    ADRes() {
        head.type = AD_Res;
        head.len = sizeof(ADRes);
    }
 
};
 
//关闭设备
struct CDReq
{
    Head head;
    char Device_Name[32];
    CDReq() {
        head.type = CD_Req;
        head.len = sizeof(CDReq);
    }
};
struct CDPermission
{
    char Device_Name[32];
    char Device_Status[32];
    char Start_Time[32];
    char Work_Time[32];
    char Manufacturer[100];
    char Devices_Type[32];
    double Longitude;
    double Latitude;
};
struct CDRes
{
    Head head;
    char Device_Status[32];
    int status;
    CDPermission per;
    CDRes() {
        head.type = CD_Res;
        head.len = sizeof(CDRes);
    }
};
 
//暂停设备
struct PDReq
{
    Head head;
    char Device_Name[32];
    PDReq() {
        head.type = PD_Req;
        head.len = sizeof(PDReq);
    }
};
struct PDPermission
{
    char Device_Name[32];
    char Device_Status[32];
    char Start_Time[32];
    char Work_Time[32];
    char Manufacturer[100];
    char Devices_Type[32];
    double Longitude;
    double Latitude;
};
struct PDRes
{
    Head head;
    char Device_Status[32];
    char Work_Time[32];
    int status;
    PDPermission per;
    PDRes() {
        head.type = PD_Res;
        head.len = sizeof(PDRes);
    }
};
 
 
//地图标注
struct MapMarkReq
{
    Head head;
    int marktype;//插入、删除、加载
    MaskInfo msg[0];//柔性数组
    MapMarkReq(){
        head.type = MAPMARK_REQ;
        head.len = sizeof(MapMarkReq);
    }
};
    
//地图响应:
struct MarkInfo
{
    int markId;//标注点id
    double latitude;//纬度
    double longitude;//经度
    int deviceId;//设备ID
    int deviceStatus;//设备状态
    char deviceName[32];//设备名称
};
    
struct MapMarkRes
{
    Head head;
    int markType;//插入还是删除
    int status; // 操作状态_成功/失败
    MaskInfo info[0];//柔性数组
    MapMarkRes()
    {
        head.type = MAPMARK_RES;
        head.len = sizeof(MapMarkRes);
    };
};
 
//大屏显示
//环境数据请求
struct EnvironmentReq
{
    Head head;
    float temp;//温度
    float humidity;//湿度
    float oxygen;//氧气浓度
    float carbon;//一氧化碳浓度
        EnvironmentReq(){
        head.type = ENVIRONMENT_REQ;
        head.len = sizeof(EnvironmentReq);
    }
};
//设备状态请求
struct DeviceStatusReq
{
    Head head;
    int device_ID;//设备编号
    char device_Name[32];//设备名称
    char device_Status[32];//设备状态
        DeviceStatusReq(){
        head.type = DEVICESTATUS_REQ;
        head.len = sizeof(DeviceStatusReq);
    }
};
//操作日志请求
struct MovementRecordReq
{
    Head head;
    char user_Name;//操作用户名
    char operate_Time[32];//操作时间
    char device_Name[32];//操作设备
    char movement[256];//操作描述
        MovementRecordReq(){
        head.type = MOVEMENTRECORD_REQ;
        head.len = sizeof(MovementRecordReq);
    }
};
//警报记录请求
struct AlarmRecordReq
{
    Head head;
    char alarm_Time[32];//警报时间
    char alarm_type[32];//解决时间
    char alarm_Content[256];//警报内容
        AlarmRecordReq(){
        head.type = ALARMRECORD_REQ;
        head.len = sizeof(AlarmRecordReq);
    }
};
//煤矿产量请求
struct YieldReq
{
    Head head;
    int month;//月份
    int yield;//产量
        YieldReq(){
        head.type = YIELD_REQ;
        head.len = sizeof(YieldReq);
    }
};
 
//警报管理
// 警报请求结构体  
struct WarningReq {  
    Head head;  
    float oxygen;   // 氧气浓度  
    float carbon;   // 一氧化碳浓度  
    float temp;     // 温度  
    float humidity; // 湿度  
 
    WarningReq() {  
        head.type = WARNING_REQ;  
        head.len = sizeof(WarningReq);  
    }  
};  
 
// 警报响应结构体  
struct WarningRes {  
    Head head;  
    int status;         // 响应状态(比如 0 表示成功,1 表示失败等)  
    const char* message; // 响应消息描述  
 
    WarningRes(int stat, const char* msg) {  
        head.type = WARNING_RES;  
        head.len = sizeof(WarningRes);  
        status = stat;  
        message = msg;  
    }  
}; 
 
//生产计划管理
//添加一行数据的请求结构体
struct AddProductionPlanReq {
    Head head;
    int type;
    char productionDate[32];
    int productionQuantity;
    int plannedProductionQuantity;
    int predictedProductionQuantity;
    char logText[256];
    AddProductionPlanReq() {
        head.type = ADD_PRODUCTION_PLAN_REQ;
        head.len = sizeof(AddProductionPlanReq);
    }
};
//添加一行数据的响应结构体
struct AddProductionPlanRes {
    Head head;
    int type;
    int status; // 可以表示添加是否成功, 0 表示失败,1 表示成功
    AddProductionPlanRes() {
        head.type = ADD_PRODUCTION_PLAN_RES;
        head.len = sizeof(AddProductionPlanRes);
    }
};
 
// 更新生产计划(计划生产量)的请求结构体
struct UpdateProductionPlanQuantityReq {
    Head head;
    int type;
    int plannedProductionQuantity;
    char productionDate[32];
    UpdateProductionPlanQuantityReq() {
        head.type = UPDATE_PRODUCTION_PLAN_QUANTITY_REQ;
        head.len = sizeof(UpdateProductionPlanQuantityReq);
    }
};
// 更新生产计划(计划生产量)的响应结构体
struct UpdateProductionPlanQuantityRes {
    Head head;
    int type;
    int status; // 可以表示更新是否成功,例如 0 表示失败,1 表示成功
    UpdateProductionPlanQuantityRes() {
        head.type = UPDATE_PRODUCTION_PLAN_QUANTITY_RES;
        head.len = sizeof(UpdateProductionPlanQuantityRes);
    }
};
 
 
// 更新生产计划(日志)的请求结构体
struct UpdateProductionPlanLogReq {
    Head head;
    int type;
    char logText[256];
    char productionDate[32];
    UpdateProductionPlanLogReq() {
        head.type = UPDATE_PRODUCTION_PLAN_LOG_REQ;
        head.len = sizeof(UpdateProductionPlanLogReq);
    }
};
// 更新生产计划请求(日志)的响应结构体
struct UpdateProductionPlanLogRes {
    Head head;
    int type;
    int status; // 可以表示更新是否成功,例如 0 表示失败,1 表示成功
    UpdateProductionPlanLogRes() {
        head.type = UPDATE_PRODUCTION_PLAN_LOG_RES;
        head.len = sizeof(UpdateProductionPlanLogRes);
    }
};
 
 
 
// 查询生产计划信息请求
struct ProductionPlanReq {
    Head head;
    int type;
    int len;
    char productionDate[32];
    int productionQuantity;
    int plannedProductionQuantity;
    int predictedProductionQuantity;
    char logText[256];
    ProductionPlanReq() {
        head.type = PRODUCTION_PLAN_REQ;
        head.len = sizeof(ProductionPlanReq);
    }
};
// 查询生产计划信息的响应结构体
struct ProductionPlanRes {
    Head head;
    int type;
    int len;
    int productionQuantity;
    int plannedProductionQuantity;
    int predictedProductionQuantity;
    int roleId;
    char productionDate[32];
    char logText[256];
    ProductionPlanRes() {
        head.type = PRODUCTION_PLAN_REQ;
        head.len = sizeof(ProductionPlanRes);
    }
};
 
 
 
//查询近十四条的请求结构体
struct RecentFourteenProductionPlansReq {
    Head head;
    int requestType;
    RecentFourteenProductionPlansReq() {
        head.type = RECENTFOURTEENPRODUCTIONPLANS_REQ;
        head.len = sizeof(RecentFourteenProductionPlansReq);
    }
};
//查询近十四条的响应结构体
struct RecentFourteenProductionPlansRes {
    Head head;
    int responseType;
    int responseLength;
    int productionQuantities[14];
    int plannedProductionQuantities[14];
    int predictedProductionQuantities[14];
    int roleIds[14];
    char productionDates[14][32];
    char logTexts[14][256];
    RecentFourteenProductionPlansRes() {
        head.type = UPDATE_PRODUCTION_PLAN_QUANTITY_REQ;
        head.len = sizeof(RecentFourteenProductionPlansRes);
    }
};
 
 
 
//历史查询分析
// 历史查询请求结构体
struct HistoryQueryReq {
    Head head;
    //根据时间范围查询
    char start_time[32];
    char end_time[32];
 
    HistoryQueryReq() {
        // 初始化数据头
        head.type = HISTORY_QUERY_REQ;
        head.len = sizeof(HistoryQueryReq);
        // 初始化查询条件字段
        std::memset(start_time, 0, sizeof(start_time));
        std::memset(end_time, 0, sizeof(end_time));
    }
};
 
// 系统运行状态表相关信息
struct Histroy_Info{
        int sysId;  // 对应系统运行状态表的记录编号
        char sysDataCollectionTime[50];  // 数据采集时间
        char sysDeviceType[50];  // 设备类型
        char sysDeviceId[50];  // 设备编号
        char sysDeviceStatus[50];  // 设备状态
        char sysSystemStatus[50];  // 系统整体运行状态描述
 
        int devId;  // 对应设备详细信息表的记录编号
        char devDeviceType[50];  // 设备类型(与系统运行状态表中的设备类型对应,可用于关联)
        char devDeviceId[50];  // 设备编号(与系统运行状态表中的设备编号对应,可用于关联)
        char devModel[50];  // 设备型号
        char runDeviceStatus[50];  // 设备状态
        char runFaultAlarmTime[50];  // 故障报警时间
        char runFaultDescription[50];  // 故障详细描述
 
        int safetyId;  // 对应设备安全状态表的记录编号
        char safetyDataCollectionTime[50];  // 数据采集时间(可用于关联不同表在同一时间点的数据情况)
        char safetyDeviceType[50];  // 设备类型(用于关联)
        char safetyDeviceId[50];  // 设备编号(用于关联)
        char safetyStatus[50];  // 设备安全状态
        char safetyParameter[50];  // 安全参数
};
// 历史查询响应结构体
// 安全状态表相关信息
struct HistoryQueryRes {
    Head head;
    Histroy_Info sys[0];
 
    HistoryQueryRes() {
        // 初始化数据头
        head.type = HISTORY_QUERY_RES;
        head.len = sizeof(HistoryQueryRes);
    }
    
};
 
//自动升级
struct VersionNumReq        // 版本号请求
{
    Head head;
    VersionNumReq() {
        head.type = VERSIONNUM_REQ;
        head.len = sizeof(VersionNumReq);
    }
};
 
struct VersionNumRes        // 版本号响应
{
    Head head;
    char version_id[64]; // 版本号
    VersionNumRes() {
        head.type = VERSIONNUM_RES;
        head.len = sizeof(VersionNumRes);
    }
};
 
// 文件传输
struct FileInfo
{
    char file_name[256];
    long long file_size;
    char s_filepath[128];
    char content[0];
};
 
struct UploadFileReq        // 上传文件的请求
{
    Head head;
    FileInfo fileInfo;
    UploadFileReq() {
        head.type = UPLOAD_FILE_REQ;
        head.len = sizeof(UploadFileReq);
    }
};
 
struct UploadFileRes {      // 上传文件的响应
    Head head;
    bool state = false;
    char file_name[256];
    long long file_size;
    UploadFileRes()
    {
        head.type = UPLOAD_FILE_RES;
        head.len = sizeof(UploadFileRes);
    }
};
 
// 版本信息录入
// 请求
struct VersionInfoEntryReq {
    Head head;
    char version_id[64]; // 版本号
    char version_id_old[64]; // 上一个版本号
    char s_filepath[16][128];    //服务器放最新版本的路径
    char version_description[256]; //更新内容
    char version_creattime[32]; // 更新时间
    char filename[16][128];
    long long filesize[16];
    char c_filepath[16][128];
    int fileNum;
 
    VersionInfoEntryReq()
    {
        head.type = VERSIONINFOENTRY_REQ;
        head.len = sizeof(VersionInfoEntryReq);
    }
};
 
// 版本信息录入响应
struct VersionInfoEntryRes {
    Head head;
    bool state = false;
    VersionInfoEntryRes()
    {
        head.type = VERSIONINFOENTRY_RES;
        head.len = sizeof(VersionInfoEntryRes);
    }
};
 
// 版本更新请求
struct VersionUpdateReq {
    Head head;
 
    char cur_version_id[64]; // 版本号
    VersionUpdateReq()
    {
        head.type = VERSIONUPDATE_REQ;
        head.len = sizeof(VersionUpdateReq);
    }
};
 
// 版本更新响应
struct VersionUpdateRes {
    Head head;
    bool state = false;
    char version_id[64]; // 版本号
    char update_date[32]; // 更新时间
    char version_description[1024]; //更新描述
 
    VersionUpdateRes()
    {
        head.type = VERSIONUPDATE_RES;
        head.len = sizeof(VersionUpdateRes);
    }
};
 
// 版本更新文件下载请求
struct FileDownloadsReq {
    Head head;
    char version_id[64]; // 版本号
    FileDownloadsReq()
    {
        head.type = FILEDOWNLOADS_REQ;
        head.len = sizeof(FileDownloadsReq);
    }
};
 
// 版本更新文件下载响应
struct FileDownloadsRes {
    Head head;
    char version_id[64]; // 版本号
    char filename[128]; //文件名
    long long filesize; //文件大小
    char c_filepath[128];    //客户端放最新版本的本地路径
    int fileNum; // 文件数量
    long long all_fileSize; // 文件总大小
    char content[0];
    FileDownloadsRes()
    {
        head.type = FILEDOWNLOADS_RES;
        head.len = sizeof(FileDownloadsRes);
    }
};
 
// 更新文件下载成功的响应
struct DownloadSuccessfullyRes{
    Head head;
    bool state = false;
    char file_name[256];
    long long file_size;
    DownloadSuccessfullyRes()
    {
        head.type = DOWNLOADSUCCESSFULLY_RES;
        head.len = sizeof(DownloadSuccessfullyRes);
    }
};
 
<<<<<<< HEAD
//日志查询
 
enum Typeinfo{
    LOGSEARCH_REQ,//日志查询请求
    LOGSEARCH_RES,//日志查询响应
 
};
 
struct Head
{
    int type;   // 功能类型
    int len;    //封包长度
 
};
// 日志查询请求结构体
struct LogQueryReq {
    Head heade;                 // 数据头
    char keyWords[0];            // 存储多个关键字的柔性数组
=======
//日志
struct ParsedLog { 
    char timestamp[64]; // 时间戳
    char device_id[64]; // 设备ID
    char level[16];     // 日志级别
    char content[256];  // 日志内容
    char source[64];    // 来源模块
    char user_id[64];   // 用户ID
};
 
// 日志查询请求结构体
struct LogQueryReq {
    Head head;                 // 数据头
    char keyWords[32];            // 存储关键字的数组
>>>>>>> bb11cc624ab058fc3a6541f91f37985b8caae9b6
    // 无参构造函数
    LogQueryReq() {
        head.type = LOGSEARCH_REQ;
        head.len = sizeof(LogQueryReq);
    }
};
 
// 日志查询响应结构体
struct LogQueryRes {
<<<<<<< HEAD
    Head heade;  
=======
    Head head;  
>>>>>>> bb11cc624ab058fc3a6541f91f37985b8caae9b6
    int status;                    // 响应状态 (如 0 表示成功,非 0 表示失败)
    char errorMessage[256];        // 错误信息(如果有)
    
    // 无参构造函数
    LogQueryRes() {
        head.type = LOGSEARCH_RES;
<<<<<<< HEAD
        head.len = sizeof(LogQueryRes);
=======
        head.len = sizeof(LogQueryRes);
>>>>>>> bb11cc624ab058fc3a6541f91f37985b8caae9b6
    }
};
 
 
 
 
#endif // COMMON_H