派生自 development/c++

pansen
2018-12-17 7d797b1a5786a8d4ca3aafe2484c75ad15ba9d8f
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
#ifndef HTTP_CONFIGSERVER_H
#define HTTP_CONFIGSERVER_H
 
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
 
#include "opencv2/opencv.hpp"
#include <string>
#include "HttpSrvRetRecieve.hpp"
#include "LDBTool.h"
#include <ErlangDbTool.h>
#include <basic/util/BASE64/Base64.h>
#include <basic/util/opencv/CvUtil.h>
#include <sys/sem.h>
 
#include <LocalDBTool/SqliteFaceEncap.h>
#include <CurlDownloadImg.hpp>
#include <basic/util/fastdfs/FastFds.hpp>
#include <atomic>
#include "../FaceSearchServer/CasiaFaceWrapper/CasiaFaceWrapperN.h"
#include "AppPipeController.h"
 
typedef std::shared_ptr<HttpServer::Response> PResponse;
 
 
struct srsPipeController_s {
    AppPipeController *appPC;
    std::atomic<int> userCounter;
};
 
class devHttpServer_c {
public:
    devHttpServer_c();
 
    devHttpServer_c(std::string test);
 
    devHttpServer_c(std::string ip, int port, int pthNum);
 
    ~devHttpServer_c();
 
//private:
    std::string dev_edit(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string dev_show(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string devchn_show(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string devchn_edit(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string dev_search_chns(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string chk_chn_connet(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string cam_edit(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string cam_show(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string chk_cam_connet(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string chk_cam_disconnet(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string dev_del(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string cam_del(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string server_info_edit(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string server_info_show(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string cut_dura_edit(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string cut_dura_show(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string netconfig_edit(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string netconfig_show(std::string ip, unsigned int port, std::string content, PResponse &response);
 
 
    std::string addNode(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string searchNode(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string modifyCluName(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string removeNode(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string createDatabase(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string deleteDatabase(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string updateDatabase(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string findAllDatabase(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string findLocalDatabase(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string addPerson(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string addPersons(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string personIsExists(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string updatePersonByOldId(std::string ip, unsigned int port, std::string content, PResponse &response);
 
 
    std::string delPerson(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string loadFaceFeaData(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string getAlarmImageFromVideoFile(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string getRecordVideoPath(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string findDevId(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string editDevName(std::string ip, unsigned int port, std::string content, PResponse &response);
 
    std::string editDevId(std::string ip, unsigned int port, std::string content, PResponse &response);
 
private:
    void init(void);
 
private:
 
    HttpSrvRetRecieve _HttpSrvRetRecieve;
    LDBTool db_c;
    std::string m_cluster_id;
    std::string m_cluster_name;
    std::map<std::string, srsPipeController_s> m_rtmp;
 
 
    ErlangTool::ErlangDbTool *erlangDbTool;
    SqliteFaceEncap m_SqliteFaceEncap;
 
//    ErlangDbTool *erlangDbTool;
    std::map<std::thread::id, CasiaFaceWrapperN *> m_handleMap;
    CvUtil cvutil;
    Base64 base64;
    std::string m_batch;
    std::string m_SerialNumber;
 
    CurlDownloadImg m_curlDownloadImg;
 
    FastFdsWithLock fdfsClient;
 
    bool getDevSerialNumber(const char *ip, const int port, const char *username, \
                            const char *passwd, const char *brand, unsigned char *serialNumber) const;
 
    bool getDevChnList(const char *ip, const int port, const char *username, const char *passwd, \
                                        const char *brand, std::vector<int> &lvecUsefulChans) const;
 
    bool loadCurrentVideo(const char *ip, const int port, const char *username, const char *passwd, \
                                        const char *brand, const int chn, std::string &videopath) const;
 
    bool cam_connect_video_start(std::string ip, int port, std::string username, std::string passwd, \
                                        std::string brand) const;
 
    bool cam_connect_video_stop(std::string ip) const;
 
    void runAllApp() const;
 
    void killFaceSearchServerApp() const;
 
    void killVideoAnalysFromHCApp() const;
 
    bool getUVDevSerialNumber(const char *ip, const char *username, const char *passwd,
                              unsigned char *serialNumber = NULL) const;
 
    bool getHKDevSerialNumber(const char *ip, const int port, const char *username, const char *passwd,
                              unsigned char *serialNumber = NULL) const;
    bool createDevId(const  int& dev_batch, const  int& dev_sequence) ;
 
    std::string getVideoPathByTime(const std::string& time,const std::string& camId,qint64& sub);
 
    std::vector<std::string> forEachFile(const std::string &dir_name);
};
 
#endif