init QiaojiaoSystem Code (svn version is r3340)
| New file |
| | |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(QiaoJiaSystem) |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build) |
| | | |
| | | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") |
| | | set(CMAKE_BUILD_TYPE debug) |
| | | add_definitions(-fpermissive) |
| | | |
| | | include_directories( |
| | | ./ |
| | | ../BasicPlatForm/ |
| | | ../BasicPlatForm/libs/jsoncpp/include |
| | | ../BasicPlatForm/libs/opencv/include |
| | | ../BasicPlatForm/libs/libuuid/include |
| | | ) |
| | | |
| | | add_subdirectory(StructureApp) |
| | | add_subdirectory(FaceDetectServer) |
| | | #add_subdirectory(YoloServer) |
| | | add_subdirectory(FaceSearchServer) |
| | | add_subdirectory(VideoAnalysFromHC) |
| | | add_subdirectory(RapidStructureApp) |
| | | add_subdirectory(RecordVideo) |
| | | add_subdirectory(DataManagerServer) |
| | | |
| | | |
| | | #add_subdirectory(FaceSearchDbWithImg) |
| | | |
| New file |
| | |
| | | #include "AppPipeController.h" |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/util/app/AppUtil.h> |
| | | //#include <sstream> |
| | | #include <algorithm> |
| | | AppPipeController::AppPipeController(int index, const Json::Value &json): |
| | | videoCaptureElement(json["rtsp"].asString(), 25,3000,appPref.getLongData("gpu.index")), |
| | | index(index), videoPublishElement(appPref.getStringData("publish.basepath")+".flv", |
| | | cv::Size(appPref.getIntData("pulish.width"),appPref.getIntData("pulish.height")), |
| | | "flv", 25, appPref.getLongData("gpu.index")) |
| | | { |
| | | videoCaptureElement.registerConnector([&]{ |
| | | //if(!videoPublishElement.isBusy()){ |
| | | videoPublishElement.setImage(videoCaptureElement.getImage()); |
| | | //videoPublishElement.submit(); |
| | | //} |
| | | |
| | | }); |
| | | |
| | | registerElement(videoCaptureElement); |
| | | registerElement(videoPublishElement); |
| | | |
| | | videoCaptureElement.setOutPutInterval(3); |
| | | } |
| | | |
| | | std::string AppPipeController::getRtmp() |
| | | { |
| | | std::string ret = videoPublishElement.getPath(); |
| | | size_t pos = ret.find(".flv"); |
| | | ret = ret.substr(0,pos); |
| | | INFO(ret); |
| | | return ret; |
| | | } |
| New file |
| | |
| | | #ifndef APPPIPECONTROLLER_H |
| | | #define APPPIPECONTROLLER_H |
| | | #include <basic/pipe/PipeController.h> |
| | | #include <basic/pipe_element/ffmpeg/FfmpegElement.h> |
| | | #include <jsoncpp/json/json.h> |
| | | |
| | | class AppPipeController : public PipeController |
| | | { |
| | | public: |
| | | AppPipeController(int index, const Json::Value& json); |
| | | std::string getRtmp(); |
| | | private: |
| | | ffmpeg::VideoCaptureElement videoCaptureElement; |
| | | ffmpeg::VideoPublishElement videoPublishElement; |
| | | int index; |
| | | }; |
| | | |
| | | #endif // APPPIPECONTROLLER_H |
| New file |
| | |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(DataWebServer) |
| | | |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build) |
| | | |
| | | set(CMAKE_CXX_STANDARD 11) |
| | | add_compile_options(-fPIC) |
| | | add_definitions(-DDEBUG_ERR -DDEBUG_INFO -fpermissive) |
| | | add_definitions(-DGLOG) |
| | | set(CMAKE_BUILD_TYPE debug) |
| | | |
| | | include_directories( |
| | | ./ |
| | | ../FaceSearchServer/CasiaFaceWrapper |
| | | ../VideoServer/QiaoJia/DB |
| | | |
| | | # |
| | | ../LocalDBTool/ |
| | | ../../BasicPlatForm/basic/db/sqlite/ |
| | | ../../BasicPlatForm/basic/db/sqlite/sqlite-v-3220000/ |
| | | |
| | | ../../BasicPlatForm |
| | | ../../BasicPlatForm/libs/opencv/include |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/include |
| | | ../../BasicPlatForm/libs/Casia_Face/FaceSdk/include |
| | | ../../BasicPlatForm/libs/jsoncpp/include |
| | | ../../BasicPlatForm/libs/crul/include |
| | | ../../BasicPlatForm/libs/FastDFS/include |
| | | ../../BasicPlatForm/libs/FastDFS/include/fastdfs |
| | | ../../BasicPlatForm/libs/FastDFS/include/fastcommon |
| | | ../../BasicPlatForm/libs/ffmpeg/include |
| | | |
| | | ../../BasicPlatForm/basic/util/fastdfs/ |
| | | ../../BasicPlatForm/basic/util/curl/ |
| | | ../../BasicPlatForm/basic/http_server/ |
| | | ../../BasicPlatForm/libs/libuuid/include |
| | | ../../BasicPlatForm/libs/uniview/include |
| | | |
| | | ../../../Erlang/syncDBTool |
| | | |
| | | ../../BasicPlatForm/libs/hcTool/HCNetSDK64/incCn |
| | | |
| | | ../../BasicPlatForm/libs/libboost/include |
| | | |
| | | /usr/include/x86_64-linux-gnu/qt5 |
| | | /usr/include/x86_64-linux-gnu/qt5/QtCore/ |
| | | /usr/include/x86_64-linux-gnu/qt5/QtSql/ |
| | | |
| | | |
| | | #glog |
| | | ../../BasicPlatForm/libs/glog/include |
| | | |
| | | ) |
| | | |
| | | link_directories( |
| | | #glog |
| | | ../../BasicPlatForm/libs/glog/lib |
| | | |
| | | /usr/lib/erlang/lib/erl_interface-3.8.2/lib/ |
| | | /usr/local/cuda/lib64 |
| | | |
| | | ../../BasicPlatForm/libs/opencv/lib |
| | | ../../BasicPlatForm/libs/Casia_Face/FaceSdk/lib/cpu |
| | | ../../BasicPlatForm/libs/crul/lib |
| | | ../../BasicPlatForm/libs/FastDFS/lib |
| | | ../../BasicPlatForm/libs/jsoncpp/lib |
| | | ../../BasicPlatForm/libs/ffmpeg/lib |
| | | ../../BasicPlatForm/libs/libuuid/lib |
| | | |
| | | ../../BasicPlatForm/libs/hcTool/HCNetSDK64/lib/ |
| | | ../../BasicPlatForm/libs/hcTool/HCNetSDK64/lib/HCNetSDKCom/ |
| | | ../../BasicPlatForm/libs/uniview/lib |
| | | |
| | | ../../BasicPlatForm/libs/libboost/lib |
| | | |
| | | |
| | | ../../BasicPlatForm/basic/db/sqlite/ |
| | | ../../BasicPlatForm/basic/db/sqlite/sqlite-v-3220000 |
| | | ) |
| | | |
| | | add_executable(DataWebServer |
| | | main.cpp |
| | | http_configserver.cpp |
| | | http_configserver.h |
| | | |
| | | ./net_config/net_config.cpp |
| | | ./net_config/net_config.h |
| | | ../VideoServer/QiaoJia/DB/LDBTool.cpp |
| | | ./AppPipeController.cpp |
| | | ./AppPipeController.h |
| | | |
| | | ../../BasicPlatForm/basic/util/opencv/CvUtil.cpp |
| | | ../../BasicPlatForm/basic/util/BASE64/Base64.cpp |
| | | ../../BasicPlatForm/basic/util/fastdfs/FastdfsClient.cpp |
| | | ../FaceSearchServer/CasiaFaceWrapper/CasiaFaceWrapperN.cpp |
| | | ../FaceSearchServer/CasiaFaceWrapper/CasiaFaceWrapperN.h |
| | | ../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp |
| | | ../../BasicPlatForm/basic/pipe_element/ffmpeg/VideoChangeScore.cpp |
| | | |
| | | |
| | | ../../../Erlang/syncDBTool/ErlangDbTool.cpp |
| | | # |
| | | ../LocalDBTool/GetUUId.cpp |
| | | ../LocalDBTool/SqliteFaceEncap.cpp |
| | | ../../BasicPlatForm/basic/db/sqlite/sqliteEncapsulation.cpp |
| | | ../../BasicPlatForm/basic/db/sqlite/sqliteEncapsulation.h |
| | | ) |
| | | |
| | | target_link_libraries(DataWebServer |
| | | glog |
| | | boost_system |
| | | boost_thread |
| | | boost_filesystem |
| | | ei |
| | | erl_interface_st |
| | | ei_st |
| | | erl_interface |
| | | uuid |
| | | rt |
| | | avformat |
| | | avcodec |
| | | swresample |
| | | swscale |
| | | avutil |
| | | bz2 dl z |
| | | |
| | | opencv_world |
| | | THFaceImage |
| | | THFeature |
| | | THFaceProperty |
| | | |
| | | curl |
| | | fastcommon |
| | | fdfsclient |
| | | |
| | | Qt5Core |
| | | Qt5Sql |
| | | sqlite3 |
| | | |
| | | jsoncpp |
| | | |
| | | imos_mw_sdk |
| | | mw_sdk_player |
| | | mw_sdk_ipc |
| | | mw_sdk_bp |
| | | mw_sdk_rm |
| | | |
| | | HCCore |
| | | hcnetsdk |
| | | pthread |
| | | ) |
| | | |
| | | #add_executable(Apptest |
| | | # demo.cpp |
| | | # ./AppPipeController.cpp |
| | | # ./AppPipeController.h |
| | | # |
| | | # ../../BasicPlatForm/basic/util/opencv/CvUtil.cpp |
| | | # ../../BasicPlatForm/basic/util/BASE64/Base64.cpp |
| | | # ../../BasicPlatForm/basic/util/fastdfs/FastdfsClient.cpp |
| | | # ../FaceSearchServer/CasiaFaceWrapper/CasiaFaceWrapperN.cpp |
| | | # ../FaceSearchServer/CasiaFaceWrapper/CasiaFaceWrapperN.h |
| | | # ../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp |
| | | # ../../BasicPlatForm/basic/pipe_element/ffmpeg/VideoChangeScore.cpp |
| | | # ) |
| | | # |
| | | #target_link_libraries(Apptest |
| | | # boost_system |
| | | # boost_thread |
| | | # boost_filesystem |
| | | # ei |
| | | # erl_interface_st |
| | | # ei_st |
| | | # erl_interface |
| | | # # uuid |
| | | # rt |
| | | # pthread |
| | | # avformat |
| | | # avcodec |
| | | # swresample |
| | | # swscale |
| | | # avutil |
| | | # bz2 dl z |
| | | # |
| | | # opencv_world |
| | | # THFaceImage |
| | | # THFeature |
| | | # THFaceProperty |
| | | # |
| | | # curl |
| | | # fastcommon |
| | | # fdfsclient |
| | | # |
| | | # Qt5Core |
| | | # Qt5Sql |
| | | # |
| | | # jsoncpp |
| | | # |
| | | # HCCore |
| | | # hcnetsdk |
| | | # ) |
| | | |
| New file |
| | |
| | | #ifndef HTTPSRVRETRECIEVE_H_XZL_201808171114 |
| | | #define HTTPSRVRETRECIEVE_H_XZL_201808171114 |
| | | |
| | | #include "client_http.hpp" |
| | | #include "server_http.hpp" |
| | | |
| | | // Added for the json-example |
| | | #define BOOST_SPIRIT_THREADSAFE |
| | | #include <boost/property_tree/json_parser.hpp> |
| | | #include <boost/property_tree/ptree.hpp> |
| | | |
| | | // Added for the default_resource example |
| | | #include <algorithm> |
| | | #include <boost/filesystem.hpp> |
| | | #include <fstream> |
| | | #include <vector> |
| | | #include <basic/debug/Debug.h> |
| | | |
| | | #ifdef HAVE_OPENSSL |
| | | #include "crypto.hpp" |
| | | #endif |
| | | |
| | | using HttpServer = SimpleWeb::Server<SimpleWeb::HTTP>; |
| | | using HttpClient = SimpleWeb::Client<SimpleWeb::HTTP>; |
| | | class HttpSrvRetRecieve |
| | | { |
| | | using TASK_FUNCTION = std::function<std::string(std::string,unsigned short,std::string,std::shared_ptr<HttpServer::Response>&)>; |
| | | using OTHER_FUNCTION = std::function<void(int)>; |
| | | public: |
| | | HttpSrvRetRecieve(const std::string& ip,const unsigned short port,const std::size_t& threadPoolSize) |
| | | :m_TASK_FUNCTION(nullptr) |
| | | { |
| | | m_server.config.address = ip; |
| | | m_server.config.port = port; |
| | | m_server.config.thread_pool_size = threadPoolSize; |
| | | } |
| | | |
| | | int setInfo(const std::string& strInfo,const std::string& strType,TASK_FUNCTION f) |
| | | { |
| | | m_map_TASKFUNC[strInfo.substr(1,(strInfo.size()-2))] = f; |
| | | m_server.resource[strInfo][strType] = [this](std::shared_ptr<HttpServer::Response> response, std::shared_ptr<HttpServer::Request> request) |
| | | { |
| | | std::string strInfo = request->path; |
| | | auto func = m_map_TASKFUNC[strInfo]; |
| | | if(func != nullptr){ |
| | | std::string strRet = func(request->remote_endpoint_address(),request->remote_endpoint_port(),request->content.string(),response); |
| | | if(strRet.size() > 0){ |
| | | DBG("strRet.size() > 0"); |
| | | response->write(strRet); |
| | | } else{ |
| | | ERR("strRet.size() <= 0"); |
| | | } |
| | | }else{ |
| | | std::cout << " func == nullptr " << std::endl; |
| | | } |
| | | }; |
| | | m_server.on_error = [](std::shared_ptr<HttpServer::Request> /*request*/, const SimpleWeb::error_code & /*ec*/) |
| | | {}; |
| | | } |
| | | |
| | | int start() |
| | | { |
| | | m_server_thread = std::make_shared<std::thread>([&]() { |
| | | // Start server |
| | | m_server.start(); |
| | | }); |
| | | return 0; |
| | | } |
| | | int waitForShutDown() |
| | | { |
| | | m_server_thread->join(); |
| | | } |
| | | |
| | | private: |
| | | HttpServer m_server; |
| | | TASK_FUNCTION m_TASK_FUNCTION; |
| | | std::map<std::string,TASK_FUNCTION> m_map_TASKFUNC; |
| | | std::shared_ptr<std::thread> m_server_thread; |
| | | }; |
| | | #endif |
| New file |
| | |
| | | // |
| | | // Created by ps on 18-9-18. |
| | | // |
| | | |
| | | #include <AppPipeController.h> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | |
| | | |
| | | int main() { |
| | | Json::Value json; |
| | | json["rtsp"] = "rtsp://admin:a1234567@192.168.1.201:554/h264/ch1/main/av_stream"; |
| | | |
| | | std::string publish_basepath = "rtmp://localhost:1934/live/cam" + std::to_string(554); |
| | | appPref.setLongData("gpu.index", 0); |
| | | appPref.setStringData("publish.basepath", publish_basepath); |
| | | appPref.setIntData("pulish.width", 640); |
| | | appPref.setIntData("pulish.height", 360); |
| | | |
| | | AppPipeController a(0, json); |
| | | a.start(); |
| | | |
| | | getchar(); |
| | | |
| | | a.stop(); |
| | | a.wait(); |
| | | |
| | | return 0; |
| | | } |
| New file |
| | |
| | | #include <iostream> |
| | | #include <VideoServer/QiaoJia/DB/DBStruct.h> |
| | | #include <jsoncpp/json/json.h> |
| | | #include "http_configserver.h" |
| | | #include <QString> |
| | | #include <basic/util/app/AppConfig.h> |
| | | #include "net_config/net_config.h" |
| | | #include "HCNetSDK.h" |
| | | #include "univiewDriver.h" |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include "HttpRequestWithCrul.hpp" |
| | | |
| | | #include <stdio.h> |
| | | #include <stdlib.h> |
| | | #include <sys/types.h> |
| | | #include <sys/stat.h> |
| | | |
| | | #include <GetUUId.h> |
| | | |
| | | #include <uuid/uuid.h> |
| | | //#include "HcRecord.h" |
| | | #include <time.h> |
| | | #include <dirent.h> |
| | | using namespace std; |
| | | |
| | | devHttpServer_c::devHttpServer_c() |
| | | : _HttpSrvRetRecieve("0.0.0.0", 8083, 1), erlangDbTool(nullptr), m_SqliteFaceEncap("LocalDataDB") { |
| | | init(); |
| | | } |
| | | |
| | | devHttpServer_c::devHttpServer_c(std::string test) |
| | | : _HttpSrvRetRecieve("0.0.0.0", 8083, 1), erlangDbTool(nullptr), m_SqliteFaceEncap("LocalDataDB") { |
| | | |
| | | fdfsClient.rwLock.wrlock(); |
| | | fdfsClient.fastFds = new FastFds("WebFDSClient.conf"); |
| | | fdfsClient.rwLock.unlock(); |
| | | } |
| | | |
| | | |
| | | devHttpServer_c::devHttpServer_c(std::string ip, int port, int pthNum) |
| | | : _HttpSrvRetRecieve(ip, port, pthNum), erlangDbTool(nullptr), m_SqliteFaceEncap("LocalDataDB") { |
| | | |
| | | auto erlNode = appConfig.getStringProperty("erlNode"); |
| | | auto erlCookie = appConfig.getStringProperty("erlCookie"); |
| | | auto erlPath = appConfig.getStringProperty("erlPath"); |
| | | auto erlFatherNode = appConfig.getStringProperty("erlFatherNode"); |
| | | if (erlNode.size() > 0 && erlCookie.size() > 0) { |
| | | string str_tmp = "DataWebserver"; |
| | | erlangDbTool = new ErlangTool::ErlangDbTool(erlPath, erlNode, erlCookie, str_tmp); |
| | | if (erlangDbTool->initErlang() == 1) { |
| | | erlangDbTool->startNodeDb(erlFatherNode); |
| | | } else { |
| | | DBG("not is startNodeDb"); |
| | | } |
| | | } |
| | | init(); |
| | | } |
| | | |
| | | devHttpServer_c::~devHttpServer_c() { |
| | | |
| | | } |
| | | |
| | | |
| | | void devHttpServer_c::init(void) { |
| | | |
| | | std::string strDevId = appConfig.getStringProperty("DEV_ID"); |
| | | // DSVAD010120181119 |
| | | m_batch = strDevId.substr(5, 2); |
| | | m_SerialNumber = strDevId.substr(7, 2); |
| | | |
| | | |
| | | fdfsClient.rwLock.wrlock(); |
| | | fdfsClient.fastFds = new FastFds("WebFDSClient.conf"); |
| | | fdfsClient.rwLock.unlock(); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/dev_show$", "POST", std::bind(&devHttpServer_c::dev_show, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/dev_edit$", "POST", std::bind(&devHttpServer_c::dev_edit, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/devchn_show$", "POST", std::bind(&devHttpServer_c::devchn_show, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/devchn_edit$", "POST", std::bind(&devHttpServer_c::devchn_edit, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/dev_search_chns$", "POST", std::bind(&devHttpServer_c::dev_search_chns, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/chk_chn_connet$", "POST", std::bind(&devHttpServer_c::chk_chn_connet, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/cam_edit$", "POST", std::bind(&devHttpServer_c::cam_edit, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/cam_show$", "POST", std::bind(&devHttpServer_c::cam_show, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/chk_cam_connet$", "POST", std::bind(&devHttpServer_c::chk_cam_connet, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/chk_cam_disconnet$", "POST", std::bind(&devHttpServer_c::chk_cam_disconnet, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/dev_del$", "POST", std::bind(&devHttpServer_c::dev_del, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/cam_del$", "POST", std::bind(&devHttpServer_c::cam_del, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/server_info_edit$", "POST", std::bind(&devHttpServer_c::server_info_edit, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/server_info_show$", "POST", std::bind(&devHttpServer_c::server_info_show, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/cut_dura_edit$", "POST", std::bind(&devHttpServer_c::cut_dura_edit, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/cut_dura_show$", "POST", std::bind(&devHttpServer_c::cut_dura_show, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | //#data modifyCluName |
| | | _HttpSrvRetRecieve.setInfo("^/addNode$", "POST", std::bind(&devHttpServer_c::addNode, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/searchNode$", "POST", std::bind(&devHttpServer_c::searchNode, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | _HttpSrvRetRecieve.setInfo("^/modifyCluName$", "POST", std::bind(&devHttpServer_c::modifyCluName, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | _HttpSrvRetRecieve.setInfo("^/removeNode$", "POST", std::bind(&devHttpServer_c::removeNode, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/createDatabase$", "POST", std::bind(&devHttpServer_c::createDatabase, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/deleteDatabase$", "POST", std::bind(&devHttpServer_c::deleteDatabase, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | _HttpSrvRetRecieve.setInfo("^/updateDatabase$", "POST", std::bind(&devHttpServer_c::updateDatabase, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/findAllDatabase$", "POST", std::bind(&devHttpServer_c::findAllDatabase, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/findLocalDatabase$", "POST", std::bind(&devHttpServer_c::findLocalDatabase, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/addPerson$", "POST", std::bind(&devHttpServer_c::addPerson, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/addPersons$", "POST", std::bind(&devHttpServer_c::addPersons, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/personIsExists$", "POST", std::bind(&devHttpServer_c::personIsExists, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/updatePersonByOldId$", "POST", std::bind(&devHttpServer_c::updatePersonByOldId, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, |
| | | std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/delPerson$", "POST", std::bind(&devHttpServer_c::delPerson, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/loadFaceFeaData$", "POST", std::bind(&devHttpServer_c::loadFaceFeaData, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/netconfig_edit$", "POST", std::bind(&devHttpServer_c::netconfig_edit, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/netconfig_show$", "POST", std::bind(&devHttpServer_c::netconfig_show, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/getAlarmImageFromVideoFile$", "POST", |
| | | std::bind(&devHttpServer_c::getAlarmImageFromVideoFile, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | _HttpSrvRetRecieve.setInfo("^/getRecordVideoPath$", "POST", |
| | | std::bind(&devHttpServer_c::getRecordVideoPath, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/findDevId$", "POST", |
| | | std::bind(&devHttpServer_c::findDevId, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | _HttpSrvRetRecieve.setInfo("^/editDevName$", "POST", |
| | | std::bind(&devHttpServer_c::editDevName, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | _HttpSrvRetRecieve.setInfo("^/editDevId$", "POST", |
| | | std::bind(&devHttpServer_c::editDevId, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | _HttpSrvRetRecieve.start(); |
| | | _HttpSrvRetRecieve.waitForShutDown(); |
| | | } |
| | | |
| | | |
| | | //æ¾ç¤ºç£çéµå |
| | | std::string devHttpServer_c::dev_show(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Value value; |
| | | Json::Value elem; |
| | | bool ret = false; |
| | | |
| | | std::list<Record_Storage_Dev> rec_list = db_c.searchDeviceTableAll(); |
| | | |
| | | list<Record_Storage_Dev>::iterator iter; |
| | | |
| | | for (iter = rec_list.begin(); iter != rec_list.end(); ++iter) { |
| | | elem["str_storage_dev_id"] = iter->str_storage_dev_id.toStdString(); |
| | | elem["str_dev_name"] = iter->str_dev_name.toStdString(); |
| | | elem["str_addr"] = iter->str_addr.toStdString(); |
| | | elem["str_longitude"] = iter->str_longitude.toStdString(); |
| | | elem["str_latitude"] = iter->str_latitude.toStdString(); |
| | | elem["str_ip"] = iter->str_ip.toStdString(); |
| | | elem["n_port"] = iter->n_port; |
| | | elem["str_username"] = iter->str_username.toStdString(); |
| | | elem["str_password"] = iter->str_password.toStdString(); |
| | | elem["tim_start_time"] = iter->tim_start_time.toString("yyyy-MM-dd hh:mm:ss").toStdString(); |
| | | elem["n_duration"] = iter->n_duration; |
| | | elem["str_brand"] = iter->str_brand.toStdString(); |
| | | elem["str_reserved"] = iter->str_reserved.toStdString(); |
| | | cout << elem.toStyledString() << endl; |
| | | value.append(elem); |
| | | } |
| | | cout << value.toStyledString() << endl; |
| | | // std::string out = value.toStyledString(); |
| | | std::string out = value.size() > 0 ? value.toStyledString() : "[]"; |
| | | |
| | | return out; |
| | | } |
| | | |
| | | //************************************ |
| | | // Method: string_replace |
| | | // FullName: string_replace |
| | | // Access: public |
| | | // Returns: void |
| | | // Qualifier: æå符串çstrsrcæ¿æ¢æstrdst |
| | | // Parameter: std::string & strBig |
| | | // Parameter: const std::string & strsrc |
| | | // Parameter: const std::string & strdst |
| | | //************************************ |
| | | static void string_replace(std::string &strBig, const std::string &strsrc, const std::string &strdst) { |
| | | std::string::size_type pos = 0; |
| | | std::string::size_type srclen = strsrc.size(); |
| | | std::string::size_type dstlen = strdst.size(); |
| | | |
| | | while ((pos = strBig.find(strsrc, pos)) != std::string::npos) { |
| | | strBig.replace(pos, srclen, strdst); |
| | | pos += dstlen; |
| | | } |
| | | } |
| | | |
| | | static std::string rtspAddrBuild(std::string ip, const int port, std::string username, |
| | | std::string passwd, std::string brand) { |
| | | std::string rtsp_url; |
| | | if (brand == "haikang") { |
| | | rtsp_url = "rtsp://" + username + ":" + passwd + "@" + ip + ":" + std::to_string(port) + |
| | | "/h264/ch1/main/av_stream"; |
| | | } else if (brand == "dahua") { |
| | | //rtsp://username:password@ip:port/cam/realmonitor?channel=1&subtype=0 |
| | | rtsp_url = "rtsp://" + username + ":" + passwd + "@" + ip + ":" + std::to_string(port) + |
| | | "/cam/realmonitor?channel=1&subtype=0"; |
| | | //TODO |
| | | } else if (brand == "yushi") { |
| | | rtsp_url = "rtsp://" + username + ":" + passwd + "@" + ip + ":" + std::to_string(port) + |
| | | "/video1"; |
| | | } else { |
| | | //TODO |
| | | } |
| | | |
| | | return rtsp_url; |
| | | } |
| | | |
| | | bool devHttpServer_c::getDevSerialNumber(const char *ip, const int port, const char *username, const char *passwd, \ |
| | | const char *brand, unsigned char *serialNumber) const { |
| | | std::string strBrand(brand); |
| | | if (strBrand == "haikang") { |
| | | getHKDevSerialNumber(ip, port, username, passwd, serialNumber); |
| | | } else if (strBrand == "dahua") { |
| | | //TODO |
| | | } else if (strBrand == "yushi") { |
| | | return getUVDevSerialNumber(ip, username, passwd, serialNumber); |
| | | } else { |
| | | //TODO |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool devHttpServer_c::getHKDevSerialNumber(const char *ip, const int port, const char *username, const char *passwd, |
| | | unsigned char *serialNumber) const { |
| | | NET_DVR_Init(); |
| | | //è®¾ç½®è¿æ¥æ¶é´ä¸éè¿æ¶é´ |
| | | NET_DVR_SetConnectTime(2000, 1); |
| | | NET_DVR_SetReconnect(10000, true); |
| | | |
| | | NET_DVR_USER_LOGIN_INFO struLoginInfo = {0}; |
| | | struLoginInfo.bUseAsynLogin = 0; //忥ç»å½æ¹å¼ |
| | | strcpy(struLoginInfo.sDeviceAddress, ip); //设å¤IPå°å |
| | | struLoginInfo.wPort = port; //è®¾å¤æå¡ç«¯å£ |
| | | strcpy(struLoginInfo.sUserName, username); //设å¤ç»å½ç¨æ·å |
| | | strcpy(struLoginInfo.sPassword, passwd); //设å¤ç»å½å¯ç |
| | | |
| | | //设å¤ä¿¡æ¯, è¾åºåæ° |
| | | NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = {0}; |
| | | |
| | | LONG m_lUserID = NET_DVR_Login_V40(&struLoginInfo, &struDeviceInfoV40); |
| | | if (m_lUserID < 0) { |
| | | // printf("Login failed, error code: %d\n", NET_DVR_GetLastError()); |
| | | NET_DVR_Cleanup(); |
| | | return false; |
| | | } |
| | | |
| | | if (serialNumber != NULL) { |
| | | memcpy(serialNumber, struDeviceInfoV40.struDeviceV30.sSerialNumber, SERIALNO_LEN);//TODOè·åç£çéµåç设å¤id |
| | | string serialNO((char *) serialNumber); |
| | | |
| | | string_replace(serialNO, " ", "_"); |
| | | serialNO.copy(serialNumber, serialNO.length(), 0); |
| | | *(serialNumber + serialNO.length()) = '\0'; |
| | | } |
| | | |
| | | //注éç¨æ· |
| | | NET_DVR_Logout(m_lUserID); |
| | | //éæ¾SDKèµæº |
| | | NET_DVR_Cleanup(); |
| | | } |
| | | |
| | | bool |
| | | devHttpServer_c::getUVDevSerialNumber(const char *ip, const char *username, const char *passwd, |
| | | unsigned char *serialNumber) const { |
| | | ULONG ulRet = 0; |
| | | CHAR szUserID[1024] = {0}; |
| | | IMOS_MW_BASIC_DEVICE_INFO_S *pstBasicInfo = NULL; |
| | | |
| | | ulRet = IMOS_MW_Initiate(); |
| | | if (ERR_COMMON_SUCCEED != ulRet) { |
| | | printf("Initiate ret[%lu]", ulRet); |
| | | return false; |
| | | } |
| | | |
| | | /*sdk login*/ |
| | | ulRet = IMOS_MW_Login(username, passwd, ip, 0, szUserID); |
| | | if (ERR_COMMON_SUCCEED != ulRet) { |
| | | printf("Login error ulRet[%lu]", ulRet); |
| | | return false; |
| | | } |
| | | |
| | | pstBasicInfo = (IMOS_MW_BASIC_DEVICE_INFO_S *) malloc(sizeof(IMOS_MW_BASIC_DEVICE_INFO_S)); |
| | | ulRet = IMOS_MW_GetDeviceStatus(szUserID, 0, IMOS_MW_STATUS_BASIC_INFO, (void *) pstBasicInfo); |
| | | if (ERR_COMMON_SUCCEED != ulRet) { |
| | | printf("GetDeviceStatus Error[%lu]\n", ulRet); |
| | | return false; |
| | | } |
| | | |
| | | if (serialNumber != NULL) { |
| | | printf("SerialNumber :%s\n", pstBasicInfo->szSerialNumber); |
| | | strcpy((char *) serialNumber, pstBasicInfo->szSerialNumber);//TODOè·åç£çéµåç设å¤id |
| | | string serialNO((char *) serialNumber); |
| | | |
| | | string_replace(serialNO, " ", "_"); |
| | | serialNO.copy(serialNumber, serialNO.length(), 0); |
| | | *(serialNumber + serialNO.length()) = '\0'; |
| | | free(pstBasicInfo); |
| | | } |
| | | |
| | | (VOID) IMOS_MW_Logout(szUserID); |
| | | (VOID) IMOS_MW_Cleanup(); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool devHttpServer_c::getDevChnList(const char *ip, const int port, const char *username, const char *passwd, \ |
| | | const char *brand, std::vector<int> &lvecUsefulChans) const { |
| | | std::string strBrand(brand); |
| | | if (strBrand == "haikang") { |
| | | NET_DVR_Init(); |
| | | //è®¾ç½®è¿æ¥æ¶é´ä¸éè¿æ¶é´ |
| | | NET_DVR_SetConnectTime(2000, 1); |
| | | NET_DVR_SetReconnect(10000, true); |
| | | |
| | | //ç»å½åæ°ï¼å
æ¬è®¾å¤å°åãç»å½ç¨æ·ãå¯ç ç |
| | | NET_DVR_USER_LOGIN_INFO struLoginInfo = {0}; |
| | | struLoginInfo.bUseAsynLogin = 0; //忥ç»å½æ¹å¼ |
| | | strcpy(struLoginInfo.sDeviceAddress, ip); //设å¤IPå°å |
| | | struLoginInfo.wPort = port; //è®¾å¤æå¡ç«¯å£ |
| | | strcpy(struLoginInfo.sUserName, username); //设å¤ç»å½ç¨æ·å |
| | | strcpy(struLoginInfo.sPassword, passwd); //设å¤ç»å½å¯ç |
| | | |
| | | //设å¤ä¿¡æ¯, è¾åºåæ° |
| | | NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = {0}; |
| | | |
| | | LONG m_lUserID = NET_DVR_Login_V40(&struLoginInfo, &struDeviceInfoV40); |
| | | if (m_lUserID < 0) { |
| | | // printf("Login failed, error code: %d\n", NET_DVR_GetLastError()); |
| | | NET_DVR_Cleanup(); |
| | | return false; |
| | | } |
| | | |
| | | |
| | | NET_DVR_IPPARACFG_V40 ipOut; |
| | | long len; |
| | | int iGroupNO = 0 + 33;//33 offset |
| | | BOOL bret = NET_DVR_GetDVRConfig(m_lUserID, NET_DVR_GET_IPPARACFG_V40, iGroupNO, &ipOut, |
| | | sizeof(NET_DVR_IPPARACFG_V40), |
| | | (LPDWORD) &len); |
| | | DWORD dErr = NET_DVR_GetLastError(); |
| | | NET_DVR_PICCFG_V40 picOut; |
| | | |
| | | bret = NET_DVR_GetDVRConfig(m_lUserID, NET_DVR_GET_PICCFG_V40, iGroupNO, &picOut, sizeof(NET_DVR_PICCFG_V40), |
| | | (LPDWORD) &len); |
| | | dErr = NET_DVR_GetLastError(); |
| | | lvecUsefulChans.clear(); |
| | | for (int i = 0; i < ipOut.dwDChanNum; i++) { |
| | | if (ipOut.struStreamMode[i].uGetStream.struChanInfo.byEnable) { |
| | | |
| | | BYTE byIPID, byIPIDHigh; |
| | | int iDevInfoIndex; |
| | | byIPID = ipOut.struStreamMode[i].uGetStream.struChanInfo.byIPID; |
| | | byIPIDHigh = ipOut.struStreamMode[i].uGetStream.struChanInfo.byIPIDHigh; |
| | | iDevInfoIndex = byIPIDHigh * 256 + byIPID - 1 - iGroupNO * 64; |
| | | // printf("IP channel no.%d is online, IP: %s\n", i + 1, |
| | | // ipOut.struIPDevInfo[iDevInfoIndex].struIP.sIpV4); |
| | | |
| | | |
| | | lvecUsefulChans.push_back(i + 33); |
| | | } |
| | | } |
| | | |
| | | //注éç¨æ· |
| | | NET_DVR_Logout(m_lUserID); |
| | | //éæ¾SDKèµæº |
| | | NET_DVR_Cleanup(); |
| | | } else if (strBrand == "dahua") { |
| | | return false;//TODO |
| | | } else if (strBrand == "yushi") { |
| | | return false;//TODO |
| | | } else { |
| | | return false;//TODO |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool devHttpServer_c::loadCurrentVideo(const char *ip, const int port, const char *username, const char *passwd, \ |
| | | const char *brand, const int chn, std::string &videopath) const { |
| | | std::string strBrand(brand); |
| | | if (strBrand == "haikang") { |
| | | NET_DVR_Init(); |
| | | //è®¾ç½®è¿æ¥æ¶é´ä¸éè¿æ¶é´ |
| | | NET_DVR_SetConnectTime(2000, 1); |
| | | NET_DVR_SetReconnect(10000, true); |
| | | |
| | | //ç»å½åæ°ï¼å
æ¬è®¾å¤å°åãç»å½ç¨æ·ãå¯ç ç |
| | | NET_DVR_USER_LOGIN_INFO struLoginInfo = {0}; |
| | | struLoginInfo.bUseAsynLogin = 0; //忥ç»å½æ¹å¼ |
| | | strcpy(struLoginInfo.sDeviceAddress, ip); //设å¤IPå°å |
| | | struLoginInfo.wPort = port; //è®¾å¤æå¡ç«¯å£ |
| | | strcpy(struLoginInfo.sUserName, username); //设å¤ç»å½ç¨æ·å |
| | | strcpy(struLoginInfo.sPassword, passwd); //设å¤ç»å½å¯ç |
| | | |
| | | //设å¤ä¿¡æ¯, è¾åºåæ° |
| | | NET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = {0}; |
| | | |
| | | LONG m_lUserID = NET_DVR_Login_V40(&struLoginInfo, &struDeviceInfoV40); |
| | | if (m_lUserID < 0) { |
| | | // printf("Login failed, error code: %d\n", NET_DVR_GetLastError()); |
| | | NET_DVR_Cleanup(); |
| | | return false; |
| | | } |
| | | |
| | | NET_DVR_PLAYCOND struDownloadCond = {0}; |
| | | struDownloadCond.dwChannel = chn; |
| | | |
| | | time_t rowtime; |
| | | time(&rowtime); |
| | | time_t start_time = rowtime - 7200; |
| | | time_t end_time = rowtime - 7200 + 10; |
| | | struct tm *pStartTime = localtime(&start_time); |
| | | |
| | | struDownloadCond.struStartTime.dwYear = pStartTime->tm_year + 1900; |
| | | struDownloadCond.struStartTime.dwMonth = pStartTime->tm_mon + 1; |
| | | struDownloadCond.struStartTime.dwDay = pStartTime->tm_mday; |
| | | struDownloadCond.struStartTime.dwHour = pStartTime->tm_hour; |
| | | struDownloadCond.struStartTime.dwMinute = pStartTime->tm_min; |
| | | struDownloadCond.struStartTime.dwSecond = pStartTime->tm_sec; |
| | | |
| | | struct tm *pEndTime = localtime(&end_time); |
| | | struDownloadCond.struStopTime.dwYear = pEndTime->tm_year + 1900; |
| | | struDownloadCond.struStopTime.dwMonth = pEndTime->tm_mon + 1; |
| | | struDownloadCond.struStopTime.dwDay = pEndTime->tm_mday; |
| | | struDownloadCond.struStopTime.dwHour = pEndTime->tm_hour; |
| | | struDownloadCond.struStopTime.dwMinute = pEndTime->tm_min; |
| | | struDownloadCond.struStopTime.dwSecond = pEndTime->tm_sec; |
| | | |
| | | std::string ip_t(ip); |
| | | std::string filePath = "./" + ip_t + ":" + \ |
| | | std::to_string(port) + "-" + \ |
| | | std::to_string(chn) + "-" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwYear) + "-" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwMonth) + "-" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwDay) + "_" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwHour) + ":" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwMinute) + ":" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwSecond) + ".mp4"; |
| | | |
| | | std::string filePath_tmp = "./" + ip_t + ":" + \ |
| | | std::to_string(port) + "-" + \ |
| | | std::to_string(chn) + "-" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwYear) + "-" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwMonth) + "-" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwDay) + "_" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwHour) + ":" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwMinute) + ":" + \ |
| | | std::to_string(struDownloadCond.struStopTime.dwSecond) + "_tmp.mp4"; |
| | | |
| | | //--------------------------------------- |
| | | //ææ¶é´ä¸è½½ |
| | | int hPlayback; |
| | | hPlayback = NET_DVR_GetFileByTime_V40(m_lUserID, (char *) filePath.c_str(), &struDownloadCond); |
| | | if (hPlayback < 0) { |
| | | printf("NET_DVR_GetFileByTime_V40 fail,last error %d\n", NET_DVR_GetLastError()); |
| | | NET_DVR_Logout(m_lUserID); |
| | | NET_DVR_Cleanup(); |
| | | return false; |
| | | } |
| | | |
| | | //--------------------------------------- |
| | | //å¼å§ä¸è½½ |
| | | if (!NET_DVR_PlayBackControl_V40(hPlayback, NET_DVR_PLAYSTART, NULL, 0, NULL, NULL)) { |
| | | printf("Play back control failed [%d]\n", NET_DVR_GetLastError()); |
| | | NET_DVR_Logout(m_lUserID); |
| | | NET_DVR_Cleanup(); |
| | | return false; |
| | | } |
| | | |
| | | int nPos = 0; |
| | | for (nPos = 0; nPos < 100 && nPos >= 0; nPos = NET_DVR_GetDownloadPos(hPlayback)) { |
| | | //printf("Be downloading... %d %%\n",nPos); |
| | | sleep(5); //millisecond |
| | | } |
| | | if (!NET_DVR_StopGetFile(hPlayback)) { |
| | | printf("failed to stop get file [%d]\n", NET_DVR_GetLastError()); |
| | | NET_DVR_Logout(m_lUserID); |
| | | NET_DVR_Cleanup(); |
| | | return false; |
| | | } |
| | | if (nPos < 0 || nPos > 100) { |
| | | printf("download err [%d]\n", NET_DVR_GetLastError()); |
| | | NET_DVR_Logout(m_lUserID); |
| | | NET_DVR_Cleanup(); |
| | | return false; |
| | | } |
| | | |
| | | std::string cmd_transform = "ffmpeg -i " + filePath + " -strict -2 -vf scale=640:360 " + filePath_tmp; |
| | | system(cmd_transform.c_str()); |
| | | std::string cmd_delsrc = "rm -f " + filePath; |
| | | system(cmd_delsrc.c_str()); |
| | | videopath = filePath_tmp; |
| | | |
| | | //注éç¨æ· |
| | | NET_DVR_Logout(m_lUserID); |
| | | //éæ¾SDKèµæº |
| | | NET_DVR_Cleanup(); |
| | | } else if (strBrand == "dahua") { |
| | | //TODO |
| | | } else if (strBrand == "yushi") { |
| | | //TODO |
| | | } else { |
| | | //TODO |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | #define DEV_NO_TYPE (0) |
| | | #define DEV_STORAGE (1) |
| | | #define DEV_CAMERA (2) |
| | | |
| | | //ç¼è¾ç£çéµå |
| | | std::string devHttpServer_c::dev_edit(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | bool ret = false; |
| | | |
| | | int dev_type = db_c.searchDevTypeFromConfigTable(); |
| | | if (DEV_CAMERA == dev_type) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } else { |
| | | DBG("dev_type :" << dev_type); |
| | | } |
| | | |
| | | Record_Storage_Dev dev_rec; |
| | | if (reader.parse(content, value)) { |
| | | dev_rec.str_dev_name = QString::fromStdString(value["str_dev_name"].asString()); |
| | | dev_rec.n_total_chn = 0; |
| | | dev_rec.str_all_chn_num = ""; |
| | | dev_rec.str_addr = QString::fromStdString(value["str_addr"].asString()); |
| | | dev_rec.str_longitude = QString::fromStdString(value["str_longitude"].asString()); |
| | | dev_rec.str_latitude = QString::fromStdString(value["str_latitude"].asString()); |
| | | dev_rec.str_ip = QString::fromStdString(value["str_ip"].asString()); |
| | | dev_rec.n_port = value["n_port"].asInt(); |
| | | dev_rec.str_username = QString::fromStdString(value["str_username"].asString()); |
| | | dev_rec.str_password = QString::fromStdString(value["str_password"].asString()); |
| | | dev_rec.tim_start_time = QDateTime::fromString(QString::fromStdString(value["tim_start_time"].asString()), \ |
| | | "yyyy-MM-dd hh:mm:ss"); |
| | | dev_rec.n_duration = value["n_duration"].asInt(); |
| | | dev_rec.str_brand = QString::fromStdString(value["str_brand"].asString()); |
| | | dev_rec.str_reserved = ""; |
| | | |
| | | unsigned char serialnumber[SERIALNO_LEN] = {0}; |
| | | ret = getDevSerialNumber(value["str_ip"].asCString(), value["n_port"].asInt(), |
| | | value["str_username"].asCString(), \ |
| | | value["str_password"].asCString(), value["str_brand"].asCString(), serialnumber); |
| | | if ((!ret) || (serialnumber[0] == 0)) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | dev_rec.str_storage_dev_id = QString::fromLatin1((const char *) serialnumber);//è·åç£çéµåç设å¤id |
| | | std::cout << dev_rec.str_storage_dev_id.toStdString() << std::endl; |
| | | ret = db_c.updateDeviceTable(dev_rec); |
| | | } else { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | if (ret) { |
| | | if (DEV_NO_TYPE == dev_type) { |
| | | db_c.updateConfigTableByDevType(DEV_STORAGE); |
| | | runAllApp(); |
| | | } else { |
| | | DBG("dev_type :" << dev_type); |
| | | } |
| | | |
| | | Json::Value value_out; |
| | | value_out["str_storage_dev_id"] = dev_rec.str_storage_dev_id.toStdString(); |
| | | std::string out = value_out.toStyledString(); |
| | | |
| | | return out; |
| | | } else { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | //æç´¢ç£çéµåéé |
| | | std::string |
| | | devHttpServer_c::dev_search_chns(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value_reader; |
| | | |
| | | if (!reader.parse(content, value_reader)) { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | Record_Storage_Dev rec = db_c.searchDeviceTableByDeviceId( |
| | | QString::fromStdString(value_reader["str_storage_dev_id"].asString())); |
| | | //è°ç¨æµ·åº·å¤§åç£çéµåsdkï¼è·åç£ççééå表 |
| | | std::vector<int> lvecUsefulChans; |
| | | getDevChnList(rec.str_ip.toStdString().c_str(), rec.n_port, rec.str_username.toStdString().c_str(), \ |
| | | rec.str_password.toStdString().c_str(), rec.str_brand.toStdString().c_str(), lvecUsefulChans); |
| | | |
| | | std::string str_result; |
| | | std::string str_tmp; |
| | | for (int i = 0; i < lvecUsefulChans.size(); i++) { |
| | | std::cout << lvecUsefulChans.at(i) << std::endl; |
| | | str_tmp = std::to_string(lvecUsefulChans.at(i)); |
| | | str_result += str_tmp; |
| | | str_result += ","; |
| | | } |
| | | str_result = str_result.substr(0, str_result.length() - 1); |
| | | Json::Value value; |
| | | |
| | | value["devchn_list"] = str_result; |
| | | std::string out = value.toStyledString(); |
| | | |
| | | return out; |
| | | } |
| | | |
| | | //æµè¯ç£çéµåééè¿æ¥ |
| | | std::string |
| | | devHttpServer_c::chk_chn_connet(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value_reader; |
| | | |
| | | if (!reader.parse(content, value_reader)) { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | Record_Storage_Dev rec = db_c.searchDeviceTableByDeviceId(\ |
| | | QString::fromStdString(value_reader["str_storage_dev_id"].asString())); |
| | | |
| | | //TODO |
| | | //è°ç¨æµ·åº·å¤§åç£çéµåsdkï¼è·åç£çvalue_reader["str_storage_dev_id"].asString(),value_reader["n_chn"].asString() |
| | | std::string loadpath; |
| | | bool ret = loadCurrentVideo(rec.str_ip.toStdString().c_str(), \ |
| | | rec.n_port, \ |
| | | rec.str_username.toStdString().c_str(), \ |
| | | rec.str_password.toStdString().c_str(), \ |
| | | rec.str_brand.toStdString().c_str(), \ |
| | | value_reader["n_chn"].asInt(), \ |
| | | loadpath); |
| | | |
| | | fdfsClient.rwLock.rdlock(); |
| | | std::string vid_url = "http://"; |
| | | if (fdfsClient.fastFds != nullptr) { |
| | | vid_url.append(fdfsClient.fastFds->getIp() + "/"); |
| | | std::string t_strVid = ""; |
| | | if (!fdfsClient.fastFds->uploadFile(loadpath, t_strVid)) { |
| | | vid_url = "upload video fail"; |
| | | } else { |
| | | vid_url.append(t_strVid); |
| | | } |
| | | } |
| | | fdfsClient.rwLock.unlock(); |
| | | std::string cmd_delsrc = "rm -f " + loadpath; |
| | | system(cmd_delsrc.c_str()); |
| | | |
| | | Json::Value value; |
| | | if (!ret) { |
| | | value["connect_status"] = "False"; |
| | | value["video_url"] = ""; |
| | | } else { |
| | | |
| | | |
| | | value["connect_status"] = "True"; |
| | | value["video_url"] = vid_url; |
| | | } |
| | | |
| | | std::string out = value.toStyledString(); |
| | | |
| | | return out; |
| | | } |
| | | |
| | | static std::vector<int> string2vectorint(std::string str_list) { |
| | | std::vector<int> result_int; |
| | | char *property_list = const_cast<char *>(str_list.c_str()); |
| | | const char *c_Analyse = ","; |
| | | char *t_property; |
| | | |
| | | #ifdef linux |
| | | char *t_save = NULL; |
| | | t_property = strtok_r(property_list, c_Analyse, &t_save); |
| | | #else |
| | | t_property = strtok(property_list,c_Analyse); |
| | | #endif |
| | | |
| | | while (t_property) { |
| | | std::string str_pro(t_property); |
| | | result_int.push_back(std::stoi(str_pro)); |
| | | #ifdef linux |
| | | t_property = strtok_r(t_save, c_Analyse, &t_save); |
| | | #else |
| | | t_property = strtok(NULL,c_Analyse); |
| | | #endif |
| | | |
| | | } |
| | | return result_int; |
| | | } |
| | | |
| | | //æ¾ç¤ºç£çéµåééå表 |
| | | std::string |
| | | devHttpServer_c::devchn_show(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value_reader; |
| | | Json::Value value; |
| | | Json::Value elem; |
| | | Json::Value chn_unused; |
| | | bool ret = false; |
| | | |
| | | if (reader.parse(content, value_reader)) { |
| | | QString dev_id = QString::fromStdString(value_reader["str_storage_dev_id"].asString()); |
| | | |
| | | std::list<Record_Cam_Chn> rec_list = db_c.searchChannelTableByDevlId(dev_id); |
| | | list<Record_Cam_Chn>::iterator iter; |
| | | |
| | | Record_Storage_Dev rec = db_c.searchDeviceTableByDeviceId( |
| | | QString::fromStdString(value_reader["str_storage_dev_id"].asString())); |
| | | std::vector<int> chns; |
| | | getDevChnList(rec.str_ip.toStdString().c_str(), rec.n_port, rec.str_username.toStdString().c_str(), \ |
| | | rec.str_password.toStdString().c_str(), rec.str_brand.toStdString().c_str(), chns); |
| | | |
| | | for (iter = rec_list.begin(); iter != rec_list.end(); ++iter) { |
| | | // elem["str_storage_dev_id"] = iter->str_storage_dev_id.toStdString(); |
| | | elem["str_name"] = iter->str_name.toStdString(); |
| | | elem["n_chn"] = iter->n_chn; |
| | | elem["str_addr"] = iter->str_addr.toStdString(); |
| | | elem["str_longitude"] = iter->str_longitude.toStdString(); |
| | | elem["str_latitude"] = iter->str_latitude.toStdString(); |
| | | elem["str_reserved"] = iter->str_reserved.toStdString(); |
| | | |
| | | Record_Chn_Sdk rec_sdk = db_c.searchChnSdkTableByChannelId(iter->str_storage_dev_id, iter->n_chn); |
| | | elem["str_sdks"] = rec_sdk.str_sdks.toStdString(); |
| | | elem["str_det_thr"] = rec_sdk.str_det_thr.toStdString(); |
| | | elem["str_cmp_thr"] = rec_sdk.str_cmp_thr.toStdString(); |
| | | |
| | | for (std::vector<int>::iterator it = chns.begin(); it != chns.end();) { |
| | | if (*it == iter->n_chn) { |
| | | it = chns.erase(it); //å é¤å
ç´ ï¼è¿å弿åå·²å é¤å
ç´ çä¸ä¸ä¸ªä½ç½® |
| | | } else { |
| | | ++it; //æåä¸ä¸ä¸ªä½ç½® |
| | | } |
| | | } |
| | | |
| | | cout << elem.toStyledString() << endl; |
| | | value.append(elem); |
| | | } |
| | | |
| | | for (std::vector<int>::iterator it1 = chns.begin(); it1 != chns.end(); it1++) { |
| | | chn_unused["n_chn"] = *it1; |
| | | cout << "*it1" << *it1 << endl; |
| | | value.append(chn_unused); |
| | | } |
| | | |
| | | cout << value.toStyledString() << endl; |
| | | // std::string out = value.toStyledString(); |
| | | std::string out = value.size() > 0 ? value.toStyledString() : "[]"; |
| | | return out; |
| | | } |
| | | |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | //ç¼è¾ç£çéµåéé |
| | | std::string |
| | | devHttpServer_c::devchn_edit(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | bool ret = false; |
| | | Record_Chn_Sdk rec_sdk_old; |
| | | Record_Chn_Sdk rec_sdk; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | Record_Cam_Chn rec; |
| | | rec.str_storage_dev_id = QString::fromStdString(value["str_storage_dev_id"].asString()); |
| | | rec.n_chn = value["n_chn"].asInt(); |
| | | rec.str_name = QString::fromStdString(value["str_name"].asString()); |
| | | rec.str_addr = QString::fromStdString(value["str_addr"].asString()); |
| | | rec.str_longitude = QString::fromStdString(value["str_longitude"].asString()); |
| | | rec.str_latitude = QString::fromStdString(value["str_latitude"].asString()); |
| | | |
| | | Record_Storage_Dev dev_rec = db_c.searchDeviceTableByDeviceId(rec.str_storage_dev_id); |
| | | rec.tim_do_time = dev_rec.tim_start_time; |
| | | rec.tim_update_time = QDateTime::currentDateTime(); |
| | | |
| | | rec_sdk_old = db_c.searchChnSdkTableByChannelId(rec.str_storage_dev_id, rec.n_chn); |
| | | |
| | | rec_sdk.str_storage_dev_id = QString::fromStdString(value["str_storage_dev_id"].asString()); |
| | | rec_sdk.n_chn = value["n_chn"].asInt(); |
| | | rec_sdk.str_sdks = QString::fromStdString(value["str_sdks"].asString()); |
| | | rec_sdk.str_det_thr = QString::fromStdString(value["str_det_thr"].asString()); |
| | | rec_sdk.str_cmp_thr = QString::fromStdString(value["str_cmp_thr"].asString()); |
| | | |
| | | ret = db_c.updateDevChnAndSdk(rec, rec_sdk); |
| | | if (!ret) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } else { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | //edit chn's sdks |
| | | if ((rec_sdk_old.str_sdks != rec_sdk.str_sdks) || |
| | | (rec_sdk_old.str_det_thr != rec_sdk.str_det_thr) || |
| | | (rec_sdk_old.str_cmp_thr != rec_sdk.str_cmp_thr)) { |
| | | killVideoAnalysFromHCApp(); |
| | | sleep(1); |
| | | runAllApp(); |
| | | } |
| | | |
| | | return "{\"ret_status\": \"ok_ack\"}"; |
| | | } |
| | | |
| | | void devHttpServer_c::killFaceSearchServerApp() const { |
| | | string local_passwd = appConfig.getStringProperty("localPasswd"); |
| | | string cmd_kill = "sleep 1 && echo \"" + local_passwd + "\" | sudo -S pkill -9 FaceSearch"; |
| | | system(cmd_kill.c_str()); |
| | | DBG("system(\"sudo -S pkill -9 FaceSearchServer\");"); |
| | | } |
| | | |
| | | void devHttpServer_c::killVideoAnalysFromHCApp() const { |
| | | string local_passwd = appConfig.getStringProperty("localPasswd"); |
| | | string cmd_kill = "echo \"" + local_passwd + "\" | sudo -S pkill -9 VideoAnalysFrom"; |
| | | system(cmd_kill.c_str()); |
| | | DBG("system(\"sudo -S pkill -9 VideoAnalysFromHC\");"); |
| | | } |
| | | |
| | | void devHttpServer_c::runAllApp() const { |
| | | string buildAddr = appConfig.getStringProperty("buildAddr"); |
| | | string cmd = "cd " + buildAddr + " && sh runAll.sh &"; |
| | | system(cmd.c_str()); |
| | | DBG("system(\"cd ~/Apps/QiaoJiaSystem/build/ && sh runAll.sh\");"); |
| | | } |
| | | |
| | | //æ¾ç¤ºæåæºå表 |
| | | std::string devHttpServer_c::cam_show(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Value value; |
| | | Json::Value elem; |
| | | |
| | | std::list<Record_Cam_Dev> rec_list = db_c.searchCamDevTableAll(); |
| | | list<Record_Cam_Dev>::iterator iter; |
| | | |
| | | for (iter = rec_list.begin(); iter != rec_list.end(); ++iter) { |
| | | // elem["str_storage_dev_id"] = iter->str_storage_dev_id.toStdString(); |
| | | elem["str_cam_dev_id"] = iter->str_cam_dev_id.toStdString(); |
| | | elem["str_name"] = iter->str_name.toStdString(); |
| | | elem["str_addr"] = iter->str_addr.toStdString(); |
| | | elem["str_longitude"] = iter->str_longitude.toStdString(); |
| | | elem["str_latitude"] = iter->str_latitude.toStdString(); |
| | | elem["str_ip"] = iter->str_ip.toStdString(); |
| | | elem["n_port"] = iter->n_port; |
| | | elem["str_username"] = iter->str_username.toStdString(); |
| | | elem["str_password"] = iter->str_password.toStdString(); |
| | | elem["str_brand"] = iter->str_brand.toStdString(); |
| | | elem["str_reserved"] = iter->str_reserved.toStdString(); |
| | | |
| | | Record_Cam_Sdk rec_sdk = db_c.searchCamSdkTableByCamId(iter->str_cam_dev_id); |
| | | elem["str_sdks"] = rec_sdk.str_sdks.toStdString(); |
| | | elem["str_det_thr"] = rec_sdk.str_det_thr.toStdString(); |
| | | elem["str_cmp_thr"] = rec_sdk.str_cmp_thr.toStdString(); |
| | | |
| | | cout << elem.toStyledString() << endl; |
| | | |
| | | value.append(elem); |
| | | } |
| | | |
| | | cout << value.toStyledString() << endl; |
| | | std::string out = value.size() > 0 ? value.toStyledString() : "[]"; |
| | | return out; |
| | | } |
| | | |
| | | //ç¼è¾æåæº |
| | | std::string devHttpServer_c::cam_edit(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | bool ret = false; |
| | | Record_Cam_Dev rec; |
| | | Record_Cam_Sdk rec_sdk_old; |
| | | Record_Cam_Sdk rec_sdk; |
| | | |
| | | int dev_type = db_c.searchDevTypeFromConfigTable(); |
| | | if (DEV_STORAGE == dev_type) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | if (reader.parse(content, value)) { |
| | | unsigned char serialnumber[SERIALNO_LEN] = {0}; |
| | | ret = getDevSerialNumber(value["str_ip"].asCString(), value["n_port"].asInt(), |
| | | value["str_username"].asCString(), \ |
| | | value["str_password"].asCString(), value["str_brand"].asCString(), serialnumber); |
| | | if ((!ret) || (serialnumber[0] == 0)) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | rec.str_cam_dev_id = QString::fromLatin1((const char *) serialnumber);//æåæºid cam_mac |
| | | rec.str_name = QString::fromStdString(value["str_name"].asString()); |
| | | rec.str_addr = QString::fromStdString(value["str_addr"].asString()); |
| | | rec.str_longitude = QString::fromStdString(value["str_longitude"].asString()); |
| | | rec.str_latitude = QString::fromStdString(value["str_latitude"].asString()); |
| | | rec.str_ip = QString::fromStdString(value["str_ip"].asString()); |
| | | rec.n_port = value["n_port"].asInt(); |
| | | rec.str_username = QString::fromStdString(value["str_username"].asString()); |
| | | rec.str_password = QString::fromStdString(value["str_password"].asString()); |
| | | rec.str_brand = QString::fromStdString(value["str_brand"].asString()); |
| | | |
| | | rec_sdk_old = db_c.searchCamSdkTableByCamId(rec.str_cam_dev_id); |
| | | |
| | | rec_sdk.str_cam_dev_id = rec.str_cam_dev_id; |
| | | rec_sdk.str_sdks = QString::fromStdString(value["str_sdks"].asString()); |
| | | rec_sdk.str_det_thr = QString::fromStdString(value["str_det_thr"].asString()); |
| | | rec_sdk.str_cmp_thr = QString::fromStdString(value["str_cmp_thr"].asString()); |
| | | |
| | | ret = db_c.updateCamAndSdkTable(rec, rec_sdk); |
| | | if (!ret) { |
| | | return "err_db_content"; |
| | | } |
| | | } else { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | if (DEV_NO_TYPE == dev_type) {//add new camera |
| | | db_c.updateConfigTableByDevType(DEV_CAMERA); |
| | | runAllApp(); |
| | | } |
| | | //edit camera's sdks |
| | | else/* if ((rec_sdk_old.str_sdks != rec_sdk.str_sdks) || |
| | | (rec_sdk_old.str_det_thr != rec_sdk.str_det_thr) || |
| | | (rec_sdk_old.str_cmp_thr != rec_sdk.str_cmp_thr)) */{ |
| | | killVideoAnalysFromHCApp(); |
| | | sleep(1); |
| | | runAllApp(); |
| | | } |
| | | |
| | | Json::Value value_out; |
| | | value_out["str_cam_dev_id"] = rec.str_cam_dev_id.toStdString(); |
| | | std::string out = value_out.toStyledString(); |
| | | |
| | | return out; |
| | | } |
| | | |
| | | bool devHttpServer_c::cam_connect_video_start(std::string ip, int port, std::string username, std::string passwd, \ |
| | | std::string brand) const { |
| | | |
| | | if (brand == "haikang") { |
| | | bool ret = getHKDevSerialNumber(ip.c_str(), port, username.c_str(), passwd.c_str()); |
| | | if (!ret) { |
| | | ERR("getHKDevSerialNumber ERR"); |
| | | return false; |
| | | } |
| | | //è°ç¨rtspæµrtsp://admin:a1234567@192.168.1.215:554/h264/ch1/main/av_stream |
| | | port = 554;//TODO |
| | | // std::string rtsp_url = "rtsp://" + username + ":" + passwd + "@" + ip + ":" + std::to_string(port) + |
| | | // "/h264/ch1/main/av_stream"; |
| | | std::string rtsp_url = rtspAddrBuild(ip.c_str(), port, username.c_str(), passwd.c_str(), brand.c_str()); |
| | | if (rtsp_url.empty()) { |
| | | return false; |
| | | } |
| | | |
| | | DBG("rtsp_url:" << rtsp_url); |
| | | Json::Value json; |
| | | json["rtsp"] = rtsp_url; |
| | | |
| | | //æ¼æ¥json |
| | | string str_uuid; |
| | | uuid_t t_uuid; |
| | | char str[36]; |
| | | uuid_generate(t_uuid); |
| | | uuid_unparse(t_uuid, str); |
| | | str_uuid = str; |
| | | |
| | | std::string rtmpAddr = appConfig.getStringProperty("srsAddr"); |
| | | std::string publish_basepath = rtmpAddr + "cam" + str_uuid; |
| | | DBG("publish_basepath:" << publish_basepath); |
| | | appPref.setStringData("publish.basepath", publish_basepath); |
| | | appPref.setIntData("pulish.width", 640); |
| | | appPref.setIntData("pulish.height", 360); |
| | | |
| | | if (m_rtmp.find(ip) != m_rtmp.end()) { |
| | | if (m_rtmp[ip].appPC == nullptr) { |
| | | m_rtmp[ip].userCounter = 0; |
| | | m_rtmp[ip].appPC = new AppPipeController(0, json); |
| | | m_rtmp[ip].appPC->start(); |
| | | } |
| | | m_rtmp[ip].userCounter++; |
| | | |
| | | } else { |
| | | m_rtmp[ip].appPC = new AppPipeController(0, json); |
| | | m_rtmp[ip].appPC->start(); |
| | | m_rtmp[ip].userCounter = 1; |
| | | } |
| | | |
| | | DBG("m_rtmp[ip]->start(); ip:" << ip); |
| | | |
| | | } else if (brand == "dahua") { |
| | | //rtsp://username:password@ip:port/cam/realmonitor?channel=1&subtype=0 |
| | | return false;//TODO |
| | | } else if (brand == "yushi") { |
| | | // rtsp://admin:admin@192.168.8.8:554/video1 |
| | | bool ret = getUVDevSerialNumber(ip.c_str(), username.c_str(), passwd.c_str()); |
| | | if (!ret) { |
| | | ERR("getUVDevSerialNumber ERR"); |
| | | return false; |
| | | } |
| | | |
| | | port = 554; |
| | | // std::string rtsp_url = "rtsp://" + username + ":" + passwd + "@" + ip + ":" + std::to_string(port) + |
| | | // "/video1"; |
| | | std::string rtsp_url = rtspAddrBuild(ip.c_str(), port, username.c_str(), passwd.c_str(), brand.c_str()); |
| | | if (rtsp_url.empty()) { |
| | | return false; |
| | | } |
| | | DBG("rtsp_url:" << rtsp_url); |
| | | Json::Value json; |
| | | json["rtsp"] = rtsp_url; |
| | | |
| | | //æ¼æ¥json |
| | | string str_uuid; |
| | | uuid_t t_uuid; |
| | | char str[36]; |
| | | uuid_generate(t_uuid); |
| | | uuid_unparse(t_uuid, str); |
| | | str_uuid = str; |
| | | |
| | | std::string rtmpAddr = appConfig.getStringProperty("srsAddr"); |
| | | std::string publish_basepath = rtmpAddr + "cam" + str_uuid; |
| | | DBG("publish_basepath:" << publish_basepath); |
| | | appPref.setStringData("publish.basepath", publish_basepath); |
| | | appPref.setIntData("pulish.width", 640); |
| | | appPref.setIntData("pulish.height", 360); |
| | | |
| | | if (m_rtmp.find(ip) != m_rtmp.end()) { |
| | | if (m_rtmp[ip].appPC == nullptr) { |
| | | m_rtmp[ip].userCounter = 0; |
| | | m_rtmp[ip].appPC = new AppPipeController(0, json); |
| | | m_rtmp[ip].appPC->start(); |
| | | } |
| | | m_rtmp[ip].userCounter++; |
| | | |
| | | } else { |
| | | m_rtmp[ip].appPC = new AppPipeController(0, json); |
| | | m_rtmp[ip].appPC->start(); |
| | | m_rtmp[ip].userCounter = 1; |
| | | } |
| | | |
| | | DBG("m_rtmp[ip]->start(); ip:" << ip); |
| | | |
| | | } else { |
| | | DBG("other brand"); |
| | | return false;//TODO |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | bool devHttpServer_c::cam_connect_video_stop(std::string ip) const { |
| | | |
| | | DBG("cam_connect_video_stop begin"); |
| | | // if (m_rtmp.size() > 0) { |
| | | // auto it = m_rtmp.begin(); |
| | | // while (it != m_rtmp.end()) { |
| | | // m_rtmp[it->first]->stop(); |
| | | // m_rtmp[it->first]->wait(); |
| | | // it++; |
| | | // } |
| | | // } |
| | | if (m_rtmp.find(ip) != m_rtmp.end()) { |
| | | if (m_rtmp[ip].appPC == nullptr) { |
| | | m_rtmp.erase(ip); |
| | | } else { |
| | | m_rtmp[ip].userCounter--; |
| | | |
| | | if (m_rtmp[ip].userCounter == 0) { |
| | | m_rtmp[ip].appPC->stop(); |
| | | m_rtmp[ip].appPC->wait(); |
| | | m_rtmp.erase(ip); |
| | | } |
| | | } |
| | | } |
| | | DBG("cam_connect_video_stop end"); |
| | | |
| | | |
| | | return true; |
| | | } |
| | | |
| | | //æµè¯æåæºè¿æ¥ |
| | | std::string |
| | | devHttpServer_c::chk_cam_connet(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value_reader; |
| | | |
| | | if (!reader.parse(content, value_reader)) { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | //TODO |
| | | //è°ç¨rtspæµrtsp://admin:a1234567@192.168.1.215:554/h264/ch1/main/av_stream |
| | | // std::string rtsp_url = "rtsp://" + username + ":" + passwd + "@" + ip + ":" + std::to_string(port) + "/h264/ch1/main/av_stream"; |
| | | bool ret = cam_connect_video_start(value_reader["str_ip"].asString(), value_reader["n_port"].asInt(), \ |
| | | value_reader["str_username"].asString(), value_reader["str_password"].asString(), \ |
| | | value_reader["str_brand"].asString()); |
| | | if (!ret) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | std::string rtmp_url = m_rtmp[value_reader["str_ip"].asCString()].appPC->getRtmp(); |
| | | Json::Value value; |
| | | value["connect_status"] = "True"; |
| | | value["video_url"] = rtmp_url; |
| | | std::string out = value.toStyledString(); |
| | | |
| | | return out; |
| | | } |
| | | |
| | | //æµè¯æåæºè¿æ¥ |
| | | std::string |
| | | devHttpServer_c::chk_cam_disconnet(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value_reader; |
| | | |
| | | if (!reader.parse(content, value_reader)) { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | //TODO |
| | | //è°ç¨rtspæµrtsp://admin:a1234567@192.168.1.215:554/h264/ch1/main/av_stream |
| | | // std::string rtsp_url = "rtsp://" + username + ":" + passwd + "@" + ip + ":" + std::to_string(port) + "/h264/ch1/main/av_stream"; |
| | | DBG("cam_connect_video_stop begin"); |
| | | bool ret = cam_connect_video_stop(value_reader["str_ip"].asString()); |
| | | if (!ret) { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | DBG("cam_connect_video_stop end"); |
| | | |
| | | Json::Value value; |
| | | value["ret_status"] = "ok_ack"; |
| | | |
| | | std::string out = value.toStyledString(); |
| | | |
| | | return out; |
| | | } |
| | | |
| | | //å é¤ç£çéµåå对åºééå表 |
| | | std::string devHttpServer_c::dev_del(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value_reader; |
| | | |
| | | int dev_type = db_c.searchDevTypeFromConfigTable(); |
| | | if (DEV_CAMERA == dev_type) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | if (reader.parse(content, value_reader)) { |
| | | QString dev_id = QString::fromStdString(value_reader["str_storage_dev_id"].asString()); |
| | | int ret = db_c.deleteDeviceTableAndChnAndSdk(dev_id); |
| | | if (ret) { |
| | | killVideoAnalysFromHCApp(); |
| | | db_c.deleteLoadFileTablebyDevID(QString::fromStdString(value_reader["str_storage_dev_id"].asString())); |
| | | db_c.deleteCutVideoTablebyDevID(QString::fromStdString(value_reader["str_storage_dev_id"].asString())); |
| | | db_c.deleteSdkHdlTablebyDevID(QString::fromStdString(value_reader["str_storage_dev_id"].asString())); |
| | | int dev_record = db_c.searchDeviceNumber(); |
| | | if (dev_record == 0) { |
| | | db_c.updateConfigTableByDevType(DEV_NO_TYPE); |
| | | } else { |
| | | runAllApp(); |
| | | } |
| | | return "{\"ret_status\": \"ok_ack\"}"; |
| | | } else { |
| | | return "err_db"; |
| | | } |
| | | } |
| | | |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | //å é¤æåæº |
| | | std::string devHttpServer_c::cam_del(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value_reader; |
| | | |
| | | int dev_type = db_c.searchDevTypeFromConfigTable(); |
| | | if (DEV_STORAGE == dev_type) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | |
| | | if (reader.parse(content, value_reader)) { |
| | | QString cam_id = QString::fromStdString(value_reader["str_cam_dev_id"].asString()); |
| | | int ret = db_c.deleteCamDevandSdkByCamID(cam_id); |
| | | if (ret) { |
| | | killVideoAnalysFromHCApp(); |
| | | int dev_record = db_c.searchCamDevNumber(); |
| | | if (dev_record == 0) { |
| | | db_c.updateConfigTableByDevType(DEV_NO_TYPE); |
| | | } else { |
| | | runAllApp(); |
| | | } |
| | | return "{\"ret_status\": \"ok_ack\"}"; |
| | | } else { |
| | | return "err_db"; |
| | | } |
| | | } |
| | | |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | //ä¿®æ¹ip 端å£çé
ç½®ä¿¡æ¯ |
| | | std::string |
| | | devHttpServer_c::server_info_edit(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | bool ret = false; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | Record_Config lRec; |
| | | lRec.str_alarm_ip = QString::fromStdString(value["alarm_ip"].asString()); |
| | | lRec.n_alarm_port = value["alarm_port"].asInt(); |
| | | lRec.str_web_pic_ip = QString::fromStdString(value["web_pic_ip"].asString()); |
| | | lRec.n_web_pic_port = value["web_pic_port"].asInt(); |
| | | lRec.str_es_pic_ip = QString::fromStdString(value["es_pic_ip"].asString()); |
| | | lRec.n_es_pic_port = value["es_pic_port"].asInt(); |
| | | if ((checkip(lRec.str_alarm_ip.toStdString())) && |
| | | (checkip(lRec.str_web_pic_ip.toStdString())) && |
| | | (checkip(lRec.str_es_pic_ip.toStdString()))) { |
| | | ret = db_c.updateConfigTableByServerInfo(lRec); |
| | | |
| | | //#todo webserver |
| | | std::string cmd_web = |
| | | "sed -i '/tracker_server=/d' ./WebFDSClient.conf && sed -i '/\\\"host:port\\\"/atracker_server=" + \ |
| | | value["web_pic_ip"].asString() + ":" + std::to_string(value["web_pic_port"].asInt()) + \ |
| | | "' ./WebFDSClient.conf";// |
| | | std::cout << "cmd_web:" << cmd_web << std::endl; |
| | | system(cmd_web.c_str()); |
| | | |
| | | //#todo fastDfsClient |
| | | //system("sed -i '/tracker_server=/d' ./fastDfsClient.conf && sed -i '/\"host:port\"/atracker_server=192.168.1.188:22122' ./fastDfsClient.conf"); |
| | | std::string cmd_es = |
| | | "sed -i '/tracker_server=/d' ./fastDfsClient.conf && sed -i '/\\\"host:port\\\"/atracker_server=" + \ |
| | | value["es_pic_ip"].asString() + ":" + std::to_string(value["es_pic_port"].asInt()) + \ |
| | | "' ./fastDfsClient.conf"; |
| | | std::cout << "cmd_es:" << cmd_es << std::endl; |
| | | system(cmd_es.c_str()); |
| | | |
| | | //#todo config |
| | | { |
| | | fdfsClient.rwLock.wrlock(); |
| | | if (fdfsClient.fastFds != nullptr) { |
| | | delete fdfsClient.fastFds; |
| | | } |
| | | fdfsClient.fastFds = new FastFds("./WebFDSClient.conf"); |
| | | fdfsClient.rwLock.unlock(); |
| | | } |
| | | |
| | | //# http client 127.0.0.1:9999/resetFdfs |
| | | std::string http_cmd = "http://127.0.0.1:9999/resetFdfs"; |
| | | HttpRequestWithCrul httpRequestWithCrul; |
| | | std::string response_bak = ""; |
| | | std::string postParams_bak = ""; |
| | | httpRequestWithCrul.curl_post_req("http://127.0.0.1:9999/resetFdfs", postParams_bak, response_bak); |
| | | } |
| | | } else { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | if (ret) { |
| | | return "{\"ret_status\": \"ok_ack\"}"; |
| | | } else { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | //æ¥è¯¢ ip 端å£çé
ç½®ä¿¡æ¯ |
| | | std::string |
| | | devHttpServer_c::server_info_show(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Value value; |
| | | |
| | | Record_Config rec = db_c.searchConfigTableWithinServerInfo(); |
| | | |
| | | value["alarm_ip"] = rec.str_alarm_ip.toStdString(); |
| | | value["alarm_port"] = rec.n_alarm_port; |
| | | value["web_pic_ip"] = rec.str_web_pic_ip.toStdString(); |
| | | value["web_pic_port"] = rec.n_web_pic_port; |
| | | value["es_pic_ip"] = rec.str_es_pic_ip.toStdString(); |
| | | value["es_pic_port"] = rec.n_es_pic_port; |
| | | |
| | | std::string out = value.toStyledString(); |
| | | |
| | | return out; |
| | | } |
| | | |
| | | //ç¼è¾ è£åªè§é¢æ¶é¿ |
| | | std::string |
| | | devHttpServer_c::cut_dura_edit(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | bool ret = false; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | int cut_max_duration = value["cut_max_duration"].asInt(); |
| | | |
| | | ret = db_c.updateConfigTableByCutDuration(cut_max_duration); |
| | | |
| | | } else { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | if (ret) { |
| | | killVideoAnalysFromHCApp(); |
| | | sleep(1); |
| | | runAllApp(); |
| | | return "{\"ret_status\": \"ok_ack\"}"; |
| | | } else { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | //æ¥è¯¢ è£åªè§é¢æ¶é¿ |
| | | std::string |
| | | devHttpServer_c::cut_dura_show(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Value value; |
| | | |
| | | int cut_max_duration = db_c.searchConfigTableWithinCutDuration(); |
| | | |
| | | value["cut_max_duration"] = cut_max_duration; |
| | | |
| | | std::string out = value.toStyledString(); |
| | | |
| | | return out; |
| | | } |
| | | |
| | | //è®¾ç½®æ¬æºnetconfig netconfig_edit |
| | | std::string |
| | | devHttpServer_c::netconfig_edit(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | bool ret = false; |
| | | unsigned char ip_old[15] = {0}; |
| | | unsigned char netmask_old[15] = {0}; |
| | | unsigned char gateway_old[15] = {0}; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string ip_addr = value["ipaddr"].asString(); |
| | | std::string netmask = value["netmask"].asString(); |
| | | std::string gateway = value["gateway"].asString(); |
| | | |
| | | //ipaddr |
| | | std::string net_ifname = appConfig.getStringProperty("netIfName"); |
| | | if (!((GetIpAddress(net_ifname.c_str(), ip_old)) && \ |
| | | (GetMaskAddress(net_ifname.c_str(), netmask_old)) && \ |
| | | (GetGateWay(net_ifname.c_str(), gateway_old)))) { |
| | | // return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | std::string ip_old_temp((char *) ip_old); |
| | | std::string netmask_old_temp((char *) netmask_old); |
| | | std::string gateway_old_temp((char *) gateway_old); |
| | | |
| | | if (!((ip_old_temp == ip_addr) && \ |
| | | (netmask_old_temp == netmask) && \ |
| | | (gateway_old_temp == gateway))) { |
| | | if (!((checkip(ip_addr)) && (checkMask(netmask)) && (checkip(gateway)))) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | ret = SetIpAddress(net_ifname.c_str(), ip_addr.c_str()); |
| | | if (!ret) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | ret = SetMaskAddress(net_ifname.c_str(), netmask.c_str()); |
| | | if (!ret) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | ret = SetGateWay(net_ifname.c_str(), gateway_old_temp.c_str(), gateway.c_str()); |
| | | if (!ret) { |
| | | //return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | //#todo /etc/network/interfaces |
| | | //system("sed -i '/tracker_server=/d' ./fastDfsClient.conf && sed -i '/\"host:port\"/atracker_server=192.168.1.188:22122' ./fastDfsClient.conf"); |
| | | // system("sed -i 's/address .*$/address 192.168.1.111/g' test"); |
| | | std::string cmd_ip = |
| | | "sed -i 's/address .*$/address " + ip_addr + "/g' /etc/network/interfaces"; |
| | | std::cout << "cmd_ip:" << cmd_ip << std::endl; |
| | | system(cmd_ip.c_str()); |
| | | |
| | | //ä¿®æ¹config.json |
| | | std::string strtmp = appConfig.getStringProperty("erlNode"); |
| | | std::string::size_type pos = strtmp.find_last_of("@"); |
| | | if (pos != std::string::npos) { |
| | | ++pos;//ä¿çsep '@' |
| | | strtmp.replace(pos, strtmp.size() - pos, ip_addr); |
| | | appConfig.setStringProperty("erlNode", strtmp); |
| | | } |
| | | |
| | | strtmp = appConfig.getStringProperty("erlFatherNode"); |
| | | pos = strtmp.find_last_of("@"); |
| | | if (pos != std::string::npos) { |
| | | ++pos;//ä¿çsep '@' |
| | | strtmp.replace(pos, strtmp.size() - pos, ip_addr); |
| | | appConfig.setStringProperty("erlFatherNode", strtmp); |
| | | } |
| | | //ES_IP |
| | | appConfig.setStringProperty("ES_IP", ip_addr); |
| | | |
| | | strtmp = appConfig.getStringProperty("srsAddr"); |
| | | strtmp.replace(strtmp.begin() + 7, strtmp.begin() + strtmp.find(":1934/live/"), ip_addr); |
| | | appConfig.setStringProperty("srsAddr", strtmp); |
| | | appConfig.save(); |
| | | |
| | | sleep(10); |
| | | system("reboot"); |
| | | } |
| | | } else { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | return "{\"ret_status\": \"ok_ack\"}"; |
| | | } |
| | | |
| | | //æ¥è¯¢ æ¬æºnetconfig netconfig_show |
| | | std::string |
| | | devHttpServer_c::netconfig_show(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | Json::Value value; |
| | | unsigned char netmask_old[15] = {0}; |
| | | unsigned char gateway_old[15] = {0}; |
| | | unsigned char ip_old[15] = {0}; |
| | | |
| | | std::string net_ifname = appConfig.getStringProperty("netIfName"); |
| | | // if (!((GetIpAddress(net_ifname.c_str(), ip_old)) && \ |
| | | // (GetMaskAddress(net_ifname.c_str(), netmask_old)) && \ |
| | | // (GetGateWay(net_ifname.c_str(), gateway_old)))) { |
| | | // return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | // } |
| | | if (GetIpAddress(net_ifname.c_str(), ip_old)) { |
| | | std::string ip_old_temp((char *) ip_old); |
| | | value["ipaddr"] = ip_old_temp; |
| | | } else { |
| | | value["ipaddr"] = ""; |
| | | } |
| | | |
| | | if (GetMaskAddress(net_ifname.c_str(), netmask_old)) { |
| | | std::string netmask_old_temp((char *) netmask_old); |
| | | value["netmask"] = netmask_old_temp; |
| | | } else { |
| | | value["netmask"] = ""; |
| | | } |
| | | |
| | | if (GetGateWay(net_ifname.c_str(), gateway_old)) { |
| | | std::string gateway_old_temp((char *) gateway_old); |
| | | value["gateway"] = gateway_old_temp; |
| | | } else { |
| | | value["gateway"] = ""; |
| | | } |
| | | |
| | | std::string out = value.toStyledString(); |
| | | |
| | | return out; |
| | | } |
| | | |
| | | std::string devHttpServer_c::addNode(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | bool ret = false; |
| | | if (reader.parse(content, value)) { |
| | | |
| | | //#todo nodeName Automatic generated? |
| | | //#todo nodes have counter? |
| | | //#todo nodeName Automatic generated? |
| | | //#todo devId+num |
| | | std::string uuid = GetUUId::getUUID(); |
| | | |
| | | unsigned char ip_old[15] = {0}; |
| | | std::string str_netIfName = appConfig.getStringProperty("netIfName"); |
| | | GetIpAddress(str_netIfName.c_str(), ip_old); |
| | | std::string str_ip((char *) ip_old); |
| | | std::string nodeName = uuid.append("@" + str_ip); |
| | | |
| | | std::string cookie = value["cookie"].asString(); |
| | | std::string FatherNodeName = value["fatherNodeName"].asString(); |
| | | |
| | | //#todo ClusterID ClusterName |
| | | std::string clusterID = value["culID"].asString(); |
| | | clusterID = clusterID.size() > 0 ? clusterID : GetUUId::getUUID(); |
| | | std::string clusterName = value["culName"].asString(); |
| | | std::string devID = value["devID"].asString(); |
| | | std::string devName = value["devName"].asString(); |
| | | |
| | | |
| | | std::string path = std::string("/opt/erlang/").append(nodeName.substr(0, nodeName.find("@"))); |
| | | if (erlangDbTool != nullptr) { |
| | | //gaunbi node |
| | | //clear data |
| | | // erlangDbTool.stop(); |
| | | delete erlangDbTool; |
| | | erlangDbTool = nullptr; |
| | | } |
| | | |
| | | if (cookie.size() > 0 && (clusterID.size() > 0 || clusterName.size() > 0)) { |
| | | // erlangDbTool = new ErlangTool::ErlangDbTool(path, nodeName, cookie); |
| | | string str_tmp = "DataWebserver"; |
| | | erlangDbTool = new ErlangTool::ErlangDbTool(path, nodeName, cookie, clusterID, clusterName, str_tmp); |
| | | bool ret = erlangDbTool->initErlang(); |
| | | FatherNodeName = FatherNodeName.size() > 0 ? FatherNodeName : " "; |
| | | // FatherNodeName = clusterID.size() > 0 ? clusterID : " "; |
| | | ret = erlangDbTool->startNodeDb(FatherNodeName, devID); |
| | | |
| | | if (ret) { |
| | | appConfig.setStringProperty("erlNode", nodeName); |
| | | appConfig.setStringProperty("erlCookie", cookie); |
| | | appConfig.setStringProperty("erlPath", path); |
| | | appConfig.setStringProperty("erlFatherNode", FatherNodeName); |
| | | appConfig.save(); |
| | | // erlangDbTool->findAllNode(); |
| | | //face search server reboot |
| | | killFaceSearchServerApp(); |
| | | runAllApp(); |
| | | // sleep(4); |
| | | } else { |
| | | appConfig.setStringProperty("erlNode", ""); |
| | | appConfig.setStringProperty("erlCookie", ""); |
| | | appConfig.setStringProperty("erlPath", ""); |
| | | appConfig.setStringProperty("erlFatherNode", ""); |
| | | appConfig.save(); |
| | | delete erlangDbTool; |
| | | erlangDbTool = nullptr; |
| | | } |
| | | |
| | | std::string str_result = std::string("{\"result\":").append("\"" + std::to_string(ret) + "\"}"); |
| | | return str_result; |
| | | } else { |
| | | std::string str_result = std::string("{\"result\":").append("\"æ°æ®æè¯¯\"}"); |
| | | return str_result; |
| | | } |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼ \"}"); |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::removeNode(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | bool ret = false; |
| | | |
| | | if (erlangDbTool != nullptr) { |
| | | |
| | | ret = erlangDbTool->removeNode(); |
| | | |
| | | appConfig.setStringProperty("erlNode", ""); |
| | | appConfig.setStringProperty("erlCookie", ""); |
| | | appConfig.setStringProperty("erlPath", ""); |
| | | appConfig.setStringProperty("erlFatherNode", ""); |
| | | appConfig.save(); |
| | | delete erlangDbTool; |
| | | erlangDbTool = nullptr; |
| | | std::string str_result = std::string("{\"result\":").append("\"" + std::to_string(ret) + "\"}"); |
| | | //#todo |
| | | system("pkill beam.*"); |
| | | return str_result; |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨ \"}"); |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | string devHttpServer_c::searchNode(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | if (erlangDbTool == nullptr) { |
| | | ERR("{\"error\":\"èç¹ä¸åå¨ \"}"); |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨ \"}"); |
| | | return ""; |
| | | // return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | // sleep(1); |
| | | auto resu = erlangDbTool->findAllNode(); |
| | | string json = ""; |
| | | if (resu.size() > 0) { |
| | | auto t_itor = resu.begin(); |
| | | m_cluster_id = t_itor->second.cluster_id; |
| | | m_cluster_name = t_itor->second.cluster_name; |
| | | json.append("{ \"cluster_id\":\"" + t_itor->second.cluster_id |
| | | + "\",\"cluster_name\":\"" + t_itor->second.cluster_name + "\",\"list\":["); |
| | | for (auto &item : resu) { |
| | | string subJson = "{ "; |
| | | subJson.append("\"uuid\":\"" + item.second.uuid + "\","); |
| | | subJson.append("\"create_time\":\"" + item.second.create_time + "\","); |
| | | subJson.append("\"dev_id\":\"" + item.second.device_id + "\","); |
| | | //#todo |
| | | auto rec = db_c.searchConfigTableWithinServerInfo(); |
| | | subJson.append("\"dev_name\":\"" + rec.dev_name.toStdString() + "\","); |
| | | |
| | | string t_nodeId = item.second.node_id; |
| | | subJson.append( |
| | | "\"node_ip\":\"" + t_nodeId.substr(t_nodeId.find("@") + 1, t_nodeId.size() - t_nodeId.find("@")) + |
| | | "\","); |
| | | subJson.append("\"node_id\":\"" + item.second.node_id + "\""); |
| | | subJson.append("},"); |
| | | json.append(subJson); |
| | | } |
| | | auto str = json.substr(0, json.size() - 1); |
| | | str.append("]}"); |
| | | DBG(str); |
| | | return str; |
| | | } else { |
| | | ERR("resu is null"); |
| | | // response->write(SimpleWeb::StatusCode::err_erlNodeIsNull, "{\"error\":\"err_erlNodeIsNull \"}"); |
| | | return "{}"; |
| | | } |
| | | } |
| | | |
| | | string devHttpServer_c::modifyCluName(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨ \"}"); |
| | | return ""; |
| | | return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | // bool ret = false; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string cluster_id = value["cluster_id"].asString(); |
| | | std::string cluster_name = value["cluster_name"].asString(); |
| | | bool ret = false; |
| | | if (cluster_id.size() <= 0 || cluster_name.size() <= 0) { |
| | | return "{\"error\":\"åæ°é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | ret = erlangDbTool->modifyCluName(cluster_id, cluster_name); |
| | | |
| | | std::string str_result = std::string("{\"result\":").append("\"" + std::to_string(ret) + "\"}"); |
| | | return str_result; |
| | | |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼ \"}"); |
| | | return ""; |
| | | return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::createDatabase(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨ \"}"); |
| | | return ""; |
| | | return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | // bool ret = false; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string TableType = value["TableType"].asString(); |
| | | std::string TableName = value["TableName"].asString(); |
| | | int SyncType = atoi(value["SyncType"].asCString()); |
| | | std::string BwType = value["BwType"].asString(); |
| | | std::string StartTime = value["StartTime"].asString(); |
| | | std::string EndTime = value["EndTime"].asString(); |
| | | bool ret = false; |
| | | if (SyncType == 1) { |
| | | //åæ¥åº |
| | | ret = erlangDbTool->createDatabase(TableType, TableName, SyncType, BwType, StartTime, EndTime); |
| | | } else if (SyncType == 0) { |
| | | TableName.insert(0, "lt_"); |
| | | //æ¬å°åº |
| | | FieldValues fieldValues; |
| | | fieldValues.insert(std::make_pair("uuid", GetUUId::getUUID())); |
| | | fieldValues.insert(std::make_pair("tableName", TableName)); |
| | | fieldValues.insert(std::make_pair("tableDesc", "ceshi")); |
| | | fieldValues.insert(std::make_pair("tableType", TableType)); |
| | | fieldValues.insert(std::make_pair("bwType", BwType)); |
| | | fieldValues.insert(std::make_pair("startTime", StartTime)); |
| | | fieldValues.insert(std::make_pair("endTime", EndTime)); |
| | | fieldValues.insert(std::make_pair("create_by", "who")); |
| | | ret = m_SqliteFaceEncap.createTable(TableName, fieldValues); |
| | | } |
| | | |
| | | erlangDbTool->sendMessage(); |
| | | std::string str_result = std::string("{\"result\":").append("\"" + std::to_string(ret) + "\"}"); |
| | | return str_result; |
| | | |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼ \"}"); |
| | | return ""; |
| | | return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::deleteDatabase(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨ \"}"); |
| | | return ""; |
| | | return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | // bool ret = false; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string uuid = value["uuid"].asString(); |
| | | std::string TableType = value["TableType"].asString(); |
| | | std::string TableName = value["TableName"].asString(); |
| | | int SyncType = atoi(value["SyncType"].asCString()); |
| | | |
| | | bool ret = false; |
| | | if (SyncType == 1) { |
| | | //åæ¥åº |
| | | ret = erlangDbTool->deleteDatabase(TableType, TableName, SyncType); |
| | | } else if (SyncType == 0) { |
| | | //æ¬å°åº |
| | | if (TableName.find("lt_") != 0) { |
| | | TableName.insert(0, "lt_"); |
| | | } |
| | | ret = m_SqliteFaceEncap.deleteTable(TableName); |
| | | } |
| | | erlangDbTool->sendMessage(); |
| | | std::string str_result = std::string("{\"result\":").append("\"" + std::to_string(ret) + "\"}"); |
| | | return str_result; |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼ \"}"); |
| | | return ""; |
| | | return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::findAllDatabase(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨ \"}"); |
| | | return ""; |
| | | return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | auto resDB = erlangDbTool->findAllDatabase(); |
| | | auto si = resDB.size(); |
| | | if (resDB.size() > 0) { |
| | | // auto resType = erlangDbTool->findAllTypeInfo(); |
| | | string json = "["; |
| | | for (auto &item : resDB) { |
| | | if (item.second.tableName.find("lt_") == 0) { |
| | | continue; |
| | | } |
| | | string subJson = "{ "; |
| | | subJson.append("\"uuid\":\"" + item.second.uuid + "\","); |
| | | subJson.append("\"tableName\":\"" + item.second.tableName + "\","); |
| | | subJson.append("\"tableType\":\"" + item.second.tableType + "\","); |
| | | // subJson.append("\"bwType\":\"" + resType[item.second.tableName].bwType + "\","); |
| | | subJson.append("\"bwType\":\"" + item.second.bwType + "\","); |
| | | //#todo modify |
| | | subJson.append("\"start_time\":\"" + item.second.startTime + "\","); |
| | | subJson.append("\"end_time\":\"" + item.second.endTime + "\""); |
| | | subJson.append("},"); |
| | | json.append(subJson); |
| | | } |
| | | |
| | | auto str = json.substr(0, json.size() - 1); |
| | | if (str.size() <= 1) |
| | | return "[]"; |
| | | str.append("]"); |
| | | return str; |
| | | } else { |
| | | // response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"size is 0 \"}"); |
| | | // return ""; |
| | | return "[]"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::findLocalDatabase(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨\"}"); |
| | | return ""; |
| | | return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | string str_local = "lt_"; |
| | | // auto resDB = erlangDbTool->findAllDatabase(); |
| | | // auto si = resDB.size(); |
| | | |
| | | auto resDB = m_SqliteFaceEncap.getTableInfos(); |
| | | |
| | | if (resDB.size() > 0) { |
| | | string json = "["; |
| | | for (auto &item : resDB) { |
| | | string subJson = "{ "; |
| | | subJson.append("\"uuid\":\"" + item.uuid + "\","); |
| | | subJson.append("\"tableName\":\"" + item.tableName + "\","); |
| | | subJson.append("\"tableType\":\"" + item.tableType + "\","); |
| | | subJson.append("\"bwType\":\"" + item.bwType + "\","); |
| | | subJson.append("\"start_time\":\"" + item.startTime + "\","); |
| | | subJson.append("\"end_time\":\"" + item.endTime + "\""); |
| | | subJson.append("},"); |
| | | json.append(subJson); |
| | | } |
| | | auto str = json.substr(0, json.size() - 1); |
| | | if (str.size() <= 1) |
| | | return "[]"; |
| | | str.append("]"); |
| | | return str; |
| | | } else { |
| | | // response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"size is 0\"}"); |
| | | // return ""; |
| | | return "[]"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::addPerson(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | // DBG("content: " << content); |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string TableName = value["TableName"].asString(); |
| | | std::string img_url = value["img_url"].asString(); |
| | | auto tests = value["img_base64"].size(); |
| | | auto ret = value["img_base64"].isString(); |
| | | |
| | | std::string img_base64 = value["img_base64"].asString(); |
| | | std::string idcard = value["idcard"].asString(); |
| | | std::string strUUID = value["uuid"].asString(); |
| | | |
| | | cv::Mat image; |
| | | if (img_url.size() > 0) { |
| | | auto t_results = m_curlDownloadImg.download_jpeg(const_cast<char *>(img_url.c_str())); |
| | | cvutil.buffer2CvMat(t_results.buffer, image); |
| | | } else if (img_base64.size() > 0) { |
| | | img_url = "http://"; |
| | | auto str_img = base64.Decode(img_base64.c_str(), img_base64.size()); |
| | | std::vector<unsigned char> buffer(str_img.size()); |
| | | memcpy(buffer.data(), str_img.data(), str_img.size()); |
| | | cvutil.buffer2CvMat(buffer, image); |
| | | |
| | | |
| | | fdfsClient.rwLock.rdlock(); |
| | | if (fdfsClient.fastFds != nullptr) { |
| | | img_url.append(fdfsClient.fastFds->getIp() + "/"); |
| | | std::string t_strImg = ""; |
| | | if (!fdfsClient.fastFds->uploadFile(buffer, t_strImg, "jpg")) { |
| | | img_url = "upload image fail"; |
| | | } else { |
| | | img_url.append(t_strImg); |
| | | img_url.clear(); |
| | | img_url = t_strImg; |
| | | // img_url.append("/").append(t_strImg); |
| | | } |
| | | } |
| | | fdfsClient.rwLock.unlock(); |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"not found img\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"not found img\"}"; |
| | | } |
| | | |
| | | thread::id pid = std::this_thread::get_id(); |
| | | if (m_handleMap[pid] == nullptr) { |
| | | DBG("pid is " << pid); |
| | | m_handleMap[pid] = new CasiaFaceWrapperN; |
| | | } |
| | | CasiaFaceWrapperN *t_CasiaFaceWapper = m_handleMap[pid]; |
| | | |
| | | std::string feature_base64; |
| | | FaceImageN faceImage{image.cols, image.rows, image.step, image.data}; |
| | | auto faceResults = t_CasiaFaceWapper->extractFace(faceImage); |
| | | |
| | | if (faceResults.size() <= 0) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"not found face\"}"); |
| | | // string str_path = "./img/"; |
| | | // str_path.append(AppUtil::getTimeString() + ".jpg"); |
| | | // cv::imwrite(str_path, image); |
| | | return ""; |
| | | // return "{\"error\":\"not found face\"}"; |
| | | } |
| | | |
| | | for (auto &item : faceResults) { |
| | | feature_base64 = base64.Encode(item.feature.data(), item.feature.size()); |
| | | } |
| | | auto size = feature_base64.size(); |
| | | // std::string uuid = ""; |
| | | bool ret_addPerson = false; |
| | | |
| | | if (TableName.find("lt_") == 0) { |
| | | FieldValues fieldValues; |
| | | AddFaceData addFaceData; |
| | | addFaceData.feature.resize(faceResults[0].feature.size()); |
| | | memcpy(addFaceData.feature.data(), faceResults[0].feature.data(), faceResults[0].feature.size()); |
| | | |
| | | //#todo uuid have value is update |
| | | if (strUUID.size() <= 0) { |
| | | // get Person id |
| | | |
| | | strUUID = AppUtil::getPersonId(m_batch, m_SerialNumber); |
| | | addFaceData.uuid = strUUID; |
| | | addFaceData.faceUrl = img_url; |
| | | |
| | | fieldValues.insert(std::make_pair("uuid", strUUID)); |
| | | fieldValues.insert(std::make_pair("idCard", idcard)); |
| | | auto t_id = m_SqliteFaceEncap.addFace(TableName, addFaceData, fieldValues); |
| | | ret_addPerson = t_id.size() > 0 ? true : false; |
| | | } else { |
| | | //#todo update table |
| | | addFaceData.uuid = strUUID; |
| | | addFaceData.faceUrl = img_url; |
| | | |
| | | fieldValues.insert(std::make_pair("uuid", strUUID)); |
| | | fieldValues.insert(std::make_pair("idCard", idcard)); |
| | | m_SqliteFaceEncap.updateFace(TableName, addFaceData, fieldValues); |
| | | } |
| | | |
| | | } else { |
| | | //#todo update data |
| | | // get Person id |
| | | strUUID = strUUID.size() > 0 ? strUUID : AppUtil::getPersonId(m_batch, m_SerialNumber); |
| | | ret_addPerson = erlangDbTool->addPerson(strUUID, TableName, feature_base64, img_url, idcard); |
| | | } |
| | | |
| | | if (ret_addPerson && strUUID.size() > 0) { |
| | | std::string str_result = std::string("{\"uuid\":").append( |
| | | "\"" + strUUID + "\",\"img_url\":\"" + img_url + "\"}"); |
| | | // usleep(100); |
| | | erlangDbTool->sendMessage(); |
| | | //todo send person to backServer |
| | | HttpRequestWithCrul m_requestWithCrul; |
| | | |
| | | std::thread sendPerson([&](std::string parm_uuid, std::string parm_img_url, std::string parm_idcard, |
| | | std::string parm_fea) { |
| | | Json::Value perInfos; |
| | | Json::Value perInfo; |
| | | // #todo get string from config.json file |
| | | // get |
| | | perInfo["id"] = parm_uuid; |
| | | perInfo["distributionIds"] = m_cluster_id; |
| | | perInfo["distributionNames"] = m_cluster_name; |
| | | auto rec = db_c.searchConfigTableWithinServerInfo(); |
| | | perInfo["deviceId"] = rec.dev_id.toStdString(); |
| | | perInfo["photos"] = parm_img_url; |
| | | // perInfo["featureBase"] = feature_base64; |
| | | perInfo["featureBase64"] = parm_fea; |
| | | perInfo["cardId"] = parm_idcard; |
| | | perInfos.append(perInfo); |
| | | |
| | | std::string str_serIp = GET_STR_CONFIG("mainServerIp"); |
| | | std::string str_serPort = GET_STR_CONFIG("mainServerPort"); |
| | | |
| | | // string sendUrl = "192.168.1.203:3697/addPerson/uploadToTemporary"; |
| | | string sendUrl = str_serIp; |
| | | sendUrl.append(":").append(str_serPort).append("/addPerson/uploadToTemporary"); |
| | | string postParams = perInfos.toStyledString(); |
| | | string str_addRes; |
| | | |
| | | m_requestWithCrul.curl_post_req(sendUrl, postParams, str_addRes); |
| | | }, strUUID, img_url, idcard, feature_base64); |
| | | sendPerson.detach(); |
| | | |
| | | return str_result; |
| | | } else { |
| | | std::string str_result = std::string("{\"error\":\"addPerson error\"}"); |
| | | return str_result; |
| | | } |
| | | |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::loadFaceFeaData(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string TableName = value["TableName"].asString(); |
| | | |
| | | |
| | | if (TableName.find("lt_") == 0) { |
| | | auto t_resDB = m_SqliteFaceEncap.getFacesFromTable(TableName); |
| | | auto t_faceInfoCache = m_SqliteFaceEncap.getFaceInfoFromTable(TableName); |
| | | |
| | | auto &resDB = *t_resDB; |
| | | if (resDB.size() > 0) { |
| | | string json = "["; |
| | | for (auto &item : resDB) { |
| | | string subJson = "{ "; |
| | | subJson.append("\"uuid\":\"" + item.second.uuid + "\","); |
| | | subJson.append("\"tableName\":\"" + TableName + "\","); |
| | | subJson.append("\"idcard\":\"" + t_faceInfoCache[item.second.uuid].idCard + "\","); |
| | | subJson.append("\"imgUrl\":\"" + item.second.faceurl + "\""); |
| | | // subJson.append("\"feature\":\"" + item.second.feature + "\","); |
| | | //#todo modifysvn upda svn comm |
| | | // subJson.append("\"start_time\":\"" + item.second.create_time + "\","); |
| | | // subJson.append("\"end_time\":\"" + item.second.update_time + "\""); |
| | | subJson.append("},"); |
| | | json.append(subJson); |
| | | } |
| | | auto str = json.substr(0, json.size() - 1); |
| | | str.append("]"); |
| | | return str; |
| | | } |
| | | } else { |
| | | auto resDB = erlangDbTool->loadFaceFeaData2(TableName); |
| | | if (resDB.size() > 0) { |
| | | string json = "["; |
| | | for (auto &item : resDB) { |
| | | string subJson = "{ "; |
| | | subJson.append("\"uuid\":\"" + item.second.id + "\","); |
| | | subJson.append("\"tableName\":\"" + TableName + "\","); |
| | | subJson.append("\"idcard\":\"" + item.second.idcard + "\","); |
| | | subJson.append("\"imgUrl\":\"" + item.second.img + "\""); |
| | | // subJson.append("\"feature\":\"" + item.second.feature + "\","); |
| | | //#todo modifysvn upda svn comm |
| | | // subJson.append("\"start_time\":\"" + item.second.create_time + "\","); |
| | | // subJson.append("\"end_time\":\"" + item.second.update_time + "\""); |
| | | subJson.append("},"); |
| | | json.append(subJson); |
| | | } |
| | | auto str = json.substr(0, json.size() - 1); |
| | | str.append("]"); |
| | | return str; |
| | | } |
| | | } |
| | | |
| | | |
| | | // response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"size is 0\"}"); |
| | | // return ""; |
| | | return "[]"; |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::updateDatabase(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨\"}"); |
| | | return ""; |
| | | return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | // bool ret = false; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string Uuid = value["uuid"].asString(); |
| | | std::string TableType = value["TableType"].asString(); |
| | | std::string TableName = value["TableName"].asString(); |
| | | int SyncType = atoi(value["SyncType"].asCString()); |
| | | std::string BwType = value["BwType"].asString(); |
| | | std::string StartTime = value["StartTime"].asString(); |
| | | std::string EndTime = value["EndTime"].asString(); |
| | | |
| | | bool ret = false; |
| | | if (SyncType == 1) { |
| | | //åæ¥åº |
| | | ret = erlangDbTool->updateDatabase(Uuid, TableType, TableName, SyncType, BwType, StartTime, EndTime); |
| | | } else if (SyncType == 0) { |
| | | //æ¬å°åº |
| | | //#æ´æ°åºåºç®¡ç表 |
| | | FieldValues fieldValues; |
| | | fieldValues.insert(std::make_pair("uuid", Uuid)); |
| | | if (TableName.find("lt_") != 0) { |
| | | TableName.insert(0, "lt_"); |
| | | } |
| | | fieldValues.insert(std::make_pair("tableName", TableName)); |
| | | // fieldValues.insert(std::make_pair("tableDesc", "ceshi2")); |
| | | fieldValues.insert(std::make_pair("tableType", TableType)); |
| | | fieldValues.insert(std::make_pair("bwType", BwType)); |
| | | fieldValues.insert(std::make_pair("startTime", StartTime)); |
| | | fieldValues.insert(std::make_pair("endTime", EndTime)); |
| | | // fieldValues.insert(std::make_pair("create_by", "who")); |
| | | ret = m_SqliteFaceEncap.updateTable("sys_o_tables", fieldValues); |
| | | } |
| | | |
| | | erlangDbTool->sendMessage(); |
| | | std::string str_result = std::string("{\"result\":").append("\"" + std::to_string(ret) + "\"}"); |
| | | return str_result; |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"); |
| | | return ""; |
| | | return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::delPerson(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string TableName = value["TableName"].asString(); |
| | | std::string strUUID = value["uuid"].asString(); |
| | | |
| | | bool ret = false; |
| | | if (TableName.find("lt_") == 0) { |
| | | ret = m_SqliteFaceEncap.deleteFace(TableName, strUUID); |
| | | } else { |
| | | ret = erlangDbTool->delPerson(strUUID, TableName); |
| | | } |
| | | |
| | | erlangDbTool->sendMessage(); |
| | | std::string str_result = std::string("{\"result\":").append("\"" + std::to_string(ret) + "\"}"); |
| | | return str_result; |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::getAlarmImageFromVideoFile(std::string ip, unsigned int port, std::string content, |
| | | PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | try { |
| | | if (reader.parse(content, value)) { |
| | | std::string videoPath; |
| | | std::string devId = value["videoNum"].asString(); |
| | | std::string picDate = value["picDate"].asString(); |
| | | |
| | | //std::string path_uuid = videoPath;//value["path_uuid"].asString(); |
| | | qint64 sub ; |
| | | std::string path = getVideoPathByTime(picDate,devId,sub); |
| | | |
| | | if (path.empty()) { |
| | | ERR("{\"error\":\"not find path\"}"); |
| | | return "{\"error\":\"æªæ¥å°è§é¢è·¯å¾\"}"; |
| | | } |
| | | DBG("path="<<path); |
| | | videoPath.clear(); |
| | | videoPath = path; |
| | | |
| | | |
| | | |
| | | // sub = (dt.toMSecsSinceEpoch() - dtFile.toMSecsSinceEpoch()); |
| | | //#yanchi buchong |
| | | // sub = sub > 3000 ? sub - 3000 : 0000; |
| | | //shijian yuejie buchang |
| | | // sub = sub < 0 ? 0000 : sub; |
| | | int haomiao = sub % 1000; |
| | | sub /= 1000; |
| | | int m = sub; |
| | | int shi, fen, miao; |
| | | char ch_time[128]; |
| | | if (m / 3600 < 24) { |
| | | shi = m / 3600; |
| | | fen = m / 60 % 60; |
| | | miao = m % 60; |
| | | sprintf(ch_time, "%02d:%02d:%02d.%03d", shi, fen, miao, haomiao); |
| | | cout << ch_time << endl; |
| | | } else printf("è¾å
¥æ°å¼å¤ªå¤§"); |
| | | |
| | | std::string str_time(ch_time); |
| | | //#todo æç
§æ¶é´å½å |
| | | std::string str_imgName(AppUtil::getTimeString() + ".jpg");// = "test.jpg"; |
| | | |
| | | std::string cmd_getVideoFileTime( |
| | | " ffmpeg -i '" + videoPath + "' 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//"); |
| | | |
| | | std::string str_tmpTime = AppUtil::getCmdResult(cmd_getVideoFileTime); |
| | | |
| | | if (str_time > str_tmpTime) { |
| | | ERR("{\"error\":\"Time error\"}" << str_time << " str_tmpTime " << str_tmpTime); |
| | | str_time = str_tmpTime.size() > 0 ? str_tmpTime.substr(0, str_tmpTime.rfind(".")) : str_time; |
| | | // return "{\"error\":\"Time error\"}"; |
| | | } |
| | | |
| | | std::string cmd("ffmpeg -ss " + str_time + " -i '" + videoPath + "' -y '" + str_imgName + "'"); |
| | | DBG(cmd); |
| | | system(cmd.c_str()); |
| | | |
| | | cv::Mat img = cv::imread(str_imgName); |
| | | if (img.empty()) { |
| | | ERR("{\"error\":\"Video File error\"}"); |
| | | return "{\"error\":\"è§é¢æä»¶é误\"}"; |
| | | } |
| | | std::vector<unsigned char> buffer; |
| | | CvUtil::cvMat2Buffer(img, buffer); |
| | | std::string img_url = "http://"; |
| | | fdfsClient.rwLock.rdlock(); |
| | | if (fdfsClient.fastFds != nullptr) { |
| | | img_url.append(fdfsClient.fastFds->getIp() + "/"); |
| | | std::string t_strImg = ""; |
| | | if (!fdfsClient.fastFds->uploadFile(buffer, t_strImg, "jpg")) { |
| | | img_url = "upload image fail"; |
| | | } else { |
| | | std::string str_tmp_cmd("rm -f '" + str_imgName + "'"); |
| | | system(str_tmp_cmd.c_str()); |
| | | img_url.append(t_strImg); |
| | | img_url.clear(); |
| | | img_url = t_strImg; |
| | | // img_url.append("/").append(t_strImg); |
| | | } |
| | | } |
| | | fdfsClient.rwLock.unlock(); |
| | | std::string result("{\"img_url\":\"" + img_url + "\"}"); |
| | | // cout << result << endl; |
| | | return result; |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | catch (std::exception ex) { |
| | | std::string message = "{\"error\":\"å¼å¸¸é误ï¼"; |
| | | message.append(const_cast<char *>(ex.what())).append("\"}"); |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, message); |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | std::string |
| | | devHttpServer_c::getRecordVideoPath(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) |
| | | { |
| | | std::string devId = value["videoNum"].asString(); |
| | | std::string picDate = value["picDate"].asString(); |
| | | qint64 sub; |
| | | std::string path=getVideoPathByTime(picDate,devId,sub); |
| | | if (path.empty()) |
| | | { |
| | | |
| | | return "{\"ret_status\":\"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | else |
| | | { |
| | | std::string result = "{\"file_path\":\"" + path + "\"}"; |
| | | return result; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return "{\"ret_status\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string devHttpServer_c::findDevId(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | |
| | | Record_Config rc = db_c.searchConfigTableWithinServerInfo(); |
| | | |
| | | Json::Value value; |
| | | value["dev_id"] = rc.dev_id.toStdString(); |
| | | value["dev_name"] = rc.dev_name.toStdString(); |
| | | |
| | | return value.toStyledString(); |
| | | |
| | | } |
| | | |
| | | std::string devHttpServer_c::editDevName(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string dev_name = value["dev_name"].asString(); |
| | | if (dev_name.empty()) { |
| | | return "{\"ret_status\":\"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | if (db_c.updateDevNameConfigTable(QString::fromStdString(dev_name))) { |
| | | return "{\"ret_status\": \"ok_ack\"}"; |
| | | } else { |
| | | return "{\"ret_status\":\"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | } else { |
| | | return "{\"ret_status\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | std::string devHttpServer_c::editDevId(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | //DSVAD010120181114 |
| | | int dev_batch = value["dev_batch"].asInt(); |
| | | int dev_sequence = value["dev_sequence"].asInt(); |
| | | if (createDevId(dev_batch, dev_sequence)) { |
| | | return "{\"ret_status\": \"ok_ack\"}"; |
| | | } else { |
| | | return "{\"ret_status\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | } else { |
| | | return "{\"ret_status\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | } |
| | | |
| | | bool devHttpServer_c::createDevId(const int &dev_batch, const int &dev_sequence) { |
| | | // std::string dev_id="DSVAD"; |
| | | char buf[12] = {0}; |
| | | char dev_id[17] = {0}; |
| | | |
| | | time_t cur = time(nullptr); |
| | | |
| | | strftime(buf, 12, "%Y%m%d", localtime(&cur)); |
| | | sprintf(dev_id, "%s%02d%02d%s", "DSVAD", dev_batch, dev_sequence, buf); |
| | | |
| | | |
| | | if (strlen(dev_id) != 17) { |
| | | return false; |
| | | } |
| | | |
| | | appConfig.setStringProperty("DEV_ID", dev_id); |
| | | appConfig.save(); |
| | | //std::cout<<dev_id<<std::endl; |
| | | return true; |
| | | } |
| | | |
| | | std::string devHttpServer_c::getVideoPathByTime(const std::string& time,const std::string& camId,qint64& sub) |
| | | { |
| | | std::string t_FilePath = appConfig.getStringProperty("cutPath"); |
| | | |
| | | bool find=false;; |
| | | if (t_FilePath.back() != '/') { |
| | | t_FilePath.push_back('/'); |
| | | } |
| | | |
| | | QDateTime dt = QDateTime::fromString(QString::fromStdString(time), "yyyy-MM-dd hh:mm:ss:zzz"); |
| | | |
| | | std::string t_strTime=dt.toString("yyyyMMddhh").toStdString(); |
| | | //# ./camIndex/YYYYMM/DD/ |
| | | t_FilePath.append(camId + "/" + t_strTime.substr(0, 6)+ "/" +t_strTime.substr(6, 2) + "/"); |
| | | //YYYYMMDDHH |
| | | t_FilePath.append(t_strTime.substr(0,10) + "/"); |
| | | |
| | | |
| | | qint64 t=dt.toMSecsSinceEpoch(); |
| | | std::vector<std::string> vec=forEachFile(t_FilePath); |
| | | std::sort(vec.begin(),vec.end()); |
| | | DBG("t_FilePath" << t_FilePath); |
| | | DBG("vec.size()" << vec.size()); |
| | | int size=vec.size(); |
| | | for(int i=0;i<size;++i) |
| | | { |
| | | qint64 t1=QDateTime::fromString(QString::fromStdString(vec[i]), "yyyy-MM-dd hh:mm:ss:zzz").toMSecsSinceEpoch(); |
| | | if(i+1<size) |
| | | { |
| | | qint64 t2=QDateTime::fromString(QString::fromStdString(vec[i+1]), "yyyy-MM-dd hh:mm:ss:zzz").toMSecsSinceEpoch(); |
| | | if(t>=t1 && t<t2) |
| | | { |
| | | DBG("path="<<vec[i]); |
| | | t_FilePath+=vec[i]+".mp4"; |
| | | sub=t-t1; |
| | | find=true; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | sub=t-t1; |
| | | if(t>=t1 && sub<=3000) |
| | | { |
| | | DBG("path="<<vec[i]); |
| | | t_FilePath+=vec[i]+".mp4"; |
| | | find=true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | DBG("sub="<<sub); |
| | | if(!find) |
| | | { |
| | | t_FilePath=""; |
| | | } |
| | | return t_FilePath; |
| | | |
| | | } |
| | | std::vector<std::string> devHttpServer_c::forEachFile(const std::string &dir_name) |
| | | { |
| | | std::vector<std::string> v; |
| | | auto dir = opendir(dir_name.data()); |
| | | struct dirent *ent; |
| | | int len = 0; |
| | | if (dir) { |
| | | while ((ent = readdir(dir)) != NULL) { |
| | | std::string filename = std::string(ent->d_name); |
| | | std::string temp; |
| | | if(filename!="."&&filename!="..") |
| | | { |
| | | |
| | | temp = filename.substr(0, filename.rfind('.')); |
| | | v.push_back(temp); |
| | | } |
| | | |
| | | } |
| | | closedir(dir); |
| | | } |
| | | return v; |
| | | } |
| | | |
| | | std::string devHttpServer_c::addPersons(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | // DBG("content: " << content); |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | string strUUID = value["uuid"].asString(); |
| | | auto perlists = value["personList"]; |
| | | |
| | | std::vector<SyncDB::AddPersonInfo> tmpPers; |
| | | // int lsize = perlists.size(); |
| | | for (auto &item : perlists) { |
| | | SyncDB::AddPersonInfo addPersonInfo; |
| | | addPersonInfo.personid = item["personId"].asString(); |
| | | addPersonInfo.idcard = item["idcard"].asString(); |
| | | addPersonInfo.personPic = item["personPic"].asString(); |
| | | addPersonInfo.feature = item["feature"].asString(); |
| | | tmpPers.push_back(addPersonInfo); |
| | | } |
| | | |
| | | auto ret_addPersons = erlangDbTool->addPersons(strUUID, tmpPers); |
| | | |
| | | std::string str_result; |
| | | if (ret_addPersons.size() > 0) { |
| | | str_result = "["; |
| | | for (auto &item : ret_addPersons) { |
| | | string subJson = "{ "; |
| | | subJson.append("\"personId\":\"" + item.PersonId + "\","); |
| | | subJson.append("\"result\":\"" + item.Result + "\","); |
| | | subJson.append("\"msg\":\"" + item.msg + "\""); |
| | | subJson.append("},"); |
| | | str_result.append(subJson); |
| | | } |
| | | auto str = str_result.substr(0, str_result.size() - 1); |
| | | str_result.swap(str.append("]")); |
| | | erlangDbTool->sendMessage(); |
| | | } else { |
| | | str_result = "[]"; |
| | | } |
| | | return str_result; |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string |
| | | devHttpServer_c::personIsExists(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string str_res; |
| | | try { |
| | | string strUUID = value["personId"].asString(); |
| | | //#todo è¿æ¥å¤±è´¥ç夿. |
| | | auto ret_resPerEits = erlangDbTool->personIsExistOnClu(strUUID); |
| | | std::string str_result = "["; |
| | | if (ret_resPerEits.size() > 0) { |
| | | for (auto &item : ret_resPerEits) { |
| | | // tableName ,uuid æ æ¤äººæ¯id为null |
| | | if (item.uuid == "null") { |
| | | continue; |
| | | } |
| | | string subJson = "{ "; |
| | | subJson.append("\"tableName\":\"" + item.tableName + "\","); |
| | | subJson.append("\"uuid\":\"" + item.tableUuid + "\""); |
| | | subJson.append("},"); |
| | | str_result.append(subJson); |
| | | } |
| | | auto str = str_result.substr(0, str_result.size() - 1); |
| | | if (str.size() <= 1) { |
| | | str_result = "[]"; |
| | | } else { |
| | | str_result.swap(str.append("]")); |
| | | } |
| | | } else { |
| | | str_result = "[]"; |
| | | } |
| | | if (str_result == "[]") { |
| | | str_res = "{\"result\":\"0\",\"msg\":\"success\",\"existDataBase\":[]}"; |
| | | } else { |
| | | str_res = "{\"result\":\"1\",\"msg\":\"success\",\"existDataBase\":"; |
| | | str_res.append(str_result).append("}"); |
| | | } |
| | | } catch (std::exception ex) { |
| | | str_res = "{\"result\":\"-1\",\"msg\":\"error\",\"existDataBase\":[]}"; |
| | | ERR(ex.what()); |
| | | } |
| | | return str_res; |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | |
| | | std::string |
| | | devHttpServer_c::updatePersonByOldId(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | | DBG("content: " << content); |
| | | if (erlangDbTool == nullptr) { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"èç¹ä¸åå¨\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"erlang is null\"}"; |
| | | } |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(content, value)) { |
| | | std::string str_res; |
| | | try { |
| | | string newPerId = value["newPerId"].asString(); |
| | | string idcard = value["idcard"].asString(); |
| | | string perPicUrl = value["perPicUrl"].asString(); |
| | | string oldId = value["oldId"].asString(); |
| | | string perFea = value["feature"].asString(); |
| | | //#todo è¿æ¥å¤±è´¥ç夿. |
| | | auto ret_resUpdPersRet = erlangDbTool->singlePersonUpdate(newPerId, oldId, idcard, perPicUrl, perFea); |
| | | std::string str_result = "["; |
| | | int notexist_conNum = 0; |
| | | if (ret_resUpdPersRet.size() > 0) { |
| | | for (auto &item : ret_resUpdPersRet) { |
| | | // tableName ,uuid æ æ¤äººæ¯id为null |
| | | if (item.result == "true") { |
| | | continue; |
| | | } |
| | | if (item.result == "notexist") { |
| | | notexist_conNum++; |
| | | continue; |
| | | } |
| | | |
| | | string subJson = "{ "; |
| | | subJson.append("\"tableName\":\"" + item.tableName + "\","); |
| | | subJson.append("\"uuid\":\"" + item.tableUuid + "\""); |
| | | subJson.append("},"); |
| | | str_result.append(subJson); |
| | | } |
| | | auto str = str_result.substr(0, str_result.size() - 1); |
| | | if (str.size() <= 1) { |
| | | str_result = "[]"; |
| | | } else { |
| | | str_result.swap(str.append("]")); |
| | | } |
| | | } else { |
| | | str_result = "error"; |
| | | } |
| | | if (str_result == "[]") { |
| | | if (notexist_conNum == ret_resUpdPersRet.size()) { |
| | | str_res = "{\"result\":\"0\",\"msg\":\"success\",\"existDataBase\":[]}"; |
| | | } else { |
| | | str_res = "{\"result\":\"1\",\"msg\":\"success\",\"existDataBase\":[]}"; |
| | | } |
| | | } else if (str_result == "error") { |
| | | str_res = "{\"result\":\"-1\",\"msg\":\"error\",\"existDataBase\":[]}"; |
| | | } else { |
| | | str_res = "{\"result\":\"-1\",\"msg\":\"success\",\"existDataBase\":"; |
| | | str_res.append(str_result).append("}"); |
| | | } |
| | | } catch (std::exception ex) { |
| | | str_res = "{\"result\":\"-1\",\"msg\":\"error\",\"existDataBase\":[]}"; |
| | | ERR(ex.what()); |
| | | } |
| | | return str_res; |
| | | } else { |
| | | response->write(SimpleWeb::StatusCode::server_error_not_implemented, "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"); |
| | | return ""; |
| | | // return "{\"error\":\"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| New file |
| | |
| | | #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 |
| New file |
| | |
| | | #include "client_http.hpp" |
| | | #include "server_http.hpp" |
| | | |
| | | // Added for the json-example |
| | | #define BOOST_SPIRIT_THREADSAFE |
| | | |
| | | #include <boost/property_tree/json_parser.hpp> |
| | | #include <boost/property_tree/ptree.hpp> |
| | | |
| | | // Added for the default_resource example |
| | | #include <algorithm> |
| | | #include <boost/filesystem.hpp> |
| | | #include <fstream> |
| | | #include <vector> |
| | | |
| | | #ifdef HAVE_OPENSSL |
| | | |
| | | #include "crypto.hpp" |
| | | |
| | | #endif |
| | | |
| | | using namespace std; |
| | | // Added for the json-example: |
| | | using namespace boost::property_tree; |
| | | |
| | | using HttpServer = SimpleWeb::Server<SimpleWeb::HTTP>; |
| | | using HttpClient = SimpleWeb::Client<SimpleWeb::HTTP>; |
| | | |
| | | int main() { |
| | | // HTTP-server at port 8080 using 1 thread |
| | | // Unless you do more heavy non-threaded processing in the resources, |
| | | // 1 thread is usually faster than several threads |
| | | HttpServer server; |
| | | server.config.thread_pool_size |
| | | server.config.address = "192.168.188.128"; |
| | | server.config.port = 8090; |
| | | |
| | | // Add resources using path-regex and method-string, and an anonymous function |
| | | // POST-example for the path /string, responds the posted string |
| | | server.resource["^/string$"]["POST"] = [](shared_ptr<HttpServer::Response> response, |
| | | shared_ptr<HttpServer::Request> request) { |
| | | // Retrieve string: |
| | | auto content = request->content.string(); |
| | | // request->content.string() is a convenience function for: |
| | | // stringstream ss; |
| | | // ss << request->content.rdbuf(); |
| | | // auto content=ss.str(); |
| | | |
| | | *response << "HTTP/1.1 200 OK\r\nContent-Length: " << content.length() << "\r\n\r\n" |
| | | << content; |
| | | |
| | | |
| | | // Alternatively, use one of the convenience functions, for instance: |
| | | // response->write(content); |
| | | }; |
| | | |
| | | // POST-example for the path /json, responds firstName+" "+lastName from the posted json |
| | | // Responds with an appropriate error message if the posted json is not valid, or if firstName or lastName is missing |
| | | // Example posted json: |
| | | // { |
| | | // "firstName": "John", |
| | | // "lastName": "Smith", |
| | | // "age": 25 |
| | | // } |
| | | server.resource["^/json$"]["POST"] = [](shared_ptr<HttpServer::Response> response, |
| | | shared_ptr<HttpServer::Request> request) { |
| | | try { |
| | | ptree pt; |
| | | read_json(request->content, pt); |
| | | |
| | | auto name = pt.get<string>("firstName") + " " + pt.get<string>("lastName"); |
| | | |
| | | // write_json() |
| | | // write_json(*response,pt); |
| | | |
| | | // *response << "HTTP/1.1 200 OK\r\n" |
| | | // << "Content-Length: " << name.length() << "\r\n\r\n" |
| | | // << name; |
| | | string res = "{\"aaaa\": \"cccc\",\"dasfd\": \"asdfasdf\",\"age\": 123212}"; |
| | | *response << "HTTP/1.1 200 OK\r\n" |
| | | << "Content-Length: " << res.size() << "\r\n\r\n"<<res; |
| | | // write_json(*response,pt); |
| | | } |
| | | catch (const exception &e) { |
| | | *response << "HTTP/1.1 400 Bad Request\r\nContent-Length: " << strlen(e.what()) << "\r\n\r\n" |
| | | << e.what(); |
| | | } |
| | | |
| | | |
| | | // Alternatively, using a convenience function: |
| | | // try { |
| | | // ptree pt; |
| | | // read_json(request->content, pt); |
| | | |
| | | // auto name=pt.get<string>("firstName")+" "+pt.get<string>("lastName"); |
| | | // response->write(name); |
| | | // } |
| | | // catch(const exception &e) { |
| | | // response->write(SimpleWeb::StatusCode::client_error_bad_request, e.what()); |
| | | // } |
| | | }; |
| | | |
| | | // GET-example for the path /info |
| | | // Responds with request-information |
| | | server.resource["^/info$"]["GET"] = [](shared_ptr<HttpServer::Response> response, |
| | | shared_ptr<HttpServer::Request> request) { |
| | | stringstream stream; |
| | | stream << "<h1>Request from " << request->remote_endpoint_address() << ":" << request->remote_endpoint_port() |
| | | << "</h1>"; |
| | | |
| | | stream << request->method << " " << request->path << " HTTP/" << request->http_version; |
| | | |
| | | stream << "<h2>Query Fields</h2>"; |
| | | auto query_fields = request->parse_query_string(); |
| | | for (auto &field : query_fields) |
| | | stream << field.first << ": " << field.second << "<br>"; |
| | | |
| | | stream << "<h2>Header Fields</h2>"; |
| | | for (auto &field : request->header) |
| | | stream << field.first << ": " << field.second << "<br>"; |
| | | |
| | | response->write(stream); |
| | | }; |
| | | |
| | | // GET-example for the path /match/[number], responds with the matched string in path (number) |
| | | // For instance a request GET /match/123 will receive: 123 |
| | | server.resource["^/match/([0-9]+)$"]["GET"] = [](shared_ptr<HttpServer::Response> response, |
| | | shared_ptr<HttpServer::Request> request) { |
| | | response->write(request->path_match[1]); |
| | | }; |
| | | |
| | | // GET-example simulating heavy work in a separate thread |
| | | server.resource["^/work$"]["GET"] = [](shared_ptr<HttpServer::Response> response, |
| | | shared_ptr<HttpServer::Request> /*request*/) { |
| | | thread work_thread([response] { |
| | | this_thread::sleep_for(chrono::seconds(5)); |
| | | response->write("Work done"); |
| | | }); |
| | | work_thread.detach(); |
| | | }; |
| | | |
| | | // Default GET-example. If no other matches, this anonymous function will be called. |
| | | // Will respond with content in the web/-directory, and its subdirectories. |
| | | // Default file: index.html |
| | | // Can for instance be used to retrieve an HTML 5 client that uses REST-resources on this server |
| | | server.default_resource["GET"] = [](shared_ptr<HttpServer::Response> response, |
| | | shared_ptr<HttpServer::Request> request) { |
| | | try { |
| | | auto web_root_path = boost::filesystem::canonical("web"); |
| | | auto path = boost::filesystem::canonical(web_root_path / request->path); |
| | | // Check if path is within web_root_path |
| | | if (distance(web_root_path.begin(), web_root_path.end()) > distance(path.begin(), path.end()) || |
| | | !equal(web_root_path.begin(), web_root_path.end(), path.begin())) |
| | | throw invalid_argument("path must be within root path"); |
| | | if (boost::filesystem::is_directory(path)) |
| | | path /= "index.html"; |
| | | |
| | | SimpleWeb::CaseInsensitiveMultimap header; |
| | | |
| | | // Uncomment the following line to enable Cache-Control |
| | | // header.emplace("Cache-Control", "max-age=86400"); |
| | | |
| | | #ifdef HAVE_OPENSSL |
| | | // Uncomment the following lines to enable ETag |
| | | // { |
| | | // ifstream ifs(path.string(), ifstream::in | ios::binary); |
| | | // if(ifs) { |
| | | // auto hash = SimpleWeb::Crypto::to_hex_string(SimpleWeb::Crypto::md5(ifs)); |
| | | // header.emplace("ETag", "\"" + hash + "\""); |
| | | // auto it = request->header.find("If-None-Match"); |
| | | // if(it != request->header.end()) { |
| | | // if(!it->second.empty() && it->second.compare(1, hash.size(), hash) == 0) { |
| | | // response->write(SimpleWeb::StatusCode::redirection_not_modified, header); |
| | | // return; |
| | | // } |
| | | // } |
| | | // } |
| | | // else |
| | | // throw invalid_argument("could not read file"); |
| | | // } |
| | | #endif |
| | | |
| | | auto ifs = make_shared<ifstream>(); |
| | | ifs->open(path.string(), ifstream::in | ios::binary | ios::ate); |
| | | |
| | | if (*ifs) { |
| | | auto length = ifs->tellg(); |
| | | ifs->seekg(0, ios::beg); |
| | | |
| | | header.emplace("Content-Length", to_string(length)); |
| | | response->write(header); |
| | | |
| | | // Trick to define a recursive function within this scope (for example purposes) |
| | | class FileServer { |
| | | public: |
| | | static void |
| | | read_and_send(const shared_ptr<HttpServer::Response> &response, const shared_ptr<ifstream> &ifs) { |
| | | // Read and send 128 KB at a time |
| | | static vector<char> buffer(131072); // Safe when server is running on one thread |
| | | streamsize read_length; |
| | | if ((read_length = ifs->read(&buffer[0], static_cast<streamsize>(buffer.size())).gcount()) > |
| | | 0) { |
| | | response->write(&buffer[0], read_length); |
| | | if (read_length == static_cast<streamsize>(buffer.size())) { |
| | | response->send([response, ifs](const SimpleWeb::error_code &ec) { |
| | | if (!ec) |
| | | read_and_send(response, ifs); |
| | | else |
| | | cerr << "Connection interrupted" << endl; |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | FileServer::read_and_send(response, ifs); |
| | | } else |
| | | throw invalid_argument("could not read file"); |
| | | } |
| | | catch (const exception &e) { |
| | | response->write(SimpleWeb::StatusCode::client_error_bad_request, |
| | | "Could not open path " + request->path + ": " + e.what()); |
| | | } |
| | | }; |
| | | |
| | | server.on_error = [](shared_ptr<HttpServer::Request> /*request*/, const SimpleWeb::error_code & /*ec*/) { |
| | | // Handle errors here |
| | | // Note that connection timeouts will also call this handle with ec set to SimpleWeb::errc::operation_canceled |
| | | }; |
| | | |
| | | thread server_thread([&server]() { |
| | | // Start server |
| | | server.start(); |
| | | }); |
| | | |
| | | // Wait for server to start so that the client can connect |
| | | this_thread::sleep_for(chrono::seconds(1)); |
| | | |
| | | // Client examples |
| | | HttpClient client("192.168.188.128:8090"); |
| | | |
| | | string json_string = "{\"firstName\": \"John\",\"lastName\": \"Smith\",\"age\": 25}"; |
| | | |
| | | // Synchronous request examples |
| | | try { |
| | | auto r1 = client.request("GET", "/match/123"); |
| | | cout << r1->content.rdbuf() << endl; // Alternatively, use the convenience function r1->content.string() |
| | | |
| | | auto r2 = client.request("POST", "/string", json_string); |
| | | cout << r2->content.rdbuf() << endl; |
| | | } |
| | | catch (const SimpleWeb::system_error &e) { |
| | | cerr << "Client request error: " << e.what() << endl; |
| | | } |
| | | |
| | | // Asynchronous request example |
| | | client.request("POST", "/json", json_string, |
| | | [](shared_ptr<HttpClient::Response> response, const SimpleWeb::error_code &ec) { |
| | | if (!ec) |
| | | cout << response->content.rdbuf() << endl; |
| | | }); |
| | | client.io_service->run(); |
| | | |
| | | server_thread.join(); |
| | | } |
| New file |
| | |
| | | #include <iostream> |
| | | |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/util/app/AppConfig.h> |
| | | #include "http_configserver.h" |
| | | #include "net_config/net_config.h" |
| | | //#include "../segvCatch.h" |
| | | using namespace std; |
| | | using namespace cv; |
| | | |
| | | int main(int argc, char **argv) { |
| | | ENABLEGLOG(GET_STR_CONFIG("logPath").c_str()); |
| | | |
| | | // unsigned char gateway_addr[15] = {0}; |
| | | // SetIpAddress("enp1s0", "192.168.1.181"); |
| | | // SetMaskAddress("enp1s0", "255.255.255.0"); |
| | | // GetGateWay("enp1s0", gateway_addr); |
| | | // SetGateWay("enp1s0", (char *)gateway_addr, "192.168.1.1"); |
| | | |
| | | appPref.setLongData("gpu.index", 0);//gpu |
| | | appPref.setLongData("thread.max", 20);//sdk |
| | | int port = appConfig.getIntProperty("webPort"); |
| | | devHttpServer_c _devHttpServer("0.0.0.0", port, 20);//webserver thread |
| | | |
| | | cout << "Hello World!" << endl; |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | //erl -name sub1@192.168.1.164 -setcookie abc -mnesia dir '"/opt/erlang/sub1"' |
| | | //erl -name sub2@192.168.1.116 -setcookie abc -mnesia dir '"/opt/erlang/sub2"' -detached -noshell |
| New file |
| | |
| | | /****************************************************************************** |
| | | * |
| | | * |
| | | ******************************************************************************* |
| | | * File name: net.c |
| | | * Purpose: |
| | | * Author: Felix(HuangFei) |
| | | * Version: v01.00 |
| | | * Compiler: arm-linux-gcc |
| | | * Created on: 2014-11-28 |
| | | ******************************************************************************* |
| | | * Note: |
| | | * Revision history: |
| | | * Created by HuangFei 2014-11-28 |
| | | ******************************************************************************/ |
| | | |
| | | #include <stdio.h> |
| | | #include <sys/types.h> |
| | | #include <sys/socket.h> |
| | | #include <sys/ioctl.h> |
| | | #include <ctype.h> |
| | | |
| | | #include <linux/sockios.h> |
| | | #include <netinet/in.h> |
| | | #include <arpa/inet.h> |
| | | #include <net/if_arp.h> |
| | | #include <unistd.h> |
| | | #include <net/if.h> |
| | | #include <net/route.h> |
| | | |
| | | #include <string.h> |
| | | #include <ifaddrs.h> |
| | | |
| | | #include "net_config.h" |
| | | #include <errno.h> |
| | | |
| | | #define TRUE 1 |
| | | #define FALSE 0 |
| | | #define MAC_ADDRESS_LEN 6 |
| | | #define PATH_PROCNET_ROUTE "/proc/net/route" |
| | | #define IFACE_NAME_LENGTH IF_NAMESIZE |
| | | |
| | | #include <string> |
| | | #include <regex> |
| | | bool checkip(std::string ip) |
| | | { |
| | | std::regex rx2("^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$"); |
| | | if( !regex_match(ip.cbegin(), ip.cend(), rx2) ) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | bool checkMask(std::string mask) |
| | | { |
| | | std::regex rx2("^(254|252|248|240|224|192|128|0)\\.0\\.0\\.0|255\\.(254|252|248|240|224|192|128|0)\\.0\\.0|255\\.255\\.(254|252|248|240|224|192|128|0)\\.0|255\\.255\\.255\\.(254|252|248|240|224|192|128|0)$"); |
| | | if( !regex_match(mask.cbegin(), mask.cend(), rx2)) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: SetMacAddress |
| | | * Description: 设置macå°å |
| | | * Input: pInterface ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼pMacAddressï¼macå°åé¦å°å |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool SetMacAddress(char *pInterface,char *pMacAddress) |
| | | { |
| | | struct ifreq ifr; |
| | | struct sockaddr *hwaddr; |
| | | unsigned char *hwptr; |
| | | int sockfd; |
| | | int i; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | if((pInterface == NULL)||(pInterface[0]!='e')||(pInterface[1]!='t')||(pInterface[2]!='h')) |
| | | { |
| | | printf("input inteface error!\n"); |
| | | return FALSE; |
| | | } |
| | | if(pMacAddress == NULL) |
| | | { |
| | | printf("input mac address error\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | sockfd= socket(AF_INET,SOCK_DGRAM,0); |
| | | if (sockfd<0) |
| | | { |
| | | printf("Can't creat socket \r\n"); |
| | | } |
| | | memset(&ifr, 0, sizeof(ifr)); |
| | | strncpy(ifr.ifr_name, pInterface, sizeof(ifr.ifr_name)-1); |
| | | |
| | | /*读åºsocketçä¿¡æ¯*/ |
| | | if (0 > ioctl(sockfd, SIOCGIFFLAGS, &ifr)) |
| | | { |
| | | printf("close the ethx:unknown interface\r\n"); |
| | | } |
| | | ifr.ifr_flags &= ~IFF_UP; |
| | | /*å°ä¿¡æ¯åå°socketä¸ï¼ä»èå
³éeth0*/ |
| | | if (0 > ioctl(sockfd, SIOCSIFFLAGS, &ifr)) |
| | | { |
| | | printf("Can't close the ethx \r\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | /*---------------------------------------------------------------------*/ |
| | | /* set the interface eth0's MAC address */ |
| | | /*---------------------------------------------------------------------*/ |
| | | memset(&ifr, 0, sizeof(ifr)); |
| | | strncpy(ifr.ifr_name, pInterface, sizeof(ifr.ifr_name)-1); |
| | | hwaddr=(struct sockaddr *)&ifr.ifr_hwaddr; |
| | | |
| | | /*ARPHRD_ETHERï¼1ï¼æ è¯æ¥æ¶çARPä¸ºä»¥å¤ªç½æ ¼å¼*/ |
| | | hwaddr->sa_family = ARPHRD_ETHER; |
| | | hwptr=(unsigned char*)hwaddr->sa_data; |
| | | |
| | | for(i=0;i<6;i++) |
| | | *hwptr++ = (unsigned char)pMacAddress[i]; |
| | | |
| | | if (0 > ioctl(sockfd, SIOCSIFHWADDR, &ifr)) |
| | | { |
| | | printf("Can't set the MAC address\r\n"); |
| | | } |
| | | |
| | | /*---------------------------------------------------------------------*/ |
| | | /* open the interface eth0 */ |
| | | /*---------------------------------------------------------------------*/ |
| | | memset(&ifr, 0, sizeof(ifr)); |
| | | strncpy(ifr.ifr_name, pInterface, sizeof(ifr.ifr_name)-1); |
| | | if (0 > ioctl(sockfd,SIOCGIFFLAGS, &ifr)) |
| | | { |
| | | printf("open the ethx:unknown interface\r\n"); |
| | | } |
| | | ifr.ifr_flags |= (IFF_UP | IFF_RUNNING); |
| | | if (0 > ioctl(sockfd, SIOCSIFFLAGS, &ifr)) |
| | | { |
| | | printf("Can't open the ethx\r\n"); |
| | | } |
| | | |
| | | close(sockfd); |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | |
| | | /********************************************************************** |
| | | * Function: SetIpAddress |
| | | * Description: 设置ipå°å |
| | | * Input: pInterface ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼IpAddressï¼ipå°åç |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool SetIpAddress(char *pInterface,const char* IpAddress) |
| | | { |
| | | |
| | | struct ifreq ifr; |
| | | struct sockaddr_in *sinaddr; |
| | | int sockfd; |
| | | |
| | | |
| | | if((pInterface == NULL)/*||(pInterface[0]!='e')||(pInterface[1]!='t')||(pInterface[2]!='h')*/) |
| | | { |
| | | printf("input inteface error!\n"); |
| | | return FALSE; |
| | | } |
| | | if(IpAddress == NULL) |
| | | { |
| | | printf("input ip address error\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | sockfd= socket(AF_INET,SOCK_DGRAM,0); |
| | | if (sockfd<0) |
| | | { |
| | | printf("Can't creat socket \r\n"); |
| | | } |
| | | |
| | | memset(&ifr, 0, sizeof(ifr)); |
| | | strncpy(ifr.ifr_name, pInterface, sizeof(ifr.ifr_name)-1); |
| | | sinaddr = (struct sockaddr_in *)&ifr.ifr_addr; |
| | | sinaddr->sin_family = AF_INET; |
| | | // sinaddr->sin_addr.s_addr = inet_aton(IpAddress); |
| | | if(inet_aton(IpAddress, &(sinaddr->sin_addr)) < 0) |
| | | { |
| | | printf("input ip address error\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | if (ioctl(sockfd, SIOCSIFADDR, &ifr) < 0) |
| | | { |
| | | printf("Can't set ip address\r\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | close(sockfd); |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: SetMaskAddress |
| | | * Description: 设置åç½æ©ç |
| | | * Input: pInterface ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼IpMaskï¼åç½æ©ç |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool SetMaskAddress(char *pInterface,const char* IpMask) |
| | | { |
| | | struct ifreq ifr; |
| | | struct sockaddr_in *sinaddr; |
| | | int sockfd; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | if((pInterface == NULL)/*||(pInterface[0]!='e')||(pInterface[1]!='t')||(pInterface[2]!='h')*/) |
| | | { |
| | | printf("input inteface error!\n"); |
| | | return FALSE; |
| | | } |
| | | if(IpMask == NULL) |
| | | { |
| | | printf("input mask address error\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | |
| | | sockfd= socket(AF_INET,SOCK_DGRAM,0); |
| | | if (sockfd<0) |
| | | { |
| | | printf("Can't creat socket \r\n"); |
| | | } |
| | | |
| | | memset(&ifr, 0, sizeof(ifr)); |
| | | strncpy(ifr.ifr_name, pInterface, sizeof(ifr.ifr_name)-1); |
| | | sinaddr = (struct sockaddr_in *)&ifr.ifr_netmask; |
| | | sinaddr->sin_family = AF_INET; |
| | | // sinaddr->sin_addr.s_addr = IpMask; |
| | | if(inet_aton(IpMask, &(sinaddr->sin_addr)) < 0) |
| | | { |
| | | printf("input ip address error\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | if (0 > ioctl(sockfd, SIOCSIFNETMASK, &ifr)) |
| | | { |
| | | printf("Can't set subnet netmask\r\n"); |
| | | } |
| | | |
| | | close(sockfd); |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: DelGateWay |
| | | * Description: å 餿å®çç½å
³ |
| | | * Input: pInterface ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼DelGateWayï¼ç½å
³ |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool DelGateWay(char *pInterface,unsigned int DelGateWay) |
| | | { |
| | | |
| | | struct sockaddr_in *sinaddr; |
| | | struct rtentry rt; |
| | | struct sockaddr rtsockaddr; |
| | | int sockfd; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | if((pInterface == NULL)||(pInterface[0]!='e')||(pInterface[1]!='t')||(pInterface[2]!='h')) |
| | | { |
| | | printf("input inteface error!\n"); |
| | | return FALSE; |
| | | } |
| | | if(DelGateWay == 0) |
| | | { |
| | | printf("input GateWay error!\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | sockfd= socket(AF_INET,SOCK_DGRAM,0); |
| | | if (sockfd<0) |
| | | { |
| | | printf("Can't creat socket \r\n"); |
| | | } |
| | | |
| | | |
| | | /* Clean out the RTREQ structure. */ |
| | | memset((char *) &rt, 0, sizeof(struct rtentry)); |
| | | memset((char *)&rtsockaddr,0,sizeof(struct sockaddr)); |
| | | sinaddr = (struct sockaddr_in *)&rtsockaddr; |
| | | sinaddr->sin_family = AF_INET; |
| | | |
| | | /*INADDR_ANYå°±æ¯æå®å°å为0.0.0.0çå°å,è¿ä¸ªå°åäºå®ä¸è¡¨ç¤ºä¸ç¡®å®å°å,æâææå°åâãâä»»æå°åâ*/ |
| | | sinaddr->sin_addr.s_addr = INADDR_ANY; |
| | | |
| | | /*set the destination address to '0.0.0.0'*/ |
| | | rt.rt_dst = rtsockaddr; |
| | | |
| | | /*set the netmask to '0.0.0.0'*/ |
| | | rt.rt_genmask = rtsockaddr; |
| | | |
| | | /* Fill in the other fields. */ |
| | | rt.rt_flags = (RTF_UP|RTF_GATEWAY); |
| | | rt.rt_metric = 1; |
| | | rt.rt_dev = pInterface; |
| | | |
| | | /*delete the current default gateway*/ |
| | | sinaddr->sin_addr.s_addr = DelGateWay; |
| | | rt.rt_gateway = rtsockaddr; |
| | | |
| | | |
| | | if (0 > ioctl(sockfd, SIOCDELRT, &rt)) |
| | | { |
| | | printf("Can't delete the current gateway\r\n"); |
| | | } |
| | | |
| | | close(sockfd); |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: AddGateWay |
| | | * Description: å¢å æå®çç½å
³ |
| | | * Input: pInterface ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼NewGateWayï¼ç½å
³ |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool AddGateWay(char *pInterface,unsigned int NewGateWay) |
| | | { |
| | | struct sockaddr_in *sinaddr; |
| | | struct rtentry rt; |
| | | struct sockaddr rtsockaddr; |
| | | int sockfd; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | if((pInterface == NULL)||(pInterface[0]!='e')||(pInterface[1]!='t')||(pInterface[2]!='h')) |
| | | { |
| | | printf("input inteface error!\n"); |
| | | return FALSE; |
| | | } |
| | | if(NewGateWay == 0) |
| | | { |
| | | printf("input GateWay error!\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | sockfd= socket(AF_INET,SOCK_DGRAM,0); |
| | | if (sockfd<0) |
| | | { |
| | | printf("Can't creat socket \r\n"); |
| | | } |
| | | |
| | | |
| | | /* Clean out the RTREQ structure. */ |
| | | memset((char *) &rt, 0, sizeof(struct rtentry)); |
| | | memset((char *)&rtsockaddr,0,sizeof(struct sockaddr)); |
| | | sinaddr = (struct sockaddr_in *)&rtsockaddr; |
| | | sinaddr->sin_family = AF_INET; |
| | | |
| | | /*INADDR_ANYå°±æ¯æå®å°å为0.0.0.0çå°å,è¿ä¸ªå°åäºå®ä¸è¡¨ç¤ºä¸ç¡®å®å°å,æâææå°åâãâä»»æå°åâ*/ |
| | | sinaddr->sin_addr.s_addr = INADDR_ANY; |
| | | |
| | | /*set the destination address to '0.0.0.0'*/ |
| | | rt.rt_dst = rtsockaddr; |
| | | |
| | | /*set the netmask to '0.0.0.0'*/ |
| | | rt.rt_genmask = rtsockaddr; |
| | | |
| | | /* Fill in the other fields. */ |
| | | rt.rt_flags = (RTF_UP|RTF_GATEWAY); |
| | | rt.rt_metric = 1; |
| | | rt.rt_dev = pInterface; |
| | | |
| | | /*set the new default gateway*/ |
| | | sinaddr->sin_addr.s_addr = NewGateWay; |
| | | rt.rt_gateway =rtsockaddr; |
| | | |
| | | if (0 > ioctl(sockfd, SIOCADDRT, &rt)) |
| | | { |
| | | printf("Can't set the new default gateway\r\n"); |
| | | } |
| | | |
| | | close(sockfd); |
| | | |
| | | return TRUE; |
| | | |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: SetGateWay |
| | | * Description: 设置ç½å
³ï¼å
å é¤å·²ç»æçï¼åæ·»å æ°ç |
| | | * Input: pInterface ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼DelGateWayï¼å é¤çç½å
³ï¼ |
| | | NewGateWayï¼ æ°æ·»å çç½å
³ |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool SetGateWay(char *pInterface,const char* DelGateWay,const char* NewGateWay) |
| | | { |
| | | |
| | | struct sockaddr_in *sinaddr; |
| | | struct rtentry rt; |
| | | struct sockaddr rtsockaddr; |
| | | int sockfd; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | if((pInterface == NULL)/*||(pInterface[0]!='e')||(pInterface[1]!='t')||(pInterface[2]!='h')*/) |
| | | { |
| | | printf("input inteface error!\n"); |
| | | return FALSE; |
| | | } |
| | | if((DelGateWay == NULL) && (NewGateWay == NULL)) |
| | | { |
| | | printf("input GateWay error!\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | sockfd= socket(AF_INET,SOCK_DGRAM,0); |
| | | if (sockfd<0) |
| | | { |
| | | printf("Can't creat socket \r\n"); |
| | | } |
| | | |
| | | |
| | | /* Clean out the RTREQ structure. */ |
| | | memset((char *) &rt, 0, sizeof(struct rtentry)); |
| | | memset((char *)&rtsockaddr,0,sizeof(struct sockaddr)); |
| | | sinaddr = (struct sockaddr_in *)&rtsockaddr; |
| | | sinaddr->sin_family = AF_INET; |
| | | |
| | | /*INADDR_ANYå°±æ¯æå®å°å为0.0.0.0çå°å,è¿ä¸ªå°åäºå®ä¸è¡¨ç¤ºä¸ç¡®å®å°å,æâææå°åâãâä»»æå°åâ*/ |
| | | sinaddr->sin_addr.s_addr = INADDR_ANY; |
| | | |
| | | /*set the destination address to '0.0.0.0'*/ |
| | | rt.rt_dst = rtsockaddr; |
| | | |
| | | /*set the netmask to '0.0.0.0'*/ |
| | | rt.rt_genmask = rtsockaddr; |
| | | |
| | | /* Fill in the other fields. */ |
| | | rt.rt_flags = (RTF_UP|RTF_GATEWAY); |
| | | rt.rt_metric = 1; |
| | | rt.rt_dev = pInterface; |
| | | |
| | | /*delete the current default gateway*/ |
| | | // sinaddr->sin_addr.s_addr = DelGateWay; |
| | | if(inet_aton(DelGateWay, &(sinaddr->sin_addr)) < 0) |
| | | { |
| | | printf("input ip address error\n"); |
| | | return FALSE; |
| | | } |
| | | rt.rt_gateway = rtsockaddr; |
| | | |
| | | |
| | | if (0 > ioctl(sockfd, SIOCDELRT, &rt)) |
| | | { |
| | | printf("Can't delete the current default gateway\r\n"); |
| | | } |
| | | |
| | | /*set the new default gateway*/ |
| | | // sinaddr->sin_addr.s_addr = NewGateWay; |
| | | if(inet_aton(NewGateWay, &(sinaddr->sin_addr)) < 0) |
| | | { |
| | | printf("input ip address error\n"); |
| | | return FALSE; |
| | | } |
| | | rt.rt_gateway =rtsockaddr; |
| | | |
| | | if (0 > ioctl(sockfd, SIOCADDRT, &rt)) |
| | | { |
| | | printf("Can't set the new default gateway\r\n"); |
| | | } |
| | | |
| | | close(sockfd); |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: GetMacAddress |
| | | * Description: è·å¾æå®ç½å£çç©çMACå°è´¨ |
| | | * Input: ifaceName ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼hwAddrï¼å¾å°çmacå°å |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool GetMacAddress (char* ifaceName, unsigned char* hwAddr) |
| | | { |
| | | int ret; |
| | | int sockfd; |
| | | struct ifreq ifr; |
| | | unsigned char temp_mac[6] = {0}; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | // if((ifaceName == NULL)||(ifaceName[0]!='e')||(ifaceName[1]!='t')||(ifaceName[2]!='h')) |
| | | // { |
| | | // printf("input inteface error!\n"); |
| | | // return FALSE; |
| | | // } |
| | | |
| | | sockfd = socket(AF_INET, SOCK_DGRAM, 0); |
| | | if(sockfd < 0) |
| | | { |
| | | printf("Could not open test socket"); |
| | | return FALSE; |
| | | } |
| | | |
| | | memset(&ifr, 0, sizeof(ifr)); |
| | | |
| | | strncpy(ifr.ifr_name, ifaceName, IFACE_NAME_LENGTH); |
| | | |
| | | if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) < 0) |
| | | { |
| | | printf("failed to request hardware address for %s", ifaceName); |
| | | close(sockfd); |
| | | return FALSE; |
| | | } |
| | | |
| | | int af = ifr.ifr_hwaddr.sa_family; |
| | | //int af = ifr.ifr_addr.sa_family; |
| | | |
| | | memcpy(temp_mac, ifr.ifr_hwaddr.sa_data, MAC_ADDRESS_LEN); |
| | | sprintf((char *)hwAddr,"%02x:%02x:%02x:%02x:%02x:%02x", \ |
| | | temp_mac[0], temp_mac[1], temp_mac[2], temp_mac[3], temp_mac[4], temp_mac[5]); |
| | | //memcpy(hwAddr, ifr.ifr_addr.sa_data, hwAddrSize); |
| | | |
| | | return TRUE; |
| | | |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: GetIpAddress |
| | | * Description: è·å¾æå®ç«¯å£çipå°å |
| | | * Input: ifaceName ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼IpAddressï¼å¾å°çipå°å |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool GetIpAddress(char* ifaceName,unsigned char *IpAddress) |
| | | { |
| | | struct ifaddrs *ifaddr, *ifa; |
| | | struct ifreq ifr; |
| | | struct sockaddr_in *sinaddr; |
| | | int sockfd; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | // if((ifaceName == NULL)||(ifaceName[0]!='e')||(ifaceName[1]!='t')||(ifaceName[2]!='h')) |
| | | // { |
| | | // printf("input inteface error!\n"); |
| | | // return FALSE; |
| | | // } |
| | | |
| | | if(getifaddrs(&ifaddr) == -1) |
| | | { |
| | | printf("Could not get interface list"); |
| | | freeifaddrs(ifaddr); |
| | | return FALSE; |
| | | } |
| | | |
| | | sockfd= socket(AF_INET,SOCK_DGRAM,0); |
| | | if (sockfd<0) |
| | | { |
| | | printf("Can't creat socket \r\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) |
| | | { |
| | | if(!strcmp(ifaceName, ifa->ifa_name) && (ifa->ifa_addr->sa_family == AF_INET)) |
| | | { |
| | | memset(&ifr, 0, sizeof(ifr)); |
| | | strncpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name)-1); |
| | | if (0 > ioctl(sockfd, SIOCGIFADDR, &ifr)) |
| | | { |
| | | printf("Can't get ip address\r\n"); |
| | | return FALSE; |
| | | } |
| | | sinaddr = (struct sockaddr_in *)&ifr.ifr_addr; |
| | | strcpy((char *)IpAddress,inet_ntoa(sinaddr->sin_addr)); |
| | | freeifaddrs(ifaddr); |
| | | close(sockfd); |
| | | return TRUE; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | printf("input interface no found\n"); |
| | | |
| | | freeifaddrs(ifaddr); |
| | | |
| | | return FALSE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: GetMaskAddress |
| | | * Description: è·å¾æå®ç«¯å£çåç½æ©ç |
| | | * Input: pInterface ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼MaskAddressï¼å¾å°çåç½æ©ç |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool GetMaskAddress(char* ifaceName,unsigned char *MaskAddress) |
| | | { |
| | | struct ifaddrs *ifaddr, *ifa; |
| | | struct ifreq ifr; |
| | | struct sockaddr_in *sinaddr; |
| | | int sockfd; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | // if((ifaceName == NULL)||(ifaceName[0]!='e')||(ifaceName[1]!='t')||(ifaceName[2]!='h')) |
| | | // { |
| | | // printf("input inteface error!\n"); |
| | | // return FALSE; |
| | | // } |
| | | |
| | | if(getifaddrs(&ifaddr) == -1) |
| | | { |
| | | printf("Could not get interface list"); |
| | | freeifaddrs(ifaddr); |
| | | return FALSE; |
| | | } |
| | | |
| | | sockfd= socket(AF_INET,SOCK_DGRAM,0); |
| | | if (sockfd<0) |
| | | { |
| | | printf("Can't creat socket \r\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | |
| | | for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) |
| | | { |
| | | if(!strcmp(ifaceName, ifa->ifa_name) && (ifa->ifa_addr->sa_family == AF_INET)) |
| | | { |
| | | memset(&ifr, 0, sizeof(ifr)); |
| | | strncpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name)-1); |
| | | if (0 > ioctl(sockfd, SIOCGIFNETMASK, &ifr)) |
| | | { |
| | | printf("Can't get ip address\r\n"); |
| | | return FALSE; |
| | | } |
| | | sinaddr = (struct sockaddr_in *)&ifr.ifr_netmask; |
| | | // *MaskAddress = sinaddr->sin_addr.s_addr; |
| | | strcpy((char *)MaskAddress,inet_ntoa(sinaddr->sin_addr)); |
| | | freeifaddrs(ifaddr); |
| | | close(sockfd); |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | printf("input interface no found\n"); |
| | | freeifaddrs(ifaddr); |
| | | |
| | | return FALSE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: GetAddress |
| | | * Description: è·å¾æå®ç½å£çsockdaddrå°å |
| | | * Input: ifaceName ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼addrï¼å°å |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool GetAddress(char* ifaceName,struct sockaddr* addr) |
| | | { |
| | | struct ifaddrs *ifaddr, *ifa; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | // if((ifaceName == NULL)||(ifaceName[0]!='e')||(ifaceName[1]!='t')||(ifaceName[2]!='h')) |
| | | // { |
| | | // printf("input inteface error!\n"); |
| | | // return FALSE; |
| | | // } |
| | | |
| | | if(getifaddrs(&ifaddr) == -1) |
| | | { |
| | | printf("Could not get interface list"); |
| | | freeifaddrs(ifaddr); |
| | | return FALSE; |
| | | } |
| | | |
| | | for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) |
| | | { |
| | | |
| | | if(!strcmp(ifaceName, ifa->ifa_name) && (ifa->ifa_addr->sa_family == AF_INET)) |
| | | { |
| | | memcpy(addr, ifa->ifa_addr, sizeof(struct sockaddr)); |
| | | freeifaddrs(ifaddr); |
| | | return TRUE; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | printf("input interface no found\n"); |
| | | freeifaddrs(ifaddr); |
| | | return FALSE; |
| | | } |
| | | |
| | | |
| | | /********************************************************************** |
| | | * Function: GetGateWay |
| | | * Description: å¾å°é»è®¤ç½å
³ |
| | | * Input: pInterface ï¼ç½ç»æ¥å£åå å¦ï¼eth0ï¼pGateWayï¼å¾å°çç½å
³ |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool GetGateWay(char *pInterface,unsigned char *pGateWay) |
| | | { |
| | | short i = 0; |
| | | char buff[1024], iface[16]; |
| | | char gate_addr[128], net_addr[128]; |
| | | char mask_addr[128]; |
| | | int num, iflags, metric, refcnt, use, mss, window, irtt; |
| | | |
| | | char *sp , *bp; |
| | | unsigned int val=0; |
| | | |
| | | /* 夿æ¥å£è¾å
¥æ¯å¦æ£ç¡® */ |
| | | // if((pInterface == NULL)||(pInterface[0]!='e')||(pInterface[1]!='t')||(pInterface[2]!='h')) |
| | | // { |
| | | // printf("input inteface error!\n"); |
| | | // return FALSE; |
| | | // } |
| | | if(pGateWay == NULL) |
| | | { |
| | | printf("input mac address error\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | FILE *fp = fopen(PATH_PROCNET_ROUTE, "r"); |
| | | |
| | | while (fgets(buff, 1023, fp)) |
| | | { |
| | | num = sscanf(buff, "%16s %128s %128s %X %d %d %d %128s %d %d %d\n", |
| | | iface, net_addr, gate_addr, |
| | | &iflags, &refcnt, &use, &metric, mask_addr, |
| | | &mss, &window, &irtt); |
| | | if (num < 10 || !(iflags & RTF_UP)) |
| | | continue; |
| | | if(strncmp(iface,pInterface,4)!=0) |
| | | continue; |
| | | if(strncmp(net_addr,"00000000",8)!=0) |
| | | continue; |
| | | if(strncmp(mask_addr,"00000000",8)!=0) |
| | | continue; |
| | | bp = (char *) &val; |
| | | |
| | | sp = gate_addr; |
| | | for (i = 0; i < 4; i++) |
| | | { |
| | | *sp = toupper(*sp); |
| | | if ((*sp >= 'A') && (*sp <= 'F')) |
| | | bp[i] |= (int) (*sp - 'A') + 10; |
| | | else if ((*sp >= '0') && (*sp <= '9')) |
| | | bp[i] |= (int) (*sp - '0'); |
| | | else |
| | | { |
| | | printf("Can't convert the gateway string to integer.\n\r"); |
| | | fclose(fp); |
| | | return 0; |
| | | } |
| | | bp[i] <<= 4; |
| | | sp++; |
| | | *sp = toupper(*sp); |
| | | |
| | | if ((*sp >= 'A') && (*sp <= 'F')) |
| | | bp[i] |= (int) (*sp - 'A') + 10; |
| | | else if ((*sp >= '0') && (*sp <= '9')) |
| | | bp[i] |= (int) (*sp - '0'); |
| | | else |
| | | { |
| | | printf("Can't convert the gateway string to integer.\n"); |
| | | fclose(fp); |
| | | return 0; |
| | | } |
| | | sp++; |
| | | } |
| | | } |
| | | |
| | | if(val == 0) |
| | | { |
| | | printf("Don't find default gateway = %d\n",val); |
| | | fclose(fp); |
| | | return FALSE; |
| | | } |
| | | else |
| | | { |
| | | // *pGateWay = htonl(val); |
| | | sprintf((char *)pGateWay,"%d.%d.%d.%d", (val>>24)&0xFF, (val>>16)&0xFF, (val>>8)&0xFF,val&0xFF); |
| | | } |
| | | |
| | | |
| | | fclose(fp); |
| | | return TRUE; |
| | | } |
| | | |
| | | |
| | | /********************************************************************** |
| | | * Function: SetSock_reUse |
| | | * Description: 设置ç½ç»å¥æ¥åéå¤ä½¿ç¨ |
| | | * Input: sockfdï¼ç½ç»å¥æ¥å |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool SetSock_reUse(int sockfd) |
| | | { |
| | | int reuse = 1; |
| | | if(-1 == setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(int))) |
| | | { |
| | | printf("setsockopt fail!\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: SetSock_NoCheck |
| | | * Description: è®¾ç½®å¥æ¥åæ°æ®å
䏿£æµ |
| | | * Input: sockfdï¼ç½ç»å¥æ¥å |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool SetSock_NoCheck(int sockfd) |
| | | { |
| | | int nocheck = 1; |
| | | if(0 != setsockopt(sockfd, SOL_SOCKET, SO_NO_CHECK, &nocheck, sizeof(int))) |
| | | { |
| | | printf("setsockopt NO_CHECK error!\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: SetMutiCastLoop |
| | | * Description: 设置åç¯å¤æ |
| | | * Input: sockfdï¼socket奿¥åï¼valï¼0 å
³éï¼1 æå¼ |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool SetMutiCastLoop(int sockfd,int val) |
| | | { |
| | | if(setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &val, sizeof(int))< 0) |
| | | { |
| | | printf("failed to set multicast LOOP value \n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: SetMutiCastTTl |
| | | * Description: è®¾ç½®å¤æå°åç»æ°æ®å
ççåæ¶é´ |
| | | * Input: sockfdï¼socket奿¥åï¼ttlï¼çåæ¶é´ |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool SetMutiCastTTl(int sockfd,int ttl) |
| | | { |
| | | if(setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, sizeof(ttl))< 0) |
| | | { |
| | | printf("failed to set multicast TTL value \n"); |
| | | return FALSE; |
| | | } |
| | | return TRUE; |
| | | } |
| | | |
| | | bool BindSockDevice(unsigned char*ifaceNmae,int sockfd) |
| | | { |
| | | struct ifreq ifreg; |
| | | strncpy(ifreg.ifr_name, (const char*)ifaceNmae,IFNAMSIZ); |
| | | if(setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,(char *)&ifreg, sizeof(ifreg)) < 0) |
| | | { |
| | | return FALSE; |
| | | } |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: AddIpAddr_ToMultiCast |
| | | * Description: å°æå®ipå°åæ·»å å
¥å¤æç» |
| | | * Input: sockfdï¼socket奿¥åï¼ipï¼ipå°åï¼multi_ipï¼å¤æå°åï¼ttlï¼çåæ¶é´ |
| | | * Return: æå 1ï¼å¤±è´¥ 0 |
| | | * Others: |
| | | **********************************************************************/ |
| | | bool AddIpAddr_ToMultiCast(int sockfd,unsigned int ip,unsigned int multi_ip,int ttl) |
| | | { |
| | | struct ip_mreq imr; |
| | | |
| | | imr.imr_multiaddr.s_addr = multi_ip; |
| | | imr.imr_interface.s_addr = ip; |
| | | |
| | | if(setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, &imr.imr_interface.s_addr, sizeof(struct in_addr)) < 0) |
| | | { |
| | | printf("failed to set multicast send interface\n"); |
| | | return FALSE; |
| | | } |
| | | |
| | | if(setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &imr, sizeof(imr))< 0) |
| | | { |
| | | printf("failed to add multicast member\n"); |
| | | return FALSE; |
| | | } |
| | | if(SetMutiCastTTl(sockfd,ttl) == FALSE) |
| | | { |
| | | return FALSE; |
| | | } |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | /********************************************************************** |
| | | * Function: DisplayInterfaceStatus |
| | | * Description: æ¾ç¤ºå½åæ¥å£ç¶æä¿¡æ¯ |
| | | * Input: ifaceName ï¼ç½ç»æ¥å£åå å¦ï¼eth0 |
| | | * Return: void |
| | | * Others: |
| | | **********************************************************************/ |
| | | void DisplayInterfaceStatus(char* ifaceName) |
| | | { |
| | | int sockfd; |
| | | struct ifreq ifr; |
| | | struct ifaddrs *ifaddr, *ifa; |
| | | unsigned int flags; |
| | | |
| | | |
| | | if((ifaceName == NULL)||(ifaceName[0]!='e')||(ifaceName[1]!='t')||(ifaceName[2]!='h')) |
| | | { |
| | | printf("input inteface error!\n"); |
| | | return; |
| | | } |
| | | |
| | | if(getifaddrs(&ifaddr) == -1) |
| | | { |
| | | printf("Could not get interface list"); |
| | | freeifaddrs(ifaddr); |
| | | return; |
| | | } |
| | | |
| | | for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) |
| | | { |
| | | |
| | | if(!strcmp(ifaceName, ifa->ifa_name)) |
| | | { |
| | | flags = ifa->ifa_flags; |
| | | freeifaddrs(ifaddr); |
| | | } |
| | | |
| | | } |
| | | if(flags & IFF_UP) |
| | | { |
| | | printf("Interface %s is up \n",ifaceName); |
| | | } |
| | | if(flags & IFF_RUNNING) |
| | | { |
| | | printf("Interface %s is running ",ifaceName); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | /****************************************************************************** |
| | | * |
| | | * |
| | | ******************************************************************************* |
| | | * File name: net.h |
| | | * Purpose: |
| | | * Author: Felix(HuangFei) |
| | | * Version: v01.00 |
| | | * Compiler: arm-linux-gcc |
| | | * Created on: 2014-11-28 |
| | | ******************************************************************************* |
| | | * Note: |
| | | * Revision history: |
| | | * Created by HuangFei 2014-11-28 |
| | | ******************************************************************************/ |
| | | |
| | | #ifndef __NET_CONFIG_H__ |
| | | #define __NET_CONFIG_H__ |
| | | #include <string> |
| | | |
| | | #define NET_IFNAME "eth0" |
| | | |
| | | bool checkip(std::string ip); |
| | | |
| | | bool checkMask(std::string mask); |
| | | |
| | | bool SetMacAddress(char *pInterface,char *pMacAddress); |
| | | |
| | | bool SetIpAddress(char *pInterface,const char* IpAddress); |
| | | |
| | | bool SetMaskAddress(char *pInterface,const char* IpMask); |
| | | |
| | | bool DelGateWay(char *pInterface,unsigned int DelGateWay); |
| | | |
| | | bool AddGateWay(char *pInterface,unsigned int NewGateWay); |
| | | |
| | | bool SetGateWay(char *pInterface,const char* DelGateWay,const char* NewGateWay); |
| | | |
| | | bool GetMacAddress (char* ifaceName, unsigned char* hwAddr); |
| | | |
| | | bool GetIpAddress(char* ifaceName,unsigned char *IpAddress); |
| | | |
| | | bool GetMaskAddress(char* ifaceName,unsigned char *MaskAddress); |
| | | |
| | | bool GetGateWay(char *pInterface,unsigned char *pGateWay); |
| | | |
| | | bool SetSock_reUse(int sockfd); |
| | | |
| | | bool SetSock_NoCheck(int sockfd); |
| | | |
| | | bool SetMutiCastLoop(int sockfd,int val); |
| | | |
| | | bool SetMutiCastTTl(int sockfd,int ttl); |
| | | |
| | | bool AddIpAddr_ToMultiCast(int sockfd,unsigned int ip,unsigned int multi_ip,int ttl); |
| | | |
| | | bool BindSockDevice(unsigned char*ifaceNmae,int sockfd); |
| | | |
| | | void DisplayInterfaceStatus(char* ifaceName); |
| | | |
| | | #endif/*__NET_CONFIG_H__*/ |
| New file |
| | |
| | | æ åè¿åå¼ï¼ |
| | | {"ret_status": "å
容æè¯¯ï¼è¯·æ£æ¥ï¼"}ï¼å
容é误 |
| | | {"ret_status": "ä¼ è¾é误ï¼è¯·æ£æ¥ï¼"}ï¼jsonæ ¼å¼é误 |
| | | {"ret_status": "ok_ack"}ï¼æä½æå |
| | | |
| | | |
| | | |
| | | |
| | | 设å¤ç¼è¾ dev_edit |
| | | ä¸åï¼ |
| | | { |
| | | "n_duration" : 2, |
| | | "n_port" : 8000, |
| | | "str_addr" : "æäº¬sohoT3", |
| | | "str_brand" : "haikang", |
| | | "str_dev_name" : "æäº¬soho海康ç£çéµå1", |
| | | "str_ip" : "192.168.1.4", |
| | | "str_latitude" : "116.45755", |
| | | "str_longitude" : "39.994445", |
| | | "str_password" : "basic123", |
| | | "str_reserved" : "", |
| | | "str_storage_dev_id" : "DS-7808N-SN0820161208AARR691369356WCVU", |
| | | "str_username" : "admin", |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "str_storage_dev_id" : "DS-7808N-SN0820161208AARR691369356WCVU" |
| | | } |
| | | |
| | | |
| | | è®¾å¤æ¥è¯¢ dev_show |
| | | ä¸åï¼æ |
| | | è¿åï¼å¦ä¸ï¼ |
| | | [ |
| | | { |
| | | "n_duration" : 1, |
| | | "n_port" : 8080, |
| | | "str_addr" : "æäº¬soho大å¦", |
| | | "str_brand" : "haikang", |
| | | "str_dev_name" : "æäº¬soho海康ç£çéµå", |
| | | "str_ip" : "192.168.1.181", |
| | | "str_latitude" : "116.457092", |
| | | "str_longitude" : "39.994827", |
| | | "str_password" : "123456", |
| | | "str_reserved" : "", |
| | | "str_storage_dev_id" : "haikang:12:34:56:78:90:ab", |
| | | "str_username" : "admin", |
| | | "tim_start_time" : "2018-08-28 00:00:00" |
| | | }, |
| | | { |
| | | "n_duration" : 2, |
| | | "n_port" : 8080, |
| | | "str_addr" : "æäº¬soho大å¦", |
| | | "str_brand" : "dahua", |
| | | "str_dev_name" : "æäº¬soho大è¯ç£çéµå", |
| | | "str_ip" : "192.168.1.181", |
| | | "str_latitude" : "116.457092", |
| | | "str_longitude" : "39.994827", |
| | | "str_password" : "123456", |
| | | "str_reserved" : "", |
| | | "str_storage_dev_id" : "dahua:12:34:56:78:90:ab", |
| | | "str_username" : "admin", |
| | | "tim_start_time" : "2018-08-28 00:00:00" |
| | | }, |
| | | { |
| | | "n_duration" : 3, |
| | | "n_port" : 8083, |
| | | "str_addr" : "æäº¬soho大å¦3", |
| | | "str_brand" : "dahua", |
| | | "str_dev_name" : "æäº¬soho大åç£çéµå", |
| | | "str_ip" : "192.168.1.183", |
| | | "str_latitude" : "116.457093", |
| | | "str_longitude" : "39.994823", |
| | | "str_password" : "123333", |
| | | "str_reserved" : "", |
| | | "str_storage_dev_id" : "dahua:11:22:33:44:55:ab", |
| | | "str_username" : "admin3", |
| | | "tim_start_time" : "2018-08-23 00:00:00" |
| | | } |
| | | ] |
| | | |
| | | //ééæåæºç¼è¾ devchn_edit |
| | | ä¸åï¼ |
| | | { |
| | | "str_storage_dev_id": "dahua:11:22:33:44:55:ab", |
| | | "n_chn": 5, |
| | | "str_name": "大åç£çéµåéé5", |
| | | "str_addr": "æäº¬soho大å¦å¡3表b座2005", |
| | | "str_latitude": "116.457095", |
| | | "str_longitude": "39.994825", |
| | | "str_sdks": "1,2,4", |
| | | "str_det_thr": "90,80,95", |
| | | "str_cmp_thr": "80,85,95", |
| | | "str_reserved": "" |
| | | } |
| | | è¿åï¼æ åè¿åå¼ |
| | | |
| | | //ééæåæºæ¥è¯¢ devchn_show |
| | | ä¸åï¼ |
| | | { |
| | | "str_storage_dev_id": "DS-7808N-SN0820161208AARR691369356WCVU" |
| | | } |
| | | è¿åï¼ |
| | | [ |
| | | { |
| | | "n_chn" : 5, |
| | | "str_addr" : "æäº¬soho大å¦å¡3表b座2005", |
| | | "str_cmp_thr" : "80,85,96", |
| | | "str_det_thr" : "90,80,94", |
| | | "str_latitude" : "116.457095", |
| | | "str_longitude" : "39.994825", |
| | | "str_name" : "大åç£çéµåéé4", |
| | | "str_reserved" : "", |
| | | "str_sdks" : "1,2,4" |
| | | }, |
| | | { |
| | | "n_chn" : 4, |
| | | "str_addr" : "æäº¬soho大å¦å¡3表b座2004", |
| | | "str_cmp_thr" : "80,85,94", |
| | | "str_det_thr" : "90,80,94", |
| | | "str_latitude" : "116.457094", |
| | | "str_longitude" : "39.994824", |
| | | "str_name" : "大åç£çéµåéé4", |
| | | "str_reserved" : "", |
| | | "str_sdks" : "1,2,4" |
| | | } |
| | | ] |
| | | |
| | | |
| | | //æ£ç´¢ç£çéµåçææéé dev_search_chns |
| | | ä¸åï¼ |
| | | { |
| | | "str_storage_dev_id": "dahua:11:22:33:44:55:ab" |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "devchn_list" : "1,2,3,4" |
| | | } |
| | | |
| | | |
| | | //æµè¯ç£çéµåééè¿æ¥æ
åµ chk_chn_connet |
| | | ä¸åï¼ |
| | | { |
| | | "str_storage_dev_id": "dahua:11:22:33:44:55:ab", |
| | | "n_chn" : 1 |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "connect_status" : "True", |
| | | "video_url" : "http://192.168.1.188/group1/M00/00/01/wKgBvFuOcuCADeQUABVsWlPEN7w947.mp4" |
| | | } |
| | | |
| | | |
| | | //æåæºç¼è¾ cam_edit |
| | | ä¸åï¼ |
| | | { |
| | | "str_cam_dev_id": "dahua:ca:me:ra:11:22:33", |
| | | "str_name": "大åæåæº1", |
| | | "str_addr": "æäº¬soho大å¦å¡3 b座2005", |
| | | "str_latitude": "116.457092", |
| | | "str_longitude": "39.994827", |
| | | "str_ip" : "192.168.1.181", |
| | | "n_port" : 8080, |
| | | "str_username" : "admin", |
| | | "str_password" : "123456", |
| | | "str_brand" : "dahua", |
| | | "str_sdks": "1,2,4", |
| | | "str_det_thr": "90,80,95", |
| | | "str_cmp_thr": "80,85,90", |
| | | "str_reserved": "" |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "str_cam_dev_id" : "dahua:ca:me:ra:11:22:33" |
| | | } |
| | | |
| | | |
| | | //æåæºæ¥è¯¢ cam_show |
| | | ä¸åï¼ |
| | | è¿åï¼ |
| | | [ |
| | | { |
| | | "str_addr" : "æäº¬soho大å¦å¡3 b座2005", |
| | | "str_brand" : "dahua", |
| | | "str_cam_dev_id" : "dahua:ca:me:ra:22:22:22", |
| | | "str_cmp_thr" : "80,92", |
| | | "str_det_thr" : "90,92", |
| | | "str_ip" : 8080, |
| | | "str_latitude" : "116.457092", |
| | | "str_longitude" : "39.994827", |
| | | "str_name" : "大åæåæº2", |
| | | "str_password" : "123456", |
| | | "str_reserved" : "", |
| | | "str_sdks" : "1,2", |
| | | "str_username" : "admin" |
| | | }, |
| | | { |
| | | "str_addr" : "æäº¬soho大å¦å¡3 b座33", |
| | | "str_brand" : "dahua", |
| | | "str_cam_dev_id" : "dahua:ca:me:ra:33:33:33", |
| | | "str_cmp_thr" : "80,85,93", |
| | | "str_det_thr" : "90,80,93", |
| | | "str_ip" : 8080, |
| | | "str_latitude" : "116.457033", |
| | | "str_longitude" : "39.994833", |
| | | "str_name" : "大åæåæº3", |
| | | "str_password" : "123433", |
| | | "str_reserved" : "", |
| | | "str_sdks" : "1,2,3", |
| | | "str_username" : "admin" |
| | | } |
| | | ] |
| | | |
| | | |
| | | //æµè¯æåæºè¿æ¥,å¼å¯è¿æ¥ chk_cam_connet |
| | | ä¸åï¼ |
| | | { |
| | | "str_brand" : "haikang", |
| | | "str_ip" : "192.168.1.215", |
| | | "n_port" : 554, |
| | | "str_username" : "admin", |
| | | "str_password" : "a1234567" |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "connect_status" : "True", |
| | | "video_url" : "rtmp://localhost:1934/live/cam554" |
| | | } |
| | | |
| | | //æµè¯æåæºè¿æ¥,æå¼è¿æ¥ chk_cam_disconnet |
| | | ä¸åï¼ |
| | | { |
| | | "str_ip" : "192.168.1.215" |
| | | } |
| | | è¿åï¼ |
| | | æ åè¿åå¼ |
| | | |
| | | //å é¤ç£çéµåï¼åå¯¹åºææééï¼åéé对åºsdk dev_del |
| | | ä¸åï¼ |
| | | { |
| | | "str_storage_dev_id": "dahua:11:22:33:44:55:ab" |
| | | } |
| | | è¿åï¼æ åè¿åå¼ |
| | | |
| | | //å é¤æåæºå对åºsdk cam_del |
| | | ä¸åï¼ |
| | | { |
| | | "str_cam_dev_id": "dahua:ca:me:ra:11:22:33" |
| | | } |
| | | è¿åï¼ |
| | | |
| | | |
| | | //ç³»ç»ç®¡çä¿¡æ¯æ¥è¯¢ server_info_show |
| | | ä¸åï¼æ |
| | | è¿åï¼ |
| | | { |
| | | "alarm_ip" : "192.168.1.321", |
| | | "alarm_port" : 111, |
| | | "es_pic_ip" : "192.168.1.223", |
| | | "es_pic_port" : 333, |
| | | "web_pic_ip" : "192.168.1.312", |
| | | "web_pic_port" : 222 |
| | | } |
| | | |
| | | //ç³»ç»ç®¡çä¿¡æ¯è®¾ç½® server_info_edit |
| | | ä¸åï¼ |
| | | { |
| | | "alarm_ip": "192.168.1.111", |
| | | "alarm_port": 111, |
| | | "web_pic_ip": "192.168.1.222", |
| | | "web_pic_port": 222, |
| | | "es_pic_ip": "192.168.1.233", |
| | | "es_pic_port": 333 |
| | | } |
| | | è¿åï¼æ åè¿åå¼ |
| | | |
| | | |
| | | //è§é¢æ¶é¿æ¥è¯¢ cut_dura_show |
| | | ä¸åï¼æ |
| | | è¿åï¼ |
| | | { |
| | | "cut_max_duration" : 4 |
| | | } |
| | | |
| | | //è§é¢æ¶é¿è®¾ç½® cut_dura_edit |
| | | ä¸åï¼ |
| | | { |
| | | "cut_max_duration" : 3 |
| | | } |
| | | è¿åï¼æ åè¿åå¼ |
| | | |
| | | //è®¾ç½®æ¬æºç½ç»é
ç½® netconfig_edit |
| | | ä¸åï¼ |
| | | { |
| | | "ipaddr" : "192.168.1.113", |
| | | "netmask" : "255.255.255.0", |
| | | "gateway" : "192.168.1.1" |
| | | } |
| | | è¿åï¼æ åè¿åå¼ |
| | | |
| | | //æ¥çæ¬æºç½ç»é
ç½® netconfig_show |
| | | ä¸åï¼æ |
| | | è¿åï¼ |
| | | { |
| | | "ipaddr" : "192.168.1.113", |
| | | "netmask" : "255.255.255.0", |
| | | "gateway" : "192.168.1.1" |
| | | } |
| | | |
| | | æ¥è¯¢èç¹ searchNode |
| | | ä¸åï¼ æ |
| | | è¿åï¼ |
| | | { |
| | | "cluster_id": "a", |
| | | "cluster_name": "b", |
| | | "list":[ |
| | | { |
| | | "uuid": "317026e2-6df8-5bac-aea4-166d2ee250fb", |
| | | "node_id": "sub1@192.168.1.186", |
| | | "create_time":"time", |
| | | "dev_id":"", |
| | | "dev_name":"", |
| | | "node_ip":"" |
| | | }, |
| | | { |
| | | "uuid": "317026e2-6df8-5bac-aea4-166d2ee250fb", |
| | | "node_id": "sub1@192.168.1.186", |
| | | "create":"time", |
| | | "dev_id":"", |
| | | "dev_name":"", |
| | | "node_ip":"" |
| | | }, |
| | | { |
| | | "uuid": "317026e2-6df8-5bac-aea4-166d2ee250fb", |
| | | "node_id": "sub1@192.168.1.186", |
| | | "create":"time", |
| | | "dev_id":"", |
| | | "dev_name":"", |
| | | "node_ip":"" |
| | | } |
| | | ] |
| | | } |
| | | |
| | | ä¿®æ¹é群åç§° modifyCluName |
| | | ä¸åï¼ |
| | | { |
| | | "cluster_id": "a", |
| | | "cluster_name": "b" |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "results": "1" //0失败1æå |
| | | } |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": ["erlang is null"||"err_json"] |
| | | } |
| | | |
| | | æ·»å èç¹ addNode |
| | | ä¸åï¼ |
| | | { |
| | | "cookie": "abc", //é群cookie |
| | | "fatherNodeName": "main@192.168.1.186", //å¼å¯¼èç¹åç§°,æ·»å å¼å¯¼èç¹æ¶è¯¥å¼ä¸º" "(å
ä¸ºç©ºæ ¼) |
| | | "culID" : "uuid", //é群id |
| | | "culName" : "name", //é群åç§° |
| | | "devID" : "uuid" //设å¤id |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "error": ["erlang is null"||"err_json"] |
| | | } |
| | | |
| | | #TODO |
| | | å é¤èç¹ removeNode |
| | | ä¸åï¼ |
| | | { |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "error": ["erlang is null"] |
| | | } |
| | | |
| | | å建åºåº createDatabase |
| | | ä¸åï¼ |
| | | { |
| | | "TableType": "person", //表类åperson/car |
| | | "TableName": "test", //表å |
| | | "SyncType": "1", //åæ¥ç±»å1忥/0æ¬å°åº |
| | | "BwType": "1", //é»ç½åå1é»åå/0ç½åå |
| | | "StartTime": "2018-01-01 01:02:00", //å¼å§æ¶é´ |
| | | "EndTime": "2018-12-31 01:02:00" //ç»ææ¶é´ |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "results": "1" //0失败1æå |
| | | } |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": ["erlang is null"||"err_json"] |
| | | } |
| | | |
| | | |
| | | æ´æ°åºåº updateDatabase |
| | | ä¸åï¼ |
| | | { |
| | | "uuid":"", //表uuid |
| | | "TableType": "person", //表类åperson/car |
| | | "TableName": "test", //表å |
| | | "SyncType": "1", //åæ¥ç±»å1忥/0æ¬å°åº |
| | | "BwType": "1", //é»ç½åå1é»åå/0ç½åå |
| | | "StartTime": "2018-01-01 01:02:00", //å¼å§æ¶é´ |
| | | "EndTime": "2018-12-31 01:02:00" //ç»ææ¶é´ |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "results": "1" //0失败1æå |
| | | } |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": ["erlang is null"||"err_json"] |
| | | } |
| | | |
| | | å é¤åºåº deleteDatabase |
| | | ä¸åï¼ |
| | | { |
| | | "uuid":"", //表uuid |
| | | "TableType": "car", //表类åperson/car |
| | | "TableName": "test2", //表å |
| | | "SyncType": "1" //åæ¥ç±»å1忥/0æ¬å°åº |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "results": "1" //0失败1æå |
| | | } |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": ["erlang is null"||"err_json"] |
| | | } |
| | | |
| | | #å é¤ä¿®æ¹è¡¨æ¶,表åä¸å lt_;éè¦ä¼ SyncType åæ®µ |
| | | |
| | | # å é¤ä¿®æ¹æ·»å æ¥è¯¢åºåºäººåæ°æ®æ¶,éè¦åºåºåç§°å lt_ |
| | | |
| | | |
| | | æ¥æ¾åæ¥åºåº findAllDatabase |
| | | ä¸åï¼ |
| | | è¿åï¼ |
| | | [{ |
| | | "uuid": "e92a005e-fc19-56b5-8a23-53570bc270ae", //表uuid |
| | | "tableName": "test", //表å |
| | | "tableType": "person", //表类å |
| | | "bwType": "1", //é»ç½ååç±»å |
| | | "start_time": "2018-01-01 01:02:00", //å¼å§æ¶é´ |
| | | "end_time": "2018-12-31 01:02:00" //ç»ææ¶é´ |
| | | }] |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": "erlang is null" |
| | | } |
| | | |
| | | æ¥æ¾åæ¥åºåº findLocalDatabase |
| | | ä¸åï¼æ |
| | | è¿åï¼ |
| | | [{ |
| | | "uuid": "e92a005e-fc19-56b5-8a23-53570bc270ae", //表uuid |
| | | "tableName": "test", //表å |
| | | "tableType": "person", //表类å |
| | | "bwType": "1", //é»ç½ååç±»å |
| | | "start_time": "2018-01-01 01:02:00", //å¼å§æ¶é´ |
| | | "end_time": "2018-12-31 01:02:00" //ç»ææ¶é´ |
| | | }] |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": "erlang is null" |
| | | } |
| | | |
| | | #d |
| | | |
| | | å è½½åºåºæ°æ® loadFaceFeaData |
| | | ä¸åï¼ |
| | | { |
| | | "TableName":"test" //表å |
| | | } |
| | | è¿åï¼ |
| | | [{ |
| | | "uuid": "00b429d6-3746-57b9-8123-0dbf134731d2", //UUID |
| | | "tableName": "test", //表å |
| | | "idcard": "123456789012345678", //身份è¯å· |
| | | "imgUrl": "http://192.168.1.188/group1/M00/00/01/wKgBvFuOcuCAbYeQAB86k1llhSw841.jpg" |
| | | }, |
| | | { |
| | | "uuid": "0148cb5c-2232-5b02-9a00-f1f9a6b71de7", |
| | | "tableName": "test", |
| | | "idcard": "123456789012345678", |
| | | "imgUrl": "http://192.168.1.188/group1/M00/00/01/wKgBvFuOcuCADeQUABVsWlPEN7w947.jpg" |
| | | }, |
| | | { |
| | | "uuid": "01f20455-32bf-5c6e-b7b8-dea1395049a0", |
| | | "tableName": "test", |
| | | "idcard": "123456789012345678", |
| | | "imgUrl": "http://192.168.1.188/group1/M00/00/01/wKgBvFuOct-Aaz39ACP45aaRJUY002.jpg" |
| | | } |
| | | ] |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": ["erlang is null"||"err_json"] |
| | | } |
| | | |
| | | |
| | | æ·»å æè
æ´æ°äººå addPerson |
| | | ä¸åï¼ |
| | | { |
| | | "uuid": "", //æ·»å äººåæ¶è¯·ä¸ºç©º"" |
| | | "TableName": "test", //表å |
| | | "img_url ": "http: //192.168.1.188/group1/M00/00/01/wKgBvFuOcuGADRA_ABzanOgXxUE975.jpg", |
| | | "idcard : 123456789012345678", //身份è¯id |
| | | "img_base64 ": "" //å¾çbase64 |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "uuid": "82ee3b83-da2c-5d18-8cfa-f15e3ec4c9d4", |
| | | "img_url": "http://192.168.1.188/group1/M00/00/01/wKgBvFuOcuGADRA_ABzanOgXxUE975.jpg" |
| | | } |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": ["erlang is null"||"err_json"] |
| | | } |
| | | |
| | | |
| | | æ·»å æè
æ´æ°äººå delPerson |
| | | ä¸åï¼ |
| | | { |
| | | "uuid": "", |
| | | "TableName": "test" //表å |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "results": "1" //0失败1æå |
| | | } |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": ["erlang is null"||"err_json"] |
| | | } |
| | | |
| | | è·åæ¥è¦å¤§å¾ getAlarmImageFromVideoFile |
| | | ä¸åï¼ |
| | | { |
| | | "videoNum": "", //camId |
| | | "picDate": "2018-01-01 00:00:00" //æ¶é´ |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "img_url": "http://192.168.1.185/group1/M00/00/7E/wKgBuVu8pAiALzfPAAPo1cKj6Hc363.jpg" |
| | | } |
| | | éè¯¯ï¼ |
| | | { |
| | | "error": ["err_json"||""Not found Time"||"Time format error"||"Time error"||"Video File error"] |
| | | } |
| | | |
| | | |
| | | è·åè§é¢è·¯å¾ getRecordVideoPath |
| | | ä¸åï¼ |
| | | { |
| | | "videoNum": "", //camId |
| | | "picDate": "2018-01-01 00:00:00" //æ¶é´ |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "file_path": "/home/basic/work_src/test_Rec/1/20181109_11:04:46:509.mp4" |
| | | } |
| | | éè¯¯ï¼ |
| | | æ åè¿åå¼ |
| | | |
| | | è·å设å¤id findDevId |
| | | ä¸åï¼æ |
| | | è¿å |
| | | { |
| | | "dev_id":"1", |
| | | "dev_name":"sss" |
| | | } |
| | | éè¯¯ï¼ |
| | | æ åè¿åå¼ |
| | | |
| | | ä¿®æ¹è®¾å¤å editDevName |
| | | ä¸åï¼{"dev_name":"sss"} |
| | | è¿åï¼ |
| | | { |
| | | "ret_status": "ok_ack" |
| | | } |
| | | é误: |
| | | æ åè¿åå¼ |
| | | |
| | | ä¿®æ¹è®¾å¤id editDevId |
| | | ä¸åï¼ |
| | | { |
| | | "dev_batch":6, //æ¹æ¬¡ |
| | | "dev_sequence":6//åºåå· |
| | | } |
| | | è¿åï¼ |
| | | { |
| | | "ret_status": "ok_ack" |
| | | } |
| | | é误: |
| | | æ åè¿åå¼ |
| | | |
| New file |
| | |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(FaceDetectServer) |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build) |
| | | set(CMAKE_CXX_STANDARD 11) |
| | | set(CMAKE_BUILD_TYPE debug) |
| | | add_definitions(-DDEBUG_ERR -DDEBUG_INFO) |
| | | add_definitions(-DGLOG) |
| | | add_compile_options(-fPIC) |
| | | |
| | | SET(LIBS |
| | | glog |
| | | jsoncpp |
| | | Ice |
| | | crypto |
| | | pthread |
| | | opencv_world |
| | | Qt5Core |
| | | THFaceImage |
| | | THFeature |
| | | THFaceProperty |
| | | ) |
| | | include_directories( |
| | | ./rpc |
| | | ../../BasicPlatForm |
| | | ../../BasicPlatForm/libs/opencv/include |
| | | ../../BasicPlatForm/libs/jsoncpp/include |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/include |
| | | ../../BasicPlatForm/libs/ffmpeg/include |
| | | ../../BasicPlatForm/wrapper/casia/include |
| | | ../../BasicPlatForm/libs/Casia_Face/FaceSdk/include |
| | | /usr/include/x86_64-linux-gnu/qt5 |
| | | #glog |
| | | ../../BasicPlatForm/libs/glog/include |
| | | ) |
| | | |
| | | link_directories( |
| | | #glog |
| | | ../../BasicPlatForm/libs/glog/lib |
| | | ../../BasicPlatForm/libs/jsoncpp/lib |
| | | /usr/local/cuda/lib64 |
| | | ../../BasicPlatForm/libs/openssl/lib/ |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/lib64 |
| | | ../../BasicPlatForm/libs/openssl/lib |
| | | ../../BasicPlatForm/libs/opencv/lib |
| | | ../../BasicPlatForm/libs/Casia_Face/FaceSdk/lib/gpu |
| | | ) |
| | | |
| | | add_executable(${PROJECT_NAME} |
| | | main_detect.cpp |
| | | FaceDetectServerI.cpp |
| | | rpc/FaceServer.cpp |
| | | ) |
| | | add_executable(FaceDetectResourcesTest |
| | | FaceDetectResourcesTest.cpp |
| | | ) |
| | | |
| | | add_executable(FaceExtractServer |
| | | main_extract.cpp |
| | | FaceExtractServerI.cpp |
| | | rpc/FaceServer.cpp |
| | | ) |
| | | |
| | | target_link_libraries(${PROJECT_NAME} |
| | | ${LIBS} |
| | | ) |
| | | |
| | | target_link_libraries(FaceExtractServer |
| | | ${LIBS} |
| | | ) |
| | | |
| | | target_link_libraries(FaceDetectResourcesTest |
| | | glog |
| | | pthread |
| | | ) |
| | | |
| New file |
| | |
| | | #include "basic/util/resource/ResourcesManager.h" |
| | | #include <string> |
| | | #include <iostream> |
| | | #include <unistd.h> |
| | | #include <thread> |
| | | #include <basic/debug/Debug.h> |
| | | |
| | | using namespace std; |
| | | |
| | | int main(int argc, char *argv[]) { |
| | | ENABLEGLOG("./log/"); |
| | | ResourcesManager<int> resource(10000); |
| | | for (int i = 0; i < 10; i++) { |
| | | resource.pushResource(i); |
| | | } |
| | | std::thread thd1([&] { |
| | | int i = 6; |
| | | while (1) { |
| | | cout << i << ":" << resource.getAvilableChannel(to_string(i)) << endl; |
| | | usleep(2000000); |
| | | i++; |
| | | if (i > 13) i = 0; |
| | | } |
| | | |
| | | }); |
| | | std::thread thd2([&] { |
| | | int i = 0; |
| | | while (1) { |
| | | cout << i << ":" << resource.getAvilableChannel(to_string(i)) << endl; |
| | | usleep(100000); |
| | | i++; |
| | | if (i > 6)i = 0; |
| | | } |
| | | |
| | | }); |
| | | getchar(); |
| | | return 0; |
| | | } |
| New file |
| | |
| | | #include "FaceDetectServerI.h" |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <QtCore/QString> |
| | | #include <QtCore/QSharedMemory> |
| | | #include <basic/timer_counter/Clocktimer.h> |
| | | #include <THFaceImage_i.h> |
| | | #include <THFaceProperty_i.h> |
| | | |
| | | FaceDetectServerI::FaceDetectServerI() { |
| | | long threadMax = appPref.getLongData("thread.max"); |
| | | long gpuIndex = appPref.getLongData("gpu.index"); |
| | | for (int i = 0; i < threadMax; i++) { |
| | | detectResourcesManager.pushResource(i); |
| | | } |
| | | for (int i = 0; i < threadMax; i++) { |
| | | propertyResourcesManager.pushResource(i); |
| | | } |
| | | if (gpuIndex < 0) { |
| | | THFI_Param *param = new THFI_Param[threadMax]; |
| | | THFI_Create(threadMax, param); |
| | | delete[] param; |
| | | } else { |
| | | THFI_Param_Ex *param = new THFI_Param_Ex[threadMax]; |
| | | THFI_Param detParam; |
| | | detParam.nMinFaceSize = 20; |
| | | detParam.nRollAngle = 60; |
| | | for (int i = 0; i < threadMax; i++) { |
| | | param[i].tp = detParam; |
| | | param[i].nDeviceID = gpuIndex; |
| | | } |
| | | THFI_Create_Ex(threadMax, param); |
| | | delete[] param; |
| | | } |
| | | THFP_Create(threadMax); |
| | | } |
| | | |
| | | FaceDetectServerI::~FaceDetectServerI() { |
| | | THFI_Release(); |
| | | THFP_Release(); |
| | | } |
| | | |
| | | FaceDetect::Faces FaceDetectServerI::faceDetect(Ice::Int width, Ice::Int height, const std::string &shareMemoryName, |
| | | const Ice::Current &) { |
| | | ClockTimer ct("FaceDetectServerI::faceDetect"); |
| | | FaceDetect::Faces faces; |
| | | QSharedMemory shareMemory(QString(shareMemoryName.c_str())); |
| | | if (shareMemory.attach()) { |
| | | auto data = shareMemory.constData(); |
| | | THFI_FacePos facesPos[30]; |
| | | int channel = detectResourcesManager.getAvilableChannel(shareMemoryName); |
| | | int faceNum = THFI_DetectFace(channel, (BYTE *) data, 24, width, height, facesPos, 30); |
| | | if (faceNum > 0) { |
| | | for (int i = 0; i < faceNum; i++) { |
| | | FaceDetect::FacePos face; |
| | | auto &pos = facesPos[i]; |
| | | memcpy(&face, &pos, sizeof(pos) - sizeof(pos.pFacialData)); |
| | | face.pFacialData.resize(sizeof(pos.pFacialData)); |
| | | memcpy(face.pFacialData.data(), pos.pFacialData, sizeof(pos.pFacialData)); |
| | | // DBG(face.fAngle.confidence); |
| | | faces.push_back(face); |
| | | } |
| | | } else { |
| | | DBG("Face num is 0"); |
| | | } |
| | | } else { |
| | | ERR("shareMemory error " << shareMemoryName); |
| | | } |
| | | return faces; |
| | | } |
| | | |
| | | FaceDetect::ThftResult FaceDetectServerI::faceProperty(Ice::Int width, Ice::Int height, const FaceDetect::FacePos &pos, |
| | | const std::string &shareMemoryName, const Ice::Current &) { |
| | | QSharedMemory shareMemory(QString(shareMemoryName.c_str())); |
| | | if (shareMemory.attach()) { |
| | | FaceDetect::ThftResult thftResult; |
| | | THFP_Result_V2 propertys; |
| | | auto data = shareMemory.constData(); |
| | | THFI_FacePos facesPos; |
| | | int channel = propertyResourcesManager.getAvilableChannel(shareMemoryName); |
| | | memcpy(&facesPos, &pos, sizeof(facesPos) - sizeof(facesPos.pFacialData)); |
| | | memcpy(facesPos.pFacialData, pos.pFacialData.data(), sizeof(facesPos.pFacialData)); |
| | | int ret = THFP_Execute_V2(channel, (BYTE *) data, width, height, &facesPos, &propertys); |
| | | if (ret == 0)memcpy(&thftResult, &propertys, sizeof(propertys)); |
| | | else { |
| | | ERR("THFP_Execute_V2 faild, returns " << ret) |
| | | } |
| | | return thftResult; |
| | | } else { |
| | | throw std::runtime_error("shareMemory attach faild"); |
| | | } |
| | | } |
| New file |
| | |
| | | #ifndef FACEDETECTSERVERI_H |
| | | #define FACEDETECTSERVERI_H |
| | | #include <FaceServer.h> |
| | | #include <basic/util/resource/ResourcesManager.h> |
| | | #include <list> |
| | | class FaceDetectServerI : public FaceDetect::FaceDetectServer |
| | | { |
| | | public: |
| | | FaceDetectServerI(); |
| | | ~FaceDetectServerI(); |
| | | // FaceDetectServer interface |
| | | public: |
| | | virtual FaceDetect::Faces faceDetect(Ice::Int, Ice::Int, const std::string &, const Ice::Current &) override; |
| | | |
| | | private: |
| | | ResourcesManager<int> detectResourcesManager; |
| | | ResourcesManager<int> propertyResourcesManager; |
| | | |
| | | |
| | | // FaceDetectServer interface |
| | | public: |
| | | virtual FaceDetect::ThftResult faceProperty(Ice::Int, Ice::Int, const FaceDetect::FacePos &, const std::string &, const Ice::Current &) override; |
| | | }; |
| | | |
| | | |
| | | |
| | | #endif // FACEDETECTSERVERI_H |
| New file |
| | |
| | | #include "FaceExtractServerI.h" |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <QtCore/QString> |
| | | #include <QtCore/QSharedMemory> |
| | | #include <basic/timer_counter/Clocktimer.h> |
| | | #include <THFeature_i.h> |
| | | |
| | | FaceExtractServerI::FaceExtractServerI() { |
| | | long threadMax = appPref.getLongData("thread.max"); |
| | | long gpuIndex = appPref.getLongData("gpu.index"); |
| | | for (int i = 0; i < threadMax; i++) { |
| | | extractResourcesManager.pushResource(i); |
| | | } |
| | | if (gpuIndex < 0) { |
| | | CHKERR(EF_Init(threadMax), threadMax, "EF_Init returns "); |
| | | } else { |
| | | EF_Param *param = new EF_Param[threadMax]; |
| | | for (int i = 0; i < threadMax; i++) { |
| | | param[i].nDeviceID = gpuIndex; |
| | | } |
| | | |
| | | CHKERR(EF_Init_Ex(threadMax, param), threadMax, "EF_Init returns "); |
| | | delete[] param; |
| | | } |
| | | } |
| | | |
| | | FaceExtractServerI::~FaceExtractServerI() { |
| | | EF_Release(); |
| | | } |
| | | |
| | | FaceDetect::Data FaceExtractServerI::faceExtract(Ice::Int width, Ice::Int height, const FaceDetect::FacePos &pos, |
| | | const std::string &shareMemoryName, const Ice::Current &) { |
| | | ClockTimer ct("FaceExtractServerI::faceExtract"); |
| | | QSharedMemory shareMemory(QString(shareMemoryName.c_str())); |
| | | FaceDetect::Data feature; |
| | | if (shareMemory.attach()) { |
| | | auto data = shareMemory.constData(); |
| | | THFI_FacePos facesPos; |
| | | int channel = extractResourcesManager.getAvilableChannel(shareMemoryName); |
| | | memcpy(&facesPos, &pos, sizeof(facesPos) - sizeof(facesPos.pFacialData)); |
| | | memcpy(facesPos.pFacialData, pos.pFacialData.data(), sizeof(facesPos.pFacialData)); |
| | | feature.resize(EF_Size()); |
| | | int ret = EF_Extract(channel, (BYTE *) data, width, height, 3, &facesPos, feature.data()); |
| | | if (ret != 1) { |
| | | ERR("THFP_Execute_V2 faild, returns " << ret) |
| | | } |
| | | return feature; |
| | | } else { |
| | | throw std::runtime_error("shareMemory attach faild"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | #ifndef FACEEXTRACTSERVERI_H |
| | | #define FACEEXTRACTSERVERI_H |
| | | |
| | | #include <FaceServer.h> |
| | | #include <basic/util/resource/ResourcesManager.h> |
| | | class FaceExtractServerI : public FaceDetect::FaceExtractServer |
| | | { |
| | | public: |
| | | FaceExtractServerI(); |
| | | ~FaceExtractServerI(); |
| | | |
| | | // FaceExtractServer interface |
| | | public: |
| | | virtual FaceDetect::Data faceExtract(Ice::Int, Ice::Int, const FaceDetect::FacePos &, const std::string &, const Ice::Current &) override; |
| | | |
| | | ResourcesManager<int> extractResourcesManager; |
| | | }; |
| | | |
| | | |
| | | |
| | | #endif // FACEEXTRACTSERVERI_H |
| New file |
| | |
| | | #include <Ice/Ice.h> |
| | | #include <basic/rpc/IceRpc.hpp> |
| | | #include <thread> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include "FaceDetectServerI.h" |
| | | int main(int argc,char** argv) { |
| | | #ifdef DEBUG |
| | | argc = 2; |
| | | const char* home = argv[0]; |
| | | const char* iceCfg = "--Ice.Config=./node/servers/FaceDetectServer/config/config"; |
| | | argv = new char*[2]; |
| | | argv[0] = (char*)home; |
| | | argv[1] = (char*)iceCfg; |
| | | #endif |
| | | |
| | | SAVE_APP_ARGS; |
| | | auto ich = Ice::initialize(argc,argv); |
| | | |
| | | #ifdef DEBUG |
| | | std::string identity("FaceDetectServer"); |
| | | std::string gpuIndex("0"); |
| | | std::string adapterName("FaceDetectServerAdapter"); |
| | | int threadMax = 10; |
| | | #else |
| | | std::string identity =ich->getProperties()->getProperty("user.face.identity"); |
| | | std::string gpuIndex =ich->getProperties()->getProperty("user.gpu.index"); |
| | | std::string adapterName = ich->getProperties()->getProperty("user.adapter.name"); |
| | | int threadMax = atol(ich->getProperties()->getProperty("user.thread.max").c_str()); |
| | | #endif |
| | | ich->getProperties()->setProperty("Ice.ThreadPool.Server.SizeMax",to_string(threadMax)); |
| | | appPref.setLongData("gpu.index",atol(gpuIndex.c_str())); |
| | | appPref.setLongData("thread.max", threadMax); |
| | | |
| | | auto adapter = ich->createObjectAdapter(adapterName); |
| | | adapter->add(new FaceDetectServerI(), Ice::stringToIdentity(identity)); |
| | | adapter->activate(); |
| | | ich->waitForShutdown(); |
| | | |
| | | return 0; |
| | | } |
| New file |
| | |
| | | #include <Ice/Ice.h> |
| | | #include <basic/rpc/IceRpc.hpp> |
| | | #include <thread> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include "FaceDetectServerI.h" |
| | | #include <basic/debug/Debug.h> |
| | | #include <basic/util/app/AppConfig.h> |
| | | |
| | | int main1(int argc, char **argv) { |
| | | #ifdef DEBUG |
| | | argc = 2; |
| | | const char* home = argv[0]; |
| | | const char* iceCfg = "--Ice.Config=./node/servers/FaceDetectServer/config/config"; |
| | | argv = new char*[2]; |
| | | argv[0] = (char*)home; |
| | | argv[1] = (char*)iceCfg; |
| | | #endif |
| | | |
| | | SAVE_APP_ARGS; |
| | | auto ich = Ice::initialize(argc, argv); |
| | | |
| | | #ifdef DEBUG |
| | | std::string identity("FaceDetectServer"); |
| | | std::string gpuIndex("0"); |
| | | std::string adapterName("FaceDetectServerAdapter"); |
| | | int threadMax = 10; |
| | | #else |
| | | std::string identity = ich->getProperties()->getProperty("user.face.identity"); |
| | | std::string gpuIndex = ich->getProperties()->getProperty("user.gpu.index"); |
| | | std::string adapterName = ich->getProperties()->getProperty("user.adapter.name"); |
| | | int threadMax = atol(ich->getProperties()->getProperty("user.thread.max").c_str()); |
| | | #endif |
| | | ich->getProperties()->setProperty("Ice.ThreadPool.Server.SizeMax", std::to_string(threadMax)); |
| | | appPref.setLongData("gpu.index", atol(gpuIndex.c_str())); |
| | | appPref.setLongData("thread.max", threadMax); |
| | | |
| | | auto adapter = ich->createObjectAdapter(adapterName); |
| | | adapter->add(new FaceDetectServerI(), Ice::stringToIdentity(identity)); |
| | | adapter->activate(); |
| | | ich->waitForShutdown(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int main(int argc, char **argv) { |
| | | SAVE_APP_ARGS; |
| | | ENABLEGLOG(GET_STR_CONFIG("logPath").c_str()); |
| | | auto ich = Ice::initialize(argc, argv); |
| | | |
| | | appPref.setLongData("gpu.index", 0); |
| | | appPref.setLongData("thread.max", 32); |
| | | |
| | | IceRpcServer<FaceDetectServerI> server("faceServer", 10002, "tcp"); |
| | | server.setMessageSizeMax(1024 * 1024 * 50); |
| | | server.setPoolInitSize(10); |
| | | server.setPoolMaxSize(32); |
| | | server.runWaitShutDown(); |
| | | return 0; |
| | | } |
| New file |
| | |
| | | #include <Ice/Ice.h> |
| | | #include <basic/rpc/IceRpc.hpp> |
| | | #include <thread> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/util/app/AppConfig.h> |
| | | #include "FaceExtractServerI.h" |
| | | #include <basic/debug/Debug.h> |
| | | |
| | | int main1(int argc, char **argv) { |
| | | #ifdef DEBUG |
| | | argc = 2; |
| | | const char* home = argv[0]; |
| | | const char* iceCfg = "--Ice.Config=./node/servers/FaceExtractServer/config/config"; |
| | | argv = new char*[2]; |
| | | argv[0] = (char*)home; |
| | | argv[1] = (char*)iceCfg; |
| | | #endif |
| | | |
| | | SAVE_APP_ARGS; |
| | | auto ich = Ice::initialize(argc, argv); |
| | | |
| | | #ifdef DEBUG |
| | | std::string identity("FaceExtractServer"); |
| | | std::string gpuIndex("0"); |
| | | std::string adapterName("FaceExtractServerAdapter"); |
| | | int threadMax = 10; |
| | | #else |
| | | std::string identity = ich->getProperties()->getProperty("user.face.identity"); |
| | | std::string gpuIndex = ich->getProperties()->getProperty("user.gpu.index"); |
| | | std::string adapterName = ich->getProperties()->getProperty("user.adapter.name"); |
| | | int threadMax = atol(ich->getProperties()->getProperty("user.thread.max").c_str()); |
| | | #endif |
| | | ich->getProperties()->setProperty("Ice.ThreadPool.Server.SizeMax", std::to_string(threadMax)); |
| | | appPref.setLongData("gpu.index", atol(gpuIndex.c_str())); |
| | | appPref.setLongData("thread.max", threadMax); |
| | | |
| | | auto adapter = ich->createObjectAdapter(adapterName); |
| | | adapter->add(new FaceExtractServerI(), Ice::stringToIdentity(identity)); |
| | | adapter->activate(); |
| | | ich->waitForShutdown(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int main(int argc, char **argv) { |
| | | |
| | | SAVE_APP_ARGS; |
| | | ENABLEGLOG(GET_STR_CONFIG("logPath").c_str()); |
| | | auto ich = Ice::initialize(argc, argv); |
| | | |
| | | appPref.setLongData("gpu.index", 0); |
| | | appPref.setLongData("thread.max", 32); |
| | | |
| | | IceRpcServer<FaceExtractServerI> server("faceExtractServer", 10008, "tcp"); |
| | | server.setMessageSizeMax(1024 * 1024 * 50); |
| | | server.setPoolInitSize(10); |
| | | server.setPoolMaxSize(32); |
| | | server.runWaitShutDown(); |
| | | return 0; |
| | | } |
| New file |
| | |
| | | // ********************************************************************** |
| | | // |
| | | // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. |
| | | // |
| | | // This copy of Ice is licensed to you under the terms described in the |
| | | // ICE_LICENSE file included in this distribution. |
| | | // |
| | | // ********************************************************************** |
| | | // |
| | | // Ice version 3.7.0 |
| | | // |
| | | // <auto-generated> |
| | | // |
| | | // Generated from file `FaceServer.ice' |
| | | // |
| | | // Warning: do not edit this file. |
| | | // |
| | | // </auto-generated> |
| | | // |
| | | |
| | | #include <FaceServer.h> |
| | | #include <IceUtil/PushDisableWarnings.h> |
| | | #include <Ice/LocalException.h> |
| | | #include <Ice/ValueFactory.h> |
| | | #include <Ice/OutgoingAsync.h> |
| | | #include <Ice/InputStream.h> |
| | | #include <Ice/OutputStream.h> |
| | | #include <IceUtil/PopDisableWarnings.h> |
| | | |
| | | #if defined(_MSC_VER) |
| | | # pragma warning(disable:4458) // declaration of ... hides class member |
| | | #elif defined(__clang__) |
| | | # pragma clang diagnostic ignored "-Wshadow" |
| | | #elif defined(__GNUC__) |
| | | # pragma GCC diagnostic ignored "-Wshadow" |
| | | #endif |
| | | |
| | | #ifndef ICE_IGNORE_VERSION |
| | | # if ICE_INT_VERSION / 100 != 307 |
| | | # error Ice version mismatch! |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 > 50 |
| | | # error Beta header file detected |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 < 0 |
| | | # error Ice patch level mismatch! |
| | | # endif |
| | | #endif |
| | | |
| | | #ifdef ICE_CPP11_MAPPING // C++11 mapping |
| | | |
| | | namespace |
| | | { |
| | | |
| | | const ::std::string iceC_FaceDetect_FaceDetectServer_ids[2] = |
| | | { |
| | | "::FaceDetect::FaceDetectServer", |
| | | "::Ice::Object" |
| | | }; |
| | | const ::std::string iceC_FaceDetect_FaceDetectServer_ops[] = |
| | | { |
| | | "faceDetect", |
| | | "faceProperty", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping" |
| | | }; |
| | | const ::std::string iceC_FaceDetect_FaceDetectServer_faceDetect_name = "faceDetect"; |
| | | const ::std::string iceC_FaceDetect_FaceDetectServer_faceProperty_name = "faceProperty"; |
| | | |
| | | const ::std::string iceC_FaceDetect_FaceExtractServer_ids[2] = |
| | | { |
| | | "::FaceDetect::FaceExtractServer", |
| | | "::Ice::Object" |
| | | }; |
| | | const ::std::string iceC_FaceDetect_FaceExtractServer_ops[] = |
| | | { |
| | | "faceExtract", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping" |
| | | }; |
| | | const ::std::string iceC_FaceDetect_FaceExtractServer_faceExtract_name = "faceExtract"; |
| | | |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceDetectServer::ice_isA(::std::string s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_FaceDetect_FaceDetectServer_ids, iceC_FaceDetect_FaceDetectServer_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector<::std::string> |
| | | FaceDetect::FaceDetectServer::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector<::std::string>(&iceC_FaceDetect_FaceDetectServer_ids[0], &iceC_FaceDetect_FaceDetectServer_ids[2]); |
| | | } |
| | | |
| | | ::std::string |
| | | FaceDetect::FaceDetectServer::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceDetect::FaceDetectServer::ice_staticId() |
| | | { |
| | | static const ::std::string typeId = "::FaceDetect::FaceDetectServer"; |
| | | return typeId; |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceDetectServer::_iceD_faceDetect(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | int iceP_width; |
| | | int iceP_height; |
| | | ::std::string iceP_shareMemory; |
| | | istr->readAll(iceP_width, iceP_height, iceP_shareMemory); |
| | | inS.endReadParams(); |
| | | ::FaceDetect::Faces ret = this->faceDetect(iceP_width, iceP_height, ::std::move(iceP_shareMemory), current); |
| | | auto ostr = inS.startWriteParams(); |
| | | ostr->writeAll(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceDetectServer::_iceD_faceProperty(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | int iceP_width; |
| | | int iceP_height; |
| | | ::FaceDetect::FacePos iceP_pos; |
| | | ::std::string iceP_shareMemory; |
| | | istr->readAll(iceP_width, iceP_height, iceP_pos, iceP_shareMemory); |
| | | inS.endReadParams(); |
| | | ::FaceDetect::ThftResult ret = this->faceProperty(iceP_width, iceP_height, ::std::move(iceP_pos), ::std::move(iceP_shareMemory), current); |
| | | auto ostr = inS.startWriteParams(); |
| | | ostr->writeAll(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceDetectServer::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_FaceDetect_FaceDetectServer_ops, iceC_FaceDetect_FaceDetectServer_ops + 6, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_FaceDetect_FaceDetectServer_ops) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_faceDetect(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_faceProperty(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 5: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceExtractServer::ice_isA(::std::string s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_FaceDetect_FaceExtractServer_ids, iceC_FaceDetect_FaceExtractServer_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector<::std::string> |
| | | FaceDetect::FaceExtractServer::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector<::std::string>(&iceC_FaceDetect_FaceExtractServer_ids[0], &iceC_FaceDetect_FaceExtractServer_ids[2]); |
| | | } |
| | | |
| | | ::std::string |
| | | FaceDetect::FaceExtractServer::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceDetect::FaceExtractServer::ice_staticId() |
| | | { |
| | | static const ::std::string typeId = "::FaceDetect::FaceExtractServer"; |
| | | return typeId; |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceExtractServer::_iceD_faceExtract(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | int iceP_width; |
| | | int iceP_height; |
| | | ::FaceDetect::FacePos iceP_pos; |
| | | ::std::string iceP_shareMemory; |
| | | istr->readAll(iceP_width, iceP_height, iceP_pos, iceP_shareMemory); |
| | | inS.endReadParams(); |
| | | ::FaceDetect::Data ret = this->faceExtract(iceP_width, iceP_height, ::std::move(iceP_pos), ::std::move(iceP_shareMemory), current); |
| | | auto ostr = inS.startWriteParams(); |
| | | ostr->writeAll(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceExtractServer::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_FaceDetect_FaceExtractServer_ops, iceC_FaceDetect_FaceExtractServer_ops + 5, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_FaceDetect_FaceExtractServer_ops) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_faceExtract(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | FaceDetect::FaceDetectServerPrx::_iceI_faceDetect(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceDetect::Faces>>& outAsync, int iceP_width, int iceP_height, const ::std::string& iceP_shareMemory, const ::Ice::Context& context) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceDetect_FaceDetectServer_faceDetect_name); |
| | | outAsync->invoke(iceC_FaceDetect_FaceDetectServer_faceDetect_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_width, iceP_height, iceP_shareMemory); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | void |
| | | FaceDetect::FaceDetectServerPrx::_iceI_faceProperty(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceDetect::ThftResult>>& outAsync, int iceP_width, int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceDetect_FaceDetectServer_faceProperty_name); |
| | | outAsync->invoke(iceC_FaceDetect_FaceDetectServer_faceProperty_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_width, iceP_height, iceP_pos, iceP_shareMemory); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | ::std::shared_ptr<::Ice::ObjectPrx> |
| | | FaceDetect::FaceDetectServerPrx::_newInstance() const |
| | | { |
| | | return ::IceInternal::createProxy<FaceDetectServerPrx>(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceDetect::FaceDetectServerPrx::ice_staticId() |
| | | { |
| | | return FaceDetect::FaceDetectServer::ice_staticId(); |
| | | } |
| | | |
| | | void |
| | | FaceDetect::FaceExtractServerPrx::_iceI_faceExtract(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceDetect::Data>>& outAsync, int iceP_width, int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceDetect_FaceExtractServer_faceExtract_name); |
| | | outAsync->invoke(iceC_FaceDetect_FaceExtractServer_faceExtract_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_width, iceP_height, iceP_pos, iceP_shareMemory); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | ::std::shared_ptr<::Ice::ObjectPrx> |
| | | FaceDetect::FaceExtractServerPrx::_newInstance() const |
| | | { |
| | | return ::IceInternal::createProxy<FaceExtractServerPrx>(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceDetect::FaceExtractServerPrx::ice_staticId() |
| | | { |
| | | return FaceDetect::FaceExtractServer::ice_staticId(); |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | } |
| | | |
| | | #else // C++98 mapping |
| | | |
| | | namespace |
| | | { |
| | | |
| | | const ::std::string iceC_FaceDetect_FaceDetectServer_faceDetect_name = "faceDetect"; |
| | | |
| | | const ::std::string iceC_FaceDetect_FaceDetectServer_faceProperty_name = "faceProperty"; |
| | | |
| | | const ::std::string iceC_FaceDetect_FaceExtractServer_faceExtract_name = "faceExtract"; |
| | | |
| | | } |
| | | ::IceProxy::Ice::Object* ::IceProxy::FaceDetect::upCast(::IceProxy::FaceDetect::FaceDetectServer* p) { return p; } |
| | | |
| | | void |
| | | ::IceProxy::FaceDetect::_readProxy(::Ice::InputStream* istr, ::IceInternal::ProxyHandle< ::IceProxy::FaceDetect::FaceDetectServer>& v) |
| | | { |
| | | ::Ice::ObjectPrx proxy; |
| | | istr->read(proxy); |
| | | if(!proxy) |
| | | { |
| | | v = 0; |
| | | } |
| | | else |
| | | { |
| | | v = new ::IceProxy::FaceDetect::FaceDetectServer; |
| | | v->_copyFrom(proxy); |
| | | } |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::FaceDetect::FaceDetectServer::_iceI_begin_faceDetect(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::std::string& iceP_shareMemory, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceDetect_FaceDetectServer_faceDetect_name, sync); |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_FaceDetect_FaceDetectServer_faceDetect_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_FaceDetect_FaceDetectServer_faceDetect_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_width); |
| | | ostr->write(iceP_height); |
| | | ostr->write(iceP_shareMemory); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_FaceDetect_FaceDetectServer_faceDetect_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | ::FaceDetect::Faces |
| | | IceProxy::FaceDetect::FaceDetectServer::end_faceDetect(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | ::Ice::AsyncResult::_check(result, this, iceC_FaceDetect_FaceDetectServer_faceDetect_name); |
| | | ::FaceDetect::Faces ret; |
| | | if(!result->_waitForResponse()) |
| | | { |
| | | try |
| | | { |
| | | result->_throwUserException(); |
| | | } |
| | | catch(const ::Ice::UserException& ex) |
| | | { |
| | | throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); |
| | | } |
| | | } |
| | | ::Ice::InputStream* istr = result->_startReadParams(); |
| | | istr->read(ret); |
| | | result->_endReadParams(); |
| | | return ret; |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::FaceDetect::FaceDetectServer::_iceI_begin_faceProperty(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceDetect_FaceDetectServer_faceProperty_name, sync); |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_FaceDetect_FaceDetectServer_faceProperty_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_FaceDetect_FaceDetectServer_faceProperty_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_width); |
| | | ostr->write(iceP_height); |
| | | ostr->write(iceP_pos); |
| | | ostr->write(iceP_shareMemory); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_FaceDetect_FaceDetectServer_faceProperty_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | ::FaceDetect::ThftResult |
| | | IceProxy::FaceDetect::FaceDetectServer::end_faceProperty(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | ::Ice::AsyncResult::_check(result, this, iceC_FaceDetect_FaceDetectServer_faceProperty_name); |
| | | ::FaceDetect::ThftResult ret; |
| | | if(!result->_waitForResponse()) |
| | | { |
| | | try |
| | | { |
| | | result->_throwUserException(); |
| | | } |
| | | catch(const ::Ice::UserException& ex) |
| | | { |
| | | throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); |
| | | } |
| | | } |
| | | ::Ice::InputStream* istr = result->_startReadParams(); |
| | | istr->read(ret); |
| | | result->_endReadParams(); |
| | | return ret; |
| | | } |
| | | |
| | | ::IceProxy::Ice::Object* |
| | | IceProxy::FaceDetect::FaceDetectServer::_newInstance() const |
| | | { |
| | | return new FaceDetectServer; |
| | | } |
| | | |
| | | const ::std::string& |
| | | IceProxy::FaceDetect::FaceDetectServer::ice_staticId() |
| | | { |
| | | return ::FaceDetect::FaceDetectServer::ice_staticId(); |
| | | } |
| | | ::IceProxy::Ice::Object* ::IceProxy::FaceDetect::upCast(::IceProxy::FaceDetect::FaceExtractServer* p) { return p; } |
| | | |
| | | void |
| | | ::IceProxy::FaceDetect::_readProxy(::Ice::InputStream* istr, ::IceInternal::ProxyHandle< ::IceProxy::FaceDetect::FaceExtractServer>& v) |
| | | { |
| | | ::Ice::ObjectPrx proxy; |
| | | istr->read(proxy); |
| | | if(!proxy) |
| | | { |
| | | v = 0; |
| | | } |
| | | else |
| | | { |
| | | v = new ::IceProxy::FaceDetect::FaceExtractServer; |
| | | v->_copyFrom(proxy); |
| | | } |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::FaceDetect::FaceExtractServer::_iceI_begin_faceExtract(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceDetect_FaceExtractServer_faceExtract_name, sync); |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_FaceDetect_FaceExtractServer_faceExtract_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_FaceDetect_FaceExtractServer_faceExtract_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_width); |
| | | ostr->write(iceP_height); |
| | | ostr->write(iceP_pos); |
| | | ostr->write(iceP_shareMemory); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_FaceDetect_FaceExtractServer_faceExtract_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | ::FaceDetect::Data |
| | | IceProxy::FaceDetect::FaceExtractServer::end_faceExtract(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | ::Ice::AsyncResult::_check(result, this, iceC_FaceDetect_FaceExtractServer_faceExtract_name); |
| | | ::FaceDetect::Data ret; |
| | | if(!result->_waitForResponse()) |
| | | { |
| | | try |
| | | { |
| | | result->_throwUserException(); |
| | | } |
| | | catch(const ::Ice::UserException& ex) |
| | | { |
| | | throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); |
| | | } |
| | | } |
| | | ::Ice::InputStream* istr = result->_startReadParams(); |
| | | istr->read(ret); |
| | | result->_endReadParams(); |
| | | return ret; |
| | | } |
| | | |
| | | ::IceProxy::Ice::Object* |
| | | IceProxy::FaceDetect::FaceExtractServer::_newInstance() const |
| | | { |
| | | return new FaceExtractServer; |
| | | } |
| | | |
| | | const ::std::string& |
| | | IceProxy::FaceDetect::FaceExtractServer::ice_staticId() |
| | | { |
| | | return ::FaceDetect::FaceExtractServer::ice_staticId(); |
| | | } |
| | | |
| | | FaceDetect::FaceDetectServer::~FaceDetectServer() |
| | | { |
| | | } |
| | | |
| | | ::Ice::Object* FaceDetect::upCast(::FaceDetect::FaceDetectServer* p) { return p; } |
| | | |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_FaceDetect_FaceDetectServer_ids[2] = |
| | | { |
| | | "::FaceDetect::FaceDetectServer", |
| | | "::Ice::Object" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceDetectServer::ice_isA(const ::std::string& s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_FaceDetect_FaceDetectServer_ids, iceC_FaceDetect_FaceDetectServer_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector< ::std::string> |
| | | FaceDetect::FaceDetectServer::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector< ::std::string>(&iceC_FaceDetect_FaceDetectServer_ids[0], &iceC_FaceDetect_FaceDetectServer_ids[2]); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceDetect::FaceDetectServer::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceDetect::FaceDetectServer::ice_staticId() |
| | | { |
| | | #ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC |
| | | static const ::std::string typeId = "::FaceDetect::FaceDetectServer"; |
| | | return typeId; |
| | | #else |
| | | return iceC_FaceDetect_FaceDetectServer_ids[0]; |
| | | #endif |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceDetectServer::_iceD_faceDetect(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::Ice::Int iceP_width; |
| | | ::Ice::Int iceP_height; |
| | | ::std::string iceP_shareMemory; |
| | | istr->read(iceP_width); |
| | | istr->read(iceP_height); |
| | | istr->read(iceP_shareMemory); |
| | | inS.endReadParams(); |
| | | ::FaceDetect::Faces ret = this->faceDetect(iceP_width, iceP_height, iceP_shareMemory, current); |
| | | ::Ice::OutputStream* ostr = inS.startWriteParams(); |
| | | ostr->write(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceDetectServer::_iceD_faceProperty(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::Ice::Int iceP_width; |
| | | ::Ice::Int iceP_height; |
| | | ::FaceDetect::FacePos iceP_pos; |
| | | ::std::string iceP_shareMemory; |
| | | istr->read(iceP_width); |
| | | istr->read(iceP_height); |
| | | istr->read(iceP_pos); |
| | | istr->read(iceP_shareMemory); |
| | | inS.endReadParams(); |
| | | ::FaceDetect::ThftResult ret = this->faceProperty(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, current); |
| | | ::Ice::OutputStream* ostr = inS.startWriteParams(); |
| | | ostr->write(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_FaceDetect_FaceDetectServer_all[] = |
| | | { |
| | | "faceDetect", |
| | | "faceProperty", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceDetectServer::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_FaceDetect_FaceDetectServer_all, iceC_FaceDetect_FaceDetectServer_all + 6, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_FaceDetect_FaceDetectServer_all) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_faceDetect(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_faceProperty(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 5: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | FaceDetect::FaceDetectServer::_iceWriteImpl(::Ice::OutputStream* ostr) const |
| | | { |
| | | ostr->startSlice(ice_staticId(), -1, true); |
| | | Ice::StreamWriter< ::FaceDetect::FaceDetectServer, ::Ice::OutputStream>::write(ostr, *this); |
| | | ostr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | FaceDetect::FaceDetectServer::_iceReadImpl(::Ice::InputStream* istr) |
| | | { |
| | | istr->startSlice(); |
| | | Ice::StreamReader< ::FaceDetect::FaceDetectServer, ::Ice::InputStream>::read(istr, *this); |
| | | istr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | FaceDetect::_icePatchObjectPtr(FaceDetectServerPtr& handle, const ::Ice::ObjectPtr& v) |
| | | { |
| | | handle = ::FaceDetect::FaceDetectServerPtr::dynamicCast(v); |
| | | if(v && !handle) |
| | | { |
| | | IceInternal::Ex::throwUOE(::FaceDetect::FaceDetectServer::ice_staticId(), v); |
| | | } |
| | | } |
| | | |
| | | FaceDetect::FaceExtractServer::~FaceExtractServer() |
| | | { |
| | | } |
| | | |
| | | ::Ice::Object* FaceDetect::upCast(::FaceDetect::FaceExtractServer* p) { return p; } |
| | | |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_FaceDetect_FaceExtractServer_ids[2] = |
| | | { |
| | | "::FaceDetect::FaceExtractServer", |
| | | "::Ice::Object" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceExtractServer::ice_isA(const ::std::string& s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_FaceDetect_FaceExtractServer_ids, iceC_FaceDetect_FaceExtractServer_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector< ::std::string> |
| | | FaceDetect::FaceExtractServer::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector< ::std::string>(&iceC_FaceDetect_FaceExtractServer_ids[0], &iceC_FaceDetect_FaceExtractServer_ids[2]); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceDetect::FaceExtractServer::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceDetect::FaceExtractServer::ice_staticId() |
| | | { |
| | | #ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC |
| | | static const ::std::string typeId = "::FaceDetect::FaceExtractServer"; |
| | | return typeId; |
| | | #else |
| | | return iceC_FaceDetect_FaceExtractServer_ids[0]; |
| | | #endif |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceExtractServer::_iceD_faceExtract(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::Ice::Int iceP_width; |
| | | ::Ice::Int iceP_height; |
| | | ::FaceDetect::FacePos iceP_pos; |
| | | ::std::string iceP_shareMemory; |
| | | istr->read(iceP_width); |
| | | istr->read(iceP_height); |
| | | istr->read(iceP_pos); |
| | | istr->read(iceP_shareMemory); |
| | | inS.endReadParams(); |
| | | ::FaceDetect::Data ret = this->faceExtract(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, current); |
| | | ::Ice::OutputStream* ostr = inS.startWriteParams(); |
| | | ostr->write(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_FaceDetect_FaceExtractServer_all[] = |
| | | { |
| | | "faceExtract", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | FaceDetect::FaceExtractServer::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_FaceDetect_FaceExtractServer_all, iceC_FaceDetect_FaceExtractServer_all + 5, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_FaceDetect_FaceExtractServer_all) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_faceExtract(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | FaceDetect::FaceExtractServer::_iceWriteImpl(::Ice::OutputStream* ostr) const |
| | | { |
| | | ostr->startSlice(ice_staticId(), -1, true); |
| | | Ice::StreamWriter< ::FaceDetect::FaceExtractServer, ::Ice::OutputStream>::write(ostr, *this); |
| | | ostr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | FaceDetect::FaceExtractServer::_iceReadImpl(::Ice::InputStream* istr) |
| | | { |
| | | istr->startSlice(); |
| | | Ice::StreamReader< ::FaceDetect::FaceExtractServer, ::Ice::InputStream>::read(istr, *this); |
| | | istr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | FaceDetect::_icePatchObjectPtr(FaceExtractServerPtr& handle, const ::Ice::ObjectPtr& v) |
| | | { |
| | | handle = ::FaceDetect::FaceExtractServerPtr::dynamicCast(v); |
| | | if(v && !handle) |
| | | { |
| | | IceInternal::Ex::throwUOE(::FaceDetect::FaceExtractServer::ice_staticId(), v); |
| | | } |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | } |
| | | |
| | | #endif |
| New file |
| | |
| | | // ********************************************************************** |
| | | // |
| | | // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. |
| | | // |
| | | // This copy of Ice is licensed to you under the terms described in the |
| | | // ICE_LICENSE file included in this distribution. |
| | | // |
| | | // ********************************************************************** |
| | | // |
| | | // Ice version 3.7.0 |
| | | // |
| | | // <auto-generated> |
| | | // |
| | | // Generated from file `FaceServer.ice' |
| | | // |
| | | // Warning: do not edit this file. |
| | | // |
| | | // </auto-generated> |
| | | // |
| | | |
| | | #ifndef __FaceServer_h__ |
| | | #define __FaceServer_h__ |
| | | |
| | | #include <IceUtil/PushDisableWarnings.h> |
| | | #include <Ice/ProxyF.h> |
| | | #include <Ice/ObjectF.h> |
| | | #include <Ice/ValueF.h> |
| | | #include <Ice/Exception.h> |
| | | #include <Ice/LocalObject.h> |
| | | #include <Ice/StreamHelpers.h> |
| | | #include <Ice/Comparable.h> |
| | | #include <Ice/Proxy.h> |
| | | #include <Ice/Object.h> |
| | | #include <Ice/GCObject.h> |
| | | #include <Ice/Value.h> |
| | | #include <Ice/Incoming.h> |
| | | #include <Ice/FactoryTableInit.h> |
| | | #include <IceUtil/ScopedArray.h> |
| | | #include <Ice/Optional.h> |
| | | #include <IceUtil/UndefSysMacros.h> |
| | | |
| | | #ifndef ICE_IGNORE_VERSION |
| | | # if ICE_INT_VERSION / 100 != 307 |
| | | # error Ice version mismatch! |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 > 50 |
| | | # error Beta header file detected |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 < 0 |
| | | # error Ice patch level mismatch! |
| | | # endif |
| | | #endif |
| | | |
| | | #ifdef ICE_CPP11_MAPPING // C++11 mapping |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | class FaceDetectServer; |
| | | class FaceDetectServerPrx; |
| | | class FaceExtractServer; |
| | | class FaceExtractServerPrx; |
| | | |
| | | } |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | struct POINT |
| | | { |
| | | int x; |
| | | int y; |
| | | |
| | | std::tuple<const int&, const int&> ice_tuple() const |
| | | { |
| | | return std::tie(x, y); |
| | | } |
| | | }; |
| | | |
| | | struct RECT |
| | | { |
| | | int left; |
| | | int top; |
| | | int right; |
| | | int bottom; |
| | | |
| | | std::tuple<const int&, const int&, const int&, const int&> ice_tuple() const |
| | | { |
| | | return std::tie(left, top, right, bottom); |
| | | } |
| | | }; |
| | | |
| | | struct FaceAngle |
| | | { |
| | | int yaw; |
| | | int pitch; |
| | | int roll; |
| | | float confidence; |
| | | |
| | | std::tuple<const int&, const int&, const int&, const float&> ice_tuple() const |
| | | { |
| | | return std::tie(yaw, pitch, roll, confidence); |
| | | } |
| | | }; |
| | | |
| | | struct ThftResult |
| | | { |
| | | int gender; |
| | | int age; |
| | | int race; |
| | | int beauty_level; |
| | | int smile_level; |
| | | |
| | | std::tuple<const int&, const int&, const int&, const int&, const int&> ice_tuple() const |
| | | { |
| | | return std::tie(gender, age, race, beauty_level, smile_level); |
| | | } |
| | | }; |
| | | |
| | | using Data = ::std::vector<::Ice::Byte>; |
| | | |
| | | struct FacePos |
| | | { |
| | | ::FaceDetect::RECT rcFace; |
| | | ::FaceDetect::POINT ptLeftEye; |
| | | ::FaceDetect::POINT ptRightEye; |
| | | ::FaceDetect::POINT ptMouth; |
| | | ::FaceDetect::POINT ptNose; |
| | | ::FaceDetect::FaceAngle fAngle; |
| | | int nQuality; |
| | | ::FaceDetect::Data pFacialData; |
| | | |
| | | std::tuple<const ::FaceDetect::RECT&, const ::FaceDetect::POINT&, const ::FaceDetect::POINT&, const ::FaceDetect::POINT&, const ::FaceDetect::POINT&, const ::FaceDetect::FaceAngle&, const int&, const ::FaceDetect::Data&> ice_tuple() const |
| | | { |
| | | return std::tie(rcFace, ptLeftEye, ptRightEye, ptMouth, ptNose, fAngle, nQuality, pFacialData); |
| | | } |
| | | }; |
| | | |
| | | using Faces = ::std::vector<::FaceDetect::FacePos>; |
| | | |
| | | using Ice::operator<; |
| | | using Ice::operator<=; |
| | | using Ice::operator>; |
| | | using Ice::operator>=; |
| | | using Ice::operator==; |
| | | using Ice::operator!=; |
| | | |
| | | } |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | class FaceDetectServer : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | using ProxyType = FaceDetectServerPrx; |
| | | |
| | | virtual bool ice_isA(::std::string, const ::Ice::Current&) const override; |
| | | virtual ::std::vector<::std::string> ice_ids(const ::Ice::Current&) const override; |
| | | virtual ::std::string ice_id(const ::Ice::Current&) const override; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::FaceDetect::Faces faceDetect(int, int, ::std::string, const ::Ice::Current&) = 0; |
| | | bool _iceD_faceDetect(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual ::FaceDetect::ThftResult faceProperty(int, int, ::FaceDetect::FacePos, ::std::string, const ::Ice::Current&) = 0; |
| | | bool _iceD_faceProperty(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&) override; |
| | | }; |
| | | |
| | | class FaceExtractServer : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | using ProxyType = FaceExtractServerPrx; |
| | | |
| | | virtual bool ice_isA(::std::string, const ::Ice::Current&) const override; |
| | | virtual ::std::vector<::std::string> ice_ids(const ::Ice::Current&) const override; |
| | | virtual ::std::string ice_id(const ::Ice::Current&) const override; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::FaceDetect::Data faceExtract(int, int, ::FaceDetect::FacePos, ::std::string, const ::Ice::Current&) = 0; |
| | | bool _iceD_faceExtract(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&) override; |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | class FaceDetectServerPrx : public virtual ::Ice::Proxy<FaceDetectServerPrx, ::Ice::ObjectPrx> |
| | | { |
| | | public: |
| | | |
| | | ::FaceDetect::Faces faceDetect(int iceP_width, int iceP_height, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makePromiseOutgoing<::FaceDetect::Faces>(true, this, &FaceDetect::FaceDetectServerPrx::_iceI_faceDetect, iceP_width, iceP_height, iceP_shareMemory, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto faceDetectAsync(int iceP_width, int iceP_height, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<::FaceDetect::Faces>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<::FaceDetect::Faces, P>(false, this, &FaceDetect::FaceDetectServerPrx::_iceI_faceDetect, iceP_width, iceP_height, iceP_shareMemory, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | faceDetectAsync(int iceP_width, int iceP_height, const ::std::string& iceP_shareMemory, |
| | | ::std::function<void(::FaceDetect::Faces)> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<::FaceDetect::Faces>(response, ex, sent, this, &FaceDetect::FaceDetectServerPrx::_iceI_faceDetect, iceP_width, iceP_height, iceP_shareMemory, context); |
| | | } |
| | | |
| | | void _iceI_faceDetect(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceDetect::Faces>>&, int, int, const ::std::string&, const ::Ice::Context&); |
| | | |
| | | ::FaceDetect::ThftResult faceProperty(int iceP_width, int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makePromiseOutgoing<::FaceDetect::ThftResult>(true, this, &FaceDetect::FaceDetectServerPrx::_iceI_faceProperty, iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto facePropertyAsync(int iceP_width, int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<::FaceDetect::ThftResult>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<::FaceDetect::ThftResult, P>(false, this, &FaceDetect::FaceDetectServerPrx::_iceI_faceProperty, iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | facePropertyAsync(int iceP_width, int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, |
| | | ::std::function<void(::FaceDetect::ThftResult)> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<::FaceDetect::ThftResult>(response, ex, sent, this, &FaceDetect::FaceDetectServerPrx::_iceI_faceProperty, iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context); |
| | | } |
| | | |
| | | void _iceI_faceProperty(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceDetect::ThftResult>>&, int, int, const ::FaceDetect::FacePos&, const ::std::string&, const ::Ice::Context&); |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | FaceDetectServerPrx() = default; |
| | | friend ::std::shared_ptr<FaceDetectServerPrx> IceInternal::createProxy<FaceDetectServerPrx>(); |
| | | |
| | | virtual ::std::shared_ptr<::Ice::ObjectPrx> _newInstance() const override; |
| | | }; |
| | | |
| | | class FaceExtractServerPrx : public virtual ::Ice::Proxy<FaceExtractServerPrx, ::Ice::ObjectPrx> |
| | | { |
| | | public: |
| | | |
| | | ::FaceDetect::Data faceExtract(int iceP_width, int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makePromiseOutgoing<::FaceDetect::Data>(true, this, &FaceDetect::FaceExtractServerPrx::_iceI_faceExtract, iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto faceExtractAsync(int iceP_width, int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<::FaceDetect::Data>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<::FaceDetect::Data, P>(false, this, &FaceDetect::FaceExtractServerPrx::_iceI_faceExtract, iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | faceExtractAsync(int iceP_width, int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, |
| | | ::std::function<void(::FaceDetect::Data)> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<::FaceDetect::Data>(response, ex, sent, this, &FaceDetect::FaceExtractServerPrx::_iceI_faceExtract, iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context); |
| | | } |
| | | |
| | | void _iceI_faceExtract(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceDetect::Data>>&, int, int, const ::FaceDetect::FacePos&, const ::std::string&, const ::Ice::Context&); |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | FaceExtractServerPrx() = default; |
| | | friend ::std::shared_ptr<FaceExtractServerPrx> IceInternal::createProxy<FaceExtractServerPrx>(); |
| | | |
| | | virtual ::std::shared_ptr<::Ice::ObjectPrx> _newInstance() const override; |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | |
| | | template<> |
| | | struct StreamableTraits<::FaceDetect::POINT> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 8; |
| | | static const bool fixedLength = true; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader<::FaceDetect::POINT, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::POINT& v) |
| | | { |
| | | istr->readAll(v.x, v.y); |
| | | } |
| | | }; |
| | | |
| | | template<> |
| | | struct StreamableTraits<::FaceDetect::RECT> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 16; |
| | | static const bool fixedLength = true; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader<::FaceDetect::RECT, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::RECT& v) |
| | | { |
| | | istr->readAll(v.left, v.top, v.right, v.bottom); |
| | | } |
| | | }; |
| | | |
| | | template<> |
| | | struct StreamableTraits<::FaceDetect::FaceAngle> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 16; |
| | | static const bool fixedLength = true; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader<::FaceDetect::FaceAngle, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::FaceAngle& v) |
| | | { |
| | | istr->readAll(v.yaw, v.pitch, v.roll, v.confidence); |
| | | } |
| | | }; |
| | | |
| | | template<> |
| | | struct StreamableTraits<::FaceDetect::ThftResult> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 20; |
| | | static const bool fixedLength = true; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader<::FaceDetect::ThftResult, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::ThftResult& v) |
| | | { |
| | | istr->readAll(v.gender, v.age, v.race, v.beauty_level, v.smile_level); |
| | | } |
| | | }; |
| | | |
| | | template<> |
| | | struct StreamableTraits<::FaceDetect::FacePos> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 69; |
| | | static const bool fixedLength = false; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader<::FaceDetect::FacePos, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::FacePos& v) |
| | | { |
| | | istr->readAll(v.rcFace, v.ptLeftEye, v.ptRightEye, v.ptMouth, v.ptNose, v.fAngle, v.nQuality, v.pFacialData); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | using FaceDetectServerPtr = ::std::shared_ptr<FaceDetectServer>; |
| | | using FaceDetectServerPrxPtr = ::std::shared_ptr<FaceDetectServerPrx>; |
| | | |
| | | using FaceExtractServerPtr = ::std::shared_ptr<FaceExtractServer>; |
| | | using FaceExtractServerPrxPtr = ::std::shared_ptr<FaceExtractServerPrx>; |
| | | |
| | | } |
| | | |
| | | #else // C++98 mapping |
| | | |
| | | namespace IceProxy |
| | | { |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | class FaceDetectServer; |
| | | void _readProxy(::Ice::InputStream*, ::IceInternal::ProxyHandle< ::IceProxy::FaceDetect::FaceDetectServer>&); |
| | | ::IceProxy::Ice::Object* upCast(::IceProxy::FaceDetect::FaceDetectServer*); |
| | | |
| | | class FaceExtractServer; |
| | | void _readProxy(::Ice::InputStream*, ::IceInternal::ProxyHandle< ::IceProxy::FaceDetect::FaceExtractServer>&); |
| | | ::IceProxy::Ice::Object* upCast(::IceProxy::FaceDetect::FaceExtractServer*); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | class FaceDetectServer; |
| | | ::Ice::Object* upCast(::FaceDetect::FaceDetectServer*); |
| | | typedef ::IceInternal::Handle< ::FaceDetect::FaceDetectServer> FaceDetectServerPtr; |
| | | typedef ::IceInternal::ProxyHandle< ::IceProxy::FaceDetect::FaceDetectServer> FaceDetectServerPrx; |
| | | typedef FaceDetectServerPrx FaceDetectServerPrxPtr; |
| | | void _icePatchObjectPtr(FaceDetectServerPtr&, const ::Ice::ObjectPtr&); |
| | | |
| | | class FaceExtractServer; |
| | | ::Ice::Object* upCast(::FaceDetect::FaceExtractServer*); |
| | | typedef ::IceInternal::Handle< ::FaceDetect::FaceExtractServer> FaceExtractServerPtr; |
| | | typedef ::IceInternal::ProxyHandle< ::IceProxy::FaceDetect::FaceExtractServer> FaceExtractServerPrx; |
| | | typedef FaceExtractServerPrx FaceExtractServerPrxPtr; |
| | | void _icePatchObjectPtr(FaceExtractServerPtr&, const ::Ice::ObjectPtr&); |
| | | |
| | | } |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | struct POINT |
| | | { |
| | | ::Ice::Int x; |
| | | ::Ice::Int y; |
| | | |
| | | bool operator==(const POINT& rhs_) const |
| | | { |
| | | if(this == &rhs_) |
| | | { |
| | | return true; |
| | | } |
| | | if(x != rhs_.x) |
| | | { |
| | | return false; |
| | | } |
| | | if(y != rhs_.y) |
| | | { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | bool operator<(const POINT& rhs_) const |
| | | { |
| | | if(this == &rhs_) |
| | | { |
| | | return false; |
| | | } |
| | | if(x < rhs_.x) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.x < x) |
| | | { |
| | | return false; |
| | | } |
| | | if(y < rhs_.y) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.y < y) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | bool operator!=(const POINT& rhs_) const |
| | | { |
| | | return !operator==(rhs_); |
| | | } |
| | | bool operator<=(const POINT& rhs_) const |
| | | { |
| | | return operator<(rhs_) || operator==(rhs_); |
| | | } |
| | | bool operator>(const POINT& rhs_) const |
| | | { |
| | | return !operator<(rhs_) && !operator==(rhs_); |
| | | } |
| | | bool operator>=(const POINT& rhs_) const |
| | | { |
| | | return !operator<(rhs_); |
| | | } |
| | | }; |
| | | |
| | | struct RECT |
| | | { |
| | | ::Ice::Int left; |
| | | ::Ice::Int top; |
| | | ::Ice::Int right; |
| | | ::Ice::Int bottom; |
| | | |
| | | bool operator==(const RECT& rhs_) const |
| | | { |
| | | if(this == &rhs_) |
| | | { |
| | | return true; |
| | | } |
| | | if(left != rhs_.left) |
| | | { |
| | | return false; |
| | | } |
| | | if(top != rhs_.top) |
| | | { |
| | | return false; |
| | | } |
| | | if(right != rhs_.right) |
| | | { |
| | | return false; |
| | | } |
| | | if(bottom != rhs_.bottom) |
| | | { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | bool operator<(const RECT& rhs_) const |
| | | { |
| | | if(this == &rhs_) |
| | | { |
| | | return false; |
| | | } |
| | | if(left < rhs_.left) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.left < left) |
| | | { |
| | | return false; |
| | | } |
| | | if(top < rhs_.top) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.top < top) |
| | | { |
| | | return false; |
| | | } |
| | | if(right < rhs_.right) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.right < right) |
| | | { |
| | | return false; |
| | | } |
| | | if(bottom < rhs_.bottom) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.bottom < bottom) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | bool operator!=(const RECT& rhs_) const |
| | | { |
| | | return !operator==(rhs_); |
| | | } |
| | | bool operator<=(const RECT& rhs_) const |
| | | { |
| | | return operator<(rhs_) || operator==(rhs_); |
| | | } |
| | | bool operator>(const RECT& rhs_) const |
| | | { |
| | | return !operator<(rhs_) && !operator==(rhs_); |
| | | } |
| | | bool operator>=(const RECT& rhs_) const |
| | | { |
| | | return !operator<(rhs_); |
| | | } |
| | | }; |
| | | |
| | | struct FaceAngle |
| | | { |
| | | ::Ice::Int yaw; |
| | | ::Ice::Int pitch; |
| | | ::Ice::Int roll; |
| | | ::Ice::Float confidence; |
| | | }; |
| | | |
| | | struct ThftResult |
| | | { |
| | | ::Ice::Int gender; |
| | | ::Ice::Int age; |
| | | ::Ice::Int race; |
| | | ::Ice::Int beauty_level; |
| | | ::Ice::Int smile_level; |
| | | |
| | | bool operator==(const ThftResult& rhs_) const |
| | | { |
| | | if(this == &rhs_) |
| | | { |
| | | return true; |
| | | } |
| | | if(gender != rhs_.gender) |
| | | { |
| | | return false; |
| | | } |
| | | if(age != rhs_.age) |
| | | { |
| | | return false; |
| | | } |
| | | if(race != rhs_.race) |
| | | { |
| | | return false; |
| | | } |
| | | if(beauty_level != rhs_.beauty_level) |
| | | { |
| | | return false; |
| | | } |
| | | if(smile_level != rhs_.smile_level) |
| | | { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | bool operator<(const ThftResult& rhs_) const |
| | | { |
| | | if(this == &rhs_) |
| | | { |
| | | return false; |
| | | } |
| | | if(gender < rhs_.gender) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.gender < gender) |
| | | { |
| | | return false; |
| | | } |
| | | if(age < rhs_.age) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.age < age) |
| | | { |
| | | return false; |
| | | } |
| | | if(race < rhs_.race) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.race < race) |
| | | { |
| | | return false; |
| | | } |
| | | if(beauty_level < rhs_.beauty_level) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.beauty_level < beauty_level) |
| | | { |
| | | return false; |
| | | } |
| | | if(smile_level < rhs_.smile_level) |
| | | { |
| | | return true; |
| | | } |
| | | else if(rhs_.smile_level < smile_level) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | bool operator!=(const ThftResult& rhs_) const |
| | | { |
| | | return !operator==(rhs_); |
| | | } |
| | | bool operator<=(const ThftResult& rhs_) const |
| | | { |
| | | return operator<(rhs_) || operator==(rhs_); |
| | | } |
| | | bool operator>(const ThftResult& rhs_) const |
| | | { |
| | | return !operator<(rhs_) && !operator==(rhs_); |
| | | } |
| | | bool operator>=(const ThftResult& rhs_) const |
| | | { |
| | | return !operator<(rhs_); |
| | | } |
| | | }; |
| | | |
| | | typedef ::std::vector< ::Ice::Byte> Data; |
| | | |
| | | struct FacePos |
| | | { |
| | | ::FaceDetect::RECT rcFace; |
| | | ::FaceDetect::POINT ptLeftEye; |
| | | ::FaceDetect::POINT ptRightEye; |
| | | ::FaceDetect::POINT ptMouth; |
| | | ::FaceDetect::POINT ptNose; |
| | | ::FaceDetect::FaceAngle fAngle; |
| | | ::Ice::Int nQuality; |
| | | ::FaceDetect::Data pFacialData; |
| | | }; |
| | | |
| | | typedef ::std::vector< ::FaceDetect::FacePos> Faces; |
| | | |
| | | } |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | class Callback_FaceDetectServer_faceDetect_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_FaceDetectServer_faceDetect_Base> Callback_FaceDetectServer_faceDetectPtr; |
| | | |
| | | class Callback_FaceDetectServer_faceProperty_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_FaceDetectServer_faceProperty_Base> Callback_FaceDetectServer_facePropertyPtr; |
| | | |
| | | class Callback_FaceExtractServer_faceExtract_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_FaceExtractServer_faceExtract_Base> Callback_FaceExtractServer_faceExtractPtr; |
| | | |
| | | } |
| | | |
| | | namespace IceProxy |
| | | { |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | class FaceDetectServer : public virtual ::Ice::Proxy<FaceDetectServer, ::IceProxy::Ice::Object> |
| | | { |
| | | public: |
| | | |
| | | ::FaceDetect::Faces faceDetect(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return end_faceDetect(_iceI_begin_faceDetect(iceP_width, iceP_height, iceP_shareMemory, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceDetect(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_faceDetect(iceP_width, iceP_height, iceP_shareMemory, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceDetect(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::std::string& iceP_shareMemory, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceDetect(iceP_width, iceP_height, iceP_shareMemory, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceDetect(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::std::string& iceP_shareMemory, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceDetect(iceP_width, iceP_height, iceP_shareMemory, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceDetect(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::std::string& iceP_shareMemory, const ::FaceDetect::Callback_FaceDetectServer_faceDetectPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceDetect(iceP_width, iceP_height, iceP_shareMemory, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceDetect(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::std::string& iceP_shareMemory, const ::Ice::Context& context, const ::FaceDetect::Callback_FaceDetectServer_faceDetectPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceDetect(iceP_width, iceP_height, iceP_shareMemory, context, del, cookie); |
| | | } |
| | | |
| | | ::FaceDetect::Faces end_faceDetect(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_faceDetect(::Ice::Int, ::Ice::Int, const ::std::string&, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | ::FaceDetect::ThftResult faceProperty(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return end_faceProperty(_iceI_begin_faceProperty(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceProperty(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_faceProperty(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceProperty(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceProperty(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceProperty(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceProperty(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceProperty(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::FaceDetect::Callback_FaceDetectServer_facePropertyPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceProperty(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceProperty(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context, const ::FaceDetect::Callback_FaceDetectServer_facePropertyPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceProperty(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context, del, cookie); |
| | | } |
| | | |
| | | ::FaceDetect::ThftResult end_faceProperty(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_faceProperty(::Ice::Int, ::Ice::Int, const ::FaceDetect::FacePos&, const ::std::string&, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | virtual ::IceProxy::Ice::Object* _newInstance() const; |
| | | }; |
| | | |
| | | class FaceExtractServer : public virtual ::Ice::Proxy<FaceExtractServer, ::IceProxy::Ice::Object> |
| | | { |
| | | public: |
| | | |
| | | ::FaceDetect::Data faceExtract(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return end_faceExtract(_iceI_begin_faceExtract(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceExtract(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_faceExtract(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceExtract(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceExtract(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceExtract(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceExtract(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceExtract(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::FaceDetect::Callback_FaceExtractServer_faceExtractPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceExtract(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceExtract(::Ice::Int iceP_width, ::Ice::Int iceP_height, const ::FaceDetect::FacePos& iceP_pos, const ::std::string& iceP_shareMemory, const ::Ice::Context& context, const ::FaceDetect::Callback_FaceExtractServer_faceExtractPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceExtract(iceP_width, iceP_height, iceP_pos, iceP_shareMemory, context, del, cookie); |
| | | } |
| | | |
| | | ::FaceDetect::Data end_faceExtract(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_faceExtract(::Ice::Int, ::Ice::Int, const ::FaceDetect::FacePos&, const ::std::string&, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | virtual ::IceProxy::Ice::Object* _newInstance() const; |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | class FaceDetectServer : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | typedef FaceDetectServerPrx ProxyType; |
| | | typedef FaceDetectServerPtr PointerType; |
| | | |
| | | virtual ~FaceDetectServer(); |
| | | |
| | | virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::FaceDetect::Faces faceDetect(::Ice::Int, ::Ice::Int, const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_faceDetect(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual ::FaceDetect::ThftResult faceProperty(::Ice::Int, ::Ice::Int, const ::FaceDetect::FacePos&, const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_faceProperty(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | protected: |
| | | |
| | | virtual void _iceWriteImpl(::Ice::OutputStream*) const; |
| | | virtual void _iceReadImpl(::Ice::InputStream*); |
| | | }; |
| | | |
| | | inline bool operator==(const FaceDetectServer& lhs, const FaceDetectServer& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) == static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | inline bool operator<(const FaceDetectServer& lhs, const FaceDetectServer& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) < static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | class FaceExtractServer : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | typedef FaceExtractServerPrx ProxyType; |
| | | typedef FaceExtractServerPtr PointerType; |
| | | |
| | | virtual ~FaceExtractServer(); |
| | | |
| | | virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::FaceDetect::Data faceExtract(::Ice::Int, ::Ice::Int, const ::FaceDetect::FacePos&, const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_faceExtract(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | protected: |
| | | |
| | | virtual void _iceWriteImpl(::Ice::OutputStream*) const; |
| | | virtual void _iceReadImpl(::Ice::InputStream*); |
| | | }; |
| | | |
| | | inline bool operator==(const FaceExtractServer& lhs, const FaceExtractServer& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) == static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | inline bool operator<(const FaceExtractServer& lhs, const FaceExtractServer& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) < static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | |
| | | template<> |
| | | struct StreamableTraits< ::FaceDetect::POINT> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 8; |
| | | static const bool fixedLength = true; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamWriter< ::FaceDetect::POINT, S> |
| | | { |
| | | static void write(S* ostr, const ::FaceDetect::POINT& v) |
| | | { |
| | | ostr->write(v.x); |
| | | ostr->write(v.y); |
| | | } |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader< ::FaceDetect::POINT, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::POINT& v) |
| | | { |
| | | istr->read(v.x); |
| | | istr->read(v.y); |
| | | } |
| | | }; |
| | | |
| | | template<> |
| | | struct StreamableTraits< ::FaceDetect::RECT> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 16; |
| | | static const bool fixedLength = true; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamWriter< ::FaceDetect::RECT, S> |
| | | { |
| | | static void write(S* ostr, const ::FaceDetect::RECT& v) |
| | | { |
| | | ostr->write(v.left); |
| | | ostr->write(v.top); |
| | | ostr->write(v.right); |
| | | ostr->write(v.bottom); |
| | | } |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader< ::FaceDetect::RECT, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::RECT& v) |
| | | { |
| | | istr->read(v.left); |
| | | istr->read(v.top); |
| | | istr->read(v.right); |
| | | istr->read(v.bottom); |
| | | } |
| | | }; |
| | | |
| | | template<> |
| | | struct StreamableTraits< ::FaceDetect::FaceAngle> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 16; |
| | | static const bool fixedLength = true; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamWriter< ::FaceDetect::FaceAngle, S> |
| | | { |
| | | static void write(S* ostr, const ::FaceDetect::FaceAngle& v) |
| | | { |
| | | ostr->write(v.yaw); |
| | | ostr->write(v.pitch); |
| | | ostr->write(v.roll); |
| | | ostr->write(v.confidence); |
| | | } |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader< ::FaceDetect::FaceAngle, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::FaceAngle& v) |
| | | { |
| | | istr->read(v.yaw); |
| | | istr->read(v.pitch); |
| | | istr->read(v.roll); |
| | | istr->read(v.confidence); |
| | | } |
| | | }; |
| | | |
| | | template<> |
| | | struct StreamableTraits< ::FaceDetect::ThftResult> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 20; |
| | | static const bool fixedLength = true; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamWriter< ::FaceDetect::ThftResult, S> |
| | | { |
| | | static void write(S* ostr, const ::FaceDetect::ThftResult& v) |
| | | { |
| | | ostr->write(v.gender); |
| | | ostr->write(v.age); |
| | | ostr->write(v.race); |
| | | ostr->write(v.beauty_level); |
| | | ostr->write(v.smile_level); |
| | | } |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader< ::FaceDetect::ThftResult, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::ThftResult& v) |
| | | { |
| | | istr->read(v.gender); |
| | | istr->read(v.age); |
| | | istr->read(v.race); |
| | | istr->read(v.beauty_level); |
| | | istr->read(v.smile_level); |
| | | } |
| | | }; |
| | | |
| | | template<> |
| | | struct StreamableTraits< ::FaceDetect::FacePos> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 69; |
| | | static const bool fixedLength = false; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamWriter< ::FaceDetect::FacePos, S> |
| | | { |
| | | static void write(S* ostr, const ::FaceDetect::FacePos& v) |
| | | { |
| | | ostr->write(v.rcFace); |
| | | ostr->write(v.ptLeftEye); |
| | | ostr->write(v.ptRightEye); |
| | | ostr->write(v.ptMouth); |
| | | ostr->write(v.ptNose); |
| | | ostr->write(v.fAngle); |
| | | ostr->write(v.nQuality); |
| | | ostr->write(v.pFacialData); |
| | | } |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader< ::FaceDetect::FacePos, S> |
| | | { |
| | | static void read(S* istr, ::FaceDetect::FacePos& v) |
| | | { |
| | | istr->read(v.rcFace); |
| | | istr->read(v.ptLeftEye); |
| | | istr->read(v.ptRightEye); |
| | | istr->read(v.ptMouth); |
| | | istr->read(v.ptNose); |
| | | istr->read(v.fAngle); |
| | | istr->read(v.nQuality); |
| | | istr->read(v.pFacialData); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace FaceDetect |
| | | { |
| | | |
| | | template<class T> |
| | | class CallbackNC_FaceDetectServer_faceDetect : public Callback_FaceDetectServer_faceDetect_Base, public ::IceInternal::TwowayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(const ::FaceDetect::Faces&); |
| | | |
| | | CallbackNC_FaceDetectServer_faceDetect(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallbackNC<T>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceDetect::FaceDetectServerPrx proxy = ::FaceDetect::FaceDetectServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceDetect::Faces ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceDetect(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::CallbackNC<T>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T> Callback_FaceDetectServer_faceDetectPtr |
| | | newCallback_FaceDetectServer_faceDetect(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceDetect::Faces&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceDetectServer_faceDetect<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_FaceDetectServer_faceDetectPtr |
| | | newCallback_FaceDetectServer_faceDetect(T* instance, void (T::*cb)(const ::FaceDetect::Faces&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceDetectServer_faceDetect<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_FaceDetectServer_faceDetect : public Callback_FaceDetectServer_faceDetect_Base, public ::IceInternal::TwowayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const ::FaceDetect::Faces&, const CT&); |
| | | |
| | | Callback_FaceDetectServer_faceDetect(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallback<T, CT>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceDetect::FaceDetectServerPrx proxy = ::FaceDetect::FaceDetectServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceDetect::Faces ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceDetect(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::Callback<T, CT>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret, CT::dynamicCast(result->getCookie())); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_FaceDetectServer_faceDetectPtr |
| | | newCallback_FaceDetectServer_faceDetect(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceDetect::Faces&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceDetectServer_faceDetect<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_FaceDetectServer_faceDetectPtr |
| | | newCallback_FaceDetectServer_faceDetect(T* instance, void (T::*cb)(const ::FaceDetect::Faces&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceDetectServer_faceDetect<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> |
| | | class CallbackNC_FaceDetectServer_faceProperty : public Callback_FaceDetectServer_faceProperty_Base, public ::IceInternal::TwowayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(const ::FaceDetect::ThftResult&); |
| | | |
| | | CallbackNC_FaceDetectServer_faceProperty(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallbackNC<T>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceDetect::FaceDetectServerPrx proxy = ::FaceDetect::FaceDetectServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceDetect::ThftResult ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceProperty(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::CallbackNC<T>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T> Callback_FaceDetectServer_facePropertyPtr |
| | | newCallback_FaceDetectServer_faceProperty(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceDetect::ThftResult&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceDetectServer_faceProperty<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_FaceDetectServer_facePropertyPtr |
| | | newCallback_FaceDetectServer_faceProperty(T* instance, void (T::*cb)(const ::FaceDetect::ThftResult&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceDetectServer_faceProperty<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_FaceDetectServer_faceProperty : public Callback_FaceDetectServer_faceProperty_Base, public ::IceInternal::TwowayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const ::FaceDetect::ThftResult&, const CT&); |
| | | |
| | | Callback_FaceDetectServer_faceProperty(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallback<T, CT>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceDetect::FaceDetectServerPrx proxy = ::FaceDetect::FaceDetectServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceDetect::ThftResult ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceProperty(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::Callback<T, CT>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret, CT::dynamicCast(result->getCookie())); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_FaceDetectServer_facePropertyPtr |
| | | newCallback_FaceDetectServer_faceProperty(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceDetect::ThftResult&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceDetectServer_faceProperty<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_FaceDetectServer_facePropertyPtr |
| | | newCallback_FaceDetectServer_faceProperty(T* instance, void (T::*cb)(const ::FaceDetect::ThftResult&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceDetectServer_faceProperty<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> |
| | | class CallbackNC_FaceExtractServer_faceExtract : public Callback_FaceExtractServer_faceExtract_Base, public ::IceInternal::TwowayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(const ::FaceDetect::Data&); |
| | | |
| | | CallbackNC_FaceExtractServer_faceExtract(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallbackNC<T>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceDetect::FaceExtractServerPrx proxy = ::FaceDetect::FaceExtractServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceDetect::Data ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceExtract(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::CallbackNC<T>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T> Callback_FaceExtractServer_faceExtractPtr |
| | | newCallback_FaceExtractServer_faceExtract(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceDetect::Data&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceExtractServer_faceExtract<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_FaceExtractServer_faceExtractPtr |
| | | newCallback_FaceExtractServer_faceExtract(T* instance, void (T::*cb)(const ::FaceDetect::Data&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceExtractServer_faceExtract<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_FaceExtractServer_faceExtract : public Callback_FaceExtractServer_faceExtract_Base, public ::IceInternal::TwowayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const ::FaceDetect::Data&, const CT&); |
| | | |
| | | Callback_FaceExtractServer_faceExtract(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallback<T, CT>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceDetect::FaceExtractServerPrx proxy = ::FaceDetect::FaceExtractServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceDetect::Data ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceExtract(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::Callback<T, CT>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret, CT::dynamicCast(result->getCookie())); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_FaceExtractServer_faceExtractPtr |
| | | newCallback_FaceExtractServer_faceExtract(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceDetect::Data&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceExtractServer_faceExtract<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_FaceExtractServer_faceExtractPtr |
| | | newCallback_FaceExtractServer_faceExtract(T* instance, void (T::*cb)(const ::FaceDetect::Data&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceExtractServer_faceExtract<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endif |
| | | |
| | | #include <IceUtil/PopDisableWarnings.h> |
| | | #endif |
| New file |
| | |
| | | module FaceDetect |
| | | { |
| | | struct POINT |
| | | { |
| | | int x; |
| | | int y; |
| | | } |
| | | |
| | | struct RECT |
| | | { |
| | | int left; |
| | | int top; |
| | | int right; |
| | | int bottom; |
| | | } |
| | | |
| | | struct FaceAngle |
| | | { |
| | | int yaw; |
| | | int pitch; |
| | | int roll; |
| | | float confidence; |
| | | } |
| | | |
| | | struct ThftResult |
| | | { |
| | | int gender;//1-male,0-female |
| | | int age;//range[0-100] |
| | | int race; //[1-white,2-yellow,3-black] |
| | | int beauty_level;//range[0-100] |
| | | int smile_level;//range[0-100] |
| | | } |
| | | |
| | | sequence<byte> Data; |
| | | |
| | | struct FacePos |
| | | { |
| | | RECT rcFace; |
| | | POINT ptLeftEye; |
| | | POINT ptRightEye; |
| | | POINT ptMouth; |
| | | POINT ptNose; |
| | | FaceAngle fAngle; |
| | | int nQuality; |
| | | Data pFacialData; |
| | | } |
| | | |
| | | sequence<FacePos> Faces; |
| | | |
| | | interface FaceDetectServer |
| | | { |
| | | Faces faceDetect(int width, int height, string shareMemory); |
| | | ThftResult faceProperty(int width, int height, FacePos pos, string shareMemory); |
| | | } |
| | | |
| | | interface FaceExtractServer |
| | | { |
| | | Data faceExtract(int width, int height, FacePos pos, string shareMemory); |
| | | Data faceExtract(Data jpgImage); |
| | | } |
| | | } |
| New file |
| | |
| | | // |
| | | // Created by ps on 2/26/18. |
| | | // |
| | | |
| | | #ifndef COMPARETEST_COMPARESERVER_H |
| | | #define COMPARETEST_COMPARESERVER_H |
| | | |
| | | #include <thread> |
| | | #include <set> |
| | | |
| | | #include <basic/debug/Debug.h> |
| | | #include <basic/util/thread/RWLock.hpp> |
| | | #include <basic/util/thread/MultiThread.h> |
| | | #include <basic/util/BASE64/Base64.h> |
| | | |
| | | struct AlarmData { |
| | | int num; |
| | | std::string tableName; |
| | | std::vector<unsigned char> feature; |
| | | float threshold; |
| | | }; |
| | | |
| | | struct FeatureData { |
| | | long face_id; |
| | | std::string uuid; |
| | | //feature |
| | | std::vector<std::vector<unsigned char>> features; |
| | | std::string faceUrl; |
| | | std::string idcard; |
| | | }; |
| | | |
| | | static std::vector<std::string> AlarmServerPropertyAnalyseByComma(std::string str_list) { |
| | | std::vector<std::string> result; |
| | | char *property_list = const_cast<char *>(str_list.c_str()); |
| | | const char *c_Analyse = ","; |
| | | char *t_property; |
| | | |
| | | #ifdef linux |
| | | char *t_save = NULL; |
| | | t_property = strtok_r(property_list, c_Analyse, &t_save); |
| | | #else |
| | | t_property = strtok(property_list,c_Analyse); |
| | | #endif |
| | | |
| | | while (t_property) { |
| | | std::string str_pro(t_property); |
| | | result.push_back(str_pro); |
| | | #ifdef linux |
| | | t_property = strtok_r(t_save, c_Analyse, &t_save); |
| | | #else |
| | | t_property = strtok(NULL,c_Analyse); |
| | | #endif |
| | | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | #define ParalleFunc std::function<void(std::string&,FeatureData&)> |
| | | enum ParallelForThreardSize { |
| | | CPU_Number = 1 |
| | | }; |
| | | |
| | | class AlarmServer { |
| | | |
| | | public: |
| | | AlarmServer() : m_dbSet(false), m_dbReady(false) { |
| | | |
| | | } |
| | | |
| | | ~AlarmServer() { |
| | | for (auto item : dataMap) { |
| | | delete &(item.second); |
| | | // item.second = NULL; |
| | | } |
| | | dataMap.clear(); |
| | | dataAddBuffer.clear(); |
| | | dataRemoveBuffer.clear(); |
| | | } |
| | | |
| | | void initDB(std::string str_config) { |
| | | std::thread thd(loadDBCahce, this, str_config); |
| | | thd.detach(); |
| | | } |
| | | |
| | | void removeData(std::string key) { |
| | | std::lock_guard<std::mutex> guard(dataRemoveBufferMtx); |
| | | dataRemoveBuffer.insert(key); |
| | | dataRemoveBufferUpdated = true; |
| | | } |
| | | |
| | | void addData(std::string key, FeatureData &value) { |
| | | std::lock_guard<std::mutex> guard(dataAddBufferMtx); |
| | | dataAddBuffer[key] = value; |
| | | dataAddBufferUpdated = true; |
| | | } |
| | | |
| | | bool getDBReady() { |
| | | return m_dbReady; |
| | | } |
| | | |
| | | //m_dbReady is false return,true go on |
| | | //use parallelFor |
| | | virtual bool compare(std::thread::id key, AlarmData *, int topN) = 0; |
| | | |
| | | private: |
| | | //init data,this is thread body |
| | | static void loadDBCahce(AlarmServer *compareServer, std::string str_config) { |
| | | std::lock_guard<std::mutex> guard(compareServer->dataRemoveBufferMtx); |
| | | std::lock_guard<std::mutex> guard2(compareServer->dataAddBufferMtx); |
| | | std::lock_guard<std::mutex> dataGuard(compareServer->dataMtx); |
| | | |
| | | compareServer->dataRemoveBuffer.clear(); |
| | | compareServer->dataAddBuffer.clear(); |
| | | |
| | | compareServer->m_rwLock.wrlock(); |
| | | compareServer->loadDBData(str_config); |
| | | compareServer->m_dbReady = true; |
| | | compareServer->m_rwLock.unlock(); |
| | | INFO("m_dbReady is true"); |
| | | } |
| | | |
| | | virtual void loadDBData(std::string tableName) = 0; |
| | | |
| | | bool m_dbSet; |
| | | bool m_dbReady; |
| | | |
| | | bool dataAddBufferUpdated; |
| | | bool dataRemoveBufferUpdated; |
| | | bool dateResetUpdated; |
| | | |
| | | RWLock m_rwLock; |
| | | |
| | | void updateDataRemove() { |
| | | if (dataRemoveBufferUpdated) { |
| | | std::lock_guard<std::mutex> dataRemoveGuard(dataRemoveBufferMtx); |
| | | std::lock_guard<std::mutex> dataGuard(dataMtx); |
| | | if (!dataRemoveBufferUpdated)return; |
| | | for (auto key: dataRemoveBuffer) { |
| | | this->dataMap.erase(key); |
| | | } |
| | | dataRemoveBuffer.clear(); |
| | | dataRemoveBufferUpdated = false; |
| | | } |
| | | } |
| | | |
| | | void updateDataAdd() { |
| | | if (dataAddBufferUpdated) { |
| | | std::lock_guard<std::mutex> dataRemoveGuard(dataAddBufferMtx); |
| | | std::lock_guard<std::mutex> dataGuard(dataMtx); |
| | | if (!dataAddBufferUpdated)return; |
| | | for (auto addData: dataAddBuffer) { |
| | | this->dataMap.insert(addData); |
| | | } |
| | | dataAddBuffer.clear(); |
| | | dataAddBufferUpdated = false; |
| | | } |
| | | } |
| | | |
| | | protected: |
| | | Base64 base64; |
| | | //#todo value is vector not is struct |
| | | std::map<std::string, FeatureData> dataMap; |
| | | std::map<std::string, FeatureData> dataAddBuffer; |
| | | std::set<std::string> dataRemoveBuffer; |
| | | std::mutex dataMtx; |
| | | std::mutex dataAddBufferMtx; |
| | | std::mutex dataRemoveBufferMtx; |
| | | std::mutex dataRestMtx; |
| | | |
| | | void parallelFor(int threads, ParalleFunc func) { |
| | | updateDataRemove(); |
| | | updateDataAdd(); |
| | | // std::lock_guard<std::mutex> dataGuard(dataMtx); |
| | | m_rwLock.rdlock(); |
| | | MultiThread mthd(threads, [&func, this](int idx, int num) { |
| | | int size = dataMap.size(); |
| | | int step = size / num; |
| | | if (step < 1) { |
| | | step = 1; |
| | | if (idx >= size)return; |
| | | } |
| | | auto iter = dataMap.begin(); |
| | | for (int i = idx * step; i > 0; i--) { |
| | | iter++; |
| | | } |
| | | for (int i = 0; i < step && iter != dataMap.end(); iter++, i++) { |
| | | auto &data = iter->second; |
| | | std::string key = iter->first; |
| | | func(key, data); |
| | | } |
| | | }); |
| | | mthd.join(); |
| | | m_rwLock.unlock(); |
| | | } |
| | | }; |
| | | |
| | | |
| | | #endif //COMPARETEST_COMPARESERVER_H |
| New file |
| | |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(FaceSearchServer) |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build) |
| | | set(CMAKE_CXX_STANDARD 11) |
| | | set(CMAKE_BUILD_TYPE debug) |
| | | add_definitions(-DDEBUG_ERR -DDEBUG_INFO -DDEBUG_INFO) |
| | | add_definitions(-DGLOG) |
| | | add_compile_options(-fPIC) |
| | | |
| | | SET(LIBS |
| | | glog |
| | | Ice |
| | | opencv_world |
| | | Qt5Core |
| | | Qt5Sql |
| | | THFaceImage |
| | | THFeature |
| | | THFaceProperty |
| | | ei |
| | | erl_interface_st |
| | | ei_st |
| | | erl_interface |
| | | curl |
| | | jsoncpp |
| | | uuid |
| | | sqlite3 |
| | | rt |
| | | pthread |
| | | ) |
| | | include_directories( |
| | | ./rpc |
| | | ./CasiaFaceWrapper |
| | | |
| | | #glog |
| | | ../../BasicPlatForm/libs/glog/include |
| | | ../LocalDBTool |
| | | ../../BasicPlatForm |
| | | ../../BasicPlatForm/libs/crul/include |
| | | ../../BasicPlatForm/libs/opencv/include |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/include |
| | | ../../BasicPlatForm/libs/ffmpeg/include |
| | | ../../BasicPlatForm/libs/Casia_Face/FaceSdk/include |
| | | # ../../BasicPlatForm/libs/erlang/erl_interface/include |
| | | |
| | | |
| | | ../../BasicPlatForm/libs/jsoncpp/include |
| | | ../../BasicPlatForm/libs/crul/include |
| | | ../../BasicPlatForm/libs/libuuid/include/ |
| | | ../../BasicPlatForm/basic/util/curl/ |
| | | ../../BasicPlatForm/basic/util/ShareMemory/ |
| | | ../../BasicPlatForm/basic/db/Elasticsearch/ |
| | | ../../BasicPlatForm/wrapper/casia/include |
| | | ../../BasicPlatForm/libs/libboost/include |
| | | |
| | | |
| | | ../../../Erlang/syncDBTool/ |
| | | |
| | | ../../BasicPlatForm/basic/db/sqlite/ |
| | | ../../BasicPlatForm/basic/db/sqlite/sqlite-v-3220000 |
| | | |
| | | /usr/include/x86_64-linux-gnu/qt5 |
| | | /usr/include/x86_64-linux-gnu/qt5/QtCore/ |
| | | /usr/include/x86_64-linux-gnu/qt5/QtSql/ |
| | | |
| | | /usr/include/boost/ |
| | | ) |
| | | |
| | | link_directories( |
| | | #glog |
| | | ../../BasicPlatForm/libs/glog/lib |
| | | /usr/local/cuda/lib64 |
| | | ../../BasicPlatForm/libs/openssl/lib/ |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/lib64 |
| | | ../../BasicPlatForm/libs/opencv/lib |
| | | ../../BasicPlatForm/libs/ffmpeg/lib |
| | | ../../BasicPlatForm/libs/Casia_Face/FaceSdk/lib/cpu |
| | | ../../BasicPlatForm/libs/crul/lib |
| | | ../../BasicPlatForm/libs/jsoncpp/lib |
| | | ../../BasicPlatForm/libs/libuuid/lib |
| | | # ../../BasicPlatForm/libs/erlang/erl_interface/libs |
| | | |
| | | ../../BasicPlatForm/basic/db/sqlite/sqlite-v-3220000 |
| | | ../../BasicPlatForm/libs/libuuid/lib |
| | | |
| | | /usr/lib/erlang/lib/erl_interface-3.8.2/lib/ |
| | | ) |
| | | |
| | | |
| | | add_executable(${PROJECT_NAME} |
| | | main.cpp |
| | | rpc/FaceSearchServer.cpp |
| | | FaceSearchServerResources.cpp |
| | | FaceFeatureSearchServerI.cpp |
| | | FaceFeatureSearchServerI.h |
| | | CasiaFaceWrapper/CasiaFaceWrapperN.cpp |
| | | CasiaFaceWrapper/CasiaFaceWrapperN.h |
| | | CasiaFaceWrapper/FaceData.hpp |
| | | AlarmServer.hpp |
| | | FaceDBCompareServer.cpp |
| | | FaceDBCompareServer.h |
| | | ../../BasicPlatForm/basic/util/thread/MultiThread.cpp |
| | | ../../BasicPlatForm/basic/util/thread/MultiThread.h |
| | | ../../BasicPlatForm/basic/util/BASE64/Base64.cpp |
| | | ../../BasicPlatForm/basic/util/curl/HttpRequestWithCrul.hpp |
| | | ../../BasicPlatForm/basic/db/Elasticsearch/EsDBTool.cpp |
| | | ../../BasicPlatForm/basic/db/Elasticsearch/EsDBTool.h |
| | | |
| | | |
| | | ../LocalDBTool/SqliteFaceEncap.cpp |
| | | ../../BasicPlatForm/basic/db/sqlite/sqliteEncapsulation.cpp |
| | | ../../BasicPlatForm/basic/db/sqlite/sqliteEncapsulation.h |
| | | |
| | | # ../../BasicPlatForm/basic/util/ShareMemory/SemTool.cpp |
| | | |
| | | ../../../Erlang/syncDBTool/ErlangDbTool.cpp |
| | | # ../../../Erlang/syncDBTool/ShareMemoryTool.hpp |
| | | # ../../../Erlang/syncDBTool/SyncDB.hpp |
| | | ) |
| | | |
| | | #add_executable(FaceSearchServerResourcesTest |
| | | # FaceSearchServerResourcesTest.cpp |
| | | # ) |
| | | |
| | | target_link_libraries(${PROJECT_NAME} |
| | | ${LIBS} |
| | | ) |
| | | |
| | | #target_link_libraries(FaceSearchServerResourcesTest |
| | | # pthread |
| | | # ) |
| | | add_executable(SearchFaceTest |
| | | Cleint.cpp |
| | | ./rpc/FaceSearchServer.cpp |
| | | ./CasiaFaceWrapper/CasiaFaceWrapperN.cpp |
| | | ) |
| | | target_link_libraries(SearchFaceTest |
| | | opencv_world |
| | | glog |
| | | curl |
| | | IceStorm |
| | | Ice |
| | | jsoncpp |
| | | uuid |
| | | THFaceImage |
| | | THFacialPos |
| | | THFaceProperty |
| | | THFeature |
| | | pthread |
| | | ) |
| | | |
| | | add_subdirectory(LoadFeaTool) |
| New file |
| | |
| | | // |
| | | // Created by pans on 4/27/18. |
| | | // |
| | | #include <iostream> |
| | | #include <string> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <atomic> |
| | | |
| | | #include "CasiaFaceWrapperN.h" |
| | | |
| | | using namespace std; |
| | | |
| | | std::atomic_int CasiaFaceWrapperN::instanceCount(0); |
| | | |
| | | CasiaFaceWrapperN::CasiaFaceWrapperN() { |
| | | threadMax = appPref.getLongData("thread.max"); |
| | | // long gpuIndex = appPref.getLongData("gpu.index"); |
| | | // for(int i = 0;i<threadMax;i++){ |
| | | // resourcesManager.pushResource(i); |
| | | // } |
| | | // if(gpuIndex < 0){ |
| | | // THFI_Param* param = new THFI_Param[threadMax]; |
| | | //// THFI_Create(threadMax, param); |
| | | // CHKERR(THFI_Create(threadMax, param), threadMax, "THFI_Create return");//old version ,default GPU device ID is 0 |
| | | // CHKERR(EF_Init(threadMax), threadMax, "EF_Create return");//old version ,default GPU device ID is 0 |
| | | // delete[] param; |
| | | // }else{ |
| | | // THFI_Param_Ex* param = new THFI_Param_Ex[threadMax]; |
| | | // THFI_Param detParam; |
| | | // EF_Param pParam[threadMax]; |
| | | // detParam.nMinFaceSize = 20; |
| | | // detParam.nRollAngle = 60; |
| | | // for(int i = 0;i<threadMax;i++){ |
| | | // param[i].tp = detParam; |
| | | // param[i].nDeviceID = gpuIndex; |
| | | // pParam[i].nDeviceID = gpuIndex;//GPU device ID,eg:0,1,2.... |
| | | // } |
| | | // THFI_Create_Ex(threadMax, param); |
| | | // CHKERR(EF_Init_Ex(threadMax,pParam), threadMax, "EF_Create return");//old version ,default GPU device ID is 0 |
| | | //// EF_Init_Ex(gpuIndexs.size(),pParam); |
| | | // delete[] param; |
| | | // } |
| | | // THFP_Create(threadMax); |
| | | |
| | | channel = instanceCount; |
| | | THFI_Param detParam; |
| | | detParam.nMinFaceSize = 50; |
| | | detParam.nRollAngle = 60; |
| | | if(instanceCount++ == 0){ |
| | | // if(gpuIndexs.empty()){ |
| | | CHKERR(THFI_Create(threadMax, &detParam), threadMax, "THFI_Create return");//old version ,default GPU device ID is 0 |
| | | CHKERR(EF_Init(threadMax), threadMax, "EF_Create return");//old version ,default GPU device ID is 0 |
| | | // } |
| | | // else{ |
| | | // THFI_Param_Ex pParamx[gpuIndexs.size()]; |
| | | // EF_Param pParam[gpuIndexs.size()]; |
| | | // for(int i = 0; i<gpuIndexs.size(); i++){ |
| | | // pParamx[i].tp=detParam; |
| | | // pParamx[i].nDeviceID=gpuIndexs[i];//GPU device ID,eg:0,1,2.... |
| | | // pParam[i].nDeviceID=gpuIndexs[i];//GPU device ID,eg:0,1,2.... |
| | | // } |
| | | // int ret=THFI_Create_Ex(gpuIndexs.size(), pParamx); |
| | | // if(ret !=gpuIndexs.size()){ |
| | | // printf("THFI_Create failed!(ret=%d)\n",ret); |
| | | // } |
| | | // ret=EF_Init_Ex(gpuIndexs.size(),pParam); |
| | | // if(ret !=gpuIndexs.size()){ |
| | | // printf("EF_Init_Ex failed!(ret=%d)\n",ret); |
| | | // } |
| | | // } |
| | | }else if(instanceCount> threadMax){ |
| | | channel = -1; |
| | | ERR("too many channels instanced, channel "<<channel<<" instance faild."); |
| | | } |
| | | |
| | | } |
| | | |
| | | CasiaFaceWrapperN::~CasiaFaceWrapperN() { |
| | | //#todo |
| | | THFI_Release(); |
| | | THFP_Release(); |
| | | } |
| | | |
| | | float CasiaFaceWrapperN::compareFeature(std::vector<unsigned char> &feature1, std::vector<unsigned char> &feature2) { |
| | | if(feature1.size()!= EF_Size()){ |
| | | ERR("feature1 size is not incorrect"); |
| | | return 0; |
| | | }else if(feature2.size()!= EF_Size()){ |
| | | ERR("feature2 size is not incorrect"); |
| | | return 0; |
| | | } |
| | | return EF_Compare(feature1.data(), feature2.data()); |
| | | } |
| | | #define COPY(NAME) memcpy(&face.NAME, &pos.NAME, sizeof (pos.NAME));s |
| | | Features CasiaFaceWrapperN::extractFace(FaceImageN img) { |
| | | Features results; |
| | | if(channel ==-1){ |
| | | ERR("invalid face channel, face detect faild"); |
| | | return results; |
| | | } |
| | | vector<unsigned char> feature; |
| | | THFI_FacePos facesPos[30]; |
| | | // int channel; |
| | | // for(int loop = 0;loop < threadMax;loop++){ |
| | | // channel = resourcesManager.getAvilableChannel(to_string(loop)); |
| | | // if(channel > 0){ |
| | | // cout << channel << endl; |
| | | // break; |
| | | // } |
| | | // } |
| | | int faceNum = THFI_DetectFace(channel, img.data,24, img.width, img.height, facesPos ,30); |
| | | if(faceNum>0){ |
| | | if(feature.size()!= EF_Size()*faceNum){ |
| | | feature.resize(EF_Size()*faceNum); |
| | | } |
| | | CHKERR(EF_Extract_M(channel, img.data, img.width, img.height, 3, facesPos, feature.data(), faceNum), 1, " return"); |
| | | for(int i = 0; i< faceNum; i++){ |
| | | FaceFeaWithScore result; |
| | | THFI_FacePos& face = facesPos[i]; |
| | | result.left = face.rcFace.left; |
| | | result.top = face.rcFace.top; |
| | | result.width = face.rcFace.right - face.rcFace.left; |
| | | result.height = face.rcFace.bottom - face.rcFace.top; |
| | | result.score = face.fAngle.confidence; |
| | | // if(face.fAngle.confidence >= 0.6){ |
| | | if((face.fAngle.pitch >-30 || face.fAngle.pitch <30 ) && |
| | | (face.fAngle.roll >-30 || face.fAngle.roll <30 ) && |
| | | (face.fAngle.yaw >-30 || face.fAngle.yaw <30 )){ |
| | | result.feature.resize(EF_Size()); |
| | | memcpy(result.feature.data(),feature.data()+i*EF_Size(),EF_Size()); |
| | | results.push_back(result); |
| | | } |
| | | // } |
| | | } |
| | | } else{ |
| | | DBG("faceNum is < 0"); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | |
| | | //#todo |
| | | //Features CasiaFaceWrapperN::extractFace(FaceImageN &img, THFI_FacePos& facePos,int faceNum) { |
| | | // return Features(); |
| | | //} |
| New file |
| | |
| | | // |
| | | // Created by pans on 4/27/18. |
| | | // |
| | | |
| | | #ifndef VIDEOSTRUCTURE_CASIAFACEWRAPPER_H |
| | | #define VIDEOSTRUCTURE_CASIAFACEWRAPPER_H |
| | | |
| | | #include <THFaceImage_i.h> |
| | | #include <THFaceProperty_i.h> |
| | | #include <THFeature_i.h> |
| | | |
| | | #include <basic/util/resource/ResourcesManager.h> |
| | | #include <libs/opencv/include/opencv2/core/mat.hpp> |
| | | #include <atomic> |
| | | |
| | | #include "FaceData.hpp" |
| | | |
| | | class CasiaFaceWrapperN { |
| | | public: |
| | | CasiaFaceWrapperN(); |
| | | |
| | | virtual ~CasiaFaceWrapperN(); |
| | | |
| | | float compareFeature(Feature &feature1,Feature &feature2); |
| | | |
| | | //todo extractFace |
| | | Features extractFace(FaceImageN img); |
| | | // Features extractFace(FaceImageN &img, THFI_FacePos& facePos,int faceNum); |
| | | |
| | | //todo detectFace |
| | | |
| | | public: |
| | | |
| | | private: |
| | | |
| | | private: |
| | | ResourcesManager<int> resourcesManager; |
| | | long threadMax; |
| | | int nGPUDeviceID=0; |
| | | short channel; |
| | | static std::atomic_int instanceCount; |
| | | // static std::vector<int> gpuIndexs; |
| | | // static int channelMax; |
| | | |
| | | }; |
| | | |
| | | |
| | | #endif //VIDEOSTRUCTURE_CASIAFACEWRAPPER_H |
| New file |
| | |
| | | // |
| | | // Created by pans on 5/2/18. |
| | | // |
| | | |
| | | #ifndef VIDEOSTRUCTURE_FACEDATA_HPP |
| | | #define VIDEOSTRUCTURE_FACEDATA_HPP |
| | | |
| | | #include <vector> |
| | | |
| | | struct FaceImageN { |
| | | int width; |
| | | int height; |
| | | int stride; |
| | | unsigned char *data; |
| | | }; |
| | | struct FaceFeaWithScore { |
| | | int left; |
| | | int top; |
| | | int width; |
| | | int height; |
| | | std::vector<unsigned char> feature; |
| | | float score; |
| | | }; |
| | | |
| | | typedef std::vector<FaceFeaWithScore> Features; |
| | | |
| | | struct FaceResult { |
| | | long id; |
| | | std::string uuid; |
| | | std::string tableName; |
| | | float confidence; |
| | | std::string face_img_url; |
| | | std::string idCard; |
| | | std::string alarmRet; |
| | | }; |
| | | |
| | | struct DbAction { |
| | | long id; |
| | | std::string tableName; |
| | | std::string face_img_url; //#todo 以徿å¾å¤åºåºæ°æ®åæ¥ |
| | | long actionNo; // 1 add; 2, remove |
| | | }; |
| | | |
| | | // sequence<DbAction> DbActions; |
| | | |
| | | typedef std::vector<FaceResult> FaceResults; |
| | | typedef std::map<float, FaceResult, std::greater<float>> mapFaceResults; |
| | | |
| | | |
| | | namespace { |
| | | |
| | | |
| | | typedef std::vector<unsigned char> Feature; |
| | | typedef std::vector<unsigned char> Data; |
| | | |
| | | struct POINT { |
| | | int x; |
| | | int y; |
| | | }; |
| | | |
| | | struct RECT { |
| | | int left; |
| | | int top; |
| | | int right; |
| | | int bottom; |
| | | }; |
| | | |
| | | struct FaceAngle { |
| | | int yaw; |
| | | int pitch; |
| | | int roll; |
| | | float confidence; |
| | | }; |
| | | |
| | | struct ThftResult { |
| | | int gender;//1-male,0-female |
| | | int age;//range[0-100] |
| | | int race; //[1-white,2-yellow,3-black] |
| | | int beauty_level;//range[0-100] |
| | | int smile_level;//range[0-100] |
| | | }; |
| | | |
| | | struct FacePos { |
| | | RECT rcFace; |
| | | POINT ptLeftEye; |
| | | POINT ptRightEye; |
| | | POINT ptMouth; |
| | | POINT ptNose; |
| | | FaceAngle fAngle; |
| | | int nQuality; |
| | | ThftResult property; |
| | | Data pFacialData; |
| | | }; |
| | | |
| | | typedef std::vector<FacePos> Faces; |
| | | |
| | | long getTimeLong() { |
| | | time_t tt; |
| | | time(&tt); |
| | | tt = tt + 8 * 3600; // transform the time zone |
| | | return tt; |
| | | } |
| | | } |
| | | |
| | | namespace FaceToolData { |
| | | enum RectSize { |
| | | horizontal = 10, |
| | | vertical = 10 |
| | | }; |
| | | |
| | | class CompareData { |
| | | public: |
| | | virtual ~CompareData() {} |
| | | }; |
| | | |
| | | |
| | | class FeatureData : public CompareData { |
| | | public: |
| | | FeatureData(int size) : feature(size) {} |
| | | |
| | | Feature feature; |
| | | int num; |
| | | float threshold; |
| | | std::string tableNameList; |
| | | }; |
| | | |
| | | struct CompareResult { |
| | | std::string id; |
| | | std::string face_img_url; |
| | | std::string table_Name; |
| | | float score; |
| | | }; |
| | | } |
| | | |
| | | #endif //VIDEOSTRUCTURE_FACEDATA_HPP |
| New file |
| | |
| | | // |
| | | // Created by pans on 5/4/18. |
| | | // |
| | | |
| | | // |
| | | // Created by ps on 3/1/18. |
| | | // |
| | | |
| | | |
| | | #include <thread> |
| | | #include "opencv2/opencv.hpp" |
| | | #include "basic/util/BASE64/Base64.h" |
| | | #include <basic/util/opencv/CvUtil.h> |
| | | #include <dirent.h> |
| | | #include <THFeature_i.h> |
| | | #include <zconf.h> |
| | | #include <Ice/Ice.h> |
| | | #include <basic/util/app/AppUtil.h> |
| | | #include <FaceData.hpp> |
| | | #include <FaceSearchServer.h> |
| | | #include <CasiaFaceWrapperN.h> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/rpc/IceRpc.hpp> |
| | | #include <CurlDownloadImg.hpp> |
| | | #include <uuid/uuid.h> |
| | | #include <jsoncpp/json/json.h> |
| | | |
| | | using namespace cv; |
| | | using namespace std; |
| | | |
| | | Base64 base64; |
| | | //void* test(void* arg){ |
| | | //#ifdef TestCode |
| | | // IceRpcClient<AlarmServerInterface::AlarmCompareServerPrx> client("FaceDBCompare", "", 10028, "tcp"); |
| | | // auto server = client.getServer(); |
| | | //#else |
| | | //#endif |
| | | // |
| | | // std::map<int,std::vector<unsigned char>> db_handle; |
| | | // { |
| | | // LoginDB g_dbLogin; |
| | | // g_dbLogin.ip = "192.168.1.81"; |
| | | // g_dbLogin.port = 8066; |
| | | // g_dbLogin.dbName = "VIDEO_STRUCTURE"; |
| | | // g_dbLogin.userName = "root"; |
| | | // g_dbLogin.pwd = "root"; |
| | | // MYSQL conn; |
| | | // mysql_init(&conn); |
| | | // bool connectStatus = mysql_real_connect(&conn,g_dbLogin.ip.c_str(),g_dbLogin.userName.c_str() |
| | | // ,g_dbLogin.pwd.c_str(),g_dbLogin.dbName.c_str(),g_dbLogin.port,NULL,CLIENT_FOUND_ROWS); |
| | | // if(connectStatus) |
| | | // { |
| | | // //#todo modify sql |
| | | // string sql = "select drug_id,feature FROM o_t_p_drug_feature where 1=1 and feature is not NULL limit 500"; |
| | | // { |
| | | // ClockTimer ct2("mysql_query"); |
| | | // int ret=mysql_query(&conn,sql.data()); |
| | | // if(ret == 0){ |
| | | // printf("OK\n"); |
| | | // }else{ |
| | | // printf("error::%s\n",mysql_error(&conn)); |
| | | // } |
| | | // } |
| | | // |
| | | // //å°æ¥è¯¢å°çç»æéåæ¾å¨ä¸´æ¶åéä¸ |
| | | // MYSQL_RES *result = NULL; |
| | | // result = mysql_store_result( &conn ); |
| | | // |
| | | // //å¾å°æ¥è¯¢åºæ¥æææ°æ®çæ¡æ° |
| | | // int row_count = mysql_num_rows(result); |
| | | // if (row_count <= 0) { |
| | | // INFO("not found data!!!") |
| | | // return NULL; |
| | | // } |
| | | // //æ¾ç¤ºè¡¨ä¸çæææ°æ® |
| | | // { |
| | | // ClockTimer ct2("mysql_fetch_row"); |
| | | // int loop = 0; |
| | | // |
| | | // MYSQL_ROW row = NULL; |
| | | // row = mysql_fetch_row( result ); |
| | | // while ( NULL != row ) |
| | | // { |
| | | // string ft = row[1]; |
| | | // string str2; |
| | | // int a = ft.length(); |
| | | // str2 = base64.Decode(ft.data(),ft.length()); |
| | | // |
| | | // FaceFeature tmp; |
| | | // tmp.resize(str2.length()); |
| | | // memset(tmp.data(), 0,str2.length()); |
| | | // memcpy(tmp.data(),str2.data(),str2.length()); |
| | | // int b = tmp.size(); |
| | | // db_handle[atoi(row[0])] = tmp; |
| | | // tmp.clear(); |
| | | // row = mysql_fetch_row( result ); |
| | | // } |
| | | // |
| | | // mysql_free_result(result); |
| | | // } |
| | | // |
| | | // }else{ |
| | | // printf("connectStatus error\n"); |
| | | // } |
| | | // |
| | | // { |
| | | // ClockTimer ct3("close"); |
| | | // mysql_close(&conn); |
| | | // } |
| | | // } |
| | | // |
| | | // ::AlarmServerInterface::AlarmInformation t_alarmData; |
| | | // |
| | | // t_alarmData.carmera_id = "1"; |
| | | // t_alarmData.create_time = "2018-03-25 18:07:53"; |
| | | // t_alarmData.alarm_url = "vvvvvadsfasd"; |
| | | // t_alarmData.resoure_id = "vvvvvadsfasd"; |
| | | // t_alarmData.flag_eq_pf = "aaa"; |
| | | // int loop = 0; |
| | | // while(true){ |
| | | // for(auto item : db_handle){ |
| | | // if(loop++ > 20 ){ |
| | | // break; |
| | | // } |
| | | // t_alarmData.faceFeature = item.second; |
| | | // int c = t_alarmData.faceFeature.size(); |
| | | // INFO("sumbitData"<<item.first); |
| | | // server->sumbitData(t_alarmData); |
| | | // sleep(1); |
| | | // } |
| | | //// while(loop <= 20) |
| | | //// { |
| | | //// ::AlarmServerInterface::AlarmRule iceP_alarmRule; |
| | | //// ::AlarmServerInterface::PersonAlarmRule m; |
| | | //// iceP_alarmRule.fllow_id = to_string(loop++); |
| | | //// iceP_alarmRule.tableName = "o_t_p_fllow22"; |
| | | //// iceP_alarmRule.rule_Type = "0"; |
| | | //// server->addRules(iceP_alarmRule); |
| | | //// } |
| | | // loop=0; |
| | | // } |
| | | //} |
| | | // |
| | | |
| | | CvUtil cvutil; |
| | | |
| | | int main(int argc, char *argv[]) { |
| | | SAVE_APP_ARGS |
| | | |
| | | ENABLEGLOG("./log/"); |
| | | Ice::CommunicatorHolder ich(argc, argv); |
| | | |
| | | // Ice::ObjectPrx base = ich->stringToProxy("FaceSearchServer"); |
| | | IceRpcClient<FaceSearch::FaceFeatureSearchServerPrx> client("faceCmServer", "", 10004, "tcp"); |
| | | auto server = client.getServer(); |
| | | // auto server = FaceSearch::FaceFeatureSearchServerPrx::checkedCast(base); |
| | | |
| | | |
| | | string str_uuid; |
| | | uuid_t t_uuid; |
| | | char str[36]; |
| | | uuid_generate(t_uuid); |
| | | uuid_unparse(t_uuid, str); |
| | | str_uuid = str; |
| | | |
| | | Json::Value t_json; |
| | | t_json["Id"] = str_uuid; //ä¸»é® |
| | | //#todo |
| | | t_json["FaceFeature"] = "base64";//确认对ä¸å¯¹ 人è¸ç¹å¾è½¬æå符串ï¼ï¼ï¼//æ ¼å¼è½¬å |
| | | |
| | | t_json["picName"] = "wait todo"; |
| | | |
| | | t_json["personId"] = "wait todo";//å
³èåºåºäººåid,人è¸id |
| | | t_json["BaseName"] = "wait todo";//å
³èåºåºè¡¨å |
| | | |
| | | t_json["personPicUrl"] = "wait todo";//人åå¾ç store |
| | | t_json["likePer"] = "";//人åç¸ä¼¼åº¦ Score |
| | | t_json["likeDate"] = "2018-01-01 01:01:01";//æ¯è¾æ¶é´ |
| | | t_json["picAddress"] = "wait todo";//ææå°å |
| | | t_json["picMaxUrl"] = "wait todo";//大å¾è·¯å¾ |
| | | t_json["picLocalUrl"] = "wait todo";//æ¬å°è·¯å¾ |
| | | t_json["picSmUrl"] = "wait todo";//人åæå°å¾ |
| | | t_json["picDate"] = "2018-01-01 01:01:01"; |
| | | t_json["content"] = "wait todo"; |
| | | t_json["viType"] = "1";//åªæ4ç§ç±»å 1:personface 2:personbody 3:car 4:bicycle 5:none æªç¥ç±»å |
| | | t_json["personIsHub"] = "1";//1: æ¥è¦ 2: å¯ç 3: å®å
¨ 4: æªç¥ |
| | | |
| | | |
| | | //faceExtractElement.setProperty("dev_id", str_device_id); |
| | | //faceExtractElement.setProperty("cg_id", str_ch_id); |
| | | t_json["videoNum"] = "";//Videç¼å· å¤é® |
| | | t_json["videoReqNum"] = "123456";//Video设å¤ç¼å· |
| | | t_json["ChannlId"] = "33";//ééid |
| | | t_json["isDelete"] = "1";//é»è®¤1 ,0æ æ 1ææ |
| | | |
| | | //人è¸å±æ§ |
| | | t_json["Age"] = "18";//æ£æµçå¹´é¾ åºè¯¥ä¸ºç©º æ æ£æµç»æ |
| | | t_json["Gender"] = "1";//æ£æµçæ§å« 为空 æ æ£æµç»æ |
| | | t_json["BeautyLevel"] = "5";//æ£æµçç¾åæ°´å¹³ 为空 æ æ£æµç»æ |
| | | t_json["SimleLevel"] = "25";//æ£æµçå¾®ç¬æ°´å¹³ 为空 æ æ£æµç»æ |
| | | t_json["Race"] = "1";//æ£æµçç§æ åºè¯¥ä¸ºç©º æ æ£æµç»æ |
| | | |
| | | |
| | | DBG(t_json.toStyledString()); |
| | | |
| | | |
| | | // return 0; |
| | | appPref.setLongData("thread.max", 1); |
| | | CasiaFaceWrapperN t_CasiaFaceWapper; |
| | | // string test1 = "http://192.168.1.65:8888/group1/M00/04/52/wKgBQVr5J-WAJ4lQAAAObkm3j38169.jpg"; |
| | | // string test2 = "http://192.168.1.65:8888/group1/M00/04/52/wKgBQVr5JGOAXmx9AAAK0Xp3QhA271.jpg"; |
| | | // CurlDownloadImg curlDownloadImg; |
| | | { |
| | | // auto curlImg = curlDownloadImg.download_jpeg(const_cast<char *>(test2.c_str())); |
| | | // cout << " image is " << test1 << endl; |
| | | long t_id = 0; |
| | | // if (curlImg.all > 0) { |
| | | if (true) { |
| | | Mat image = imread("/home/bsk/work/development/c++/Qt-test/testFastDfs/build/fastdfs/18.jpg"); |
| | | // cvutil.buffer2CvMat(curlImg.buffer, image); |
| | | |
| | | FaceImageN faceImage2{image.cols, image.rows, image.step, image.data}; |
| | | // auto res = t_CasiaFaceWapper.extractFace(faceImage2); |
| | | auto faceResults = t_CasiaFaceWapper.extractFace(faceImage2); |
| | | |
| | | DBG("faceResults" << faceResults.size()); |
| | | for (auto item : faceResults) { |
| | | ::FaceSearch::Data t_fea; |
| | | t_fea.resize(item.feature.size()); |
| | | memcpy(t_fea.data(), item.feature.data(), item.feature.size()); |
| | | try { |
| | | std::vector<::std::string> tables{"aaa1", "TestFace2", "TestFace3", "TestFace4"}; |
| | | auto re = server->faceSearchTopN(t_fea, t_json.toStyledString(), 1, 0.8); |
| | | INFO("faceSearchMax " << re.size()); |
| | | for (auto item : re) { |
| | | INFO("faceSearchMax id " << (item.uuid)); |
| | | INFO("faceSearchMax confidence " << (item.confidence)); |
| | | INFO("faceSearchMax tableName " << (item.tableName)); |
| | | } |
| | | // sleep(3); |
| | | // ::std::vector<::std::string> tables2{"aaa1", "TestFace2", "TestFace3", "TestFace4"}; |
| | | // auto re2 = server->faceSearchTopN(t_fea, 5, tables2); |
| | | // INFO("faceSearchTopN " << re2.size()); |
| | | // for (auto item : re2) { |
| | | // INFO("faceSearchTopN id " << (item.uuid)); |
| | | // INFO("faceSearchTopN confidence " << (item.confidence)); |
| | | // INFO("faceSearchTopN tableName " << (item.tableName)); |
| | | // } |
| | | } catch (std::exception ex) { |
| | | ERR(ex.what()); |
| | | } |
| | | t_fea.clear(); |
| | | } |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //void test22333() { |
| | | // |
| | | // int loop = 0; |
| | | ////#todo |
| | | // while (1) { |
| | | // string t_path = "./img/"; |
| | | // DIR *dp = opendir(t_path.c_str()); |
| | | // if (dp != NULL) { |
| | | // struct dirent *ep; |
| | | // int loop = 0; |
| | | // while ( |
| | | // ep = readdir(dp) |
| | | // ) { |
| | | // string path(ep->d_name); |
| | | // if (path.find(".jpg") == std::string::npos) { |
| | | // ERR("Couldn't find jpg."); |
| | | // continue; |
| | | // } else { |
| | | // printf("jpg url: %s\n", path. |
| | | // |
| | | // c_str() |
| | | // |
| | | // ); |
| | | // } |
| | | // |
| | | // string tName(t_path); |
| | | // tName. |
| | | // append(path); |
| | | // Mat img1 = imread(tName); // ST_PIX_FMT_BGR888 |
| | | // if (!img1.data) { |
| | | // printf("read first image file failed. url: %s\n", tName. |
| | | // |
| | | // c_str() |
| | | // |
| | | // ); |
| | | // continue; |
| | | // } else { |
| | | // INFO("read img ok!"); |
| | | // } |
| | | // FaceImageN faceImage{img1.cols, img1.rows, img1.step, img1.data}; |
| | | //// m_casiaFaceWrapper.extractFace(faceImage); |
| | | // auto faceResults = t_CasiaFaceWapper.extractFace(faceImage); |
| | | // |
| | | // DBG("faceResults" << faceResults.size()); |
| | | // for ( |
| | | // auto item |
| | | // : faceResults) { |
| | | // ::FaceSearch::Data t_fea; |
| | | // t_fea. |
| | | // resize(item |
| | | // .feature. |
| | | // |
| | | // size() |
| | | // |
| | | // ); |
| | | // memcpy(t_fea |
| | | // . |
| | | // |
| | | // data(), item |
| | | // |
| | | // .feature. |
| | | // |
| | | // data(), item |
| | | // |
| | | // .feature. |
| | | // |
| | | // size() |
| | | // |
| | | // ); |
| | | // try { |
| | | // ::std::vector<::std::string> tables{"o_t_p_escape", "TestFace2", "TestFace3", "TestFace4"}; |
| | | // auto re = server->faceSearchMax(t_fea, tables); |
| | | // INFO("faceSearchMax " << re.size()); |
| | | // for ( |
| | | // auto &item |
| | | // : re) { |
| | | // INFO("faceSearchMax id " << (item.id)); |
| | | // INFO("faceSearchMax confidence " << (item.confidence)); |
| | | // INFO("faceSearchMax tableName " << (item.tableName)); |
| | | // } |
| | | //// sleep(3); |
| | | // ::std::vector<::std::string> tables2{"o_t_p_escape", "TestFace2", "TestFace3", "TestFace4"}; |
| | | // auto re2 = server->faceSearchTopN(t_fea, 5, tables2); |
| | | // INFO("faceSearchTopN " << re2.size()); |
| | | // for ( |
| | | // auto &item |
| | | // : re2) { |
| | | // INFO("faceSearchTopN id " << (item.id)); |
| | | // INFO("faceSearchTopN confidence " << (item.confidence)); |
| | | // INFO("faceSearchTopN tableName " << (item.tableName)); |
| | | // } |
| | | // } catch ( |
| | | // std::exception ex |
| | | // ) { |
| | | // ERR(ex.what()); |
| | | // } |
| | | // t_fea. |
| | | // |
| | | // clear(); |
| | | ////#todo if sc add message |
| | | ////else nothing |
| | | // } |
| | | //// extractFace(FaceImage image, vector<unsigned char>& feature, int& faceNum); |
| | | //// vector<unsigned char> feature; |
| | | //// vector<unsigned char> feature2; |
| | | //// cvutil.cvMat2Buffer(img1,feature); |
| | | //// auto test = feature.size(); |
| | | ////// DBG(test) |
| | | //// ::FaceSearch::Data t_fea; |
| | | //// t_fea.resize(feature.size()); |
| | | //// memcpy(t_fea.data(),feature.data(),feature.size()); |
| | | //// try { |
| | | ////// server->addFace(t_fea,"aaa");addFaceWithId |
| | | ////// server->addFaceWithId(t_fea,(++loop),"aaa"); |
| | | ////// sleep(1); |
| | | ////// server->addFaceWithId(t_fea,(loop),"bbb"); |
| | | //// ::std::vector< ::std::string> tables{"aaa","bbb"}; |
| | | //// auto re = server->faceSearchMax(t_fea,tables); |
| | | //// |
| | | //// INFO("faceSearchMax " << re.size() ); |
| | | //// for (auto& item : re) { |
| | | //// INFO("faceSearchMax id " << ( item.id)); |
| | | //// INFO("faceSearchMax confidence " << ( item.confidence)); |
| | | //// INFO("faceSearchMax tableName " << ( item.tableName)); |
| | | //// } |
| | | //// sleep(3); |
| | | //// }catch (std::exception ex){ |
| | | //// ERR(ex.what()); |
| | | //// } |
| | | //// feature.clear(); |
| | | //// break; |
| | | //// int faceNum; |
| | | //// FaceImageN faceImage {img1.cols, img1.rows, img1.step, img1.data}; |
| | | //// //#todo pthread |
| | | //// auto res = t_CasiaFaceWapper.extractFace(faceImage); |
| | | //// for (auto item : res) { |
| | | ////// item.feature |
| | | //////addFace(const ::FaceSearch::Data& iceP_jpgData, const ::std::string& iceP_tableName, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | //// ::FaceSearch::Data t_fea; |
| | | //// t_fea.resize(item.feature.size()); |
| | | //// memcpy(t_fea.data(),item.feature.data(),item.feature.size()); |
| | | //// |
| | | //// try { |
| | | //// server->addFace(t_fea,"aaa"); |
| | | //// INFO("add"); |
| | | //// }catch (std::exception ex){ |
| | | //// ERR(ex.what()); |
| | | //// } |
| | | //// } |
| | | // |
| | | // printf("\n"); |
| | | // printf("\n"); |
| | | // printf("\n"); |
| | | // printf("\n"); |
| | | // } |
| | | // closedir(dp); |
| | | // } else { |
| | | // ERR("Couldn't open the directory."); |
| | | // } |
| | | //// break; |
| | | // sleep(10); |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | // |
| | | //// try { |
| | | //// long out; |
| | | //// auto temp = server2->getDbActions(000,out); |
| | | //// cout << temp.size() << endl; |
| | | //// cout << out << endl; |
| | | //// INFO("getDbActions"); |
| | | //// }catch (std::exception ex){ |
| | | //// ERR(ex.what()); |
| | | //// } |
| | | ////getchar(); |
| | | // return 0; |
| | | // |
| | | //} |
| | | |
| New file |
| | |
| | | // |
| | | // Created by ps on 2/26/18. |
| | | // |
| | | |
| | | #include <cstring> |
| | | #include <THFeature_i.h> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/util/ShareMemory/ShareMemoryTool.hpp> |
| | | #include "FaceDBCompareServer.h" |
| | | |
| | | using namespace std; |
| | | |
| | | FaceDBCompareServer::FaceDBCompareServer() : m_erlangDbTool(nullptr), m_sqliteFaceEncap(nullptr) { |
| | | |
| | | } |
| | | |
| | | FaceDBCompareServer::FaceDBCompareServer(ErlangTool::ErlangDbTool *erlangDbTool) : m_erlangDbTool(erlangDbTool), |
| | | m_sqliteFaceEncap(nullptr) { |
| | | |
| | | } |
| | | |
| | | FaceDBCompareServer::FaceDBCompareServer(SqliteFaceEncap *sqliteFaceEncap) : m_erlangDbTool(nullptr), |
| | | m_sqliteFaceEncap(sqliteFaceEncap) { |
| | | |
| | | } |
| | | |
| | | //FaceDBCompareServer::FaceDBCompareServer(Ice::CommunicatorHolder& ich) : minThreshold(10) { |
| | | //#ifdef TestCode |
| | | // |
| | | //#else |
| | | // try { |
| | | // base_alarm = ich->stringToProxy("ServerAlarm"); |
| | | // }catch(std::exception ex){ |
| | | // ERR("ServerAlarm connceticon fail" << ex.what()); |
| | | // }; |
| | | //#endif |
| | | //} |
| | | |
| | | FaceDBCompareServer::~FaceDBCompareServer() { |
| | | |
| | | } |
| | | |
| | | FaceResults FaceDBCompareServer::getTopResult(std::thread::id key) { |
| | | if (m_dbRWLocks.find(key) == m_dbRWLocks.end()) { |
| | | m_dbRWLocks[key] = RWLock(); |
| | | } |
| | | RWLock &t_rwl = m_dbRWLocks[key]; |
| | | t_rwl.wrlock(); |
| | | FaceResults t_result = topResult[key]; |
| | | topResult.erase(key); |
| | | t_rwl.unlock(); |
| | | return t_result; |
| | | } |
| | | |
| | | //#todo map 1->2 modify 2->1 |
| | | bool FaceDBCompareServer::compare(thread::id key, AlarmData *alarmData, int topN) { |
| | | if (m_dbRWLocks.find(key) == m_dbRWLocks.end()) { |
| | | m_dbRWLocks[key] = RWLock(); |
| | | } |
| | | RWLock &t_rwl = m_dbRWLocks[key]; |
| | | // ClockTimer clockTimer("compare "); |
| | | RWLock t_rwLock; |
| | | |
| | | m_rwLock.rdlock(); |
| | | mapFaceResults t_compareResults; |
| | | if (topN > 1) { |
| | | //topN |
| | | parallelFor(ParallelForThreardSize::CPU_Number, [&](string &key, FeatureData &data) { |
| | | //#todo |
| | | double sc = 0; |
| | | for (auto &t_fea : data.features) { |
| | | double t_sc = m_casiaFaceWapper.compareFeature(alarmData->feature, t_fea); |
| | | if (t_sc > sc) |
| | | sc = t_sc; |
| | | } |
| | | // FaceResult tface{data.face_id, data.uuid, alarmData->tableName, sc, false}; |
| | | FaceResult tface{0, data.uuid, alarmData->tableName, sc, data.faceUrl, data.idcard, ""}; |
| | | t_rwLock.wrlock(); |
| | | //#todo |
| | | if (sc < t_compareResults.end()->second.confidence) { |
| | | t_rwLock.unlock(); |
| | | return; |
| | | } |
| | | t_compareResults.insert(make_pair(tface.confidence, tface)); |
| | | //#todo 10 |
| | | if (t_compareResults.size() > topN) { |
| | | t_compareResults.erase((--t_compareResults.end()), t_compareResults.end()); |
| | | } |
| | | t_rwLock.unlock(); |
| | | }); |
| | | } else { |
| | | //Max |
| | | float maxScore = 0; |
| | | parallelFor(ParallelForThreardSize::CPU_Number, [&](string &key, FeatureData &data) { |
| | | //#todo |
| | | double sc = 0; |
| | | for (auto &t_fea : data.features) { |
| | | double t_sc = m_casiaFaceWapper.compareFeature(alarmData->feature, t_fea); |
| | | if (t_sc > sc) sc = t_sc; |
| | | } |
| | | FaceResult tface{0, data.uuid, alarmData->tableName, sc, data.faceUrl, data.idcard, ""}; |
| | | t_rwLock.wrlock(); |
| | | if (sc < maxScore) { |
| | | t_rwLock.unlock(); |
| | | return; |
| | | } else { |
| | | t_compareResults.clear(); |
| | | t_compareResults.insert(make_pair(tface.confidence, tface)); |
| | | maxScore = t_compareResults.begin()->second.confidence; |
| | | } |
| | | t_rwLock.unlock(); |
| | | }); |
| | | } |
| | | m_rwLock.unlock(); |
| | | |
| | | int maxSearchFaces = alarmData->num; |
| | | |
| | | t_rwl.wrlock(); |
| | | auto &t_topResult = topResult[key]; |
| | | t_topResult.clear(); |
| | | for (auto &item : t_compareResults) { |
| | | auto &it = item.second; |
| | | //#todo |
| | | // if (it.confidence <= 0.6) { |
| | | // continue; |
| | | // } |
| | | FaceResult t_CR{it.id, it.uuid, it.tableName, it.confidence, it.face_img_url, it.idCard, it.alarmRet}; |
| | | //cout << __FUNCTION__ << " -> " << __LINE__ << " -> scroe" << it.confidence << endl; |
| | | t_topResult.push_back(t_CR); |
| | | } |
| | | while (topResult.size() > maxSearchFaces) |
| | | t_topResult.pop_back(); |
| | | t_rwl.unlock(); |
| | | return true; |
| | | } |
| | | |
| | | bool FaceDBCompareServer::compare(std::thread::id key, AlarmData *alarmData) { |
| | | if (m_dbRWLocks.find(key) == m_dbRWLocks.end()) { |
| | | m_dbRWLocks[key] = RWLock(); |
| | | } |
| | | RWLock &t_rwl = m_dbRWLocks[key]; |
| | | // ClockTimer clockTimer("compare "); |
| | | t_rwl.wrlock(); |
| | | RWLock t_rwLock; |
| | | mapFaceResults t_compareResults; |
| | | m_rwLock.rdlock(); |
| | | parallelFor(ParallelForThreardSize::CPU_Number, [&](string &key, FeatureData &data) { |
| | | double sc = 0; |
| | | for (auto &t_fea : data.features) { |
| | | double t_sc = m_casiaFaceWapper.compareFeature(alarmData->feature, t_fea); |
| | | if (t_sc > sc)sc = t_sc; |
| | | } |
| | | FaceResult tface{data.face_id, data.uuid, alarmData->tableName, sc, data.faceUrl, data.idcard, ""}; |
| | | // FaceResult tface{0, data.uuid, alarmData->tableName, sc, data.faceUrl,false}; |
| | | t_rwLock.wrlock(); |
| | | if (sc < alarmData->threshold) { |
| | | t_rwLock.unlock(); |
| | | DBG("return"); |
| | | return; |
| | | } |
| | | if (t_compareResults.size() > alarmData->num) { |
| | | t_compareResults.erase((--t_compareResults.end()), t_compareResults.end()); |
| | | } |
| | | t_compareResults.insert(make_pair(tface.confidence, tface)); |
| | | t_rwLock.unlock(); |
| | | }); |
| | | m_rwLock.unlock(); |
| | | int maxSearchFaces = alarmData->num; |
| | | auto &t_topResult = topResult[key]; |
| | | t_topResult.clear(); |
| | | for (auto &item : t_compareResults) { |
| | | auto &it = item.second; |
| | | FaceResult t_CR{it.id, it.uuid, it.tableName, it.confidence, it.face_img_url, it.idCard, it.alarmRet}; |
| | | // FaceResult t_CR{it.id, it.uuid, it.tableName, it.confidence, it.face_img_url, ""}; |
| | | t_topResult.push_back(t_CR); |
| | | } |
| | | // while (t_topResult.size() > maxSearchFaces) |
| | | // t_topResult.pop_back(); |
| | | return true; |
| | | } |
| | | |
| | | void FaceDBCompareServer::loadDBData(std::string str_config) { |
| | | string log = "loadDBData " + str_config; |
| | | ClockTimer clk(log); |
| | | |
| | | Json::Value t_json; |
| | | Json::FastWriter writer; |
| | | Json::Reader reader; |
| | | |
| | | if (reader.parse(str_config, t_json)) { |
| | | |
| | | m_rwLock.wrlock(); |
| | | if (t_json["\"syncTpye\""].type() == Json::nullValue) { |
| | | auto str_tab = t_json["\"tableName\""].asString(); |
| | | m_tableName = str_tab.substr(1, str_tab.length() - 2);//.append("_fea"); |
| | | |
| | | string tet = "./syncDBClient "; |
| | | string str_json = writer.write(t_json); |
| | | tet.append("\"" + str_json.substr(0, str_json.length() - 1) + "\" "); |
| | | INFO(tet); |
| | | system(tet.c_str()); |
| | | dataMap.clear(); |
| | | try { |
| | | // init |
| | | BISTL::BiMapFeaData biMapFeaData(m_tableName); |
| | | auto mymap = biMapFeaData.getMap(); |
| | | auto size = mymap->size(); |
| | | //#todo |
| | | for (auto it = mymap->begin(); it != mymap->end(); it++) { |
| | | string str_uuid(it->second.m_id.data()); |
| | | string ft(it->second.m_feature.data()); |
| | | string imgUrl(it->second.m_imgUrl.data()); |
| | | string strIdCard(it->second.m_idcard.data()); |
| | | string str2; |
| | | str2 = base64.Decode(ft.data(), ft.length()); |
| | | std::vector<unsigned char> t_fea; |
| | | t_fea.resize(str2.size()); |
| | | memcpy(t_fea.data(), str2.data(), str2.size()); |
| | | auto &test = dataMap[str_uuid]; |
| | | test.uuid = str_uuid; |
| | | test.features.push_back(t_fea); |
| | | test.faceUrl = imgUrl; |
| | | test.idcard = strIdCard; |
| | | } |
| | | } catch (const std::exception &e) { |
| | | printf("Exception:%s\n", e.what()); |
| | | BISTL::shared_memory_object::remove(m_tableName.c_str()); |
| | | } |
| | | BISTL::shared_memory_object::remove(m_tableName.c_str()); |
| | | appPref.setIntData(m_tableName, 1); |
| | | DBG(m_tableName << " size is " << dataMap.size()); |
| | | } else { |
| | | //#todo get sqlite3 data |
| | | m_tableName = t_json["tableName"].asCString(); |
| | | auto t_res = m_sqliteFaceEncap->getFacesFromTable(m_tableName); |
| | | auto t_faceInfoCache = m_sqliteFaceEncap->getFaceInfoFromTable(m_tableName); |
| | | auto &res = *t_res; |
| | | //#todo |
| | | DBG(m_tableName << "clear before size is " << dataMap.size()); |
| | | dataMap.clear(); |
| | | DBG(m_tableName << "clear after size is " << dataMap.size()); |
| | | for (auto &item : res) { |
| | | auto &t_sen = item.second; |
| | | std::vector<unsigned char> t_fea; |
| | | t_fea.resize(t_sen.faceFeature.size()); |
| | | memcpy(t_fea.data(), t_sen.faceFeature.data(), t_sen.faceFeature.size()); |
| | | auto &test = dataMap[t_sen.uuid]; |
| | | test.uuid = t_sen.uuid; |
| | | test.features.push_back(t_fea); |
| | | test.faceUrl = t_sen.faceurl; |
| | | test.idcard = t_faceInfoCache[t_sen.uuid].idCard; |
| | | } |
| | | appPref.setIntData(m_tableName, 1); |
| | | DBG(m_tableName << " size is " << dataMap.size()); |
| | | } |
| | | m_rwLock.unlock(); |
| | | } else { |
| | | ERR("json format error :: " << str_config); |
| | | appPref.setIntData(str_config, 1); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| New file |
| | |
| | | // |
| | | // Created by ps on 2/26/18. |
| | | // |
| | | |
| | | #ifndef COMPARETEST_FACEDBCOMPARESERVER_H |
| | | #define COMPARETEST_FACEDBCOMPARESERVER_H |
| | | |
| | | #include <pthread.h> |
| | | |
| | | #include <Ice/Ice.h> |
| | | #include <basic/rpc/IceRpc.hpp> |
| | | #include <FaceSearchServer.h> |
| | | #include "AlarmServer.hpp" |
| | | #include "CasiaFaceWrapper/CasiaFaceWrapperN.h" |
| | | #include <basic/util/thread/RWLock.hpp> |
| | | #include <ErlangDbTool.h> |
| | | #include <SqliteFaceEncap.h> |
| | | |
| | | class FaceDBCompareServer : public AlarmServer { |
| | | |
| | | public: |
| | | FaceDBCompareServer(); |
| | | |
| | | FaceDBCompareServer(SqliteFaceEncap *); |
| | | |
| | | FaceDBCompareServer(ErlangTool::ErlangDbTool *); |
| | | |
| | | ~FaceDBCompareServer(); |
| | | |
| | | virtual bool compare(std::thread::id key, AlarmData *alarmData, int topN); |
| | | |
| | | bool compare(std::thread::id key, AlarmData *alarmData); |
| | | |
| | | FaceResults getTopResult(std::thread::id key); |
| | | |
| | | private: |
| | | virtual void loadDBData(std::string str_config); |
| | | |
| | | protected: |
| | | CasiaFaceWrapperN m_casiaFaceWapper; |
| | | std::string m_tableName; |
| | | |
| | | int fea_size; |
| | | RWLock m_rwLock; |
| | | std::mutex topResultMtx; |
| | | std::map<std::thread::id, FaceResults> topResult; |
| | | std::map<std::thread::id, RWLock> m_dbRWLocks; |
| | | |
| | | ErlangTool::ErlangDbTool *m_erlangDbTool; |
| | | SqliteFaceEncap *m_sqliteFaceEncap; |
| | | |
| | | }; |
| | | |
| | | static bool getRet(std::string startTime, std::string endTime) { |
| | | auto crrentTime = AppUtil::getTimeSecString(); |
| | | |
| | | if (crrentTime.compare(startTime) > 0 && crrentTime.compare(endTime) < 0) { |
| | | return true; |
| | | } |
| | | return false; |
| | | |
| | | } |
| | | |
| | | #endif //COMPARETEST_FACEDBCOMPARESERVER_H |
| New file |
| | |
| | | // |
| | | // Created by pans on 4/27/18. |
| | | // |
| | | |
| | | #include <iostream> |
| | | |
| | | #include "jsoncpp/json/json.h" |
| | | |
| | | #include <basic/debug/Debug.h> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include "FaceFeatureSearchServerI.h" |
| | | |
| | | using namespace std; |
| | | |
| | | static std::string t_cNodeName = "FaceSearch"; |
| | | |
| | | void erlangCallBackFunc(std::string) { |
| | | DBG("erlangCallBackFunc"); |
| | | pthread_cond_signal(&(func_cond)); |
| | | pthread_mutex_unlock(&(func_cond_mutex)); |
| | | } |
| | | |
| | | FaceFeatureSearchServerI::FaceFeatureSearchServerI() |
| | | : m_erlangDbTool(appConfig.getStringProperty("erlPath"), appConfig.getStringProperty("erlNode"), |
| | | appConfig.getStringProperty("erlCookie"), t_cNodeName), m_retUpdatePthread(true), |
| | | pManagerEsDB(appPref.getStringData("ipAdd"), appPref.getIntData("ipPort")), m_sqliteFaceEncap("LocalDataDB") { |
| | | |
| | | auto erlFatherNode = appConfig.getStringProperty("erlFatherNode"); |
| | | if (m_erlangDbTool.initErlang() == 1) { |
| | | m_erlangDbTool.startNodeDb(erlFatherNode); |
| | | } |
| | | |
| | | m_erlangDbTool.test(&func_cond, &func_cond_mutex); |
| | | |
| | | loadFeatureData(this); |
| | | } |
| | | |
| | | FaceFeatureSearchServerI::FaceFeatureSearchServerI(Ice::CommunicatorPtr &ich, string nodeName, string cookie) |
| | | : m_erlangDbTool(nodeName, cookie, t_cNodeName), m_retUpdatePthread(true), |
| | | pManagerEsDB(appPref.getStringData("ipAdd"), appPref.getIntData("ipPort")), |
| | | m_sqliteFaceEncap("LocalDataDB") { |
| | | |
| | | // try { |
| | | // std::string identity2 = ich->getProperties()->getProperty("user.FaceData"); |
| | | // DBG(identity2); |
| | | // base_FaceMemoryData = ich->stringToProxy(appPref.getStringData("user.FaceData")); |
| | | // } catch (std::exception ex) { |
| | | // ERR("base_FaceMemoryData connceticon fail" << ex.what()); |
| | | // }; |
| | | |
| | | loadFeatureData(this); |
| | | } |
| | | |
| | | FaceFeatureSearchServerI::~FaceFeatureSearchServerI() { |
| | | t_live_ret = false; |
| | | } |
| | | |
| | | //#todo ä¼å |
| | | ::FaceSearch::FaceResults |
| | | FaceFeatureSearchServerI::faceSearchMax(const ::FaceSearch::Data &feature, const ::std::string &info_json, |
| | | const ::Ice::Current &) { |
| | | thread::id key = std::this_thread::get_id(); |
| | | ClockTimer clockTimer("faceSearchMax"); |
| | | ::FaceSearch::FaceResults results; |
| | | FaceResults t_TableCompareResult; |
| | | AlarmData featureData; |
| | | featureData.num = 1; |
| | | featureData.feature.resize(feature.size()); |
| | | memcpy(featureData.feature.data(), feature.data(), feature.size()); |
| | | |
| | | for (auto &it : m_faceFCMAP) { |
| | | auto &t_FaceFC = it.second; |
| | | auto t_tableInfo = m_tableType[it.first]; |
| | | bool ret = getRet(t_tableInfo.startTime, t_tableInfo.endTime); |
| | | if (ret) { |
| | | bool alarmRet = atoi(t_tableInfo.bwType.c_str()); |
| | | //#todo éåæ¥åºæ¯å¦éè¦æ¯è¾ï¼ |
| | | t_FaceFC->compare(key, &featureData, 1); |
| | | auto t_results = t_FaceFC->getTopResult(key); |
| | | for (auto &t_item : t_results) { |
| | | t_item.tableName = it.first; |
| | | //#todo baojing zhuangtai ? |
| | | t_item.alarmRet = ret; |
| | | t_TableCompareResult.push_back(t_item); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // DBG("t_TableCompareResult size" << t_TableCompareResult.size()); |
| | | for (auto itor = t_TableCompareResult.begin(); itor != t_TableCompareResult.end(); ++itor) { |
| | | float new_confidence = itor->confidence; |
| | | auto rtTR = results.rbegin(); |
| | | if (!results.empty()) { |
| | | auto temp = rtTR->confidence; |
| | | while (new_confidence > temp) { |
| | | ++rtTR; |
| | | if (rtTR == (results.rend() + 1)) { |
| | | rtTR--; |
| | | break; |
| | | } else { |
| | | // DBG(" sc is "<< new_confidence << " > " << temp); |
| | | } |
| | | temp = rtTR->confidence; |
| | | } |
| | | } else { |
| | | // INFO("topResult is null"); |
| | | } |
| | | auto itTR(rtTR.base()); |
| | | ::FaceSearch::FaceResult t_faceCR; |
| | | t_faceCR.id = itor->id; |
| | | t_faceCR.uuid = itor->uuid; |
| | | t_faceCR.tableName = itor->tableName; |
| | | t_faceCR.confidence = itor->confidence; |
| | | DBG("compare results tablename is " << t_faceCR.tableName << " id is " << t_faceCR.uuid << " sc is" |
| | | << t_faceCR.confidence); |
| | | results.insert(itTR, t_faceCR); |
| | | } |
| | | |
| | | |
| | | //#todo send message |
| | | |
| | | return results; |
| | | } |
| | | |
| | | //#todo ä¼å |
| | | ::FaceSearch::FaceResults |
| | | FaceFeatureSearchServerI::faceSearchTopN(const ::FaceSearch::Data &feature, const ::std::string &info_json, |
| | | ::Ice::Int topN, ::Ice::Float score, const ::Ice::Current &) { |
| | | ClockTimer clockTimer("faceSearchTopN " + to_string(score) + " :"); |
| | | INFO("faceSearchTopN start"); |
| | | thread::id key = std::this_thread::get_id(); |
| | | ::FaceSearch::FaceResults results; |
| | | FaceResults t_TableCompareResult; |
| | | AlarmData featureData; |
| | | featureData.num = topN; |
| | | featureData.feature.resize(feature.size()); |
| | | memcpy(featureData.feature.data(), feature.data(), feature.size()); |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if (reader.parse(info_json, value)) { |
| | | //#todo |
| | | |
| | | m_rwLock.rdlock(); |
| | | std::string feature_base64; |
| | | feature_base64 = base64.Encode(feature.data(), feature.size()); |
| | | value["FaceFeature"] = feature_base64; |
| | | DBG("auto &it : m_faceFCMAP start " << m_faceFCMAP.size()); |
| | | //#todo lock |
| | | for (auto &it : m_faceFCMAP) { |
| | | auto &t_FaceFC = it.second; |
| | | auto t_tableInfo = m_tableType[it.first]; |
| | | bool ret = getRet(t_tableInfo.startTime, t_tableInfo.endTime); |
| | | if (ret) { |
| | | string t_alarmRet = t_tableInfo.bwType; |
| | | // bool alarmRet = atoi(t_tableInfo.bwType.c_str()); |
| | | //#todo éåæ¥åºæ¯å¦éè¦æ¯è¾ï¼ |
| | | |
| | | DBG("m_faceFCMAP compare start " << it.first); |
| | | t_FaceFC->compare(key, &featureData, topN); |
| | | DBG("m_faceFCMAP compare end " << it.first); |
| | | |
| | | auto t_results = t_FaceFC->getTopResult(key); |
| | | for (auto &t_item : t_results) { |
| | | t_item.tableName = it.first; |
| | | t_item.alarmRet = t_alarmRet; |
| | | t_TableCompareResult.push_back(t_item); |
| | | } |
| | | } else { |
| | | INFO("m_faceFCMAP ret is false " << it.first); |
| | | } |
| | | } |
| | | m_rwLock.unlock(); |
| | | DBG("auto &it : m_faceFCMAP end"); |
| | | |
| | | // DBG("t_TableCompareResult size" << t_TableCompareResult.size()); |
| | | //sort_all_results |
| | | for (auto itor = t_TableCompareResult.begin(); itor != t_TableCompareResult.end(); ++itor) { |
| | | float new_confidence = itor->confidence; |
| | | auto rtTR = results.rbegin(); |
| | | if (!results.empty()) { |
| | | auto temp = rtTR->confidence; |
| | | while (new_confidence > temp) { |
| | | ++rtTR; |
| | | if (rtTR == (results.rend() + 1)) { |
| | | rtTR--; |
| | | break; |
| | | } else { |
| | | } |
| | | temp = rtTR->confidence; |
| | | } |
| | | } else { |
| | | ERR("topResult is null"); |
| | | } |
| | | auto itTR(rtTR.base()); |
| | | ::FaceSearch::FaceResult t_faceCR; |
| | | t_faceCR.id = itor->id; |
| | | t_faceCR.uuid = itor->uuid; |
| | | t_faceCR.tableName = itor->tableName; |
| | | t_faceCR.confidence = itor->confidence; |
| | | //#todo url idcard |
| | | t_faceCR.imgUrl = itor->face_img_url; |
| | | t_faceCR.idcard = itor->idCard; |
| | | t_faceCR.alarmRet = itor->alarmRet; |
| | | // DBG("compare results tablename is " << t_faceCR.tableName << " id is " << t_faceCR.uuid << " sc is" |
| | | // << t_faceCR.confidence); |
| | | results.insert(itTR, t_faceCR); |
| | | } |
| | | bool retface = true; |
| | | // cout << __FUNCTION__ << " -> " << __LINE__ << " -> " << results.size() << endl; |
| | | //#todo send message |
| | | if (results.size() > 0) { |
| | | for (auto &item : results) { |
| | | //#todo å¾åæ¯è¾ï¼åºè¯¥å¨compareä¸è¿è¡ |
| | | if (item.confidence < score) { |
| | | //#todo test |
| | | auto str_uuid = value["Id"].asString(); |
| | | value["personIsHub"] = "4"; |
| | | value["likePer"] = 0.0; |
| | | // DBG(value.toStyledString()); |
| | | cout << __FUNCTION__ << " -> " << __LINE__ << " -> " << "value.toStyledString() " |
| | | << value.toStyledString() << endl; |
| | | retface = pManagerEsDB.insertData("videopersons", "perVideoPicture", value.toStyledString(), |
| | | str_uuid); |
| | | break; |
| | | } |
| | | value["personId"] = item.uuid.size() > 0 ? item.uuid : "";//å
³èåºåºäººåid,人è¸id |
| | | |
| | | // string tmp_tableName = item.tableName; |
| | | // if (tmp_tableName.find("lt_") == 0) { |
| | | // tmp_tableName = tmp_tableName.insert(tmp_tableName.find("lt_") + 3, "::"); |
| | | // value["BaseName"] = tmp_tableName;//å
³èåºåºè¡¨å |
| | | // } else { |
| | | // value["BaseName"] = item.tableName.size() > 0 ? item.tableName : "";//å
³èåºåºè¡¨å |
| | | // } |
| | | |
| | | value["BaseName"] = item.tableName.size() > 0 ? item.tableName : "";//å
³èåºåºè¡¨å |
| | | |
| | | value["likePer"] = item.confidence > 0 ? item.confidence : 0.0; |
| | | value["personPicUrl"] = item.imgUrl.size() > 0 ? item.imgUrl : "";//diku tupian |
| | | value["idcard"] = item.idcard.size() > 0 ? item.idcard : "";//diku tupian |
| | | //妿 alarmRet ä¸ä¸ºç©ºæ ä»çå¼ æ¾å
¥ personIsHub,å¦å为4 |
| | | value["personIsHub"] = item.alarmRet.size() > 0 ? item.alarmRet : "4"; |
| | | |
| | | auto str_uuid = value["Id"].asString(); |
| | | // DBG(value.toStyledString()); |
| | | |
| | | cout << __FUNCTION__ << " -> " << __LINE__ << " -> " << "value.toStyledString() " |
| | | << value.toStyledString() << "\n score " << score << endl; |
| | | // DBG("score " << score); |
| | | retface = pManagerEsDB.insertData("videopersons", "perVideoPicture", value.toStyledString(), |
| | | str_uuid); |
| | | break; |
| | | } |
| | | } else { |
| | | auto str_uuid = value["Id"].asString(); |
| | | value["personIsHub"] = "4"; |
| | | value["likePer"] = 0.0; |
| | | DBG(value.toStyledString()); |
| | | // cout << __FUNCTION__ << " -> " << __LINE__ << " -> " << "value.toStyledString() " |
| | | // << value.toStyledString() << endl; |
| | | retface = pManagerEsDB.insertData("videopersons", "perVideoPicture", value.toStyledString(), |
| | | str_uuid); |
| | | } |
| | | if (!retface) { |
| | | ERR("insert error"); |
| | | } else { |
| | | cout << __FUNCTION__ << " -> " << __LINE__ << " -> " << "retface " << retface << endl; |
| | | }; |
| | | } else { |
| | | ERR("json is error" << info_json); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // for (auto &item : t_tables) { |
| | | // DBG(item); |
| | | // } |
| | | return results; |
| | | } |
| | | |
| | | bool FaceFeatureSearchServerI::loadFeatureData(FaceFeatureSearchServerI *faceFea) { |
| | | ErlangTool::map_TabDataCache dataBaseCache = faceFea->m_erlangDbTool.findAllDatabase(); |
| | | if (dataBaseCache.size() < 0 && faceFea->m_retUpdatePthread) { |
| | | faceFea->m_retUpdatePthread = false; |
| | | std::thread thd(dataUpdate, faceFea); |
| | | thd.detach(); |
| | | } |
| | | auto typeInfoCache = faceFea->m_erlangDbTool.findAllTypeInfo(); |
| | | faceFea->m_tableType.clear(); |
| | | string str_config = faceFea->m_erlangDbTool.getConfigJsonString(); |
| | | |
| | | |
| | | Json::Value t_json; |
| | | Json::FastWriter writer; |
| | | Json::Reader reader; |
| | | |
| | | faceFea->m_rwLock.wrlock(); |
| | | if (reader.parse(str_config, t_json)) { |
| | | for (auto &item : dataBaseCache) { |
| | | TableInfo tabInfo; |
| | | tabInfo.tableName = item.first; |
| | | tabInfo.startTime = item.second.startTime; |
| | | tabInfo.endTime = item.second.endTime; |
| | | // tabInfo.bwType = item.second.bwType = typeInfoCache.find(item.first)->second.bwType; |
| | | tabInfo.bwType = item.second.bwType;//= typeInfoCache.find(item.first)->second.bwType; |
| | | tabInfo.createBy = item.second.create_by; |
| | | |
| | | if ((tabInfo.tableName.find("lt_") == 0) && (tabInfo.createBy != appConfig.getStringProperty("erlNode"))) { |
| | | continue; |
| | | } |
| | | string &tableName = item.second.tableName; |
| | | faceFea->m_tableType[tableName] = tabInfo; |
| | | appPref.setIntData(tableName, 0); |
| | | if (faceFea->m_faceFCMAP.find(tableName) == faceFea->m_faceFCMAP.end()) { |
| | | faceFea->m_faceFCMAP[tableName] = new FaceDBCompareServer(&(faceFea->m_erlangDbTool)); |
| | | // usleep(1000); |
| | | } |
| | | t_json["\"tableName\""] = "\"" + tableName + "\""; |
| | | std::string str_json = writer.write(t_json); |
| | | |
| | | str_json.substr(0, str_json.length() - 1); |
| | | // sleep(1); |
| | | usleep(1500 * 1000); |
| | | faceFea->m_faceFCMAP[tableName]->initDB(str_json); |
| | | DBG("initDB tableName " << tableName); |
| | | } |
| | | } else { |
| | | ERR("json format error :: " << str_config); |
| | | } |
| | | |
| | | //#todo get data from sqlite3 |
| | | { |
| | | //#æ¥è¯¢äººè¸åºåºå表 |
| | | auto res = faceFea->m_sqliteFaceEncap.getTableInfos(); |
| | | for (auto &item : res) { |
| | | if (item.tableType == "person") { |
| | | std::cout << "tableName is " << item.tableName << std::endl; |
| | | |
| | | { |
| | | std::string tableName = item.tableName; |
| | | faceFea->m_tableType[tableName] = item; |
| | | appPref.setIntData(tableName, 0); |
| | | if (faceFea->m_faceFCMAP.find(tableName) == faceFea->m_faceFCMAP.end()) { |
| | | faceFea->m_faceFCMAP[tableName] = new FaceDBCompareServer(&(faceFea->m_sqliteFaceEncap)); |
| | | } |
| | | |
| | | Json::Value t_json2; |
| | | t_json2.clear(); |
| | | |
| | | t_json2["\"syncTpye\""] = "local"; |
| | | t_json2["tableName"] = tableName; |
| | | std::string str_json = writer.write(t_json2); |
| | | |
| | | str_json.substr(0, str_json.length() - 1); |
| | | faceFea->m_faceFCMAP[tableName]->initDB(str_json); |
| | | DBG("initDB tableName " << tableName); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | faceFea->m_rwLock.unlock(); |
| | | |
| | | INFO("get time"); |
| | | faceFea->m_inTime = getTimeLong(); |
| | | if (faceFea->m_retUpdatePthread) { |
| | | faceFea->m_retUpdatePthread = false; |
| | | std::thread thd(dataUpdate, faceFea); |
| | | |
| | | // faceFea->m_erlangDbTool.test(faceFea, erlangCallBackFunc); |
| | | INFO("start thread"); |
| | | thd.detach(); |
| | | } else { |
| | | ERR("m_retUpdatePthread is false "); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | void FaceFeatureSearchServerI::waitTables(FaceFeatureSearchServerI *faceFea, int loop) { |
| | | DBG("waitTales"); |
| | | while (t_live_ret) { |
| | | faceFea->m_rwLock.rdlock(); |
| | | if (faceFea->m_faceFCMAP.size() == 0) { |
| | | ERR("table size is 0"); |
| | | faceFea->m_rwLock.unlock(); |
| | | return; |
| | | } |
| | | bool tmp = true; |
| | | for (auto &t_face : faceFea->m_faceFCMAP) { |
| | | auto t_ret = appPref.getIntData(t_face.first); |
| | | tmp = t_ret & tmp; |
| | | } |
| | | if (tmp && faceFea->m_faceFCMAP.size() > 0) { |
| | | INFO("waitTables ok"); |
| | | faceFea->m_rwLock.unlock(); |
| | | return; |
| | | } else { |
| | | ERR("tmp is " << tmp << " faceFea->m_faceFCMAP.size() is " << faceFea->m_faceFCMAP.size()); |
| | | faceFea->m_rwLock.unlock(); |
| | | usleep(1000); |
| | | // if (loop != -1 && loop-- < 1) { |
| | | // ERR("return " << loop); |
| | | // return; |
| | | // } |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | |
| | | |
| | | //void FaceFeatureSearchServerI::erlangCallBackFunc(std::string) { |
| | | // DBG("erlangCallBackFunc"); |
| | | // pthread_cond_signal(&(func_cond)); |
| | | // pthread_mutex_unlock(&(func_cond_mutex)); |
| | | //} |
| | | |
| | | void FaceFeatureSearchServerI::dataUpdate(FaceFeatureSearchServerI *faceFea) { |
| | | long inTime = faceFea->m_inTime; |
| | | // modify all db ready start update, <10s |
| | | faceFea->waitTables(faceFea, 100); |
| | | int loop = 0; |
| | | long outTime; |
| | | //update |
| | | while (t_live_ret) { |
| | | DBG(" wait lock?"); |
| | | pthread_mutex_lock(&(func_cond_mutex)); |
| | | DBG(" get lock?"); |
| | | pthread_cond_wait(&(func_cond), &(func_cond_mutex)); |
| | | try { |
| | | // faceFea->m_rwLock.rdlock(); |
| | | // if (faceFea->m_faceFCMAP.size() > 0) { |
| | | // faceFea->m_rwLock.unlock(); |
| | | // } else { |
| | | // faceFea->m_rwLock.unlock(); |
| | | // } |
| | | DBG("update data sleep before "); |
| | | int sleepTime = appConfig.getIntProperty("FaceSeachSleepTime"); |
| | | sleepTime = sleepTime > 30 ? sleepTime : 30; |
| | | DBG("sleepTime is " << sleepTime); |
| | | sleep(30); |
| | | inTime = outTime; |
| | | outTime = 0; |
| | | cout << " loop is " << loop++ << endl; |
| | | faceFea->loadFeatureData(faceFea); |
| | | faceFea->waitTables(faceFea, 100000); |
| | | pthread_mutex_unlock(&func_cond_mutex); |
| | | } catch (std::exception ex) { |
| | | ERR(ex.what()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | bool FaceFeatureSearchServerI::initErlang(std::string nodeName, std::string cookie) { |
| | | //#todo |
| | | // m_erlangDbTool = ErlangTool::ErlangDbTool(nodeName, cookie); |
| | | return false; |
| | | } |
| | | |
| New file |
| | |
| | | // |
| | | // Created by pans on 4/27/18. |
| | | // |
| | | |
| | | #ifndef FACESEARCHSERVER_FACEFEATURESEARCHSERVERI_H |
| | | #define FACESEARCHSERVER_FACEFEATURESEARCHSERVERI_H |
| | | |
| | | #include <FaceSearchServer.h> |
| | | #include <Ice/Ice.h> |
| | | #include <basic/rpc/IceRpc.hpp> |
| | | #include <basic/db/Elasticsearch/EsDBTool.h> |
| | | #include <basic/util/app/AppConfig.h> |
| | | |
| | | #include <ErlangDbTool.h> |
| | | #include <SqliteFaceEncap.h> |
| | | #include "FaceDBCompareServer.h" |
| | | |
| | | //struct TableInfo { |
| | | // std::string tab_name; |
| | | // std::string startTime; |
| | | // std::string endTime; |
| | | // std::string bwType; |
| | | // std::string create_by; |
| | | //}; |
| | | |
| | | static bool t_live_ret = true; |
| | | static pthread_cond_t func_cond(PTHREAD_COND_INITIALIZER); |
| | | static pthread_mutex_t func_cond_mutex(PTHREAD_MUTEX_INITIALIZER); |
| | | |
| | | |
| | | void erlangCallBackFunc(std::string); |
| | | |
| | | class FaceFeatureSearchServerI : public FaceSearch::FaceFeatureSearchServer { |
| | | public: |
| | | FaceFeatureSearchServerI(); |
| | | |
| | | FaceFeatureSearchServerI(Ice::CommunicatorPtr &ich, std::string nodeName, std::string cookie); |
| | | |
| | | virtual ~FaceFeatureSearchServerI(); |
| | | |
| | | public: |
| | | virtual ::FaceSearch::FaceResults faceSearchMax(const ::FaceSearch::Data &, const ::std::string &, |
| | | const ::Ice::Current & = ::Ice::emptyCurrent); |
| | | |
| | | virtual ::FaceSearch::FaceResults |
| | | faceSearchTopN(const ::FaceSearch::Data &, const ::std::string &, ::Ice::Int, ::Ice::Float, |
| | | const ::Ice::Current & = ::Ice::emptyCurrent); |
| | | |
| | | private: |
| | | bool initErlang(std::string nodeName, std::string cookie); |
| | | |
| | | //#todo delete cache |
| | | |
| | | //#todo loadData |
| | | static bool loadFeatureData(FaceFeatureSearchServerI *faceFea); |
| | | |
| | | static void dataUpdate(FaceFeatureSearchServerI *faceFea); |
| | | |
| | | static void waitTables(FaceFeatureSearchServerI *faceFea, int loop = -1); |
| | | |
| | | // void erlangCallBackFunc(std::string); |
| | | |
| | | private: |
| | | long m_inTime; |
| | | std::map<std::string, FaceDBCompareServer *> m_faceFCMAP; |
| | | std::map<std::string, TableInfo> m_tableType; |
| | | |
| | | RWLock m_rwLock; |
| | | ErlangTool::ErlangDbTool m_erlangDbTool; |
| | | SqliteFaceEncap m_sqliteFaceEncap; |
| | | std::mutex m_mutex; |
| | | bool m_retUpdatePthread; |
| | | |
| | | Base64 base64; |
| | | // Ice::ObjectPrx base_FaceMemoryData; |
| | | // IceRpcClient<::FaceSearch::FaceMemoryDataPrx> m_faceMemoryClient; |
| | | // ::FaceSearch::FaceMemoryDataPrx serverFaceMemoryData; |
| | | |
| | | // func_cond_mutex(PTHREAD_MUTEX_INITIALIZER), func_cond(PTHREAD_COND_INITIALIZER) |
| | | |
| | | EsDBTool pManagerEsDB;//(appPref.getStringData("ipAdd"), appPref.getIntData("ipPort")); |
| | | }; |
| | | |
| | | |
| | | #endif //FACESEARCHSERVER_FACEFEATURESEARCHSERVERI_H |
| New file |
| | |
| | | // |
| | | // Created by pans on 4/27/18. |
| | | // |
| | | |
| New file |
| | |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(LoadDBClient) |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../../build) |
| | | |
| | | add_definitions(-DGLOG) |
| | | set(CMAKE_CXX_STANDARD 11) |
| | | |
| | | include_directories( |
| | | /home/ps/boost_1_68_0 |
| | | /usr/include/ |
| | | ../../../BasicPlatForm/libs/glog/include |
| | | ../../../BasicPlatForm/libs/jsoncpp/include |
| | | ../../../BasicPlatForm/basic/util/ShareMemory/ |
| | | ../../../../Erlang/syncDBTool |
| | | ) |
| | | |
| | | link_directories( |
| | | /usr/lib/erlang/lib/erl_interface-3.8.2/lib/ |
| | | ../../../BasicPlatForm/libs/glog/lib |
| | | ../../../BasicPlatForm/libs/jsoncpp/lib |
| | | ) |
| | | |
| | | |
| | | add_executable(syncDBClient |
| | | main.cpp |
| | | |
| | | ../../../../Erlang/syncDBTool/ErlangDbTool.cpp |
| | | # ../../../BasicPlatForm/basic/util/ShareMemory/SemTool.cpp |
| | | ) |
| | | |
| | | target_link_libraries( |
| | | syncDBClient |
| | | glog |
| | | ei |
| | | erl_interface_st |
| | | ei_st |
| | | erl_interface |
| | | rt |
| | | jsoncpp |
| | | pthread |
| | | ) |
| | | |
| | | add_executable(TestCilent |
| | | Client.cpp |
| | | # ../../../BasicPlatForm/basic/util/ShareMemory/SemTool.cpp |
| | | |
| | | ) |
| | | |
| | | target_link_libraries(TestCilent |
| | | pthread |
| | | jsoncpp |
| | | rt |
| | | ) |
| | | |
| | | |
| | | #include_directories( |
| | | # /usr/include/x86_64-linux-gnu/qt5 |
| | | # /usr/include/x86_64-linux-gnu/qt5/QtCore/ |
| | | # /usr/include/x86_64-linux-gnu/qt5/QtSql/ |
| | | #) |
| | | #add_executable(demoTime |
| | | # demoTime.cpp |
| | | # # ../../../BasicPlatForm/basic/util/ShareMemory/SemTool.cpp |
| | | # ) |
| | | # |
| | | #target_link_libraries(demoTime |
| | | # pthread |
| | | # Qt5Core |
| | | # Qt5Sql |
| | | # ) |
| | | |
| | | |
| | | #./syncDBClient "{"\"cookie\"":"\"12121\"","\"nodeName\"":"\"wp1@192.168.1.103\"","\"path\"":"\"/opt/erlang/wp1\"","\"tableName\"":"\"æµè¯ä¸æ\""}" > tl1 & \ |
| | | #./syncDBClient "{"\"cookie\"":"\"12121\"","\"nodeName\"":"\"wp1@192.168.1.103\"","\"path\"":"\"/opt/erlang/wp1\"","\"tableName\"":"\"æµè¯ä¸æ2\""}" > tl2 |
| New file |
| | |
| | | // |
| | | // Created by ps on 8/9/18. |
| | | // |
| | | |
| | | |
| | | #include "ShareMemoryTool.hpp" |
| | | #include <jsoncpp/json/json.h> |
| | | #include <SemTool.h> |
| | | |
| | | |
| | | using namespace std; |
| | | |
| | | static std::string getTimeSecString() { |
| | | char buf[128] = {0}; |
| | | time_t t = time(nullptr); |
| | | timeval time{0}; |
| | | gettimeofday(&time, nullptr); |
| | | tm *local = localtime(&t); //转为æ¬å°æ¶é´ |
| | | strftime(buf, 64, "%Y-%m-%d %H:%M:%S", local); |
| | | return std::string(buf); |
| | | } |
| | | |
| | | int main() { |
| | | |
| | | // string str_json = "{\"path\":\"/opt/erlang/sub1/\",\"nodeName\":\"sub1@192.168.1.186\",\"cookie\":\"abc\",\"tableName\":\"test\"}"; |
| | | |
| | | // int key = 1234; |
| | | // SemTool semTool(key); |
| | | // semTool.set_semvalue(); |
| | | |
| | | auto str = getTimeSecString(); |
| | | |
| | | cout << str.substr(0, 10) << endl; |
| | | |
| | | |
| | | srand(time(0)); |
| | | |
| | | bool ret = true; |
| | | if (rand() % 2) { |
| | | for (int i = 0; i < 10; ++i) { |
| | | int loop = 3; |
| | | cout << loop << " " << loop % 2 << endl; |
| | | ret &= loop % 2; |
| | | } |
| | | } else { |
| | | ret = false; |
| | | } |
| | | |
| | | if (ret) { |
| | | cout << "true" << endl; |
| | | } else { |
| | | cout << "false" << endl; |
| | | } |
| | | |
| | | return 0; |
| | | |
| | | Json::Value t_json; |
| | | Json::FastWriter writer; |
| | | |
| | | t_json["\"path\""] = "\"/opt/erlang/sub1/\""; |
| | | t_json["\"nodeName\""] = "\"sub1@192.168.1.186\""; |
| | | t_json["\"cookie\""] = "\"abc\""; |
| | | t_json["\"tableName\""] = "\"test\""; |
| | | // t_json["\"key\""] = "\""+to_string(key)+"\""; |
| | | string tet = "./syncDBClient "; |
| | | string str_json = writer.write(t_json); |
| | | |
| | | tet.append("\"" + str_json.substr(0, str_json.length() - 1) + "\" "); |
| | | cout << tet << endl; |
| | | system(tet.c_str()); |
| | | // return 0; |
| | | // sleep(2); |
| | | |
| | | // semTool.semaphore_p(); |
| | | |
| | | try { |
| | | // BISTL::shared_memory_object |
| | | // init |
| | | // BISTL::managed_shared_memory segment(BISTL::open_only, "aaa8" ); |
| | | BISTL::BiMapFeaData biMapFeaData("test"); |
| | | |
| | | // const BISTL::void_allocator alloc_inst (segment.get_segment_manager()); |
| | | |
| | | // BISTL::bi_map_Feature_Info * mymap = |
| | | // segment.construct<BISTL::bi_map_Feature_Info>("MyMap")(std::less<BISTL::char_string>(),alloc_inst); |
| | | // BISTL::bi_map_Feature_Info *mymap = |
| | | // segment.find_or_construct<BISTL::bi_map_Feature_Info>("aaa8")(std::less<BISTL::char_string>(), alloc_inst); |
| | | |
| | | auto mymap = biMapFeaData.getMap(); |
| | | auto size = mymap->size(); |
| | | for (auto it = mymap->begin(); it != mymap->end(); it++) { |
| | | // printf("%s \n", it->second.id.c_str()); |
| | | // printf("%d \n", it->second.id); |
| | | string a = string(it->second.m_id.data()); |
| | | string b = string(it->second.m_feature.data()); |
| | | std::cout << "id " << a << std::endl; |
| | | std::cout << "feature " << b << std::endl; |
| | | // it->second.id; |
| | | } |
| | | printf("\n"); |
| | | |
| | | // BISTL::shared_memory_object::remove("SharedMemory"); |
| | | } |
| | | catch (const std::exception &e) { |
| | | printf("Exception:%s\n", e.what()); |
| | | BISTL::shared_memory_object::remove("test"); |
| | | } |
| | | getchar(); |
| | | BISTL::shared_memory_object::remove("test"); |
| | | |
| | | return 0; |
| | | } |
| New file |
| | |
| | | // |
| | | // Created by ps on 18-9-30. |
| | | // |
| | | |
| | | #include<QDateTime> |
| | | #include <iostream> |
| | | |
| | | using namespace std; |
| | | |
| | | typedef struct { |
| | | int Year; |
| | | int Month; |
| | | int Day; |
| | | int Hour; |
| | | int Minute; |
| | | int Second; |
| | | } TimeSt, *pTimeSt; |
| | | |
| | | void DownLoad(QDateTime startTime, QDateTime endTime) { |
| | | cout << __FUNCTION__ << " " << startTime.toString("yyyy-MM-dd hh:mm:ss").toStdString() << endl; |
| | | cout << __FUNCTION__ << " " << endTime.toString("yyyy-MM-dd hh:mm:ss").toStdString() << endl; |
| | | |
| | | |
| | | cout << "\n\n\n" << endl; |
| | | } |
| | | |
| | | void testFunc(QDateTime startTime, QDateTime endTime); |
| | | |
| | | void testFunc(QDateTime startTime, QDateTime endTime) { |
| | | |
| | | int loop = 0; |
| | | |
| | | QDateTime tmp_EndTime = startTime.addSecs(1 * 60 * 15); |
| | | if (tmp_EndTime < endTime) { |
| | | DownLoad(startTime, tmp_EndTime); |
| | | testFunc(tmp_EndTime, endTime); |
| | | } else { |
| | | DownLoad(startTime, endTime); |
| | | return; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | int main() { |
| | | |
| | | |
| | | QDateTime startTime = QDateTime::fromString("2018-10-08 13:03:07", "yyyy-MM-dd hh:mm:ss"); |
| | | // QDateTime startTime = QDateTime::currentDateTime();//å³å°ä¸è½½çæä»¶çå¼å§æ¶é´ |
| | | QDateTime endTime;//è®°å½æ´æ°æ¶é´ |
| | | |
| | | int nDuration = 2; |
| | | endTime = startTime.addSecs(nDuration * 60 * 59); |
| | | |
| | | cout << __LINE__ << " " << startTime.toString("yyyy-MM-dd hh:mm:ss").toStdString() << endl; |
| | | cout << __LINE__ << " " << endTime.toString("yyyy-MM-dd hh:mm:ss").toStdString() << endl; |
| | | |
| | | |
| | | //task_time Start |
| | | TimeSt stTimeSt; |
| | | stTimeSt.Year = startTime.date().year(); |
| | | stTimeSt.Month = startTime.date().month(); |
| | | stTimeSt.Day = startTime.date().day(); |
| | | stTimeSt.Hour = startTime.time().hour(); |
| | | stTimeSt.Minute = startTime.time().minute(); |
| | | stTimeSt.Second = startTime.time().second(); |
| | | |
| | | |
| | | char ch_StringStartTime[128]; |
| | | sprintf(ch_StringStartTime, "%04d-%02d-%02d %02d:%02d:%02d", stTimeSt.Year, stTimeSt.Month, stTimeSt.Day, |
| | | stTimeSt.Hour, |
| | | stTimeSt.Minute, stTimeSt.Second); |
| | | string str_StringStartTime(ch_StringStartTime); |
| | | // string str_StringStartTime( |
| | | // to_string(stTimeSt.Year) + "-" + to_string(stTimeSt.Month) + "-" + to_string(stTimeSt.Day) + " " |
| | | // + to_string(stTimeSt.Hour) + ":" + to_string(stTimeSt.Minute) + ":" + |
| | | // to_string(stTimeSt.Second)); |
| | | |
| | | cout << "str_____" << str_StringStartTime << endl; |
| | | QDateTime |
| | | taskStartTime = QDateTime::fromString(QString::fromStdString(str_StringStartTime), "yyyy-MM-dd hh:mm:ss"); |
| | | cout << taskStartTime.toString("yyyy-MM-dd hh:mm:ss").toStdString() << endl; |
| | | //task_time Start ------------------------------------------------- |
| | | |
| | | //task_time end |
| | | TimeSt endTimeSt; |
| | | endTimeSt.Year = endTime.date().year(); |
| | | endTimeSt.Month = endTime.date().month(); |
| | | endTimeSt.Day = endTime.date().day(); |
| | | endTimeSt.Hour = endTime.time().hour(); |
| | | endTimeSt.Minute = endTime.time().minute(); |
| | | endTimeSt.Second = endTime.time().second(); |
| | | |
| | | char ch_StringEndTime[128]; |
| | | sprintf(ch_StringEndTime, "%04d-%02d-%02d %02d:%02d:%02d", endTimeSt.Year, endTimeSt.Month, endTimeSt.Day, |
| | | endTimeSt.Hour, endTimeSt.Minute, endTimeSt.Second); |
| | | string str_StringEndTime(ch_StringEndTime); |
| | | |
| | | // string str_StringEndTime( |
| | | // to_string(endTimeSt.Year) + "-" + to_string(endTimeSt.Month) + "-" + to_string(endTimeSt.Day) + " " |
| | | // + to_string(endTimeSt.Hour) + ":" + to_string(endTimeSt.Minute) + ":" + |
| | | // to_string(endTimeSt.Second)); |
| | | |
| | | cout << "str_____" << str_StringEndTime << endl; |
| | | QDateTime |
| | | taskEndTime = QDateTime::fromString(QString::fromStdString(str_StringEndTime), "yyyy-MM-dd hh:mm:ss"); |
| | | cout << taskEndTime.toString("yyyy-MM-dd hh:mm:ss").toStdString() << endl; |
| | | //task_time end ------------------------------------------------- |
| | | |
| | | |
| | | cout << "\n\n\n" << endl; |
| | | |
| | | testFunc(taskStartTime, taskEndTime); |
| | | |
| | | return 0; |
| | | |
| | | } |
| New file |
| | |
| | | #include <iostream> |
| | | #include <unistd.h> |
| | | #include <sys/time.h> |
| | | #include <vector> |
| | | #include <boost/interprocess/shared_memory_object.hpp> |
| | | #include <boost/interprocess/mapped_region.hpp> |
| | | |
| | | #include <jsoncpp/json/json.h> |
| | | #include <SemTool.h> |
| | | #include <basic/util/app/AppConfig.h> |
| | | #include <basic/debug/Debug.h> |
| | | |
| | | #include "ErlangDbTool.h" |
| | | #include "ShareMemoryTool.hpp" |
| | | |
| | | using namespace std; |
| | | |
| | | //#erl -name b@192.168.1.164 -setcookie abc -mnesia dir '"/home/firefly/erlang"' -detached -noshell |
| | | int main(int argc, char **argv) { |
| | | std::cout << "Hello, World!" << std::endl; |
| | | ENABLEGLOG(GET_STR_CONFIG("logPath").c_str()); |
| | | |
| | | if (argc <= 1) { |
| | | ERR("argc size is err"); |
| | | exit(-1); |
| | | } |
| | | |
| | | string str_json(argv[1]); |
| | | // cout << str_json << endl; |
| | | // string str_json = "{\"path\":\"/opt/erlang/sub1/\",\"nodeName\":\"sub1@192.168.1.186\",\"cookie\":\"abc\",\"tableName\":\"test\"}"; |
| | | |
| | | Json::Value t_json; |
| | | Json::Reader reader; |
| | | |
| | | if (!reader.parse(str_json, t_json)) { |
| | | ERR("json format error :: " << str_json); |
| | | return -1; |
| | | } |
| | | |
| | | int loop = 0; |
| | | |
| | | std::string path = t_json["path"].asString();//"/opt/erlang/za/"; |
| | | std::string nodeName = t_json["nodeName"].asString();//"za@192.168.188.128"; |
| | | std::string cookie = t_json["cookie"].asString();//"abc"; |
| | | std::string tableName = t_json["tableName"].asString(); |
| | | |
| | | // SemTool semTool(t_json["key"].asInt()); |
| | | // |
| | | // semTool.semaphore_p(); |
| | | |
| | | |
| | | /*** |
| | | * jiazai renlian |
| | | */ |
| | | // struct timeval t1, t2; |
| | | // gettimeofday(&t1, NULL); |
| | | |
| | | |
| | | std::string str_node("testNode"); |
| | | str_node.append(to_string((int) getpid())); |
| | | ErlangTool::ErlangDbTool erlangDbTool(nodeName, cookie, str_node); |
| | | while (1) { |
| | | /*** |
| | | * load fea |
| | | */ |
| | | |
| | | auto cache = erlangDbTool.loadFaceFeaData(tableName); |
| | | |
| | | // gettimeofday(&t2, NULL); |
| | | //é£ä¹å½æ°fè¿è¡æè±çæ¶é´ä¸º |
| | | // auto deltaT = (t2.tv_sec - t1.tv_sec) * 1000000 + t2.tv_usec - t1.tv_usec; |
| | | // DBG(" loadData " << deltaT << "us") |
| | | // DBG(tableName << "size is " << cache.size() << " " << loop); |
| | | if (cache.size() <= 0 && loop++ <= 10) { |
| | | usleep(100); |
| | | continue; |
| | | } |
| | | auto size = sizeof(cache[0]) * cache.size(); |
| | | try { |
| | | BISTL::shared_memory_object::remove(tableName.c_str()); |
| | | BISTL::BiMapFeaData biMapFeaData(tableName, size); |
| | | for (auto &item :cache) { |
| | | biMapFeaData.saveKeyOrValue(item.second.id, item.second.feature, item.second.img, item.second.idcard, |
| | | item.second.create_by, item.second.create_time, item.second.update_time); |
| | | } |
| | | auto mymap = biMapFeaData.getMap(); |
| | | // for (auto it = mymap->begin(); it != mymap->end(); it++) { |
| | | // std::cout << "feature " << it->second.m_feature << std::endl; |
| | | // } |
| | | DBG("load ok " << tableName << "mymap size is " << mymap->size()); |
| | | } |
| | | catch (const std::exception &e) { |
| | | printf("Exception:%s\n", e.what()); |
| | | BISTL::shared_memory_object::remove(tableName.c_str()); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| New file |
| | |
| | | // |
| | | // Created by pans on 4/27/18. |
| | | // |
| | | #include <iostream> |
| | | #include <Ice/Ice.h> |
| | | #include <thread> |
| | | |
| | | #include <basic/rpc/IceRpc.hpp> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include "FaceFeatureSearchServerI.h" |
| | | #include <basic/util/app/AppConfig.h> |
| | | #include <basic/debug/Debug.h> |
| | | |
| | | using namespace std; |
| | | |
| | | int main(int argc, char **argv) { |
| | | |
| | | SAVE_APP_ARGS; |
| | | ENABLEGLOG(GET_STR_CONFIG("logPath").c_str()); |
| | | auto ich = Ice::initialize(argc, argv); |
| | | |
| | | DBG("\n\n\nstart\n\n"); |
| | | |
| | | appPref.setLongData("thread.max", 32); |
| | | //#todo |
| | | |
| | | // appPref.setStringData("ipAdd", "192.168.1.185"); |
| | | // appPref.setIntData("ipPort", 9200); |
| | | appPref.setStringData("ipAdd", appConfig.getStringProperty("ES_IP")); |
| | | appPref.setIntData("ipPort", appConfig.getIntProperty("ES_PORT")); |
| | | |
| | | IceRpcServer<FaceFeatureSearchServerI> server("faceCmServer", 10004, "tcp"); |
| | | server.setMessageSizeMax(1024 * 1024 * 50); |
| | | server.setPoolInitSize(10); |
| | | server.setPoolMaxSize(32); |
| | | server.runWaitShutDown(); |
| | | } |
| New file |
| | |
| | | // ********************************************************************** |
| | | // |
| | | // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. |
| | | // |
| | | // This copy of Ice is licensed to you under the terms described in the |
| | | // ICE_LICENSE file included in this distribution. |
| | | // |
| | | // ********************************************************************** |
| | | // |
| | | // Ice version 3.7.0 |
| | | // |
| | | // <auto-generated> |
| | | // |
| | | // Generated from file `FaceSearchServer.ice' |
| | | // |
| | | // Warning: do not edit this file. |
| | | // |
| | | // </auto-generated> |
| | | // |
| | | |
| | | #include <FaceSearchServer.h> |
| | | #include <IceUtil/PushDisableWarnings.h> |
| | | #include <Ice/LocalException.h> |
| | | #include <Ice/ValueFactory.h> |
| | | #include <Ice/OutgoingAsync.h> |
| | | #include <Ice/InputStream.h> |
| | | #include <Ice/OutputStream.h> |
| | | #include <IceUtil/PopDisableWarnings.h> |
| | | |
| | | #if defined(_MSC_VER) |
| | | # pragma warning(disable:4458) // declaration of ... hides class member |
| | | #elif defined(__clang__) |
| | | # pragma clang diagnostic ignored "-Wshadow" |
| | | #elif defined(__GNUC__) |
| | | # pragma GCC diagnostic ignored "-Wshadow" |
| | | #endif |
| | | |
| | | #ifndef ICE_IGNORE_VERSION |
| | | # if ICE_INT_VERSION / 100 != 307 |
| | | # error Ice version mismatch! |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 > 50 |
| | | # error Beta header file detected |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 < 0 |
| | | # error Ice patch level mismatch! |
| | | # endif |
| | | #endif |
| | | |
| | | #ifdef ICE_CPP11_MAPPING // C++11 mapping |
| | | |
| | | namespace |
| | | { |
| | | |
| | | const ::std::string iceC_FaceSearch_FaceFeatureSearchServer_ids[2] = |
| | | { |
| | | "::FaceSearch::FaceFeatureSearchServer", |
| | | "::Ice::Object" |
| | | }; |
| | | const ::std::string iceC_FaceSearch_FaceFeatureSearchServer_ops[] = |
| | | { |
| | | "faceSearchMax", |
| | | "faceSearchTopN", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping" |
| | | }; |
| | | const ::std::string iceC_FaceSearch_FaceFeatureSearchServer_faceSearchMax_name = "faceSearchMax"; |
| | | const ::std::string iceC_FaceSearch_FaceFeatureSearchServer_faceSearchTopN_name = "faceSearchTopN"; |
| | | |
| | | } |
| | | |
| | | bool |
| | | FaceSearch::FaceFeatureSearchServer::ice_isA(::std::string s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_FaceSearch_FaceFeatureSearchServer_ids, iceC_FaceSearch_FaceFeatureSearchServer_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector<::std::string> |
| | | FaceSearch::FaceFeatureSearchServer::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector<::std::string>(&iceC_FaceSearch_FaceFeatureSearchServer_ids[0], &iceC_FaceSearch_FaceFeatureSearchServer_ids[2]); |
| | | } |
| | | |
| | | ::std::string |
| | | FaceSearch::FaceFeatureSearchServer::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceSearch::FaceFeatureSearchServer::ice_staticId() |
| | | { |
| | | static const ::std::string typeId = "::FaceSearch::FaceFeatureSearchServer"; |
| | | return typeId; |
| | | } |
| | | |
| | | bool |
| | | FaceSearch::FaceFeatureSearchServer::_iceD_faceSearchMax(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | ::FaceSearch::Data iceP_feature; |
| | | ::std::string iceP_info; |
| | | istr->readAll(iceP_feature, iceP_info); |
| | | inS.endReadParams(); |
| | | ::FaceSearch::FaceResults ret = this->faceSearchMax(::std::move(iceP_feature), ::std::move(iceP_info), current); |
| | | auto ostr = inS.startWriteParams(); |
| | | ostr->writeAll(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | FaceSearch::FaceFeatureSearchServer::_iceD_faceSearchTopN(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | ::FaceSearch::Data iceP_feature; |
| | | ::std::string iceP_info; |
| | | int iceP_topN; |
| | | float iceP_score; |
| | | istr->readAll(iceP_feature, iceP_info, iceP_topN, iceP_score); |
| | | inS.endReadParams(); |
| | | ::FaceSearch::FaceResults ret = this->faceSearchTopN(::std::move(iceP_feature), ::std::move(iceP_info), iceP_topN, iceP_score, current); |
| | | auto ostr = inS.startWriteParams(); |
| | | ostr->writeAll(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | FaceSearch::FaceFeatureSearchServer::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_FaceSearch_FaceFeatureSearchServer_ops, iceC_FaceSearch_FaceFeatureSearchServer_ops + 6, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_FaceSearch_FaceFeatureSearchServer_ops) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_faceSearchMax(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_faceSearchTopN(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 5: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | FaceSearch::FaceFeatureSearchServerPrx::_iceI_faceSearchMax(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceSearch::FaceResults>>& outAsync, const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::Ice::Context& context) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchMax_name); |
| | | outAsync->invoke(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchMax_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_feature, iceP_info); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | void |
| | | FaceSearch::FaceFeatureSearchServerPrx::_iceI_faceSearchTopN(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceSearch::FaceResults>>& outAsync, const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, int iceP_topN, float iceP_score, const ::Ice::Context& context) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchTopN_name); |
| | | outAsync->invoke(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchTopN_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_feature, iceP_info, iceP_topN, iceP_score); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | ::std::shared_ptr<::Ice::ObjectPrx> |
| | | FaceSearch::FaceFeatureSearchServerPrx::_newInstance() const |
| | | { |
| | | return ::IceInternal::createProxy<FaceFeatureSearchServerPrx>(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceSearch::FaceFeatureSearchServerPrx::ice_staticId() |
| | | { |
| | | return FaceSearch::FaceFeatureSearchServer::ice_staticId(); |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | } |
| | | |
| | | #else // C++98 mapping |
| | | |
| | | namespace |
| | | { |
| | | |
| | | const ::std::string iceC_FaceSearch_FaceFeatureSearchServer_faceSearchMax_name = "faceSearchMax"; |
| | | |
| | | const ::std::string iceC_FaceSearch_FaceFeatureSearchServer_faceSearchTopN_name = "faceSearchTopN"; |
| | | |
| | | } |
| | | ::IceProxy::Ice::Object* ::IceProxy::FaceSearch::upCast(::IceProxy::FaceSearch::FaceFeatureSearchServer* p) { return p; } |
| | | |
| | | void |
| | | ::IceProxy::FaceSearch::_readProxy(::Ice::InputStream* istr, ::IceInternal::ProxyHandle< ::IceProxy::FaceSearch::FaceFeatureSearchServer>& v) |
| | | { |
| | | ::Ice::ObjectPrx proxy; |
| | | istr->read(proxy); |
| | | if(!proxy) |
| | | { |
| | | v = 0; |
| | | } |
| | | else |
| | | { |
| | | v = new ::IceProxy::FaceSearch::FaceFeatureSearchServer; |
| | | v->_copyFrom(proxy); |
| | | } |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::FaceSearch::FaceFeatureSearchServer::_iceI_begin_faceSearchMax(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchMax_name, sync); |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_FaceSearch_FaceFeatureSearchServer_faceSearchMax_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchMax_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_feature); |
| | | ostr->write(iceP_info); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchMax_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | ::FaceSearch::FaceResults |
| | | IceProxy::FaceSearch::FaceFeatureSearchServer::end_faceSearchMax(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | ::Ice::AsyncResult::_check(result, this, iceC_FaceSearch_FaceFeatureSearchServer_faceSearchMax_name); |
| | | ::FaceSearch::FaceResults ret; |
| | | if(!result->_waitForResponse()) |
| | | { |
| | | try |
| | | { |
| | | result->_throwUserException(); |
| | | } |
| | | catch(const ::Ice::UserException& ex) |
| | | { |
| | | throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); |
| | | } |
| | | } |
| | | ::Ice::InputStream* istr = result->_startReadParams(); |
| | | istr->read(ret); |
| | | result->_endReadParams(); |
| | | return ret; |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::FaceSearch::FaceFeatureSearchServer::_iceI_begin_faceSearchTopN(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, ::Ice::Int iceP_topN, ::Ice::Float iceP_score, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | _checkTwowayOnly(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchTopN_name, sync); |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_FaceSearch_FaceFeatureSearchServer_faceSearchTopN_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchTopN_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_feature); |
| | | ostr->write(iceP_info); |
| | | ostr->write(iceP_topN); |
| | | ostr->write(iceP_score); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_FaceSearch_FaceFeatureSearchServer_faceSearchTopN_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | ::FaceSearch::FaceResults |
| | | IceProxy::FaceSearch::FaceFeatureSearchServer::end_faceSearchTopN(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | ::Ice::AsyncResult::_check(result, this, iceC_FaceSearch_FaceFeatureSearchServer_faceSearchTopN_name); |
| | | ::FaceSearch::FaceResults ret; |
| | | if(!result->_waitForResponse()) |
| | | { |
| | | try |
| | | { |
| | | result->_throwUserException(); |
| | | } |
| | | catch(const ::Ice::UserException& ex) |
| | | { |
| | | throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); |
| | | } |
| | | } |
| | | ::Ice::InputStream* istr = result->_startReadParams(); |
| | | istr->read(ret); |
| | | result->_endReadParams(); |
| | | return ret; |
| | | } |
| | | |
| | | ::IceProxy::Ice::Object* |
| | | IceProxy::FaceSearch::FaceFeatureSearchServer::_newInstance() const |
| | | { |
| | | return new FaceFeatureSearchServer; |
| | | } |
| | | |
| | | const ::std::string& |
| | | IceProxy::FaceSearch::FaceFeatureSearchServer::ice_staticId() |
| | | { |
| | | return ::FaceSearch::FaceFeatureSearchServer::ice_staticId(); |
| | | } |
| | | |
| | | FaceSearch::FaceFeatureSearchServer::~FaceFeatureSearchServer() |
| | | { |
| | | } |
| | | |
| | | ::Ice::Object* FaceSearch::upCast(::FaceSearch::FaceFeatureSearchServer* p) { return p; } |
| | | |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_FaceSearch_FaceFeatureSearchServer_ids[2] = |
| | | { |
| | | "::FaceSearch::FaceFeatureSearchServer", |
| | | "::Ice::Object" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | FaceSearch::FaceFeatureSearchServer::ice_isA(const ::std::string& s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_FaceSearch_FaceFeatureSearchServer_ids, iceC_FaceSearch_FaceFeatureSearchServer_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector< ::std::string> |
| | | FaceSearch::FaceFeatureSearchServer::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector< ::std::string>(&iceC_FaceSearch_FaceFeatureSearchServer_ids[0], &iceC_FaceSearch_FaceFeatureSearchServer_ids[2]); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceSearch::FaceFeatureSearchServer::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | FaceSearch::FaceFeatureSearchServer::ice_staticId() |
| | | { |
| | | #ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC |
| | | static const ::std::string typeId = "::FaceSearch::FaceFeatureSearchServer"; |
| | | return typeId; |
| | | #else |
| | | return iceC_FaceSearch_FaceFeatureSearchServer_ids[0]; |
| | | #endif |
| | | } |
| | | |
| | | bool |
| | | FaceSearch::FaceFeatureSearchServer::_iceD_faceSearchMax(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::FaceSearch::Data iceP_feature; |
| | | ::std::string iceP_info; |
| | | istr->read(iceP_feature); |
| | | istr->read(iceP_info); |
| | | inS.endReadParams(); |
| | | ::FaceSearch::FaceResults ret = this->faceSearchMax(iceP_feature, iceP_info, current); |
| | | ::Ice::OutputStream* ostr = inS.startWriteParams(); |
| | | ostr->write(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | FaceSearch::FaceFeatureSearchServer::_iceD_faceSearchTopN(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::FaceSearch::Data iceP_feature; |
| | | ::std::string iceP_info; |
| | | ::Ice::Int iceP_topN; |
| | | ::Ice::Float iceP_score; |
| | | istr->read(iceP_feature); |
| | | istr->read(iceP_info); |
| | | istr->read(iceP_topN); |
| | | istr->read(iceP_score); |
| | | inS.endReadParams(); |
| | | ::FaceSearch::FaceResults ret = this->faceSearchTopN(iceP_feature, iceP_info, iceP_topN, iceP_score, current); |
| | | ::Ice::OutputStream* ostr = inS.startWriteParams(); |
| | | ostr->write(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_FaceSearch_FaceFeatureSearchServer_all[] = |
| | | { |
| | | "faceSearchMax", |
| | | "faceSearchTopN", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | FaceSearch::FaceFeatureSearchServer::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_FaceSearch_FaceFeatureSearchServer_all, iceC_FaceSearch_FaceFeatureSearchServer_all + 6, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_FaceSearch_FaceFeatureSearchServer_all) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_faceSearchMax(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_faceSearchTopN(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 5: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | FaceSearch::FaceFeatureSearchServer::_iceWriteImpl(::Ice::OutputStream* ostr) const |
| | | { |
| | | ostr->startSlice(ice_staticId(), -1, true); |
| | | Ice::StreamWriter< ::FaceSearch::FaceFeatureSearchServer, ::Ice::OutputStream>::write(ostr, *this); |
| | | ostr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | FaceSearch::FaceFeatureSearchServer::_iceReadImpl(::Ice::InputStream* istr) |
| | | { |
| | | istr->startSlice(); |
| | | Ice::StreamReader< ::FaceSearch::FaceFeatureSearchServer, ::Ice::InputStream>::read(istr, *this); |
| | | istr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | FaceSearch::_icePatchObjectPtr(FaceFeatureSearchServerPtr& handle, const ::Ice::ObjectPtr& v) |
| | | { |
| | | handle = ::FaceSearch::FaceFeatureSearchServerPtr::dynamicCast(v); |
| | | if(v && !handle) |
| | | { |
| | | IceInternal::Ex::throwUOE(::FaceSearch::FaceFeatureSearchServer::ice_staticId(), v); |
| | | } |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | } |
| | | |
| | | #endif |
| New file |
| | |
| | | // ********************************************************************** |
| | | // |
| | | // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. |
| | | // |
| | | // This copy of Ice is licensed to you under the terms described in the |
| | | // ICE_LICENSE file included in this distribution. |
| | | // |
| | | // ********************************************************************** |
| | | // |
| | | // Ice version 3.7.0 |
| | | // |
| | | // <auto-generated> |
| | | // |
| | | // Generated from file `FaceSearchServer.ice' |
| | | // |
| | | // Warning: do not edit this file. |
| | | // |
| | | // </auto-generated> |
| | | // |
| | | |
| | | #ifndef __FaceSearchServer_h__ |
| | | #define __FaceSearchServer_h__ |
| | | |
| | | #include <IceUtil/PushDisableWarnings.h> |
| | | #include <Ice/ProxyF.h> |
| | | #include <Ice/ObjectF.h> |
| | | #include <Ice/ValueF.h> |
| | | #include <Ice/Exception.h> |
| | | #include <Ice/LocalObject.h> |
| | | #include <Ice/StreamHelpers.h> |
| | | #include <Ice/Comparable.h> |
| | | #include <Ice/Proxy.h> |
| | | #include <Ice/Object.h> |
| | | #include <Ice/GCObject.h> |
| | | #include <Ice/Value.h> |
| | | #include <Ice/Incoming.h> |
| | | #include <Ice/FactoryTableInit.h> |
| | | #include <IceUtil/ScopedArray.h> |
| | | #include <Ice/Optional.h> |
| | | #include <IceUtil/UndefSysMacros.h> |
| | | |
| | | #ifndef ICE_IGNORE_VERSION |
| | | # if ICE_INT_VERSION / 100 != 307 |
| | | # error Ice version mismatch! |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 > 50 |
| | | # error Beta header file detected |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 < 0 |
| | | # error Ice patch level mismatch! |
| | | # endif |
| | | #endif |
| | | |
| | | #ifdef ICE_CPP11_MAPPING // C++11 mapping |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | class FaceFeatureSearchServer; |
| | | class FaceFeatureSearchServerPrx; |
| | | |
| | | } |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | using Data = ::std::vector<::Ice::Byte>; |
| | | |
| | | struct FaceResult |
| | | { |
| | | long long int id; |
| | | ::std::string uuid; |
| | | ::std::string tableName; |
| | | float confidence; |
| | | ::std::string imgUrl; |
| | | ::std::string idcard; |
| | | ::std::string alarmRet; |
| | | |
| | | std::tuple<const long long int&, const ::std::string&, const ::std::string&, const float&, const ::std::string&, const ::std::string&, const ::std::string&> ice_tuple() const |
| | | { |
| | | return std::tie(id, uuid, tableName, confidence, imgUrl, idcard, alarmRet); |
| | | } |
| | | }; |
| | | |
| | | using FaceResults = ::std::vector<::FaceSearch::FaceResult>; |
| | | |
| | | using Ice::operator<; |
| | | using Ice::operator<=; |
| | | using Ice::operator>; |
| | | using Ice::operator>=; |
| | | using Ice::operator==; |
| | | using Ice::operator!=; |
| | | |
| | | } |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | class FaceFeatureSearchServer : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | using ProxyType = FaceFeatureSearchServerPrx; |
| | | |
| | | virtual bool ice_isA(::std::string, const ::Ice::Current&) const override; |
| | | virtual ::std::vector<::std::string> ice_ids(const ::Ice::Current&) const override; |
| | | virtual ::std::string ice_id(const ::Ice::Current&) const override; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::FaceSearch::FaceResults faceSearchMax(::FaceSearch::Data, ::std::string, const ::Ice::Current&) = 0; |
| | | bool _iceD_faceSearchMax(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual ::FaceSearch::FaceResults faceSearchTopN(::FaceSearch::Data, ::std::string, int, float, const ::Ice::Current&) = 0; |
| | | bool _iceD_faceSearchTopN(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&) override; |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | class FaceFeatureSearchServerPrx : public virtual ::Ice::Proxy<FaceFeatureSearchServerPrx, ::Ice::ObjectPrx> |
| | | { |
| | | public: |
| | | |
| | | ::FaceSearch::FaceResults faceSearchMax(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makePromiseOutgoing<::FaceSearch::FaceResults>(true, this, &FaceSearch::FaceFeatureSearchServerPrx::_iceI_faceSearchMax, iceP_feature, iceP_info, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto faceSearchMaxAsync(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<::FaceSearch::FaceResults>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<::FaceSearch::FaceResults, P>(false, this, &FaceSearch::FaceFeatureSearchServerPrx::_iceI_faceSearchMax, iceP_feature, iceP_info, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | faceSearchMaxAsync(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, |
| | | ::std::function<void(::FaceSearch::FaceResults)> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<::FaceSearch::FaceResults>(response, ex, sent, this, &FaceSearch::FaceFeatureSearchServerPrx::_iceI_faceSearchMax, iceP_feature, iceP_info, context); |
| | | } |
| | | |
| | | void _iceI_faceSearchMax(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceSearch::FaceResults>>&, const ::FaceSearch::Data&, const ::std::string&, const ::Ice::Context&); |
| | | |
| | | ::FaceSearch::FaceResults faceSearchTopN(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, int iceP_topN, float iceP_score, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makePromiseOutgoing<::FaceSearch::FaceResults>(true, this, &FaceSearch::FaceFeatureSearchServerPrx::_iceI_faceSearchTopN, iceP_feature, iceP_info, iceP_topN, iceP_score, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto faceSearchTopNAsync(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, int iceP_topN, float iceP_score, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<::FaceSearch::FaceResults>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<::FaceSearch::FaceResults, P>(false, this, &FaceSearch::FaceFeatureSearchServerPrx::_iceI_faceSearchTopN, iceP_feature, iceP_info, iceP_topN, iceP_score, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | faceSearchTopNAsync(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, int iceP_topN, float iceP_score, |
| | | ::std::function<void(::FaceSearch::FaceResults)> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<::FaceSearch::FaceResults>(response, ex, sent, this, &FaceSearch::FaceFeatureSearchServerPrx::_iceI_faceSearchTopN, iceP_feature, iceP_info, iceP_topN, iceP_score, context); |
| | | } |
| | | |
| | | void _iceI_faceSearchTopN(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::FaceSearch::FaceResults>>&, const ::FaceSearch::Data&, const ::std::string&, int, float, const ::Ice::Context&); |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | FaceFeatureSearchServerPrx() = default; |
| | | friend ::std::shared_ptr<FaceFeatureSearchServerPrx> IceInternal::createProxy<FaceFeatureSearchServerPrx>(); |
| | | |
| | | virtual ::std::shared_ptr<::Ice::ObjectPrx> _newInstance() const override; |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | |
| | | template<> |
| | | struct StreamableTraits<::FaceSearch::FaceResult> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 17; |
| | | static const bool fixedLength = false; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader<::FaceSearch::FaceResult, S> |
| | | { |
| | | static void read(S* istr, ::FaceSearch::FaceResult& v) |
| | | { |
| | | istr->readAll(v.id, v.uuid, v.tableName, v.confidence, v.imgUrl, v.idcard, v.alarmRet); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | using FaceFeatureSearchServerPtr = ::std::shared_ptr<FaceFeatureSearchServer>; |
| | | using FaceFeatureSearchServerPrxPtr = ::std::shared_ptr<FaceFeatureSearchServerPrx>; |
| | | |
| | | } |
| | | |
| | | #else // C++98 mapping |
| | | |
| | | namespace IceProxy |
| | | { |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | class FaceFeatureSearchServer; |
| | | void _readProxy(::Ice::InputStream*, ::IceInternal::ProxyHandle< ::IceProxy::FaceSearch::FaceFeatureSearchServer>&); |
| | | ::IceProxy::Ice::Object* upCast(::IceProxy::FaceSearch::FaceFeatureSearchServer*); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | class FaceFeatureSearchServer; |
| | | ::Ice::Object* upCast(::FaceSearch::FaceFeatureSearchServer*); |
| | | typedef ::IceInternal::Handle< ::FaceSearch::FaceFeatureSearchServer> FaceFeatureSearchServerPtr; |
| | | typedef ::IceInternal::ProxyHandle< ::IceProxy::FaceSearch::FaceFeatureSearchServer> FaceFeatureSearchServerPrx; |
| | | typedef FaceFeatureSearchServerPrx FaceFeatureSearchServerPrxPtr; |
| | | void _icePatchObjectPtr(FaceFeatureSearchServerPtr&, const ::Ice::ObjectPtr&); |
| | | |
| | | } |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | typedef ::std::vector< ::Ice::Byte> Data; |
| | | |
| | | struct FaceResult |
| | | { |
| | | ::Ice::Long id; |
| | | ::std::string uuid; |
| | | ::std::string tableName; |
| | | ::Ice::Float confidence; |
| | | ::std::string imgUrl; |
| | | ::std::string idcard; |
| | | ::std::string alarmRet; |
| | | }; |
| | | |
| | | typedef ::std::vector< ::FaceSearch::FaceResult> FaceResults; |
| | | |
| | | } |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | class Callback_FaceFeatureSearchServer_faceSearchMax_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_FaceFeatureSearchServer_faceSearchMax_Base> Callback_FaceFeatureSearchServer_faceSearchMaxPtr; |
| | | |
| | | class Callback_FaceFeatureSearchServer_faceSearchTopN_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_FaceFeatureSearchServer_faceSearchTopN_Base> Callback_FaceFeatureSearchServer_faceSearchTopNPtr; |
| | | |
| | | } |
| | | |
| | | namespace IceProxy |
| | | { |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | class FaceFeatureSearchServer : public virtual ::Ice::Proxy<FaceFeatureSearchServer, ::IceProxy::Ice::Object> |
| | | { |
| | | public: |
| | | |
| | | ::FaceSearch::FaceResults faceSearchMax(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return end_faceSearchMax(_iceI_begin_faceSearchMax(iceP_feature, iceP_info, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchMax(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_faceSearchMax(iceP_feature, iceP_info, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchMax(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceSearchMax(iceP_feature, iceP_info, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchMax(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceSearchMax(iceP_feature, iceP_info, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchMax(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::FaceSearch::Callback_FaceFeatureSearchServer_faceSearchMaxPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceSearchMax(iceP_feature, iceP_info, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchMax(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, const ::Ice::Context& context, const ::FaceSearch::Callback_FaceFeatureSearchServer_faceSearchMaxPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceSearchMax(iceP_feature, iceP_info, context, del, cookie); |
| | | } |
| | | |
| | | ::FaceSearch::FaceResults end_faceSearchMax(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_faceSearchMax(const ::FaceSearch::Data&, const ::std::string&, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | ::FaceSearch::FaceResults faceSearchTopN(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, ::Ice::Int iceP_topN, ::Ice::Float iceP_score, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return end_faceSearchTopN(_iceI_begin_faceSearchTopN(iceP_feature, iceP_info, iceP_topN, iceP_score, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchTopN(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, ::Ice::Int iceP_topN, ::Ice::Float iceP_score, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_faceSearchTopN(iceP_feature, iceP_info, iceP_topN, iceP_score, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchTopN(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, ::Ice::Int iceP_topN, ::Ice::Float iceP_score, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceSearchTopN(iceP_feature, iceP_info, iceP_topN, iceP_score, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchTopN(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, ::Ice::Int iceP_topN, ::Ice::Float iceP_score, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceSearchTopN(iceP_feature, iceP_info, iceP_topN, iceP_score, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchTopN(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, ::Ice::Int iceP_topN, ::Ice::Float iceP_score, const ::FaceSearch::Callback_FaceFeatureSearchServer_faceSearchTopNPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceSearchTopN(iceP_feature, iceP_info, iceP_topN, iceP_score, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_faceSearchTopN(const ::FaceSearch::Data& iceP_feature, const ::std::string& iceP_info, ::Ice::Int iceP_topN, ::Ice::Float iceP_score, const ::Ice::Context& context, const ::FaceSearch::Callback_FaceFeatureSearchServer_faceSearchTopNPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_faceSearchTopN(iceP_feature, iceP_info, iceP_topN, iceP_score, context, del, cookie); |
| | | } |
| | | |
| | | ::FaceSearch::FaceResults end_faceSearchTopN(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_faceSearchTopN(const ::FaceSearch::Data&, const ::std::string&, ::Ice::Int, ::Ice::Float, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | virtual ::IceProxy::Ice::Object* _newInstance() const; |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | class FaceFeatureSearchServer : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | typedef FaceFeatureSearchServerPrx ProxyType; |
| | | typedef FaceFeatureSearchServerPtr PointerType; |
| | | |
| | | virtual ~FaceFeatureSearchServer(); |
| | | |
| | | virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::FaceSearch::FaceResults faceSearchMax(const ::FaceSearch::Data&, const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_faceSearchMax(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual ::FaceSearch::FaceResults faceSearchTopN(const ::FaceSearch::Data&, const ::std::string&, ::Ice::Int, ::Ice::Float, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_faceSearchTopN(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | protected: |
| | | |
| | | virtual void _iceWriteImpl(::Ice::OutputStream*) const; |
| | | virtual void _iceReadImpl(::Ice::InputStream*); |
| | | }; |
| | | |
| | | inline bool operator==(const FaceFeatureSearchServer& lhs, const FaceFeatureSearchServer& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) == static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | inline bool operator<(const FaceFeatureSearchServer& lhs, const FaceFeatureSearchServer& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) < static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | |
| | | template<> |
| | | struct StreamableTraits< ::FaceSearch::FaceResult> |
| | | { |
| | | static const StreamHelperCategory helper = StreamHelperCategoryStruct; |
| | | static const int minWireSize = 17; |
| | | static const bool fixedLength = false; |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamWriter< ::FaceSearch::FaceResult, S> |
| | | { |
| | | static void write(S* ostr, const ::FaceSearch::FaceResult& v) |
| | | { |
| | | ostr->write(v.id); |
| | | ostr->write(v.uuid); |
| | | ostr->write(v.tableName); |
| | | ostr->write(v.confidence); |
| | | ostr->write(v.imgUrl); |
| | | ostr->write(v.idcard); |
| | | ostr->write(v.alarmRet); |
| | | } |
| | | }; |
| | | |
| | | template<typename S> |
| | | struct StreamReader< ::FaceSearch::FaceResult, S> |
| | | { |
| | | static void read(S* istr, ::FaceSearch::FaceResult& v) |
| | | { |
| | | istr->read(v.id); |
| | | istr->read(v.uuid); |
| | | istr->read(v.tableName); |
| | | istr->read(v.confidence); |
| | | istr->read(v.imgUrl); |
| | | istr->read(v.idcard); |
| | | istr->read(v.alarmRet); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace FaceSearch |
| | | { |
| | | |
| | | template<class T> |
| | | class CallbackNC_FaceFeatureSearchServer_faceSearchMax : public Callback_FaceFeatureSearchServer_faceSearchMax_Base, public ::IceInternal::TwowayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(const ::FaceSearch::FaceResults&); |
| | | |
| | | CallbackNC_FaceFeatureSearchServer_faceSearchMax(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallbackNC<T>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceSearch::FaceFeatureSearchServerPrx proxy = ::FaceSearch::FaceFeatureSearchServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceSearch::FaceResults ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceSearchMax(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::CallbackNC<T>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T> Callback_FaceFeatureSearchServer_faceSearchMaxPtr |
| | | newCallback_FaceFeatureSearchServer_faceSearchMax(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceSearch::FaceResults&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceFeatureSearchServer_faceSearchMax<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_FaceFeatureSearchServer_faceSearchMaxPtr |
| | | newCallback_FaceFeatureSearchServer_faceSearchMax(T* instance, void (T::*cb)(const ::FaceSearch::FaceResults&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceFeatureSearchServer_faceSearchMax<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_FaceFeatureSearchServer_faceSearchMax : public Callback_FaceFeatureSearchServer_faceSearchMax_Base, public ::IceInternal::TwowayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const ::FaceSearch::FaceResults&, const CT&); |
| | | |
| | | Callback_FaceFeatureSearchServer_faceSearchMax(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallback<T, CT>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceSearch::FaceFeatureSearchServerPrx proxy = ::FaceSearch::FaceFeatureSearchServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceSearch::FaceResults ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceSearchMax(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::Callback<T, CT>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret, CT::dynamicCast(result->getCookie())); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_FaceFeatureSearchServer_faceSearchMaxPtr |
| | | newCallback_FaceFeatureSearchServer_faceSearchMax(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceSearch::FaceResults&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceFeatureSearchServer_faceSearchMax<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_FaceFeatureSearchServer_faceSearchMaxPtr |
| | | newCallback_FaceFeatureSearchServer_faceSearchMax(T* instance, void (T::*cb)(const ::FaceSearch::FaceResults&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceFeatureSearchServer_faceSearchMax<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> |
| | | class CallbackNC_FaceFeatureSearchServer_faceSearchTopN : public Callback_FaceFeatureSearchServer_faceSearchTopN_Base, public ::IceInternal::TwowayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(const ::FaceSearch::FaceResults&); |
| | | |
| | | CallbackNC_FaceFeatureSearchServer_faceSearchTopN(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallbackNC<T>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceSearch::FaceFeatureSearchServerPrx proxy = ::FaceSearch::FaceFeatureSearchServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceSearch::FaceResults ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceSearchTopN(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::CallbackNC<T>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T> Callback_FaceFeatureSearchServer_faceSearchTopNPtr |
| | | newCallback_FaceFeatureSearchServer_faceSearchTopN(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceSearch::FaceResults&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceFeatureSearchServer_faceSearchTopN<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_FaceFeatureSearchServer_faceSearchTopNPtr |
| | | newCallback_FaceFeatureSearchServer_faceSearchTopN(T* instance, void (T::*cb)(const ::FaceSearch::FaceResults&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_FaceFeatureSearchServer_faceSearchTopN<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_FaceFeatureSearchServer_faceSearchTopN : public Callback_FaceFeatureSearchServer_faceSearchTopN_Base, public ::IceInternal::TwowayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const ::FaceSearch::FaceResults&, const CT&); |
| | | |
| | | Callback_FaceFeatureSearchServer_faceSearchTopN(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallback<T, CT>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::FaceSearch::FaceFeatureSearchServerPrx proxy = ::FaceSearch::FaceFeatureSearchServerPrx::uncheckedCast(result->getProxy()); |
| | | ::FaceSearch::FaceResults ret; |
| | | try |
| | | { |
| | | ret = proxy->end_faceSearchTopN(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::Callback<T, CT>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret, CT::dynamicCast(result->getCookie())); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_FaceFeatureSearchServer_faceSearchTopNPtr |
| | | newCallback_FaceFeatureSearchServer_faceSearchTopN(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::FaceSearch::FaceResults&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceFeatureSearchServer_faceSearchTopN<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_FaceFeatureSearchServer_faceSearchTopNPtr |
| | | newCallback_FaceFeatureSearchServer_faceSearchTopN(T* instance, void (T::*cb)(const ::FaceSearch::FaceResults&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_FaceFeatureSearchServer_faceSearchTopN<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endif |
| | | |
| | | #include <IceUtil/PopDisableWarnings.h> |
| | | #endif |
| New file |
| | |
| | | module FaceSearch |
| | | { |
| | | sequence<byte> Data; |
| | | |
| | | struct FaceResult |
| | | { |
| | | long id; |
| | | string uuid; |
| | | string tableName; |
| | | float confidence; |
| | | string imgUrl; |
| | | string idcard; |
| | | string alarmRet; |
| | | } |
| | | |
| | | sequence<FaceResult> FaceResults; |
| | | |
| | | interface FaceFeatureSearchServer |
| | | { |
| | | FaceResults faceSearchMax(Data feature,string info); |
| | | FaceResults faceSearchTopN(Data feature,string info, int topN,float score); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | #!/usr/bin/env bash |
| | | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/bsk/development/c++/Qt/BasicPlatForm/libs/Ice-3.7.0/lib64/ |
| | | ./../../../BasicPlatForm/libs/Ice-3.7.0/bin/slice2cpp FaceSearchServer.ice |
| New file |
| | |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(LocalDBTool) |
| | | |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build) |
| | | |
| | | set(CMAKE_CXX_STANDARD 11) |
| | | add_compile_options(-fPIC) |
| | | add_definitions(-DDEBUG_ERR -DDEBUG_INFO -fpermissive) |
| | | add_definitions(-DGLOG) |
| | | |
| | | set(CMAKE_BUILD_TYPE debug) |
| | | |
| | | include_directories( |
| | | ./ |
| | | |
| | | ../../BasicPlatForm |
| | | |
| | | ../../BasicPlatForm/basic/util/app |
| | | |
| | | ../../BasicPlatForm/basic/db/sqlite/ |
| | | ../../BasicPlatForm/basic/db/sqlite/sqlite-v-3220000 |
| | | |
| | | ../../BasicPlatForm/libs/libuuid/include |
| | | ../../BasicPlatForm/libs/glog/include |
| | | ../../BasicPlatForm/libs/jsoncpp/include |
| | | |
| | | /usr/include/x86_64-linux-gnu/qt5 |
| | | /usr/include/x86_64-linux-gnu/qt5/QtCore/ |
| | | /usr/include/x86_64-linux-gnu/qt5/QtSql/ |
| | | |
| | | ) |
| | | |
| | | link_directories( |
| | | ../../BasicPlatForm/basic/db/sqlite/sqlite-v-3220000 |
| | | ../../BasicPlatForm/libs/libuuid/lib |
| | | ../../BasicPlatForm/libs/glog/lib |
| | | ../../BasicPlatForm/libs/jsoncpp/lib |
| | | |
| | | ) |
| | | |
| | | add_executable(${PROJECT_NAME} |
| | | main.cpp |
| | | # SqliteFaceEncap.cpp |
| | | # |
| | | # ../../BasicPlatForm/basic/db/sqlite/sqliteEncapsulation.cpp |
| | | # ../../BasicPlatForm/basic/db/sqlite/sqliteEncapsulation.h |
| | | # GetUUId.cpp GetUUId.h |
| | | ) |
| | | |
| | | target_link_libraries(${PROJECT_NAME} |
| | | glog |
| | | pthread |
| | | Qt5Core |
| | | Qt5Sql |
| | | uuid |
| | | jsoncpp |
| | | sqlite3 |
| | | dl |
| | | ) |
| New file |
| | |
| | | // |
| | | // Created by ps on 18-11-9. |
| | | // |
| | | |
| | | #include "GetUUId.h" |
| | | |
| New file |
| | |
| | | // |
| | | // Created by ps on 18-11-9. |
| | | // |
| | | |
| | | #ifndef DB_CON_GETUUID_H |
| | | #define DB_CON_GETUUID_H |
| | | |
| | | |
| | | #include <string> |
| | | #include <uuid/uuid.h> |
| | | |
| | | class GetUUId { |
| | | public: |
| | | static std::string getUUID() { |
| | | std::string str_uuid; |
| | | uuid_t t_uuid; |
| | | char str[36]; |
| | | uuid_generate(t_uuid); |
| | | uuid_unparse(t_uuid, str); |
| | | str_uuid = str; |
| | | return str_uuid; |
| | | } |
| | | |
| | | }; |
| | | |
| | | |
| | | #endif //DB_CON_GETUUID_H |
| New file |
| | |
| | | // |
| | | // Created by pans on 4/28/18. |
| | | // |
| | | #include <iostream> |
| | | |
| | | #include <QtSql/QSql> |
| | | #include <QtSql/QSqlDatabase> |
| | | #include <QtSql/QSqlError> |
| | | #include <QtSql/QSqlQuery> |
| | | #include <QtCore/QString> |
| | | #include <QtCore/QDebug> |
| | | #include <QtCore/QVariantList> |
| | | #include <basic/debug/Debug.h> |
| | | |
| | | #include "SqliteFaceEncap.h" |
| | | |
| | | using namespace std; |
| | | |
| | | |
| | | static QSqlDatabase g_db = QSqlDatabase::addDatabase("QSQLITE", "GBond"); |
| | | |
| | | SqliteFaceEncap::SqliteFaceEncap(std::string t_string) : sqliteEncapsulation(t_string.c_str()) { |
| | | /* Open database */ |
| | | int rc; |
| | | string sql; |
| | | bool initRet = false; |
| | | bool *test = &initRet; |
| | | //--------------init db------------------- |
| | | rc = sqlite3_open(t_string.c_str(), &db); |
| | | string initRetSql = "select count(*) from sqlite_master where type='table' and name = '" + g_tableName + "';"; |
| | | rc = sqlite3_exec(db, initRetSql.c_str(), isExist, (void *) test, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg); |
| | | ERR(initRetSql); |
| | | sqlite3_free(zErrMsg); |
| | | } else { |
| | | if (!initRet) { |
| | | /* Create SQL statement */ |
| | | sql = getInitDBSql(); |
| | | /* Execute SQL statement */ |
| | | rc = sqlite3_exec(db, sql.c_str(), NULL, 0, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg); |
| | | ERR(sql); |
| | | sqlite3_free(zErrMsg); |
| | | } else { |
| | | fprintf(stdout, "sys_o_tables created successfully\n"); |
| | | } |
| | | fprintf(stdout, "Operation done successfully\n"); |
| | | } |
| | | } |
| | | //--------------init db------------------- |
| | | g_db.setDatabaseName(t_string.c_str()); |
| | | g_db.open(); |
| | | |
| | | } |
| | | |
| | | //#todo |
| | | bool SqliteFaceEncap::createTable(std::string t_tableName, FieldValues &fieldValues) { |
| | | int rc; |
| | | //--------------create table------------------- |
| | | /* Create SQL statement */ |
| | | string sql = getCreateFaceTableSql(t_tableName); |
| | | |
| | | /* Execute SQL statement */ |
| | | // cout << sql << endl; |
| | | rc = sqlite3_exec(db, sql.c_str(), NULL, 0, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg); |
| | | ERR(sql); |
| | | sqlite3_free(zErrMsg); |
| | | return false; |
| | | } else { |
| | | fprintf(stdout, "Table created successfully\n"); |
| | | // INSERT INTO sys_o_tables(name,people_name,type,color,table_name,table_type,is_self,is_long_control) |
| | | // VALUES ('å¨éåº','å¨é人å','人','red','taseee',2,0,0); |
| | | // FieldValues fieldValues; |
| | | // fieldValues.insert(std::make_pair("name","å¨éåº")); |
| | | // fieldValues.insert(std::make_pair("people_name","å¨é人å")); |
| | | // fieldValues.insert(std::make_pair("type","人")); |
| | | // fieldValues.insert(std::make_pair("color","red")); |
| | | // fieldValues.insert(std::make_pair("table_name",t_tableName)); |
| | | // fieldValues.insert(std::make_pair("table_type","2")); |
| | | // fieldValues.insert(std::make_pair("is_self","0")); |
| | | // fieldValues.insert(std::make_pair("is_long_control","0")); |
| | | string insertSql = getInsertSql("sys_o_tables", fieldValues); |
| | | /* Execute SQL statement */ |
| | | rc = sqlite3_exec(db, insertSql.c_str(), NULL, 0, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg); |
| | | ERR(insertSql); |
| | | sqlite3_free(zErrMsg); |
| | | //#todo throw exp |
| | | // throw exception("insert fail"); |
| | | } else { |
| | | fprintf(stdout, " insert data successfully\n"); |
| | | } |
| | | } |
| | | //--------------create table------------------- |
| | | return true; |
| | | } |
| | | |
| | | |
| | | bool SqliteFaceEncap::updateTable(std::string t_tableName, FieldValues &fieldValues) { |
| | | int rc; |
| | | //--------------create table------------------- |
| | | /* Create SQL statement */ |
| | | //#todo |
| | | string sql = getUpdateFaceTableSql(t_tableName, fieldValues); |
| | | |
| | | //#todo create facefea |
| | | |
| | | /* Execute SQL statement */ |
| | | // cout << sql << endl; |
| | | rc = sqlite3_exec(db, sql.c_str(), NULL, 0, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg); |
| | | ERR(sql); |
| | | sqlite3_free(zErrMsg); |
| | | return false; |
| | | } else { |
| | | fprintf(stdout, "updateTable successfully\n"); |
| | | } |
| | | //--------------create table------------------- |
| | | return true; |
| | | } |
| | | |
| | | //#todo backup data? |
| | | bool SqliteFaceEncap::deleteTable(std::string t_tableName) { |
| | | string delTableSql = getDeleteFaceTableSql(t_tableName); |
| | | int rc = sqlite3_exec(db, delTableSql.c_str(), NULL, 0, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg); |
| | | ERR(delTableSql); |
| | | sqlite3_free(zErrMsg); |
| | | return false; |
| | | } else { |
| | | fprintf(stdout, "Table deleted successfully\n"); |
| | | FieldValues fieldValues; |
| | | fieldValues.insert(std::make_pair("tableName", t_tableName)); |
| | | string deleteSql = getDeleteSql("sys_o_tables", fieldValues); |
| | | // cout << deleteSql << endl; |
| | | /* Execute SQL statement */ |
| | | rc = sqlite3_exec(db, deleteSql.c_str(), NULL, 0, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg); |
| | | ERR(deleteSql); |
| | | sqlite3_free(zErrMsg); |
| | | //#todo throw exp |
| | | // throw exception("insert fail"); |
| | | } else { |
| | | fprintf(stdout, " delete data successfully\n"); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | bool SqliteFaceEncap::updateFace(std::string t_tableName, AddFaceData &faceData, FieldValues &fieldValues) { |
| | | |
| | | // updateFaceData |
| | | bool ret = updateFaceData(t_tableName + "_fea", faceData); |
| | | updateFaceInfo(t_tableName, fieldValues); |
| | | return ret; |
| | | } |
| | | |
| | | bool SqliteFaceEncap::updateFaceData(std::string t_tableName, AddFaceData &faceData) { |
| | | |
| | | QByteArray qFea((char *) faceData.feature.data(), faceData.feature.size()); |
| | | QSqlQuery query(g_db); |
| | | QString strSql = "update "; |
| | | strSql.append(t_tableName.c_str()); |
| | | if (faceData.feature.size() > 0 || faceData.faceUrl.size() > 0) { |
| | | strSql.append(" set "); |
| | | |
| | | if (faceData.feature.size() > 0) { |
| | | strSql.append(" feature = :feature ,"); |
| | | } |
| | | if (faceData.faceUrl.size() > 0) { |
| | | strSql.append(" faceUrl = :faceUrl ,"); |
| | | } |
| | | |
| | | //#todo |
| | | strSql.append(" update_time = '2010-01-03 01:01:00' "); |
| | | |
| | | strSql.append(" where del_flag = 0 and uuid = '" + QString::fromStdString(faceData.uuid) + "';"); |
| | | query.prepare(strSql); |
| | | // query.addBindValue(QString::fromStdString(faceData.uuid)); |
| | | if (faceData.feature.size() > 0) { |
| | | query.addBindValue(qFea); |
| | | } |
| | | if (faceData.faceUrl.size() > 0) { |
| | | query.addBindValue(QString::fromStdString(faceData.faceUrl)); |
| | | } |
| | | |
| | | if (!query.exec()) { |
| | | ERR("updateFaceData fail"); |
| | | qDebug() << "updateFaceData" << __FILE__ << __LINE__ << |
| | | query.lastQuery() << " " << query.lastError(); |
| | | } else { |
| | | DBG("æ´æ°è®°å½æå " << faceData.uuid); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | //#wait todo |
| | | bool SqliteFaceEncap::updateFaceInfo(std::string t_tableName, FieldValues &fieldValues) { |
| | | std::string sql = getUpdateFaceTableSql(t_tableName, fieldValues); |
| | | int rc = sqlite3_exec(db, sql.c_str(), NULL, 0, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg) |
| | | sqlite3_free(zErrMsg); |
| | | return false; |
| | | } else { |
| | | fprintf(stdout, "addFaceInfo successfully\n"); |
| | | } |
| | | return true; |
| | | }//#todo |
| | | |
| | | std::string SqliteFaceEncap::addFace(std::string t_tableName, AddFaceData &faceData, FieldValues &fieldValues) { |
| | | std::string uuid = addFaceData(t_tableName + "_fea", faceData); |
| | | if (uuid.size() > 0) { |
| | | fieldValues["uuid"] = uuid; |
| | | addFaceInfo(t_tableName, fieldValues); |
| | | } |
| | | return uuid; |
| | | } |
| | | |
| | | //INSERT INTO aaaFace (id, feature, del_flag ) VALUES (12,'sdfasdfasdfasdf',0); |
| | | std::string SqliteFaceEncap::addFaceData(std::string t_tableName, AddFaceData &faceData) { |
| | | |
| | | QByteArray qFea((char *) faceData.feature.data(), faceData.feature.size()); |
| | | QSqlQuery query(g_db); |
| | | QString strSql = "INSERT INTO "; |
| | | strSql.append(t_tableName.c_str()); |
| | | |
| | | strSql.append("(uuid,feature,faceUrl) VALUES (:uuid,:feature,:faceUrl);"); |
| | | query.prepare(strSql); |
| | | query.addBindValue(QString::fromStdString(faceData.uuid)); |
| | | query.addBindValue(qFea); |
| | | // cout << faceData.faceUrl << endl; |
| | | query.addBindValue(QString::fromStdString(faceData.faceUrl)); |
| | | |
| | | if (!query.exec()) { |
| | | ERR("addFaceData fail"); |
| | | qDebug() << "addFaceData" << __FILE__ << __LINE__ << query.lastError(); |
| | | return ""; |
| | | } else { |
| | | DBG("æå
¥è®°å½æå " << faceData.uuid); |
| | | } |
| | | return faceData.uuid; |
| | | } |
| | | |
| | | bool SqliteFaceEncap::addFaceInfo(std::string t_tableName, FieldValues &fieldValues) { |
| | | std::string sql = getInsertSql(t_tableName, fieldValues); |
| | | int rc = sqlite3_exec(db, sql.c_str(), NULL, 0, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg) |
| | | sqlite3_free(zErrMsg); |
| | | return false; |
| | | } else { |
| | | fprintf(stdout, "addFaceInfo successfully\n"); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | bool SqliteFaceEncap::deleteFace(std::string t_tableName, std::string uuid) { |
| | | deleteFaceData(t_tableName, uuid); |
| | | std::string t_tmp(t_tableName); |
| | | t_tmp.append("_fea"); |
| | | bool ret = deleteFaceData(t_tmp.c_str(), uuid); |
| | | |
| | | return ret; |
| | | } |
| | | |
| | | //DELETE FROM aaaFace where 1=1 and id = 122 |
| | | //#todo update del_flag ? |
| | | bool SqliteFaceEncap::deleteFaceData(std::string t_tableName, std::string uuid) { |
| | | // FieldValues fieldValues; |
| | | // fieldValues.insert(std::make_pair("uuid", uuid)); |
| | | // string deleteSql = getDeleteSql(t_tableName, fieldValues); |
| | | string deleteSql = "update "; |
| | | deleteSql.append(t_tableName + " set del_flag = 1 ,update_time = '" + AppUtil::getTimeSecString() + "' "); |
| | | deleteSql.append(" where uuid = '" + uuid + "' "); |
| | | // cout << deleteSql << endl; |
| | | /* Execute SQL statement */ |
| | | int rc = sqlite3_exec(db, deleteSql.c_str(), NULL, 0, &zErrMsg); |
| | | if (rc != SQLITE_OK) { |
| | | SQLERR(zErrMsg) |
| | | sqlite3_free(zErrMsg); |
| | | //#todo throw exp |
| | | // throw exception("insert fail"); |
| | | return false; |
| | | } else { |
| | | fprintf(stdout, " delete data successfully\n"); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | std::vector<string> SqliteFaceEncap::getTableNameList(std::string type) { |
| | | std::vector<string> tables; |
| | | QString sql = QString::fromStdString(getTableListSqlWithType(type)); |
| | | QSqlQuery query(g_db); |
| | | // qDebug() << strSql; |
| | | query.prepare(sql); |
| | | if (!query.exec()) { |
| | | qDebug() << "getTableNameList" << __FILE__ << __LINE__ << query.lastError(); |
| | | } else { |
| | | while (query.next()) { |
| | | string tableName = query.value(0).toString().toStdString(); |
| | | tables.push_back(tableName); |
| | | } |
| | | } |
| | | return tables; |
| | | } |
| | | |
| | | FeatureDBWithUrlCache *SqliteFaceEncap::getFacesFromTable(std::string tableName) { |
| | | ClockTimer clk("loading " + tableName); |
| | | FeatureDBWithUrlCache &t_db = m_dbCache[tableName]; |
| | | QString sql = QString::fromStdString(getFacesFromTableSql(tableName)); |
| | | QSqlQuery query(g_db); |
| | | query.prepare(sql); |
| | | if (!query.exec()) { |
| | | qDebug() << "getFacesFromTable" << __FILE__ << __LINE__ << query.lastError(); |
| | | } else { |
| | | while (query.next()) { |
| | | int del_flag = query.value(4).toInt(); |
| | | std::string uuid = query.value(0).toString().toStdString(); |
| | | if (del_flag) { |
| | | t_db.erase(uuid); |
| | | } else { |
| | | FaceFeatureWithUrl &t_feas = t_db[uuid]; |
| | | t_feas.uuid = uuid; |
| | | QByteArray t_fea = query.value(1).toByteArray(); |
| | | // std::cout << t_fea.size() << std::endl; |
| | | t_feas.faceFeature.resize(t_fea.size()); |
| | | memcpy(t_feas.faceFeature.data(), t_fea.data(), t_fea.size()); |
| | | // string create_time = query.value(2).toString().toStdString(); |
| | | t_feas.faceurl = query.value(3).toString().toStdString(); |
| | | } |
| | | } |
| | | } |
| | | return &t_db; |
| | | } |
| | | |
| | | |
| | | FeatureDBWithUrlCache SqliteFaceEncap::getFacesFromTableWhereDate(std::string tableName, std::string date) { |
| | | //#todo not used del_flag |
| | | |
| | | return FeatureDBWithUrlCache(); |
| | | } |
| | | |
| | | TableInfos SqliteFaceEncap::getTableInfos() { |
| | | TableInfos tableInfos; |
| | | QString sql = QString::fromStdString(getTableInfosSql()); |
| | | qDebug() << sql; |
| | | QSqlQuery query(g_db); |
| | | query.prepare(sql); |
| | | if (!query.exec()) { |
| | | qDebug() << "getTableInfos" << __FILE__ << __LINE__ << query.lastError() << " " << query.lastQuery(); |
| | | } else { |
| | | while (query.next()) { |
| | | TableInfo tableInfo; |
| | | tableInfo.uuid = query.value(0).toString().toStdString(); |
| | | tableInfo.tableName = query.value(1).toString().toStdString(); |
| | | tableInfo.tableType = query.value(2).toString().toStdString(); |
| | | tableInfo.bwType = query.value(3).toString().toStdString(); |
| | | tableInfo.startTime = query.value(4).toString().toStdString(); |
| | | tableInfo.endTime = query.value(5).toString().toStdString(); |
| | | tableInfos.push_back(tableInfo); |
| | | } |
| | | } |
| | | return tableInfos; |
| | | } |
| | | |
| | | FaceInfosCache SqliteFaceEncap::getFaceInfoFromTable(std::string tableName) { |
| | | FaceInfosCache faceInfosCache; |
| | | QString sql = QString::fromStdString(getTableInfosSql(tableName)); |
| | | std::lock_guard<std::mutex> dataGuard(dataMtx); |
| | | QSqlQuery query(g_db); |
| | | query.prepare(sql); |
| | | if (!query.exec()) { |
| | | qDebug() << "getTableNameList" << __FILE__ << __LINE__ << query.lastError(); |
| | | } else { |
| | | while (query.next()) { |
| | | int del_falg = query.value(9).toInt(); |
| | | if (del_falg == 1) { |
| | | continue; |
| | | } |
| | | FaceInfo tableInfo; |
| | | tableInfo.uuid = query.value(0).toString().toStdString(); |
| | | tableInfo.personName = query.value(1).toString().toStdString(); |
| | | tableInfo.age = query.value(2).toString().toStdString(); |
| | | tableInfo.sex = query.value(3).toString().toStdString(); |
| | | tableInfo.idCard = query.value(4).toString().toStdString(); |
| | | tableInfo.phoneNum = query.value(5).toString().toStdString(); |
| | | faceInfosCache.insert(std::make_pair(tableInfo.uuid, tableInfo)); |
| | | } |
| | | } |
| | | return faceInfosCache; |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | // |
| | | // Created by pans on 4/28/18. |
| | | // |
| | | |
| | | #ifndef TESTSQLITE_SQLITEFACEENCAP_H |
| | | #define TESTSQLITE_SQLITEFACEENCAP_H |
| | | |
| | | #include "sqliteEncapsulation.h" |
| | | |
| | | #include "SqliteToolkit.hpp" |
| | | |
| | | /** |
| | | * #todo sqlite -> Qt.sqlite |
| | | */ |
| | | |
| | | class SqliteFaceEncap : public sqliteEncapsulation { |
| | | public: |
| | | explicit SqliteFaceEncap(std::string t_string); |
| | | |
| | | bool createTable(std::string t_tableName, FieldValues &fieldValues); |
| | | |
| | | bool updateTable(std::string t_tableName, FieldValues &fieldValues); |
| | | |
| | | bool deleteTable(std::string t_tableName); |
| | | |
| | | /*** |
| | | * æ ¹æ®åºåºç±»åè·ååºåºå表 |
| | | * @param type åºåºç±»å |
| | | * @return åºåºå表 |
| | | */ |
| | | std::vector<std::string> getTableNameList(std::string type); |
| | | |
| | | TableInfos getTableInfos(); |
| | | |
| | | public: |
| | | |
| | | std::string addFace(std::string t_tableName, AddFaceData &faceData, FieldValues &fieldValues); |
| | | |
| | | bool updateFace(std::string t_tableName, AddFaceData &faceData, FieldValues &fieldValues); |
| | | |
| | | std::string addFaceData(std::string t_tableName, AddFaceData &faceData); |
| | | |
| | | //#todo |
| | | bool addFaceInfo(std::string t_tableName, FieldValues &fieldValues); |
| | | |
| | | bool updateFaceData(std::string t_tableName, AddFaceData &faceData); |
| | | |
| | | bool updateFaceInfo(std::string t_tableName, FieldValues &fieldValues); |
| | | |
| | | bool deleteFace(std::string t_tableName, std::string uuid); |
| | | |
| | | private: |
| | | bool deleteFaceData(std::string t_tableName, std::string uuid); |
| | | |
| | | public: |
| | | /*** |
| | | * æ ¹æ®äººè¸è¡¨åç§°è·å人è¸ç¹å¾å表 |
| | | * @param tableName è¡¨é¢ |
| | | * @return 人è¸ç¹å¾éå |
| | | */ |
| | | FeatureDBWithUrlCache *getFacesFromTable(std::string tableName); |
| | | |
| | | FaceInfosCache getFaceInfoFromTable(std::string tableName); |
| | | |
| | | FeatureDBWithUrlCache getFacesFromTableWhereDate(std::string tableName, std::string date); |
| | | |
| | | |
| | | private: |
| | | |
| | | void initDB(const char *t_string) const; |
| | | |
| | | private: |
| | | sqlite3 *db; |
| | | char *zErrMsg = 0; |
| | | std::mutex dataMtx; |
| | | |
| | | |
| | | |
| | | // FeatureDBCache m_db; |
| | | |
| | | std::map<std::string, FeatureDBWithUrlCache> m_dbCache; |
| | | }; |
| | | |
| | | |
| | | #endif //TESTSQLITE_SQLITEFACEENCAP_H |
| New file |
| | |
| | | // |
| | | // Created by pans on 4/28/18. |
| | | // |
| | | |
| | | #ifndef TESTSQLITE_SQLITETOOLKIT_HPP |
| | | #define TESTSQLITE_SQLITETOOLKIT_HPP |
| | | |
| | | #include <iostream> |
| | | #include <map> |
| | | #include <vector> |
| | | #include <string> |
| | | #include <cstring> |
| | | #include <sstream> |
| | | #include <basic/util/app/AppUtil.h> |
| | | |
| | | /** |
| | | * åæ®µçéå |
| | | * @key FieldName |
| | | * @value Value |
| | | */ |
| | | typedef std::map<std::string, std::string> FieldValues; |
| | | /*** |
| | | * 人è¸ç¹å¾ |
| | | */ |
| | | typedef std::vector<unsigned char> FaceFeature; |
| | | |
| | | struct AddFaceData { |
| | | std::string uuid; |
| | | FaceFeature feature; |
| | | std::string faceUrl; |
| | | }; |
| | | |
| | | struct FaceInfo { |
| | | std::string uuid; |
| | | std::string personName; |
| | | std::string age; |
| | | std::string sex; |
| | | std::string idCard; |
| | | std::string phoneNum; |
| | | }; |
| | | typedef std::vector<FaceInfo> FaceInfos; |
| | | typedef std::map<std::string, FaceInfo> FaceInfosCache; |
| | | |
| | | struct TableInfo { |
| | | std::string uuid; |
| | | std::string tableName; |
| | | std::string tableType; |
| | | std::string bwType; |
| | | std::string startTime; |
| | | std::string endTime; |
| | | std::string createBy; |
| | | }; |
| | | typedef std::vector<TableInfo> TableInfos; |
| | | typedef std::map<std::string, TableInfo> TableInfosCache; |
| | | |
| | | //typedef std::vector<FaceFeature> FaceFeatures; |
| | | |
| | | //typedef std::map<std::string, FaceFeatures> FeatureDBCache; |
| | | |
| | | struct FaceFeatureWithUrl { |
| | | std::string uuid; |
| | | std::string faceurl; |
| | | FaceFeature faceFeature; |
| | | }; |
| | | |
| | | typedef std::map<std::string, FaceFeatureWithUrl> FeatureDBWithUrlCache; |
| | | |
| | | namespace { |
| | | |
| | | #define INITCOPY(_DEST, _SRC) _DEST.resize(_SRC.size());memcpy(_DEST.data(),_SRC.data(), _SRC.size()); |
| | | #define COPY(NAME1, NAME2) memcpy(&NAME1.data(), &NAME2.data(), NAME2.size); |
| | | #define SQLERR(message) fprintf(stderr, "%s->%d-> SQLite error: %s\n",__FILE__,__LINE__, message); |
| | | |
| | | |
| | | //#todo æ°æ®åºwenjianåç§° |
| | | static std::string file_dbName = "TestFaceDB.db"; |
| | | //#todo æ°æ®åºåç§° |
| | | static std::string g_dbName = "main"; |
| | | //#todo 管ç表ç表å |
| | | static std::string g_tableName = "sys_o_tables"; |
| | | |
| | | // |
| | | std::string getFacesFromTableSql(std::string tableName) { |
| | | std::string sql = |
| | | "select uuid,feature,create_time,faceUrl,del_flag from " + tableName + |
| | | "_fea where feature is not null "; |
| | | return sql; |
| | | } |
| | | |
| | | std::string getTableListSqlWithType(std::string type) { |
| | | std::string sql = "select tableName,del_flag from " + g_tableName + " where del_flag = 0"; |
| | | if (type.size() > 0) { |
| | | sql.append(" and tableType = '" + type + "'"); |
| | | } |
| | | return sql; |
| | | } |
| | | |
| | | std::string getTableInfosSql(std::string tableName) { |
| | | std::string sql = "select * from " + tableName;// + " where del_flag = 0"; |
| | | return sql; |
| | | } |
| | | |
| | | |
| | | std::string getTableInfosSql() { |
| | | //uuid,tableName,tableDesc,tableType,bwType,startTime,endTime |
| | | std::string sql = "select uuid,tableName,tableType,bwType,startTime,endTime from " + g_tableName + |
| | | " where del_flag = 0"; |
| | | return sql; |
| | | } |
| | | |
| | | /** |
| | | * not used have bug |
| | | * @param tableName |
| | | * @param id |
| | | * @param feature |
| | | * @return |
| | | */ |
| | | char *getAddFaceDataSql(std::string tableName, int id, FaceFeature &feature) { |
| | | if (tableName.size() == 0 || feature.size() == 0) { |
| | | //#todo errInfo |
| | | return "tableName or FaceFeature is NULL"; |
| | | } |
| | | std::string str_fea; |
| | | str_fea.assign(feature.begin(), feature.end()); |
| | | |
| | | std::stringstream sql;//= ; |
| | | sql << "INSERT INTO " << tableName << " ("; |
| | | //std::string sqlTemp = sql; |
| | | std::string sql2 = ") VALUES(\""; |
| | | if (id >= 0) { |
| | | sql << "id,"; |
| | | sql2.append(std::to_string(id) + "\",\""); |
| | | } |
| | | sql << "feature " << sql2 << str_fea << "\")"; |
| | | |
| | | //sql1 delete , |
| | | //sql2 delete 2 ,' add ) |
| | | return const_cast<char *>(str_fea.c_str()); |
| | | } |
| | | |
| | | /** |
| | | * å 餿°æ® |
| | | * @param tableName 表å |
| | | * @param fieldValues å é¤çæ¡ä»¶ç»å |
| | | * @return |
| | | */ |
| | | std::string getDeleteSql(std::string tableName, FieldValues &fieldValues) { |
| | | if (tableName.size() == 0 || fieldValues.size() == 0) { |
| | | //#todo errInfo |
| | | return "tableName or fieldValues is NULL"; |
| | | } |
| | | std::string sql = "DELETE from " + tableName + " where 1 = 1 "; |
| | | for (auto item : fieldValues) { |
| | | if (item.first.size() != 0) { |
| | | sql.append("and " + item.first + " = '" + item.second + "' "); |
| | | } |
| | | } |
| | | return sql; |
| | | } |
| | | |
| | | /** |
| | | * æ·»å æ°æ® || å建人è¸è¡¨ä¹åï¼å°è¯¥è®°å½æå
¥ç®¡ç表 |
| | | * @param tableName 表å |
| | | * @param fieldValues å°è¦æå
¥å段çéå |
| | | * @return |
| | | */ |
| | | std::string getInsertSql(std::string tableName, FieldValues &fieldValues) { |
| | | if (tableName.size() == 0 || fieldValues.size() == 0) { |
| | | //#todo errInfo |
| | | return "tableName or fieldValues is NULL"; |
| | | } |
| | | std::string sql = "INSERT INTO " + tableName + " ("; |
| | | std::string sqlTemp = sql; |
| | | std::string sql2 = ") VALUES('"; |
| | | for (auto item : fieldValues) { |
| | | if (item.first.size() != 0) { |
| | | sql.append(item.first + ","); |
| | | sql2.append(item.second + "','"); |
| | | } |
| | | } |
| | | //sql1 delete , |
| | | sql = sql.substr(0, sql.length() - 1); |
| | | //sql2 delete 2 ,' add ) |
| | | sql2 = sql2.substr(0, sql2.length() - 2); |
| | | sql2.append(" )"); |
| | | sql.append(sql2); |
| | | return sql; |
| | | } |
| | | |
| | | /** |
| | | * å建管ç表çsqlè¯å¥ |
| | | * |
| | | * @return sql |
| | | */ |
| | | std::string getInitDBSql() { |
| | | std::string sql = "CREATE TABLE \"main\".\"sys_o_tables\" ("; |
| | | sql.append(" uuid varchar(255) PRIMARY KEY, "); |
| | | // sql.append(" ClusterName varchar(255) DEFAULT NULL,");//æ¬å°åºä¸éè¦ |
| | | sql.append(" tableName varchar(255) UNIQUE,"); |
| | | sql.append(" tableDesc varchar(255) DEFAULT NULL,"); |
| | | sql.append(" tableType varchar(255) DEFAULT NULL,"); |
| | | sql.append(" bwType varchar(255) DEFAULT NULL,"); |
| | | sql.append(" startTime varchar(255) DEFAULT NULL,"); |
| | | sql.append(" endTime varchar(255) DEFAULT NULL,"); |
| | | sql.append(" create_time BLOB default (datetime('now', 'localtime')),"); |
| | | sql.append(" update_time varchar(255) DEFAULT NULL,"); |
| | | sql.append(" create_by varchar(255) DEFAULT NULL,"); |
| | | sql.append(" del_flag varchar(255) DEFAULT 0"); |
| | | sql.append(");"); |
| | | return sql; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å建人è¸è¡¨çsqlè¯å¥ |
| | | * @param tableName æ³è¦å建ç表å |
| | | * @return |
| | | */ |
| | | std::string getCreateFaceTableSql(std::string tableName) { |
| | | if (tableName.size() == 0) { |
| | | //#todo errInfo |
| | | return "tableName is NULL"; |
| | | } |
| | | // 人åä¿¡æ¯è¡¨ |
| | | std::string sql = "CREATE TABLE " + g_dbName + "."; |
| | | sql.append(tableName); |
| | | sql.append(" ( uuid varchar(255) PRIMARY KEY,"); |
| | | sql.append("personName varchar(255) DEFAULT NULL,"); |
| | | sql.append("age varchar(255) DEFAULT NULL,"); |
| | | sql.append("sex varchar(255) DEFAULT NULL,"); |
| | | sql.append("idCard varchar(255) DEFAULT NULL,"); |
| | | sql.append("phoneNum varchar(255) DEFAULT NULL,"); |
| | | sql.append("create_time BLOB DEFAULT (datetime('now', 'localtime')),"); |
| | | sql.append("update_time DATETIME DEFAULT NULL,"); |
| | | sql.append("create_by varchar(255) DEFAULT NULL,"); |
| | | sql.append("del_flag INTEGER DEFAULT 0"); |
| | | sql.append(");"); |
| | | // 人è¸ç¹å¾è¡¨ |
| | | sql.append("CREATE TABLE " + g_dbName + "."); |
| | | sql.append(tableName + "_fea"); |
| | | sql.append(" ( uuid varchar(255) PRIMARY KEY,"); |
| | | sql.append(" feature BLOB NOT NULL,"); |
| | | sql.append(" faceUrl BLOB NOT NULL,"); |
| | | sql.append(" create_time BLOB default (datetime('now', 'localtime')),"); |
| | | sql.append(" update_time varchar(255) DEFAULT NULL,"); |
| | | sql.append(" create_by varchar(255) DEFAULT NULL,"); |
| | | sql.append(" del_flag INTEGER DEFAULT 0"); |
| | | sql.append(");"); |
| | | return sql; |
| | | } |
| | | |
| | | |
| | | std::string getUpdateFaceTableSql(std::string tableName, FieldValues &fieldValues) { |
| | | if (tableName.size() == 0) { |
| | | //#todo errInfo |
| | | return "tableName is NULL"; |
| | | } |
| | | std::string uuid = fieldValues["uuid"]; |
| | | if (uuid.size() <= 0) { |
| | | SQLERR("uuid size is error"); |
| | | return ""; |
| | | } |
| | | fieldValues.erase("uuid"); |
| | | if (fieldValues.size() <= 0) { |
| | | SQLERR("fieldValues size is error"); |
| | | return ""; |
| | | } |
| | | std::string sql = "update "; |
| | | sql.append(tableName + " set "); |
| | | for (auto &item :fieldValues) { |
| | | sql.append(item.first + " = '" + item.second + "',"); |
| | | } |
| | | sql.append(" update_time ='" + AppUtil::getTimeSecString() + "'"); |
| | | sql.append(" where uuid ='" + uuid + "'"); |
| | | return sql; |
| | | } |
| | | |
| | | |
| | | //#TODO 人è¸è¡¨éè¦å é¤ä¸¤ä¸ª |
| | | std::string getDeleteFaceTableSql(std::string tableName) { |
| | | if (tableName.size() == 0) { |
| | | //#todo errInfo |
| | | return "tableName is NULL"; |
| | | } |
| | | std::string sql = "DROP TABLE " + g_dbName + "." + tableName + ";"; |
| | | sql.append("DROP TABLE " + g_dbName + "." + tableName + "_fea;"); |
| | | return sql; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®è¡¨åå¤ææ°æ®è¡¨æ¯å¦åå¨ |
| | | * @param existRet true is exist. |
| | | * @param nCount åæ®µæ°é |
| | | * @param pValue åæ®µå¼æ°ç» |
| | | * @param azColName åæ®µåç§°æ°ç» |
| | | * @return |
| | | */ |
| | | static int isExist(void *existRet, int nCount, char **pValue, char **azColName) { |
| | | bool *testRet = (bool *) existRet; |
| | | int num = atoi(pValue[0]); |
| | | if (num > 0) { |
| | | *testRet = true; |
| | | } else { |
| | | *testRet = false; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | #endif //TESTSQLITE_SQLITETOOLKIT_HPP |
| New file |
| | |
| | | // |
| | | // Created by pans on 5/2/18. |
| | | // |
| | | #include <iostream> |
| | | #include <thread> |
| | | |
| | | //#include <basic/util/app/AppPreference.hpp> |
| | | #include <zconf.h> |
| | | #include <basic/debug/Debug.h> |
| | | //#include <QtCore/QString> |
| | | //#include "SqliteFaceEncap.h" |
| | | //#include "SqliteToolkit.hpp" |
| | | #include "GetUUId.h" |
| | | |
| | | using namespace std; |
| | | |
| | | /*** |
| | | * åå§åå建表 : |
| | | * 1.åºåºç®¡ç表 |
| | | * uuid, tableName, tableDesc, tableType, bwType, create_time, update_time, create_by, del_flag, startTime, endTime |
| | | * sql ok |
| | | * |
| | | * 2.䏿åuuid对åºè¡¨ |
| | | * uuid, name, tableName(uuid) |
| | | * sql ok code not ok |
| | | * |
| | | * |
| | | * åºåºç¹å¾è¡¨ idæ¯uuid |
| | | * uuid, feature, img_url, create_time, update_time, create_by |
| | | * sql ok |
| | | * |
| | | * 人åä¿¡æ¯è¡¨ |
| | | * uuid, personName, age, sex, idCard, phoneNum, create_time, update_time, create_by |
| | | * sql ok |
| | | * |
| | | * car #todo |
| | | * |
| | | * |
| | | * |
| | | */ |
| | | |
| | | /*** |
| | | |
| | | drop table "main"."sys_o_tables"; |
| | | CREATE TABLE "main"."sys_o_tables" ( |
| | | uuid varchar(255) PRIMARY KEY, |
| | | ClusterName varchar(255) DEFAULT NULL, |
| | | tableName varchar(255) DEFAULT NULL, |
| | | tableDesc varchar(255) DEFAULT NULL, |
| | | tableType varchar(255) DEFAULT NULL, |
| | | bwType varchar(255) DEFAULT NULL, |
| | | startTime varchar(255) DEFAULT NULL, |
| | | endTime varchar(255) DEFAULT NULL, |
| | | create_time BLOB DEFAULT (datetime('now', 'localtime')), |
| | | update_time varchar(255) DEFAULT NULL, |
| | | create_by varchar(255) DEFAULT NULL, |
| | | del_flag varchar(255) DEFAULT 0 |
| | | ); |
| | | |
| | | drop table "main"."TN2TID"; |
| | | CREATE TABLE "main"."TN2TID" ( |
| | | uuid varchar(255) PRIMARY KEY, |
| | | TableName varchar(255) NOT NULL, |
| | | tableID varchar(255) NOT NULL, |
| | | create_time BLOB DEFAULT (datetime('now', 'localtime')), |
| | | update_time varchar(255) DEFAULT NULL, |
| | | del_flag INTEGER DEFAULT 0 |
| | | ); |
| | | |
| | | drop table "main"."person_info"; |
| | | CREATE TABLE "main"."person_info" ( |
| | | uuid varchar(255) PRIMARY KEY, |
| | | personName varchar(255) DEFAULT NULL, |
| | | age varchar(255) DEFAULT NULL, |
| | | sex varchar(255) DEFAULT NULL, |
| | | idCard varchar(255) DEFAULT NULL, |
| | | phoneNum varchar(255) DEFAULT NULL, |
| | | create_time BLOB DEFAULT (datetime('now', 'localtime')), |
| | | update_time DATETIME DEFAULT NULL, |
| | | create_by varchar(255) DEFAULT NULL, |
| | | del_flag INTEGER DEFAULT 0 |
| | | ); |
| | | |
| | | drop table "main"."person_info_feature"; |
| | | CREATE TABLE "main"."person_info_feature" ( |
| | | uuid varchar(255) PRIMARY KEY, |
| | | feature BLOB NOT NULL, |
| | | faceUrl BLOB NOT NULL, |
| | | create_time BLOB DEFAULT (datetime('now', 'localtime')), |
| | | update_time varchar(255) DEFAULT NULL, |
| | | create_by varchar(255) DEFAULT NULL, |
| | | del_flag INTEGER DEFAULT 0 |
| | | ); |
| | | |
| | | */ |
| | | |
| | | |
| | | //struct FaceFeaWithScore { |
| | | // int left; |
| | | // int top; |
| | | // int width; |
| | | // int height; |
| | | // std::vector<unsigned char> feature; |
| | | // float score; |
| | | //}; |
| | | //typedef std::vector<FaceFeaWithScore> Features; |
| | | |
| | | |
| | | /*** |
| | | * |
| | | * @param argc |
| | | * @param argv |
| | | * @return |
| | | */ |
| | | /* |
| | | int main2(int argc, char **argv) { |
| | | |
| | | SAVE_APP_ARGS; |
| | | |
| | | // cout << getInitDBSql(); |
| | | |
| | | SqliteFaceEncap sqliteFaceEncap("testRR"); |
| | | |
| | | { |
| | | //#å é¤åºåº |
| | | // sqliteFaceEncap.deleteTable("test1"); |
| | | } |
| | | |
| | | { |
| | | FieldValues fieldValues; |
| | | fieldValues.insert(std::make_pair("uuid", GetUUId::getUUID())); |
| | | fieldValues.insert(std::make_pair("tableName", "test2")); |
| | | fieldValues.insert(std::make_pair("tableDesc", "ceshi")); |
| | | fieldValues.insert(std::make_pair("tableType", "person")); |
| | | fieldValues.insert(std::make_pair("bwType", "1")); |
| | | fieldValues.insert(std::make_pair("startTime", "2018-01-01 02:02:02")); |
| | | fieldValues.insert(std::make_pair("endTime", "2018-12-01 02:02:02")); |
| | | fieldValues.insert(std::make_pair("create_by", "who")); |
| | | |
| | | //#å建åºåº |
| | | // sqliteFaceEncap.createTable("test2", fieldValues); |
| | | } |
| | | |
| | | { |
| | | //#æ¥è¯¢äººè¸åºåºå表 |
| | | auto res = sqliteFaceEncap.getTableNameList("person"); |
| | | for (auto &item : res) { |
| | | std::cout << "tableName is " << item << std::endl; |
| | | } |
| | | } |
| | | |
| | | { |
| | | //#æ´æ°åºåºç®¡ç表 |
| | | FieldValues fieldValues; |
| | | fieldValues.insert(std::make_pair("uuid", "c4e27077-59a3-458e-aedf-4b5d4def649b")); |
| | | fieldValues.insert(std::make_pair("tableName", "test4")); |
| | | fieldValues.insert(std::make_pair("tableDesc", "ceshi2")); |
| | | fieldValues.insert(std::make_pair("tableType", "car")); |
| | | fieldValues.insert(std::make_pair("bwType", "0")); |
| | | fieldValues.insert(std::make_pair("startTime", "2018-01-01 02:02:02")); |
| | | fieldValues.insert(std::make_pair("endTime", "2018-12-01 02:02:02")); |
| | | fieldValues.insert(std::make_pair("create_by", "who")); |
| | | // sqliteFaceEncap.updateTable("sys_o_tables", fieldValues); |
| | | } |
| | | |
| | | { |
| | | Features faceResults; |
| | | for (int i = 0; i < 10; i++) { |
| | | FaceFeaWithScore faceFeaWithScore; |
| | | faceFeaWithScore.feature.resize(100); |
| | | memset(faceFeaWithScore.feature.data(), 1, faceFeaWithScore.feature.size()); |
| | | |
| | | faceResults.push_back(faceFeaWithScore); |
| | | } |
| | | //#æ·»å äººè¸æ°æ® TODO test |
| | | //#ä¸¤å¼ è¡¨ |
| | | int lpp = 0; |
| | | FieldValues fieldValues; |
| | | for (auto item : faceResults) { |
| | | AddFaceData addFaceData; |
| | | addFaceData.feature.resize(item.feature.size()); |
| | | memcpy(addFaceData.feature.data(), item.feature.data(), item.feature.size()); |
| | | addFaceData.uuid = GetUUId::getUUID(); |
| | | addFaceData.faceUrl = "null"; |
| | | auto t_id = sqliteFaceEncap.addFace("test1", addFaceData, fieldValues); |
| | | } |
| | | } |
| | | |
| | | { |
| | | //#æ´æ°äººè¸æ°æ® |
| | | //#todo ä¸¤å¼ è¡¨ |
| | | FieldValues fieldValues; |
| | | FaceFeaWithScore faceFeaWithScore; |
| | | faceFeaWithScore.feature.resize(100); |
| | | memset(faceFeaWithScore.feature.data(), 1, faceFeaWithScore.feature.size()); |
| | | |
| | | |
| | | AddFaceData addFaceData; |
| | | addFaceData.feature.resize(faceFeaWithScore.feature.size()); |
| | | memcpy(addFaceData.feature.data(), faceFeaWithScore.feature.data(), faceFeaWithScore.feature.size()); |
| | | // addFaceData.uuid = "ac8b30cf-8476-4dcf-a476-96907bb9a01f"; |
| | | addFaceData.faceUrl = "ttttttttt"; |
| | | // auto ret = sqliteFaceEncap.updateFace("test1", addFaceData, fieldValues); |
| | | // if (ret) { |
| | | // DBG("true"); |
| | | // } else { |
| | | // DBG("false"); |
| | | // } |
| | | } |
| | | |
| | | { |
| | | //#å é¤äººè¸æ°æ® |
| | | sqliteFaceEncap.deleteFace("test1", "e04ad3bc-5126-4fe5-b01f-f461dd30e104"); |
| | | } |
| | | |
| | | |
| | | { |
| | | //#æ¥è¯¢äººè¸æ°æ® |
| | | auto res = sqliteFaceEncap.getFacesFromTable("test1"); |
| | | auto &res_t = *res; |
| | | for (auto &item : res_t) { |
| | | // std::cout << item.first << std::endl; |
| | | std::cout << item.second.uuid << std::endl; |
| | | std::cout << item.second.faceurl << std::endl; |
| | | std::cout << item.second.faceFeature.size() << std::endl; |
| | | } |
| | | } |
| | | |
| | | { |
| | | auto res = sqliteFaceEncap.getTableInfos(); |
| | | for (auto &item : res) { |
| | | std::cout << item.uuid << std::endl; |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | */ |
| | | //#define STRIP_LOG 0 |
| | | #include <AppConfig.h> |
| | | |
| | | int main(int argc, char **argv) { |
| | | ENABLEGLOG(GET_STR_CONFIG("logPath").c_str()); |
| | | |
| | | std::string m = "test"; |
| | | DBG(m << " DBG"); |
| | | DBG(m << " DBG"); |
| | | LOG(INFO) << "hello glog"; // æå°logï¼âhello glog. 类似äºC++ streamã |
| | | SYSLOG(INFO) << "test log"; |
| | | // DLOG(INFO, m); |
| | | // RAW_DLOG(WARNING, "test"); |
| | | |
| | | |
| | | CHKMSG(1, 1, m << " CHKMSG"); |
| | | CHKMSG(1, 2, m << " CHKMSG"); |
| | | MSG(m << " MSG"); |
| | | |
| | | CHKERR(1, 1, m << " CHKERR"); |
| | | CHKERR(1, 2, m << " CHKERR"); |
| | | |
| | | ERR(m << " ERR"); |
| | | |
| | | CHKINFO(1, 1, m << " CHKINFO"); |
| | | CHKINFO(1, 2, m << " CHKINFO"); |
| | | INFO(m << " INFO"); |
| | | |
| | | CHKDBG(1, 1, m << " CHKDBG"); |
| | | CHKDBG(1, 2, m << " CHKDBG"); |
| | | |
| | | DBG(m << " DBG"); |
| | | |
| | | getchar(); |
| | | } |
| New file |
| | |
| | | #include "AppPaController.h" |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/util/app/AppUtil.h> |
| | | #include <algorithm> |
| | | #include <basic/util/app/AppConfig.h> |
| | | #include <QtCore/QDateTime> |
| | | #include <QtCore/QtGlobal> |
| | | #include <net_config.h> |
| | | |
| | | |
| | | AppPaController:: AppPaController(int index, const ControllerConfig& cfg ): |
| | | videoCaptureElement(cfg.camInfo.strRtsp, 25, 3000, appPref.getLongData("gpu.index"), true), |
| | | m_index(index), |
| | | fdfsClient(nullptr), |
| | | yoloRpcElement(to_string(index) + "yoloRpc"), |
| | | triggerElement(cfg.paAlarmInfo.nTriggerDelay, cfg.paAlarmInfo.nAlarmDelay), |
| | | recordVideoElement(index, cfg.camInfo.strRtsp), |
| | | m_cfg(cfg) |
| | | { |
| | | |
| | | init(); |
| | | } |
| | | |
| | | AppPaController::~AppPaController() { |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | bool AppPaController::getRunning() { |
| | | return videoCaptureElement.isRunning(); |
| | | } |
| | | |
| | | |
| | | |
| | | void AppPaController::init() { |
| | | |
| | | unsigned char ip_old[15] = {0}; |
| | | std::string net_ifname = appConfig.getStringProperty("netIfName"); |
| | | // if (!(GetIpAddress(net_ifname.c_str(), ip_old))) { |
| | | // ERR("couldn't get ip"); |
| | | // } |
| | | |
| | | bUp = false; |
| | | |
| | | yoloRpcElement.setProperty("str_addr", m_cfg.camInfo.strAdrr); |
| | | yoloRpcElement.setProperty("local_ip", std::string((char *) ip_old)); |
| | | // yoloRpcElement.setMask(QString::fromStdString(m_cfg.paAlarmInfo.strMaskPath)); |
| | | yoloRpcElement.SetRuleCfg(&m_cfg); |
| | | yoloRpcElement.setProperty("dev_id", m_cfg.camInfo.strCamId); |
| | | m_json_Record["rtsp"] = m_cfg.camInfo.strRtsp; |
| | | |
| | | |
| | | |
| | | videoCaptureElement.registerConnector([&] { |
| | | |
| | | auto i_t = videoCaptureElement.getChangeLevel(); |
| | | if (i_t > 80) |
| | | { |
| | | // cout << __FUNCTION__ << " -> " << __LINE__ << " -> " << i_t << endl; |
| | | triggerElement.setState(true); |
| | | } |
| | | else if (i_t < 50) |
| | | { |
| | | // cout << __FUNCTION__ << " -> " << __LINE__ << " -> " << i_t << endl; |
| | | triggerElement.setState(false); |
| | | } |
| | | |
| | | triggerElement.triggerOnce(); |
| | | |
| | | int test_sub = triggerElement.getState() ? 1 : 5;// |
| | | |
| | | videoCaptureElement.setOutPutInterval(test_sub); |
| | | |
| | | if (triggerElement.getTriggerState()) { |
| | | if (!bUp) { |
| | | |
| | | string t_FilePath = ""; |
| | | m_json_Record["path"] = t_FilePath; |
| | | std::string t_recJsonStr = m_fastWriter.write(m_json_Record); |
| | | t_FilePath = recordVideoElement.startRecord(t_recJsonStr); |
| | | INFO(m_cfg.camInfo.strCamId << "file keey is ::" << t_FilePath); |
| | | yoloRpcElement.setProperty("path", t_FilePath); |
| | | bUp = true; |
| | | |
| | | std::thread timerFunc([&] { |
| | | //å½å¶æ¶é´è¶
è¿ç¨æ·è®¾å®çæ¶é´åæªæï¼éæ°å½å¶ |
| | | long startTime = AppUtil::getCurrentMs(); |
| | | int cut_max_duration = appPref.getIntData("n_cut_max_duration"); |
| | | long triggerTime = cut_max_duration == -1 ? 2 * 60 * 1000 : cut_max_duration * 1000; |
| | | while (bUp) { |
| | | if (AppUtil::getCurrentMs() - startTime > triggerTime) { |
| | | // if (bUp) { |
| | | bUp = false; |
| | | // } |
| | | break; |
| | | } else { |
| | | usleep(5000); |
| | | } |
| | | } |
| | | }); |
| | | timerFunc.detach(); |
| | | } else { |
| | | recordVideoElement.feedDog(); |
| | | } |
| | | } else { |
| | | if (bUp) { |
| | | bUp = false; |
| | | //DBG(m_camId << "endRecord"); |
| | | recordVideoElement.endRecord(); |
| | | } |
| | | // return; |
| | | } |
| | | |
| | | |
| | | |
| | | std::string strNewTime; |
| | | if (m_cfg.camInfo.strCamId.size() > 0) { |
| | | strNewTime = AppUtil::getTimeSecString(); |
| | | } else { |
| | | //#todo 计ç®å½åæä»¶æ¶é´ |
| | | //#TODO è¾åºé´éç¨äºè®¡ç®æ¶é´ |
| | | // ç°ä¸ºæ¯ä¸å¸§è®¡ç®ä¸æ¬¡ï¼å¯¼è´è®¡ç®çæ¶é´é¿äºæä»¶çå®é
æ¶é´ |
| | | auto opit = 25;// videoCaptureElement.getOutPutInterval(); |
| | | auto opidx = videoCaptureElement.getoutPutIndex(); |
| | | int second = opidx / opit; |
| | | qint64 newTime = m_dt.toMSecsSinceEpoch() + second * 1000; |
| | | QDateTime newDt = QDateTime::fromMSecsSinceEpoch(newTime); |
| | | strNewTime = newDt.toString("yyyy-MM-dd hh:mm:ss").toStdString(); |
| | | |
| | | } |
| | | // DBG(strNewTime); |
| | | |
| | | |
| | | |
| | | if (!yoloRpcElement.isBusy()) { |
| | | // yoloRpcElement.setProperty("uuid", uuid); |
| | | //#todo |
| | | yoloRpcElement.setProperty("time", strNewTime); |
| | | yoloRpcElement.setImage(videoCaptureElement.getImage()); |
| | | yoloRpcElement.submit(); |
| | | } |
| | | |
| | | if (!imageDrawElement.isBusy()) { |
| | | imageDrawElement.setImage(videoCaptureElement.getImage()); |
| | | imageDrawElement.submit(); |
| | | } |
| | | |
| | | |
| | | }); |
| | | |
| | | |
| | | triggerElement.registerConnector([&] { |
| | | |
| | | // std::string strImgPath,strVideoPath,strCurTime; |
| | | // makePath(strImgPath,strVideoPath,strCurTime); |
| | | if(yoloRpcElement.getRealNum()<m_cfg.paAlarmInfo.nAssembleCount) |
| | | return; |
| | | switch (triggerElement.getTriggerType()) { |
| | | case UP: |
| | | INFO("UP:sendVideoAlarm(true) num="<<yoloRpcElement.getRealNum()); |
| | | // this->sendVideoAlarm(true); |
| | | //this->openSoundAlarm(); |
| | | //if(isSaveResult()) alarmResultSaveToDB(strImgPath,strVideoPath,strCurTime); |
| | | //if(isSaveVideo()) recordVideoElement.startRecord()strVideoPath.c_str()); |
| | | break; |
| | | case DOWN: |
| | | |
| | | INFO("UP:sendVideoAlarm(false) num="<<yoloRpcElement.getRealNum()); |
| | | // this->sendVideoAlarm(false); |
| | | // this->closeSoundAlarm(); |
| | | //if(isSaveVideo()) recordVideoElement.endRecord(); |
| | | break; |
| | | default: |
| | | break; |
| | | }; |
| | | // if(isSaveImage() &&triggerElement.getTriggerType()==UP) |
| | | // { |
| | | |
| | | // std::vector<cv::Rect> rects ; |
| | | // std::vector<ScoredRect> scoredRects=yoloRpcElement.getLastScoreRects(); |
| | | // for(auto scoreRect:scoredRects) |
| | | // { |
| | | // rects.push_back(scoreRect.rect); |
| | | // } |
| | | |
| | | // cv::Mat img = this->videoCaptureElement.getImage(); |
| | | // AppPaController::saveRectsImage(rects,img,strImgPath.c_str()); |
| | | // } |
| | | |
| | | }); |
| | | yoloRpcElement.registerConnector([&] { |
| | | imageDrawElement.setYoloObjects(yoloRpcElement.getLastScoreRects()); |
| | | triggerElement.setState(yoloRpcElement.getRealNum()>=m_cfg.paAlarmInfo.nAssembleCount); |
| | | |
| | | }); |
| | | |
| | | |
| | | imageDrawElement.registerConnector([&] { |
| | | if (appPref.getIntData("show.image") == 1) { |
| | | ImageShowElement::showImage(to_string(this->m_index), *imageDrawElement.getImage()); |
| | | } |
| | | }); |
| | | |
| | | registerElement(videoCaptureElement); |
| | | |
| | | registerElement(yoloRpcElement); |
| | | |
| | | |
| | | registerElement(imageDrawElement); |
| | | |
| | | registerElement(triggerElement); |
| | | |
| | | videoCaptureElement.setOutPutInterval(3); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | void AppPaController::setfdfsClient(FastFdsWithLock *p_fdfsClient) { |
| | | fdfsClient = p_fdfsClient; |
| | | yoloRpcElement.setFdfs(fdfsClient); |
| | | } |
| | | |
| | | std::string AppPaController::getRtmp() { |
| | | std::string ret = "";// = videoPublishElement.getPath(); |
| | | size_t pos = ret.find(".flv"); |
| | | ret = ret.substr(0, pos); |
| | | INFO(ret); |
| | | return ret; |
| | | } |
| | | //void AppPaController::sendVideoAlarm(bool value) |
| | | //{ |
| | | // ::Alarm::AlarmInfo alarmInfo; |
| | | // alarmInfo.bAlarm = value; |
| | | // alarmInfo.strRtsp = m_cfg.camInfo.strRtsp; |
| | | // alarmInfo.wallNo = m_cfg.paAlarmInfo.nWallNum; |
| | | // alarmInfo.subWallNo = m_cfg.paAlarmInfo.nWallSubNum; |
| | | // alarmInfo.windowNo = m_cfg.paAlarmInfo.nWindowNum; |
| | | // try { |
| | | // auto server = alarmRpc.getServer(); |
| | | // if(server){ |
| | | // server->AlarmSingle(alarmInfo); |
| | | // }else{ |
| | | // ERR("sendVideoAlarm falid; server is null"); |
| | | // } |
| | | // } catch (std::exception& e) { |
| | | // ERR(e.what()); |
| | | // } |
| | | //} |
| | | |
| | | void AppPaController::openSoundAlarm() |
| | | { |
| | | try { |
| | | // auto server = alarmRpc.getServer(); |
| | | // if(server){ |
| | | // server->AlarmSound(appPref.getStringData("pa.identity"),true); |
| | | // }else{ |
| | | // ERR("openSoundAlarm falid; server is null"); |
| | | // } |
| | | } catch (std::exception& e) { |
| | | ERR(e.what()); |
| | | } |
| | | } |
| | | |
| | | void AppPaController::closeSoundAlarm() |
| | | { |
| | | try { |
| | | // auto server = alarmRpc.getServer(); |
| | | // if(server){ |
| | | // server->AlarmSound(appPref.getStringData("pa.identity"),false); |
| | | // }else{ |
| | | // ERR("closeSoundAlarm falid; server is null"); |
| | | // } |
| | | } catch (std::exception& e) { |
| | | ERR(e.what()); |
| | | } |
| | | } |
| | | |
| | | void AppPaController::playSound() |
| | | { |
| | | try { |
| | | // auto server = soundRpc.getServer(); |
| | | // if(server){ |
| | | |
| | | // server->SoundPlay(m_index,soundInfos); |
| | | // }else{ |
| | | // ERR("playSound falid; server is null"); |
| | | // } |
| | | } catch (std::exception& e) { |
| | | ERR(e.what()); |
| | | } |
| | | } |
| | | |
| | | void AppPaController::stopSound() |
| | | { |
| | | try { |
| | | // auto server = soundRpc.getServer(); |
| | | // if(server){ |
| | | // server->SoundStop(m_index); |
| | | // }else{ |
| | | // ERR("stopSound falid; server is null"); |
| | | // } |
| | | } catch (std::exception& e) { |
| | | ERR(e.what()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //void AppPaController::alarmResultSaveToDB(std::string& imgPath,std::string& videoPath,std::string& curTime) |
| | | //{ |
| | | // try { |
| | | // auto server = m_SaveAlarmRpc.getServer(); |
| | | // if(server){ |
| | | // ::SaveModule::AlarmInfo iceAlarmInfo; |
| | | // iceAlarmInfo.nCamID = index; |
| | | // iceAlarmInfo.nStatus = 0; |
| | | // iceAlarmInfo.strAlarmDescribe = "invade"; |
| | | // size_t pos = imgPath.find("/static"); |
| | | // iceAlarmInfo.strAlarmImgPath = imgPath.substr(pos,imgPath.length()-pos); |
| | | // pos = videoPath.find("/static"); |
| | | // iceAlarmInfo.strAlarmVideoPath = videoPath.substr(pos,videoPath.length()-pos); |
| | | // iceAlarmInfo.strCreateTime = curTime; |
| | | // server->saveAlarmInfo(iceAlarmInfo); |
| | | // }else{ |
| | | // ERR("ice alarmSaveToDB falid; server is null"); |
| | | // } |
| | | // }catch (std::exception& e) { |
| | | // ERR(e.what()); |
| | | // } |
| | | //} |
| | | |
| | | static int AppPaController::saveRectsImage(const vector<cv::Rect2f> &rects, const cv::Mat &img, const char *path) |
| | | { |
| | | if(img.rows==0||img.cols==0)return -1; |
| | | cv::Mat image = img.clone(); |
| | | for(auto& rectf:rects){ |
| | | cv::Rect rect(rectf.x*image.cols,rectf.y*image.rows,rectf.width*image.cols,rectf.height*image.rows); |
| | | cv::rectangle(image, rect,cv::Scalar(0,0,255),4); |
| | | } |
| | | return cv::imwrite(path,image); |
| | | |
| | | } |
| | | |
| | | bool AppPaController::isSaveVideo() |
| | | { |
| | | return appPref.getIntData("video.save") != 0; |
| | | } |
| | | |
| | | bool AppPaController::isSaveResult() |
| | | { |
| | | return appPref.getIntData("alarmresult.save") != 0; |
| | | } |
| | | |
| | | bool AppPaController::isSaveImage() |
| | | { |
| | | return appPref.getIntData("image.save") != 0; |
| | | } |
| | | |
| | | |
| | | |
| New file |
| | |
| | | #ifndef APPPACONTROLLER_H |
| | | #define APPPACONTROLLER_H |
| | | |
| | | #include <basic/pipe/PipeController.h> |
| | | #include <basic/pipe_element/ffmpeg/FfmpegElement.h> |
| | | #include <basic/pipe_element/ImageShowElement.h> |
| | | #include <basic/util/curl/HttpRequestWithCrul.hpp> |
| | | #include "PaImageDrawElement.h" |
| | | #include "../StructureApp/RecordVideoElement.h" |
| | | #include "PaYoloRpcElement.h" |
| | | #include <TriggerElement.h> |
| | | #include <QtCore/QDateTime> |
| | | #include <jsoncpp/json/json.h> |
| | | //#include <basic/rpc/IceRpc.hpp> |
| | | //#include "../Alarm/rpc/Alarm.h" |
| | | //#include "../netsoundbox/rpc/NetSoundBox.h" |
| | | //#include <QtCore/QVector> |
| | | //ç½ç»é³ç®±é
ç½® |
| | | struct SoundPlayInfo |
| | | { |
| | | SoundPlayInfo():nSoundDuration(-1) |
| | | {} |
| | | //int nID; |
| | | std::string strIP;//é³ç®±IP |
| | | int nSoundDuration;//声é³é´éæ¶é´ |
| | | std::string strPath;//声é³è·¯å¾ |
| | | }; |
| | | //æåå¤´ä¿¡æ¯ |
| | | struct CamInfo |
| | | { |
| | | int nFps;//帧ç |
| | | std::string strCamId; |
| | | std::string strAdrr; |
| | | std::string strRtsp;//RTSPå°å |
| | | }; |
| | | |
| | | //æ¥è¦ä¿¡æ¯ |
| | | struct PaAlarmInfo |
| | | { |
| | | // int nWallNum;//å¢å· |
| | | // int nWallSubNum;//åå¢å· |
| | | // int nWindowNum;//çªå£å· |
| | | int nTriggerDelay;//æ¥è¦å¼å§å»¶æ¶æ¶é´é´é |
| | | int nAlarmDelay;//æ¥è¦ç»æå»¶æ¶æ¶é´é´é |
| | | QString strMaskPath; //alarm maskPathè§£ç 卿¥è¦çROIåºåå°å¾è·¯å¾ |
| | | float fSensitivity;//alarm sensitivityæ¥è¦çæ£æµéå¼ |
| | | int nAssembleCount;//èéçäººæ° |
| | | }; |
| | | |
| | | //èéä¿¡æ¯ |
| | | struct AssembleInfo |
| | | { |
| | | int nAssembleCount;//èéçäººæ° |
| | | float fSensitivity;//AssembleInfo sensitivityèéçæ£æµéå¼ |
| | | //std::string strProxy; |
| | | std::string strMaskPath;// AssembleInfo maskPathèéçROIåºåå°å¾è·¯å¾ |
| | | std::vector<SoundPlayInfo> sounds;//ç½ç»é³ç®±ææ¾ä¿¡æ¯ |
| | | }; |
| | | |
| | | struct RuleWeekInfo |
| | | { |
| | | RuleWeekInfo() |
| | | { |
| | | m_nType = 1; |
| | | m_strBegin = ""; |
| | | m_strEnd = ""; |
| | | } |
| | | |
| | | int m_nType; //å¨å |
| | | QString m_strBegin;//00:00 |
| | | QString m_strEnd; |
| | | }; |
| | | //addcameraé
置项 |
| | | struct ControllerConfig |
| | | { |
| | | |
| | | //NONE neither alarm nor assemble |
| | | //ALARM alarm |
| | | //ASSEMBLE Assemble |
| | | |
| | | //camInfo |
| | | CamInfo camInfo;//æåå¤´ä¿¡æ¯ |
| | | |
| | | //alarmInfo |
| | | PaAlarmInfo paAlarmInfo;//æ¥è¦ä¿¡æ¯ |
| | | |
| | | //AssembleInfo |
| | | // AssembleInfo assembleInfo;//èéä¿¡æ¯ |
| | | |
| | | QVector<RuleWeekInfo> ruleWeekInfoVec; |
| | | |
| | | }; |
| | | |
| | | class AppPaController : public PipeController { |
| | | public: |
| | | /*** |
| | | * ç¨äºå¿«éè§é¢ç»æå |
| | | * @param folderPath 任塿 ¹ç®å½ï¼ç¨äºåå
±äº«å
åid |
| | | * @param json åæ°ä¸ºrtspæµå°å sdkæ¯å¦å¯ç¨çæ è¯ |
| | | */ |
| | | |
| | | AppPaController(int index, const ControllerConfig& cfg); |
| | | |
| | | virtual ~AppPaController(); |
| | | |
| | | void sendVideoAlarm(bool value); |
| | | //éç¥æ¥è¦æå¡æ¥è¦ |
| | | void openSoundAlarm(); |
| | | //éç¥æ¥è¦æå¡å
³éæ¥è¦ |
| | | void closeSoundAlarm(); |
| | | //éç¥ç½ç»é³ç®±ææ¾é³ä¹ |
| | | void playSound(); |
| | | //éç¥ç½ç»é³ç®±åæ¢ææ¾é³ä¹ |
| | | void stopSound(); |
| | | |
| | | //void alarmResultSaveToDB(std::string&,std::string&,std::string&); |
| | | |
| | | //ä¿å人ä½è£åªå¾ |
| | | static int saveRectsImage(const vector<cv::Rect2f>& rects,const cv::Mat& img,const char* path); |
| | | |
| | | |
| | | bool isSaveVideo(); |
| | | |
| | | bool isSaveResult(); |
| | | |
| | | bool isSaveImage(); |
| | | |
| | | |
| | | bool getRunning(); |
| | | |
| | | std::string getRtmp(); |
| | | |
| | | void setfdfsClient(FastFdsWithLock *p_fdfsClient); |
| | | |
| | | private: |
| | | void init(); |
| | | |
| | | private: |
| | | ffmpeg::VideoCaptureElement videoCaptureElement; |
| | | PaYoloRpcElement yoloRpcElement; |
| | | PaImageDrawElement imageDrawElement; |
| | | RecordVideoElement recordVideoElement; |
| | | // VideoPublishElement videoPublishElement; |
| | | |
| | | int m_index; |
| | | std::string m_folderPath; |
| | | Json::Value m_json_Record; |
| | | |
| | | Json::FastWriter m_fastWriter; |
| | | FastFdsWithLock *fdfsClient; |
| | | |
| | | |
| | | TriggerElement triggerElement; |
| | | std::atomic<bool> bUp; |
| | | |
| | | QDateTime m_dt; |
| | | |
| | | |
| | | const ControllerConfig m_cfg; |
| | | |
| | | // NetSoundBox::SoundInfos soundInfos; |
| | | // IceRpcClient<Alarm::AlarmInterfacePrx> alarmRpc; |
| | | // IceRpcClient<NetSoundBox::SoundInterfacePrxPtr> soundRpc; |
| | | // IceRpcClient<SaveModule::SaveAlarmPrx> m_SaveAlarmRpc; |
| | | |
| | | }; |
| | | |
| | | #endif // APPPIPECONTROLLER_H |
| New file |
| | |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(PerimeterAlarm) |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build) |
| | | set(CMAKE_CXX_STANDARD 11) |
| | | set(CMAKE_BUILD_TYPE debug) |
| | | add_compile_options(-fPIC) |
| | | add_definitions(-DDEBUG_ERR -DDEBUG_INFO -DTESTCODE -fpermissive) |
| | | |
| | | SET(SOURCES |
| | | # TrackingTrigger.cpp |
| | | PaYoloRpcElement.cpp |
| | | PaImageDrawElement.cpp |
| | | |
| | | # rpc/StructureApp.cpp |
| | | AppPaController.cpp |
| | | ../YoloServer/rpc/YoloServer.cpp |
| | | ../RecordVideo/rpc/RecordVideo.cpp |
| | | ../RapidStructureApp/TriggerElement.cpp |
| | | ../StructureApp/TrackingTrigger.cpp |
| | | ../StructureApp/RecordVideoElement.cpp |
| | | # ../Alarm/rpc/Alarm.cpp |
| | | # ../netsoundbox/rpc/NetSoundBox.cpp |
| | | |
| | | |
| | | |
| | | # rpc/AlarmInfo.cpp |
| | | |
| | | |
| | | ../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp |
| | | ../../BasicPlatForm/basic/pipe_element/ffmpeg/VideoChangeScore.cpp |
| | | ../../BasicPlatForm/basic/pipe_element/ImageFactoryElement.cpp |
| | | ../../BasicPlatForm/basic/util/BASE64/Base64.cpp |
| | | ../../BasicPlatForm/basic/util/fastdfs/FastdfsClient.cpp |
| | | ../../BasicPlatForm/basic/pipe/TimerElement.cpp |
| | | ../../BasicPlatForm/basic/db/Elasticsearch/EsDBTool.cpp |
| | | ../../BasicPlatForm/basic/util/curl/HttpRequestWithCrul.hpp |
| | | ../../BasicPlatForm/basic/util/net_config/net_config.cpp |
| | | ) |
| | | |
| | | SET(LIBS |
| | | Ice |
| | | crypto |
| | | opencv_world |
| | | avformat |
| | | avcodec |
| | | swresample |
| | | swscale |
| | | avutil |
| | | bz2 dl z |
| | | Qt5Core |
| | | pthread |
| | | jsoncpp |
| | | cuda |
| | | cudart |
| | | cublas |
| | | curand |
| | | |
| | | glog |
| | | |
| | | uuid |
| | | curl |
| | | fastcommon |
| | | fdfsclient |
| | | Qt5Gui |
| | | ) |
| | | |
| | | include_directories( |
| | | # ./rpc |
| | | ../YoloServer/rpc |
| | | ../RecordVideo/rpc |
| | | ../RapidStructureApp/ |
| | | |
| | | # ../netsoundbox/rpc/ |
| | | # ../Alarm/rpc |
| | | |
| | | |
| | | ../../BasicPlatForm |
| | | ../../BasicPlatForm/libs/opencv/include |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/include |
| | | ../../BasicPlatForm/libs/ffmpeg/include |
| | | ../../BasicPlatForm/libs/jsoncpp/include |
| | | |
| | | ../../BasicPlatForm/basic/util/net_config/ |
| | | ../../BasicPlatForm/basic/util/fastdfs/ |
| | | ../../BasicPlatForm/libs/FastDFS/include |
| | | ../../BasicPlatForm/libs/FastDFS/include/fastdfs |
| | | ../../BasicPlatForm/libs/FastDFS/include/fastcommon |
| | | |
| | | ../../BasicPlatForm/basic/pipe/ |
| | | ../../BasicPlatForm/libs/crul/include |
| | | ../../BasicPlatForm/basic/util/curl/ |
| | | ../../BasicPlatForm/libs/libuuid/include |
| | | ../../BasicPlatForm/libs/glog/include |
| | | /usr/include/x86_64-linux-gnu/qt5 |
| | | ) |
| | | |
| | | link_directories( |
| | | /usr/local/cuda/lib64 |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/lib64 |
| | | ../../BasicPlatForm/libs/openssl/lib |
| | | ../../BasicPlatForm/libs/opencv/lib |
| | | ../../BasicPlatForm/libs/ffmpeg/lib |
| | | ../../BasicPlatForm/libs/jsoncpp/lib |
| | | ../../BasicPlatForm/libs/FastDFS/lib |
| | | ../../BasicPlatForm/libs/libuuid/lib |
| | | |
| | | ../../BasicPlatForm/libs/glog/lib |
| | | ../../BasicPlatForm/libs/crul/lib |
| | | ) |
| | | |
| | | add_executable(${PROJECT_NAME} |
| | | main.cpp |
| | | ${SOURCES} |
| | | ) |
| | | |
| | | |
| | | target_link_libraries(${PROJECT_NAME} |
| | | ${LIBS} |
| | | ) |
| | | |
| | | |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE QtCreatorProject> |
| | | <!-- Written by QtCreator 4.5.1, 2018-11-26T18:16:49. --> |
| | | <qtcreator> |
| | | <data> |
| | | <variable>EnvironmentId</variable> |
| | | <value type="QByteArray">{e1ca3822-a9f7-41c4-8b27-ed35006d2304}</value> |
| | | </data> |
| | | <data> |
| | | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
| | | <value type="int">0</value> |
| | | </data> |
| | | <data> |
| | | <variable>ProjectExplorer.Project.EditorSettings</variable> |
| | | <valuemap type="QVariantMap"> |
| | | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
| | | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
| | | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
| | | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
| | | <value type="QString" key="language">Cpp</value> |
| | | <valuemap type="QVariantMap" key="value"> |
| | | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
| | | </valuemap> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
| | | <value type="QString" key="language">QmlJS</value> |
| | | <valuemap type="QVariantMap" key="value"> |
| | | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
| | | </valuemap> |
| | | </valuemap> |
| | | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
| | | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
| | | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
| | | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
| | | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
| | | <value type="int" key="EditorConfiguration.MarginColumn">80</value> |
| | | <value type="bool" key="EditorConfiguration.MouseHiding">true</value> |
| | | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
| | | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
| | | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
| | | <value type="bool" key="EditorConfiguration.ShowMargin">false</value> |
| | | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
| | | <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value> |
| | | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
| | | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
| | | <value type="int" key="EditorConfiguration.TabSize">8</value> |
| | | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
| | | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
| | | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
| | | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
| | | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
| | | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
| | | </valuemap> |
| | | </data> |
| | | <data> |
| | | <variable>ProjectExplorer.Project.PluginSettings</variable> |
| | | <valuemap type="QVariantMap"/> |
| | | </data> |
| | | <data> |
| | | <variable>ProjectExplorer.Project.Target.0</variable> |
| | | <valuemap type="QVariantMap"> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æ¡é¢</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">æ¡é¢</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{9141802c-62f7-4eed-b036-21940bb88d33}</value> |
| | | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
| | | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
| | | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">2</value> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
| | | <valuelist type="QVariantList" key="CMake.Configuration"/> |
| | | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/basic/c++/Qt/QiaoJiaSystem/build-StructureApp-unknown-Default</value> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">all</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æå»º</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">clean</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æ¸
ç</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
| | | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
| | | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Default</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Default</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> |
| | | <valuelist type="QVariantList" key="CMake.Configuration"> |
| | | <value type="QString">CMAKE_BUILD_TYPE:STRING=Debug</value> |
| | | </valuelist> |
| | | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/basic/c++/Qt/QiaoJiaSystem/build-StructureApp-unknown-Debug</value> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">all</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æå»º</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">clean</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æ¸
ç</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
| | | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
| | | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> |
| | | <valuelist type="QVariantList" key="CMake.Configuration"> |
| | | <value type="QString">CMAKE_BUILD_TYPE:STRING=Release</value> |
| | | </valuelist> |
| | | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/basic/c++/Qt/QiaoJiaSystem/build-StructureApp-unknown-Release</value> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">all</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æå»º</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">clean</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æ¸
ç</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
| | | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
| | | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3"> |
| | | <valuelist type="QVariantList" key="CMake.Configuration"> |
| | | <value type="QString">CMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value> |
| | | </valuelist> |
| | | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/basic/c++/Qt/QiaoJiaSystem/build-StructureApp-unknown-Release with Debug Information</value> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">all</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æå»º</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">clean</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æ¸
ç</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
| | | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
| | | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release with Debug Information</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release with Debug Information</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.4"> |
| | | <valuelist type="QVariantList" key="CMake.Configuration"> |
| | | <value type="QString">CMAKE_BUILD_TYPE:STRING=MinSizeRel</value> |
| | | </valuelist> |
| | | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/basic/c++/Qt/QiaoJiaSystem/build-StructureApp-unknown-Minimum Size Release</value> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">all</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æå»º</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
| | | <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value> |
| | | <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> |
| | | <value type="QString">clean</value> |
| | | </valuelist> |
| | | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CMake Build</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">æ¸
ç</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
| | | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
| | | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Minimum Size Release</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Minimum Size Release</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">5</value> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
| | | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">é¨ç½²</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">卿¬å°é¨ç½²</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
| | | <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> |
| | | <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> |
| | | <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> |
| | | <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> |
| | | <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> |
| | | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
| | | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
| | | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
| | | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
| | | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
| | | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
| | | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
| | | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
| | | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
| | | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
| | | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
| | | <value type="int">0</value> |
| | | <value type="int">1</value> |
| | | <value type="int">2</value> |
| | | <value type="int">3</value> |
| | | <value type="int">4</value> |
| | | <value type="int">5</value> |
| | | <value type="int">6</value> |
| | | <value type="int">7</value> |
| | | <value type="int">8</value> |
| | | <value type="int">9</value> |
| | | <value type="int">10</value> |
| | | <value type="int">11</value> |
| | | <value type="int">12</value> |
| | | <value type="int">13</value> |
| | | <value type="int">14</value> |
| | | </valuelist> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">StructureApp</value> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/home/basic/c++/Qt/QiaoJiaSystem/build</value> |
| | | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
| | | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">StructureApp</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.StructureApp</value> |
| | | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
| | | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
| | | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
| | | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
| | | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
| | | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1"> |
| | | <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> |
| | | <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> |
| | | <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> |
| | | <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> |
| | | <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> |
| | | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
| | | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
| | | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
| | | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
| | | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
| | | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
| | | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
| | | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
| | | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
| | | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
| | | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
| | | <value type="int">0</value> |
| | | <value type="int">1</value> |
| | | <value type="int">2</value> |
| | | <value type="int">3</value> |
| | | <value type="int">4</value> |
| | | <value type="int">5</value> |
| | | <value type="int">6</value> |
| | | <value type="int">7</value> |
| | | <value type="int">8</value> |
| | | <value type="int">9</value> |
| | | <value type="int">10</value> |
| | | <value type="int">11</value> |
| | | <value type="int">12</value> |
| | | <value type="int">13</value> |
| | | <value type="int">14</value> |
| | | </valuelist> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">AppPipeControllerTest</value> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/home/basic/c++/Qt/QiaoJiaSystem/build</value> |
| | | <value type="int" key="PE.EnvironmentAspect.Base">-1</value> |
| | | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">AppPipeControllerTest</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.AppPipeControllerTest</value> |
| | | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
| | | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
| | | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
| | | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
| | | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
| | | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
| | | </valuemap> |
| | | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.2"> |
| | | <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> |
| | | <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> |
| | | <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> |
| | | <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> |
| | | <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> |
| | | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
| | | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
| | | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
| | | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
| | | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
| | | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
| | | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
| | | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
| | | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
| | | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
| | | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
| | | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
| | | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
| | | <value type="int">0</value> |
| | | <value type="int">1</value> |
| | | <value type="int">2</value> |
| | | <value type="int">3</value> |
| | | <value type="int">4</value> |
| | | <value type="int">5</value> |
| | | <value type="int">6</value> |
| | | <value type="int">7</value> |
| | | <value type="int">8</value> |
| | | <value type="int">9</value> |
| | | <value type="int">10</value> |
| | | <value type="int">11</value> |
| | | <value type="int">12</value> |
| | | <value type="int">13</value> |
| | | <value type="int">14</value> |
| | | </valuelist> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">PerimeterAlarm</value> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value> |
| | | <value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/home/basic/c++/Qt/QiaoJiaSystem/build</value> |
| | | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
| | | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">PerimeterAlarm</value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| | | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.PerimeterAlarm</value> |
| | | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
| | | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
| | | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
| | | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
| | | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
| | | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
| | | </valuemap> |
| | | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">3</value> |
| | | </valuemap> |
| | | </data> |
| | | <data> |
| | | <variable>ProjectExplorer.Project.TargetCount</variable> |
| | | <value type="int">1</value> |
| | | </data> |
| | | <data> |
| | | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
| | | <value type="int">18</value> |
| | | </data> |
| | | <data> |
| | | <variable>Version</variable> |
| | | <value type="int">18</value> |
| | | </data> |
| | | </qtcreator> |
| New file |
| | |
| | | #include "PaImageDrawElement.h" |
| | | #include <basic/util/opencv/CvUtil.h> |
| | | |
| | | PaImageDrawElement::PaImageDrawElement() { |
| | | |
| | | } |
| | | |
| | | void PaImageDrawElement::darwProperty(cv::Mat &image, string key, string value, int x, int y) { |
| | | cv::putText(image, key + ": " + value, cv::Point(x, y), cv::HersheyFonts::FONT_HERSHEY_PLAIN, 1.5, |
| | | cv::Scalar(255, 255, 0), 2); |
| | | } |
| | | |
| | | void PaImageDrawElement::processImage(cv::Mat &image) { |
| | | |
| | | auto yoloObjectsData = yoloObjects.getData(); |
| | | |
| | | // {\"x\":4,\"y\":6},{\"x\":4,\"y\":537},{\"x\":955,\"y\":536},{\"x\":951,\"y\":9},{\"x\":4,\"y\":6}] |
| | | CvPoint spoint1[5] = {{4,6},{4,537},{955,536},{951,9},{4,6}}; |
| | | |
| | | cv::Rect rect(100,6,1700,1200); |
| | | cv::rectangle(image, rect, cv::Scalar(0, 0, 255), 2); |
| | | for (auto yoloObj: yoloObjectsData) { |
| | | auto rect = CvUtil::zoomRect(yoloObj.rect, 1, 1); |
| | | // Scalar scalar; |
| | | if(yoloObj.id>=0) |
| | | { |
| | | if(yoloObj.isMask) |
| | | { |
| | | //scalar=cv::Scalar(0, 0, 255); |
| | | cv::rectangle(image, rect, cv::Scalar(0, 0, 255), 2); |
| | | } |
| | | else |
| | | { |
| | | //scalar=cv::Scalar(255, 0, 0); |
| | | cv::rectangle(image, rect, cv::Scalar(255, 0, 0), 2); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // scalar=cv::Scalar(0, 255, 255); |
| | | cv::rectangle(image, rect, cv::Scalar(0, 255, 255), 2); |
| | | } |
| | | //cv::rectangle(image, rect, scalar, 2); |
| | | int i = 0; |
| | | for (auto &property:yoloObj.properties) { |
| | | darwProperty(image, property.first, property.second, rect.x + rect.width, rect.y + 40 * i++); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | void PaImageDrawElement::setYoloObjects(std::vector<ScoredRect> value) { |
| | | yoloObjects = value; |
| | | } |
| New file |
| | |
| | | #ifndef PAIMAGEDRAWELEMENT_H |
| | | #define PAIMAGEDRAWELEMENT_H |
| | | |
| | | #include <YoloServer.h> |
| | | #include <basic/pipe_element/ImageFactoryElement.h> |
| | | #include <basic/core/DoubleBufferedData.h> |
| | | #include "../StructureApp/TrackingTrigger.h" |
| | | |
| | | class PaImageDrawElement : public ImageFactoryElement { |
| | | public: |
| | | PaImageDrawElement(); |
| | | |
| | | // ImageFactoryElement interface |
| | | |
| | | |
| | | void setYoloObjects(std::vector<ScoredRect> value); |
| | | |
| | | private: |
| | | virtual void processImage(cv::Mat &) override; |
| | | |
| | | void darwProperty(cv::Mat &image, string key, string value, int x, int y); |
| | | |
| | | private: |
| | | DoubleBufferedData<std::vector<ScoredRect>> yoloObjects; |
| | | }; |
| | | |
| | | |
| | | #endif // IMAGEDRAWELEMENT_H |
| New file |
| | |
| | | #include "PaYoloRpcElement.h" |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <QtCore/QSharedMemory> |
| | | #include <QtCore/QString> |
| | | #include <basic/timer_counter/Clocktimer.h> |
| | | #include <basic/util/opencv/CvUtil.h> |
| | | |
| | | #include "AppPaController.h" |
| | | #include <basic/db/Elasticsearch/EsDBTool.h> |
| | | #include <uuid/uuid.h> |
| | | #include <jsoncpp/json/json.h> |
| | | |
| | | #include <basic/db/ES/es/ManagerEsDB.h> |
| | | #include <QtCore/QJsonDocument> |
| | | #include <QtCore/QJsonObject> |
| | | |
| | | |
| | | PaYoloRpcElement::PaYoloRpcElement(string shareMemoryName) : |
| | | rpcClient(appPref.getStringData("yolo.proxy"), appPref.getStringData("yolo.ip"), |
| | | appPref.getIntData("yolo.port"), "tcp"), fdfsClient(nullptr), sharedMemory(nullptr), |
| | | mRealNum(0),mCfg(nullptr), |
| | | trackingTrigger(nullptr) { |
| | | sharedMemory = new QSharedMemory(QString(shareMemoryName.c_str())); |
| | | // DBG(shareMemoryName); |
| | | //1520 x 2688 1080 x 1920 //2560 * 1440 * 4 |
| | | if (!sharedMemory->create(4608 * 2592 * 4)) { |
| | | sharedMemory->attach(); |
| | | } |
| | | trackingTrigger = new TrackingTrigger(0.5); |
| | | try { |
| | | auto server = rpcClient.getServer(); |
| | | cocoData = server->getCocoData(); |
| | | } |
| | | catch (std::exception &e) { |
| | | ERR(e.what()) |
| | | } |
| | | } |
| | | |
| | | PaYoloRpcElement::~PaYoloRpcElement() { |
| | | if (sharedMemory) { |
| | | delete sharedMemory; |
| | | } |
| | | if (trackingTrigger) { |
| | | delete trackingTrigger; |
| | | } |
| | | if (mCfg) |
| | | { |
| | | delete mCfg; |
| | | mCfg=nullptr; |
| | | } |
| | | mPolygon.clear(); |
| | | } |
| | | |
| | | void PaYoloRpcElement::threadFunc() { |
| | | // ClockTimer ct("YoloRpcElement::threadFunc");. |
| | | triggerMats.clear(); |
| | | int num=0; |
| | | bool bInWeekTime=false; |
| | | if(mCfg==nullptr) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | auto server = rpcClient.getServer(); |
| | | if (!server) { |
| | | ERR("server is null"); |
| | | return; |
| | | } |
| | | objs = server->YoloDetect(image.cols, image.rows, sharedMemory->key().toStdString());//TODO |
| | | if (objs.size() <= 0) { |
| | | trackingTrigger->triggerLine(); |
| | | return; |
| | | } |
| | | string t_camIdex = getProperty("dev_id") + getProperty("ch_id"); |
| | | // float t_det_sc = |
| | | // appPref.getFloatData(t_camIdex + "yolo.det") == -1 ? 0.75 : appPref.getFloatData(t_camIdex + "yolo.det"); |
| | | |
| | | bInWeekTime=isInWeekRuleTime(); |
| | | |
| | | for (auto &obj: objs) { |
| | | if (obj.type != 0) |
| | | continue; |
| | | if(obj.prob < ((1-mCfg->paAlarmInfo.fSensitivity)/2+0.5))continue; |
| | | |
| | | |
| | | ScoredRect scoredRect; |
| | | |
| | | int x = obj.rcObj.left * image.cols; |
| | | int y = obj.rcObj.top * image.rows; |
| | | int w = (obj.rcObj.right - obj.rcObj.left) * image.cols; |
| | | int h = (obj.rcObj.bottom - obj.rcObj.top) * image.rows; |
| | | scoredRect.rect = cv::Rect(x, y, w, h); |
| | | QRect rect(x,y,w,h); |
| | | QPoint center = rect.center(); |
| | | scoredRect.score = scoredRect.rect.area() > 0 ? obj.prob : 0; |
| | | |
| | | if(mPolygon.containsPoint(center,Qt::OddEvenFill)) |
| | | { |
| | | scoredRect.isMask=true; |
| | | if(bInWeekTime) |
| | | num++; |
| | | } |
| | | |
| | | if ( trackingTrigger->triggerOnce(scoredRect)) { |
| | | |
| | | DBG("x="<<center.x()<<"y="<<center.y()); |
| | | trackingTrigger->getLastRect().isMask= scoredRect.isMask; |
| | | trackingTrigger->getLastRect().properties["id"] = to_string(scoredRect.id); |
| | | trackingTrigger->getLastRect().properties["type"] = cocoData[obj.type]; |
| | | auto t_image = image(scoredRect.rect & cv::Rect(0, 0, image.cols, image.rows)).clone(); |
| | | triggerMats.push_back(t_image); |
| | | |
| | | std::string strImgUrl = "http://"; |
| | | if (fdfsClient != nullptr && fdfsClient->fastFds != nullptr) { |
| | | fdfsClient->rwLock.rdlock(); |
| | | std::vector<unsigned char> buffer; |
| | | CvUtil::cvMat2Buffer(t_image, buffer); |
| | | std::string strImgUrlTmp = ""; |
| | | fdfsClient->fastFds->uploadFile(buffer, strImgUrlTmp, "jpg"); |
| | | strImgUrl.append(fdfsClient->fastFds->getIp() + "/" + strImgUrlTmp); |
| | | fdfsClient->rwLock.unlock(); |
| | | } |
| | | |
| | | //使ç¨çæ¶åå°falseæ¹ä¸ºture |
| | | if(0) |
| | | { |
| | | //#todo |
| | | EsDBTool pManagerEsDB(appPref.getStringData("ipAdd"), appPref.getIntData("ipPort")); |
| | | |
| | | string str_uuid; |
| | | uuid_t t_uuid; |
| | | char str[36]; |
| | | uuid_generate(t_uuid); |
| | | uuid_unparse(t_uuid, str); |
| | | str_uuid = str; |
| | | |
| | | // jsonyolo.insert("HardCamId","");//硬çæåæºid ï¼ï¼ï¼æ¿ä¸å° |
| | | // jsonyolo.insert("ChannlId","");//ééid ï¼ï¼ï¼ æ¿ä¸å° |
| | | // jsonyolo.insert("Time","");//æ¶é´ å¯ä»¥è·åå½åæ¶é´ æç¡®æ¶é´æ¯è·åå½åçè¿æ¯ä¼ è¿æ¥ç ï¼ï¼ï¼ æ¿ä¸å° |
| | | // jsonyolo.insert("ImgUrl","");//å¾åimgè·¯å¾ ï¼ï¼ï¼ æ¿ä¸å° |
| | | // jsonyolo.insert("Image","");//å¿«ç
§ ï¼ï¼ï¼ æ¿ä¸å° |
| | | // jsonyolo.insert("DataType",obj.type);//æ£æµçç±»å |
| | | // jsonyolo.insert("Score",obj.prob);//æ£æµçå¾å |
| | | |
| | | Json::Value t_json; |
| | | t_json["Id"] = str_uuid; //ä¸»é® |
| | | //#todo |
| | | |
| | | t_json["picName"] = "wait todo"; |
| | | t_json["DataType"] = cocoData[obj.type]; |
| | | t_json["Score"] = obj.prob; |
| | | |
| | | t_json["personPicUrl"] = "wait todo";//人åå¾ç store |
| | | t_json["likeDate"] = AppUtil::getTimeSecString();//æ¯è¾æ¶é´ |
| | | t_json["picAddress"] = getProperty("str_addr");//ææå°å |
| | | t_json["picMaxUrl"] = "wait todo";//大å¾è·¯å¾ |
| | | t_json["picLocalUrl"] = "wait todo";//æ¬å°è·¯å¾ |
| | | t_json["picSmUrl"] = strImgUrl;//人åæå°å¾ |
| | | |
| | | // faceRpcElement.setProperty("frame_number", frame_number); |
| | | t_json["picDate"] = getProperty("time"); |
| | | t_json["content"] = "wait todo"; |
| | | t_json["viType"] = "2";//åªæ4ç§ç±»å 1:personface 2:personbody 3:car 4:bicycle 5:none æªç¥ç±»å |
| | | t_json["personIsHub"] = "4";//1: æ¥è¦ 2: å¯ç 3: å®å
¨ 4: æªç¥ |
| | | t_json["videoIp"] = getProperty("local_ip");//å½åæå¡å¨IPå°å |
| | | |
| | | |
| | | t_json["videoNum"] = getProperty("path");//Videç¼å· å¤é® |
| | | t_json["videoReqNum"] = getProperty("dev_id");//Video设å¤ç¼å· |
| | | t_json["ChannlId"] = getProperty("ch_id");//ééid |
| | | t_json["isDelete"] = "1";//é»è®¤1 ,0æ æ 1ææ |
| | | |
| | | t_json["indeviceid"] = appPref.getStringData("fxDevID"); |
| | | t_json["indevicename"] = appPref.getStringData("fxDevNAME"); |
| | | |
| | | DBG(t_json.toStyledString()); |
| | | bool retface = false; |
| | | retface = pManagerEsDB.insertData("yolodet", "info", t_json.toStyledString(), str_uuid); |
| | | if (retface) { |
| | | INFO("facedb success"); |
| | | } else { |
| | | ERR("facedb fail"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | mRealNum=num; |
| | | trackingTrigger->triggerLine(); |
| | | if (triggerMats.size() > 0)fireConnectors("YoloTrigger"); |
| | | fireConnectors(); |
| | | } catch (std::exception &e) { |
| | | ERR(e.what()) |
| | | } |
| | | } |
| | | |
| | | ::YoloDetect::ObjInfos PaYoloRpcElement::getObjects() const { |
| | | return objs; |
| | | } |
| | | |
| | | std::vector<cv::Mat> PaYoloRpcElement::getTriggerMats() { |
| | | return triggerMats; |
| | | } |
| | | |
| | | std::vector<ScoredRect> PaYoloRpcElement::getLastScoreRects() const { |
| | | return trackingTrigger->getLastScoreRects(); |
| | | } |
| | | |
| | | void PaYoloRpcElement::setImage(const cv::Mat &value) { |
| | | if (value.size != image.size) { |
| | | image = cv::Mat(value.rows, value.cols, CV_8UC3, sharedMemory->data()); |
| | | } |
| | | value.copyTo(image); |
| | | } |
| | | |
| | | |
| | | bool PaYoloRpcElement::isInWeekRuleTime() |
| | | { |
| | | |
| | | int nWeek = QDate::currentDate().dayOfWeek(); |
| | | //QString strWeek = getWeekString(nWeek); |
| | | int size=mCfg->ruleWeekInfoVec.size(); |
| | | for(int i = 0;i < size;++i) |
| | | { |
| | | if(mCfg->ruleWeekInfoVec[i].m_nType == nWeek) |
| | | { |
| | | QString strCurrent = QDateTime::currentDateTime().toString("hh:mm"); |
| | | if(strCurrent >= mCfg->ruleWeekInfoVec[i].m_strBegin && strCurrent <= mCfg->ruleWeekInfoVec[i].m_strEnd) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | QJsonArray PaYoloRpcElement::getJsonArrayFromQString(const QString strJson) |
| | | { |
| | | QJsonDocument jsonDocument = QJsonDocument::fromJson(strJson.toLocal8Bit()); |
| | | if( jsonDocument.isNull() ){ |
| | | //DBG("please check the string"<< strJson.toLocal8Bit()); |
| | | return QJsonArray(); |
| | | } |
| | | QJsonArray jsonArray = jsonDocument.array(); |
| | | return jsonArray; |
| | | } |
| | | |
| | | void PaYoloRpcElement::SetRuleCfg(const ControllerConfig* cfg) |
| | | { |
| | | mCfg=cfg; |
| | | if(mCfg) |
| | | { |
| | | |
| | | QJsonArray arrayAreas = getJsonArrayFromQString(mCfg->paAlarmInfo.strMaskPath); |
| | | if(arrayAreas.isEmpty()) |
| | | { |
| | | return;//do not detect |
| | | } |
| | | for(int i = 0;i < arrayAreas.size();++i) |
| | | { |
| | | QJsonValue jsonValue = arrayAreas[i]; |
| | | QJsonObject obj = jsonValue.toObject(); |
| | | int x = obj.value("x").toInt(); |
| | | int y = obj.value("y").toInt(); |
| | | mPolygon<<(QPoint(x,y)); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | int PaYoloRpcElement::getRealNum() const |
| | | { |
| | | return mRealNum; |
| | | } |
| New file |
| | |
| | | #ifndef PAYOLORPCELEMENT_H |
| | | #define PAYOLORPCELEMENT_H |
| | | |
| | | #include <YoloServer.h> |
| | | #include <basic/pipe/PipeElement.h> |
| | | #include <basic/rpc/IceRpc.hpp> |
| | | #include <opencv2/opencv.hpp> |
| | | #include <basic/util/fastdfs/FastFds.hpp> |
| | | #include "../StructureApp/TrackingTrigger.h" |
| | | #include <QtCore/QVector> |
| | | #include <QtCore/QJsonArray> |
| | | #include <QtGui/qpolygon.h> |
| | | class QSharedMemory; |
| | | class ControllerConfig; |
| | | class PaYoloRpcElement : public basic::PipeElement { |
| | | public: |
| | | PaYoloRpcElement(string); |
| | | |
| | | ~PaYoloRpcElement(); |
| | | |
| | | void setImage(const cv::Mat &value); |
| | | |
| | | int getRealNum() const; |
| | | void SetRuleCfg(const ControllerConfig* cfg); |
| | | |
| | | ::YoloDetect::ObjInfos getObjects() const; |
| | | |
| | | std::vector<cv::Mat> getTriggerMats(); |
| | | |
| | | std::vector<ScoredRect> getLastScoreRects() const; |
| | | |
| | | |
| | | |
| | | void setFdfs(FastFdsWithLock *p_fdfsClient) { |
| | | fdfsClient = p_fdfsClient; |
| | | } |
| | | |
| | | private: |
| | | virtual void threadFunc() override; |
| | | bool isInWeekRuleTime(); |
| | | QJsonArray getJsonArrayFromQString(const QString strJson); |
| | | private: |
| | | IceRpcClient<YoloDetect::YoloDetectServerPrx> rpcClient; |
| | | cv::Mat image; |
| | | QSharedMemory *sharedMemory; |
| | | ::YoloDetect::ObjInfos objs; |
| | | TrackingTrigger *trackingTrigger; |
| | | std::vector<cv::Mat> triggerMats; |
| | | ::YoloDetect::stringData cocoData; |
| | | FastFdsWithLock *fdfsClient; |
| | | cv::Mat mask,numMask; |
| | | QString mStrArea; |
| | | QPolygon mPolygon; |
| | | int mRealNum; |
| | | ControllerConfig* mCfg; |
| | | |
| | | }; |
| | | |
| | | #endif // YOLORPCELEMENT_H |
| New file |
| | |
| | | #include <thread> |
| | | #include "AppPaController.h" |
| | | #include <basic/util/file/FileUtil.h> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/debug/Debug.h> |
| | | #include <basic/util/app/AppConfig.h> |
| | | using namespace std; |
| | | |
| | | |
| | | int main(int argc, char **argv) { |
| | | SAVE_APP_ARGS; |
| | | |
| | | #ifdef GLOG |
| | | ENABLEGLOG("./log/"); |
| | | #endif |
| | | |
| | | // std::string src_path = "/home/bsk/development/c++/Qt/QiaoJiaSystem/build/cut/123456/34/201808/28/123456-34-201808-20180828090100"; |
| | | std::string src_path = "/home/basic/è§é¢/test"; |
| | | |
| | | |
| | | appPref.setLongData("gpu.index", 0); |
| | | appPref.setIntData("show.image", 1); |
| | | |
| | | //yolo server |
| | | appPref.setStringData("yolo.proxy", "yoloServer"); |
| | | //#todo |
| | | appPref.setStringData("yolo.ip", ""); |
| | | appPref.setIntData("yolo.port", 10003); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //loopRecord server |
| | | appPref.setStringData("loopRecord.proxy", "LoopRecordVideoServer"); |
| | | //#todo |
| | | appPref.setStringData("loopRecord.ip", ""); |
| | | appPref.setIntData("loopRecord.port", 10010); |
| | | //rpcClient(appPref.getStringData("loopRecord.proxy"), appPref.getStringData("loopRecord.ip"), appPref.getLongData("loopRecord.port"),"tcp"), |
| | | |
| | | appPref.setStringData("ipAdd", "192.168.1.185"); |
| | | appPref.setIntData("ipPort", 9200); |
| | | Json::Value json; |
| | | |
| | | //split sdks enable |
| | | //#todo other sdk |
| | | |
| | | // json["face.enable"] = "1"; |
| | | json["yolo.enable"] = "1"; |
| | | json["rtsp"] = "rtsp://admin:a1234567@192.168.1.188:554/h264/ch1/main/av_stream"; |
| | | // json["rtsp"] = "rtsp://admin:a1234567@192.168.1.188:554/h264/ch1/main/av_stream"; |
| | | // json["rtsp"] = "/home/bsk/test/realtime/test123/201809/27/test123-2018092717/2018-09-27 17:20:57.mp4"; |
| | | |
| | | |
| | | FastFdsWithLock fdfsClient; |
| | | // fdfsClient.fastFds = new FastFds; |
| | | |
| | | //#todo from path get file list |
| | | file_filter_type filter = [](const char *dirName, const char *dirent) { |
| | | return (strstr(dirent, ".mp4") != nullptr);// add format |
| | | }; |
| | | std::vector<std::string> vec = for_each_file(src_path, filter); |
| | | // while (true) { |
| | | auto size = vec.size(); |
| | | // int size = 1; |
| | | int pos = 0; |
| | | |
| | | QVector<RuleWeekInfo> ruleWeekVec; |
| | | for(int i=1;i<=7;++i) |
| | | { |
| | | RuleWeekInfo info; |
| | | info.m_nType=i; |
| | | info.m_strBegin="00:00"; |
| | | info.m_strEnd="23.59"; |
| | | ruleWeekVec.push_back(info); |
| | | } |
| | | |
| | | ControllerConfig cfg; |
| | | cfg.ruleWeekInfoVec.swap(ruleWeekVec); |
| | | cfg.camInfo.strRtsp="rtsp://admin:a1234567@192.168.1.188:554/h264/ch1/main/av_stream"; |
| | | cfg.camInfo.strCamId="1"; |
| | | cfg.paAlarmInfo.nTriggerDelay=25; |
| | | cfg.paAlarmInfo.nAlarmDelay=5; |
| | | // cfg.paAlarmInfo.strMaskPath="/home/basic/aaa/1.png"; |
| | | cfg.paAlarmInfo.strMaskPath="[{\"x\":100,\"y\":6},{\"x\":100,\"y\":1200},{\"x\":1800,\"y\":1200},{\"x\":1800,\"y\":6}]"; |
| | | cfg.paAlarmInfo.fSensitivity=0.5; |
| | | cfg.paAlarmInfo.nAssembleCount=2; |
| | | |
| | | |
| | | |
| | | AppPaController _AppPaController(1, cfg); |
| | | // AppPipeController _AppPipeController(src_path, json); |
| | | _AppPaController.setfdfsClient(&fdfsClient); |
| | | // for (; pos < size;) { |
| | | // |
| | | // //#todo |
| | | // _AppPipeController.resetVideoCapturePath(vec[pos++]); |
| | | // _AppPipeController.resetVideoCapturePath( |
| | | // "/home/basic/work/qiaojia/cut/DS-7808N-SN0820161208AARR691369356WCVU/34/201810/11/DS-7808N-SN0820161208AARR691369356WCVU-34-20181011090000/2018-10-11 09:48:05.mp4"); |
| | | _AppPaController.start(); |
| | | while (_AppPaController.getRunning()) { |
| | | usleep(40000); |
| | | } |
| | | _AppPaController.stop(); |
| | | _AppPaController.wait(); |
| | | DBG("finish file"); |
| | | |
| | | getchar(); |
| | | |
| | | return 0; |
| | | } |
| New file |
| | |
| | | #include "AppController.h" |
| | | #include <basic/util/file/FileUtil.h> |
| | | |
| | | #define VECSIZE 1 |
| | | |
| | | AppController::AppController(std::string path, int interval) : TimerElement(interval), m_path(path), |
| | | func_cond_mutex(PTHREAD_MUTEX_INITIALIZER), |
| | | func_cond(PTHREAD_COND_INITIALIZER) { |
| | | file_filter_type filter = [](const char *dirName, const char *dirent) { |
| | | return (strstr(dirent, ".mp4") != nullptr);// add format |
| | | }; |
| | | |
| | | std::string tmp = path; |
| | | m_pathOut = tmp.replace(tmp.begin() + tmp.find("/load"), tmp.begin() + tmp.find("/load") + 5, "/cut"); |
| | | // DBG("m_pathOut is " << m_pathOut); |
| | | |
| | | std::vector<std::string> vec = for_each_file(m_path, filter); |
| | | |
| | | INFO(path << " vec size : " << vec.size()); |
| | | |
| | | for (int i = 0; i < vec.size(); ++i) { |
| | | m_que.push(vec[i]); |
| | | } |
| | | |
| | | if (vec.size() >= VECSIZE) { |
| | | m_vec.resize(VECSIZE); |
| | | } else { |
| | | m_vec.resize(vec.size()); |
| | | } |
| | | |
| | | for (int i = 0; i < m_vec.size(); ++i) { |
| | | m_vec[i] = nullptr; |
| | | } |
| | | } |
| | | |
| | | RapidAppPipeController *AppController::addController() { |
| | | RapidAppPipeController *p = nullptr; |
| | | std::lock_guard<std::mutex> lg(mtx); |
| | | std::string strPath; |
| | | Json::Value value; |
| | | if (!m_que.empty()) { |
| | | strPath = m_que.front(); |
| | | value["rtsp"] = strPath; |
| | | m_que.pop(); |
| | | p = new RapidAppPipeController(m_nIndex, value, m_pathOut); |
| | | p->start(); |
| | | m_nIndex++; |
| | | } |
| | | return p; |
| | | } |
| | | |
| | | std::string AppController::startController() { |
| | | start(); |
| | | pthread_mutex_lock(&func_cond_mutex); |
| | | // INFO("before wait" << m_path); |
| | | pthread_cond_wait(&func_cond, &func_cond_mutex); |
| | | int m_t_size = m_vec.size(); |
| | | for (int i = 0; i < m_vec.size(); ++i) { |
| | | if (m_vec[i] == nullptr) { |
| | | continue; |
| | | } |
| | | while (m_vec[i]->getIsRunning()) { |
| | | usleep(40000); |
| | | } |
| | | m_vec[i]->stop(); |
| | | m_vec[i]->wait(); |
| | | delete m_vec[i]; |
| | | m_vec[i] = nullptr; |
| | | m_t_size--; |
| | | } |
| | | // INFO("after wait" << m_path); |
| | | pthread_mutex_unlock(&func_cond_mutex); |
| | | wait(); |
| | | // DBG("cut ok ;m_pathOut is " << m_pathOut); |
| | | return m_pathOut; |
| | | } |
| | | |
| | | void AppController::timerFunc() { |
| | | if (m_que.empty()) { |
| | | // INFO("before signal " << m_path); |
| | | stop(); |
| | | pthread_cond_signal(&func_cond); |
| | | // INFO("after signal" << m_path); |
| | | return; |
| | | } |
| | | |
| | | for (int i = 0; i < m_vec.size(); ++i) { |
| | | if (m_vec[i] == nullptr) { |
| | | m_vec[i] = addController(); |
| | | continue; |
| | | } |
| | | |
| | | if (!m_vec[i]->getIsRunning()) { |
| | | |
| | | m_vec[i]->stop(); |
| | | m_vec[i]->wait(); |
| | | |
| | | delete m_vec[i]; |
| | | // std::string cmd = "rm -rf \""; |
| | | // cmd.append(m_vec[i]->getPath()).append("\" & "); |
| | | // system(cmd.c_str()); |
| | | m_vec[i] = nullptr; |
| | | |
| | | m_vec[i] = addController(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //if (!m_que.empty()) |
| | | //{ |
| | | // strPath = m_que.pop(); |
| | | //}else |
| | | //{ |
| | | // return; |
| | | //} |
| | | //value["rtsp"] = strPath; |
| | | |
| | | //std::string strPath; |
| | | //Json::Value value; |
| | | |
| | | //m_vec[i] = new RapidAppPipeController(m_nIndex,strPath); |
| | | //m_vec[i]->start(); |
| | | |
| | | //m_vec[i]->stop(); |
| | | //m_vec[i]->wait(); |
| | | |
| | | //delete m_vec[i]; |
| | | //m_vec[i] = nullptr; |
| | | |
| | | //m_vec[i] = new RapidAppPipeController(m_nIndex,strPath); |
| | | //m_vec[i]->start(); |
| New file |
| | |
| | | #ifndef APPCONTROLLER_H |
| | | #define APPCONTROLLER_H |
| | | |
| | | #include <basic/pipe/TimerElement.h> |
| | | #include <queue> |
| | | #include "RapidAppPipeController.h" |
| | | #include <condition_variable> |
| | | #include <mutex> |
| | | |
| | | class AppController : public TimerElement { |
| | | public: |
| | | AppController(std::string path, int interval); |
| | | |
| | | RapidAppPipeController *addController(); |
| | | |
| | | std::string startController(); |
| | | |
| | | private: |
| | | virtual void timerFunc() override; |
| | | |
| | | private: |
| | | std::string m_path; |
| | | std::string m_pathOut; |
| | | std::queue<std::string> m_que; |
| | | std::vector<RapidAppPipeController *> m_vec; |
| | | |
| | | bool m_state; |
| | | |
| | | int m_nIndex; |
| | | std::mutex mtx; |
| | | |
| | | pthread_cond_t func_cond; |
| | | pthread_mutex_t func_cond_mutex; |
| | | |
| | | }; |
| | | |
| | | #endif // APPCONTROLLER_H |
| New file |
| | |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(RapidStructureApp) |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build) |
| | | set(CMAKE_CXX_STANDARD 11) |
| | | #set(CMAKE_BUILD_TYPE debug) |
| | | add_compile_options(-fPIC) |
| | | add_definitions(-DDEBUG_ERR -DDEBUG_INFO) |
| | | |
| | | SET(SOURCES |
| | | RapidAppPipeController.cpp |
| | | VideoMoveCaptureElement.cpp |
| | | VideoChangeScore.cpp |
| | | TriggerElement.cpp |
| | | AppController.cpp |
| | | ../../BasicPlatForm/basic/pipe_element/ImageFactoryElement.cpp |
| | | ../../BasicPlatForm/basic/pipe/TimerElement.cpp |
| | | ../../BasicPlatForm/basic/util/file/FileUtil.cpp |
| | | ../../BasicPlatForm/basic/pipe_element/ffmpeg/ffmpegRecoder/FileRecorder.cpp |
| | | ) |
| | | |
| | | SET(LIBS |
| | | Ice |
| | | opencv_world |
| | | avformat |
| | | avcodec |
| | | swresample |
| | | swscale |
| | | avutil |
| | | bz2 dl z |
| | | Qt5Core |
| | | pthread |
| | | jsoncpp |
| | | ) |
| | | |
| | | include_directories( |
| | | ../VptServer/rpc |
| | | ../YoloServer/rpc |
| | | ../FaceDetectServer/rpc |
| | | ../StructureApp |
| | | ../../BasicPlatForm |
| | | ../../BasicPlatForm/libs/opencv/include |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/include |
| | | ../../BasicPlatForm/libs/ffmpeg/include |
| | | ../../BasicPlatForm/libs/jsoncpp/include |
| | | ../../BasicPlatForm/basic/pipe/ |
| | | /usr/include/x86_64-linux-gnu/qt5 |
| | | ) |
| | | |
| | | link_directories( |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/lib64 |
| | | ../../BasicPlatForm/libs/openssl/lib |
| | | ../../BasicPlatForm/libs/opencv/lib |
| | | ../../BasicPlatForm/libs/ffmpeg/lib |
| | | ../../BasicPlatForm/libs/jsoncpp/lib |
| | | ) |
| | | |
| | | add_executable(${PROJECT_NAME} |
| | | main.cpp |
| | | ${SOURCES} |
| | | ) |
| | | |
| | | target_link_libraries(${PROJECT_NAME} |
| | | ${LIBS} |
| | | ) |
| | | |
| | | |
| | | add_executable(${PROJECT_NAME}Rtsp |
| | | mainRtsp.cpp |
| | | ${SOURCES} |
| | | ) |
| | | |
| | | target_link_libraries(${PROJECT_NAME}Rtsp |
| | | ${LIBS} |
| | | ) |
| New file |
| | |
| | | #include "RapidAppPipeController.h" |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/util/app/AppUtil.h> |
| | | |
| | | //#include <sstream> |
| | | #include <algorithm> |
| | | |
| | | RapidAppPipeController::RapidAppPipeController(int index, const Json::Value &json, const std::string &outPath) : |
| | | videoCaptureElement(json["rtsp"].asString(), outPath, 25, -1, 0),//appPref.getLongData("gpu.index") |
| | | index(index), bUp(false), m_json(json), |
| | | /*yoloRpcElement(to_string(index)+"yoloRpc"),*/triggerElement(0, 3) { |
| | | videoCaptureElement.registerConnector([&] { |
| | | if (videoCaptureElement.getChangeLevel() > 40) { |
| | | triggerElement.setState(true); |
| | | } else if (videoCaptureElement.getChangeLevel() < 20) { |
| | | triggerElement.setState(false); |
| | | } |
| | | |
| | | triggerElement.triggerOnce(); |
| | | |
| | | if (triggerElement.getState()) { |
| | | videoCaptureElement.setOutPutInterval(1); |
| | | } else { |
| | | videoCaptureElement.setOutPutInterval(25); |
| | | } |
| | | |
| | | if (triggerElement.getTriggerState()) { |
| | | if (!bUp) { |
| | | bUp = true; |
| | | // DBG(videoCaptureElement.getOutPutIndex()); |
| | | videoCaptureElement.startRecord(videoCaptureElement.getOutPutIndex()); |
| | | } else { |
| | | //#TODO |
| | | auto it = (videoCaptureElement.getOutPutIndex() - videoCaptureElement.getM_nFrame()) / 25; |
| | | // DBG("tes t " << it); |
| | | if (it > (60 * 5)) { |
| | | // DBG("test"); |
| | | bUp = false; |
| | | videoCaptureElement.endRecord(videoCaptureElement.getOutPutIndex()); |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | if (bUp) { |
| | | bUp = false; |
| | | // DBG(videoCaptureElement.getOutPutIndex()); |
| | | videoCaptureElement.endRecord(videoCaptureElement.getOutPutIndex()); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | triggerElement.registerConnector([&] { |
| | | switch (triggerElement.getTriggerType()) { |
| | | case UP: |
| | | // DBG("UP"); |
| | | break; |
| | | case DOWN: |
| | | // DBG("DOWN"); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | registerElement(videoCaptureElement); |
| | | // if(appPref.getStringData("yolo.enable")=="1"){ |
| | | // registerElement(yoloRpcElement); |
| | | // } |
| | | //registerElement(yoloRpcElement); |
| | | //registerElement(imageDrawElement); |
| | | registerElement(triggerElement); |
| | | |
| | | videoCaptureElement.setOutPutInterval(1); |
| | | } |
| | | |
| | | bool RapidAppPipeController::getIsRunning() const { |
| | | return videoCaptureElement.isRunning(); |
| | | } |
| | | |
| | | RapidAppPipeController::~RapidAppPipeController() { |
| | | |
| | | } |
| | | |
| | | std::string RapidAppPipeController::getPath() { |
| | | return m_json["rtsp"].asString(); |
| | | } |
| New file |
| | |
| | | #ifndef RAPIDAPPPIPECONTROLLER_H |
| | | #define RAPIDAPPPIPECONTROLLER_H |
| | | |
| | | #include <basic/pipe/PipeController.h> |
| | | #include <basic/pipe_element/ImageShowElement.h> |
| | | #include "VideoMoveCaptureElement.h" |
| | | #include "TriggerElement.h" |
| | | #include <jsoncpp/json/json.h> |
| | | |
| | | class RapidAppPipeController : public PipeController { |
| | | public: |
| | | RapidAppPipeController(int index, const Json::Value &json, const std::string &outPath); |
| | | |
| | | virtual ~RapidAppPipeController(); |
| | | |
| | | bool getIsRunning() const; |
| | | |
| | | std::string getPath(); |
| | | |
| | | private: |
| | | VideoMoveCaptureElement videoCaptureElement; |
| | | TriggerElement triggerElement; |
| | | int index; |
| | | bool bUp; |
| | | Json::Value m_json; |
| | | }; |
| | | |
| | | #endif // RAPIDAPPPIPECONTROLLER_H |
| New file |
| | |
| | | #include "TriggerElement.h" |
| | | |
| | | TriggerElement::TriggerElement(long tolerance, long delay) : |
| | | state(false), |
| | | // TimerElement(1), |
| | | triggerState(false), |
| | | tolerance(tolerance), delay(delay), |
| | | triggerType(DOWN), triggerTimes(0),lastDown(0),lastUp(0) { |
| | | |
| | | } |
| | | |
| | | TriggerElement::~TriggerElement() { |
| | | |
| | | } |
| | | |
| | | bool TriggerElement::getState() const { |
| | | return state; |
| | | } |
| | | |
| | | void TriggerElement::setState(bool value) { |
| | | state = value; |
| | | } |
| | | |
| | | TriggerType TriggerElement::getTriggerType() const { |
| | | return triggerType; |
| | | } |
| | | |
| | | void TriggerElement::triggerOnce() { |
| | | triggerTimes++; |
| | | if (state) { |
| | | lastUp = triggerTimes; |
| | | if (!triggerState) { |
| | | if (triggerTimes - lastDown > tolerance) { |
| | | triggerType = UP; |
| | | triggerState = true; |
| | | fireConnectors(); |
| | | } |
| | | } |
| | | } else { |
| | | lastDown = triggerTimes; |
| | | if (triggerState) { |
| | | if (triggerTimes - lastUp > delay) { |
| | | triggerType = DOWN; |
| | | triggerState = false; |
| | | fireConnectors(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | void TriggerElement::triggerOnce(bool ret_notused) { |
| | | triggerTimes++; |
| | | if (state) { |
| | | lastUp = triggerTimes; |
| | | if (!triggerState) { |
| | | if (triggerTimes - lastDown > tolerance) { |
| | | triggerType = UP; |
| | | triggerState = true; |
| | | } |
| | | } |
| | | } else { |
| | | lastDown = triggerTimes; |
| | | if (triggerState) { |
| | | if (triggerTimes - lastUp > delay) { |
| | | triggerType = DOWN; |
| | | triggerState = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | bool TriggerElement::getTriggerState() const { |
| | | return triggerState; |
| | | } |
| | | |
| | | void TriggerElement::threadInitial() { |
| | | lastUp = 0; |
| | | lastDown = 0; |
| | | triggerType = DOWN; |
| | | } |
| | | |
| | | |
| | | void TriggerElement::timerFunc() { |
| | | |
| | | } |
| | | |
| | | void TriggerElement::threadClosing() { |
| | | |
| | | } |
| New file |
| | |
| | | #ifndef TRIGGERELEMENT_H |
| | | #define TRIGGERELEMENT_H |
| | | |
| | | #include <mutex> |
| | | #include <opencv2/opencv.hpp> |
| | | #include <basic/pipe/TimerElement.h> |
| | | #include <atomic> |
| | | |
| | | enum TriggerType { |
| | | UP = 0, DOWN |
| | | }; |
| | | |
| | | class TriggerElement : public basic::PipeElement { |
| | | |
| | | public: |
| | | TriggerElement(long tolerance = 0, long delay = 0); |
| | | |
| | | virtual ~TriggerElement(); |
| | | |
| | | bool getState() const; |
| | | |
| | | void setState(bool value); |
| | | |
| | | TriggerType getTriggerType() const; |
| | | |
| | | void triggerOnce(); |
| | | |
| | | void triggerOnce(bool); |
| | | |
| | | bool getTriggerState() const; |
| | | |
| | | private: |
| | | bool state; |
| | | bool triggerState; |
| | | long tolerance; |
| | | long delay; |
| | | long lastDown; |
| | | long lastUp; |
| | | long triggerTimes; |
| | | TriggerType triggerType; |
| | | |
| | | private: |
| | | |
| | | virtual void threadInitial() override; |
| | | |
| | | virtual void timerFunc(); |
| | | |
| | | virtual void threadClosing() override; |
| | | }; |
| | | |
| | | #endif // TRIGGERELEMENT_H |
| New file |
| | |
| | | #include "VideoChangeScore.h" |
| | | |
| | | VideoChangeScore::VideoChangeScore() { |
| | | |
| | | } |
| | | |
| | | int VideoChangeScore::EvalChange(cv::Mat &image) { |
| | | if (image.empty())return 0; |
| | | |
| | | cv::blur(image, image, cv::Size(16, 9)); |
| | | if (backGround.empty()) { |
| | | image.copyTo(backGround); |
| | | } else { |
| | | backGround = image * 0.1 + backGround * 0.9; |
| | | } |
| | | cv::absdiff(image, backGround, change); |
| | | double min, max; |
| | | cv::minMaxLoc(change, &min, &max); |
| | | return max; |
| | | } |
| | | |
| | | cv::Mat VideoChangeScore::getBackGround() const { |
| | | return backGround; |
| | | } |
| | | |
| | | cv::Mat VideoChangeScore::getChange() const { |
| | | return change; |
| | | } |
| New file |
| | |
| | | #ifndef VIDEOCHANGESCORE_H |
| | | #define VIDEOCHANGESCORE_H |
| | | |
| | | #include <opencv2/opencv.hpp> |
| | | |
| | | class VideoChangeScore { |
| | | public: |
| | | VideoChangeScore(); |
| | | |
| | | int EvalChange(cv::Mat &image); |
| | | |
| | | cv::Mat getBackGround() const; |
| | | |
| | | cv::Mat getChange() const; |
| | | |
| | | private: |
| | | cv::Mat change; |
| | | cv::Mat temp; |
| | | cv::Mat backGround; |
| | | }; |
| | | |
| | | #endif // VIDEOCHANGESCORE_H |
| New file |
| | |
| | | #include "VideoMoveCaptureElement.h" |
| | | //#include <basic/pipe_element/ffmpeg/cap_ffmpeg_impl.hpp> |
| | | //#todo |
| | | #include <basic/pipe_element/ffmpeg/FfmpegElement.cpp> |
| | | #include <QtCore/QStringList> |
| | | #include <QtCore/QDateTime> |
| | | #include <unistd.h> |
| | | #include <basic/pipe_element/ffmpeg/ffmpegRecoder/FileRecorder.h> |
| | | |
| | | VideoMoveCaptureElement::VideoMoveCaptureElement(const std::string &path, const std::string &outPath, |
| | | int fps, int reOpenTime, int gpuIndex) : |
| | | basic::PipeElement(false), path(path), m_pathOut(outPath), gpuIndex(gpuIndex), |
| | | reopenTime(reOpenTime), outPutInterval(25), outPutIndex(0), bYoloDetect(false) //TODO25 |
| | | { |
| | | |
| | | } |
| | | |
| | | void VideoMoveCaptureElement::threadFunc() { |
| | | // _timer.reset(); |
| | | usleep(1); |
| | | u_char *data; |
| | | int width = 0, height = 0, step = 0, cn = 0; |
| | | bool ret = capture->grabFrame(); |
| | | if (!ret) { |
| | | if (reopenTime < 0) { |
| | | stop(); |
| | | INFO("grabFrame faild, element stopping" << path); |
| | | //INFO(_timerTotal.tell_ms()); |
| | | return; |
| | | } else { |
| | | usleep(reopenTime * 1000); |
| | | INFO("grabFrame faild, try reopen video: " << path); |
| | | openVideo(); |
| | | ret = capture->grabFrame(); |
| | | if (!ret)return; |
| | | } |
| | | } |
| | | |
| | | // DBG(_timer.tell_ns()); |
| | | if (outPutInterval > 0 && (outPutIndex++ % outPutInterval != 0)) { |
| | | return; |
| | | } |
| | | |
| | | capture->retrieveFrame(0, &data, &step, &width, &height, &cn); |
| | | try { |
| | | cv::Mat img(height, width, CV_8UC3, data, step); |
| | | cv::resize(img, image, cv::Size(192, 108), 0, 0, cv::INTER_LINEAR); |
| | | nChangeLevel = videoChangeScore.EvalChange(image); |
| | | } catch (std::exception ex) { |
| | | ERR("ex is " << ex.what()); |
| | | } |
| | | |
| | | |
| | | |
| | | // DBG(nChangeLevel); |
| | | |
| | | fireConnectors(); |
| | | |
| | | } |
| | | |
| | | int VideoMoveCaptureElement::getOutPutInterval() const { |
| | | return outPutInterval; |
| | | } |
| | | |
| | | void VideoMoveCaptureElement::setOutPutInterval(int value) { |
| | | outPutInterval = value; |
| | | } |
| | | |
| | | cv::Mat VideoMoveCaptureElement::getImage() const { |
| | | return image; |
| | | } |
| | | |
| | | void VideoMoveCaptureElement::openVideo() { |
| | | if (gpuIndex >= 0) { |
| | | setenv("CUDA_VISIBLE_DEVICES", std::to_string(gpuIndex).c_str(), 0); |
| | | } |
| | | capture->open(path.c_str(), gpuIndex >= 0); |
| | | } |
| | | |
| | | int VideoMoveCaptureElement::getOutPutIndex() const { |
| | | return outPutIndex; |
| | | } |
| | | |
| | | void VideoMoveCaptureElement::startRecord(int startFrame) { |
| | | m_nFrame = startFrame; |
| | | } |
| | | |
| | | void VideoMoveCaptureElement::endRecord(int endFrame) { |
| | | int startSec = m_nFrame / outPutInterval; |
| | | int endSec = endFrame / outPutInterval; |
| | | |
| | | std::string start = std::to_string(startSec); |
| | | std::string end = std::to_string(endSec); |
| | | |
| | | QString strPath = QString::fromStdString(path); |
| | | QStringList list = strPath.split("/"); |
| | | QString fileName; |
| | | QString time; |
| | | QString strNewTime; |
| | | if (list.size() != 0) { |
| | | fileName = list.last(); |
| | | time = fileName.split(".").first(); |
| | | //#todo |
| | | // time = fileName.split("_").first(); |
| | | } else { |
| | | ERR("list.size() == 0)"); |
| | | } |
| | | |
| | | if (!time.isEmpty()) { |
| | | QDateTime dt = QDateTime::fromString(time, "yyyy-MM-dd hh:mm:ss"); |
| | | int second = m_nFrame / outPutInterval; |
| | | qint64 newTime = dt.toMSecsSinceEpoch() + second * 1000; |
| | | QDateTime newDt = QDateTime::fromMSecsSinceEpoch(newTime); |
| | | strNewTime = newDt.toString("yyyy-MM-dd hh:mm:ss"); |
| | | } |
| | | |
| | | //#todo m_pathOut + / |
| | | QString strNewPath = QString(m_pathOut.c_str()) + "/" + strNewTime + QString(".mp4"); |
| | | |
| | | fileRecord(path.c_str(), start.c_str(), endSec - startSec, strNewPath.toStdString().c_str()); |
| | | } |
| | | |
| | | bool VideoMoveCaptureElement::getBYoloDetect() const { |
| | | return bYoloDetect; |
| | | } |
| | | |
| | | int VideoMoveCaptureElement::getChangeLevel() const { |
| | | return nChangeLevel; |
| | | } |
| | | |
| | | void VideoMoveCaptureElement::threadInitial() { |
| | | capture = new CvCapture_FFMPEG; |
| | | openVideo(); |
| | | //_timerTotal.reset(); |
| | | } |
| | | |
| | | void VideoMoveCaptureElement::threadClosing() { |
| | | capture->close(); |
| | | delete capture; |
| | | capture = nullptr; |
| | | } |
| | | |
| | | int VideoMoveCaptureElement::getM_nFrame() const { |
| | | return m_nFrame; |
| | | } |
| New file |
| | |
| | | #ifndef VIDEOMOVECAPTUREELEMENT_H |
| | | #define VIDEOMOVECAPTUREELEMENT_H |
| | | |
| | | #include <basic/pipe/TimerElement.h> |
| | | #include <opencv2/opencv.hpp> |
| | | #include "VideoChangeScore.h" |
| | | |
| | | //#include <basic/pipe/my_timer.hpp> |
| | | |
| | | struct CvCapture_FFMPEG; |
| | | struct CvVideoWriter_FFMPEG; |
| | | |
| | | class VideoMoveCaptureElement : public basic::PipeElement { |
| | | public: |
| | | VideoMoveCaptureElement(const std::string &path, const std::string &outPath, |
| | | int fps = 30, int reOpenTime = -1, int gpuIndex = -1 |
| | | ); |
| | | |
| | | cv::Mat getImage() const; |
| | | |
| | | int getOutPutInterval() const; |
| | | |
| | | void setOutPutInterval(int value); |
| | | |
| | | int getChangeLevel() const; |
| | | |
| | | bool getBYoloDetect() const; |
| | | |
| | | int getOutPutIndex() const; |
| | | |
| | | void startRecord(int startFrame);//too large?no int? |
| | | |
| | | void endRecord(int endFrame); |
| | | |
| | | private: |
| | | void threadFunc(); |
| | | |
| | | void threadInitial(); |
| | | |
| | | void threadClosing(); |
| | | |
| | | void openVideo(); |
| | | |
| | | private: |
| | | CvCapture_FFMPEG *capture; |
| | | std::string path; |
| | | std::string m_pathOut; |
| | | cv::Mat image; |
| | | int gpuIndex; |
| | | int outPutIndex; |
| | | int outPutInterval; |
| | | int reopenTime; |
| | | |
| | | VideoChangeScore videoChangeScore; |
| | | int nChangeLevel; |
| | | |
| | | bool bYoloDetect; |
| | | |
| | | int m_nFrame; |
| | | public: |
| | | int getM_nFrame() const; |
| | | |
| | | // my_module_space::Timer _timer; |
| | | // my_module_space::Timer _timerTotal; |
| | | }; |
| | | |
| | | #endif // VIDEOMOVECAPTUREELEMENT_H |
| New file |
| | |
| | | #include <iostream> |
| | | #include "AppController.h" |
| | | |
| | | |
| | | using namespace std; |
| | | |
| | | int main(int argc, char **argv) { |
| | | |
| | | vector<string> vec; |
| | | vec.push_back("/home/bsk/test/1/load/"); |
| | | // vec.push_back("/home/bsk/2/load/"); |
| | | |
| | | // while (true) { |
| | | |
| | | for (int i = 0; i < vec.size(); ++i) { |
| | | AppController _AppController(vec[i], 5000); |
| | | auto str_Path = _AppController.startController(); |
| | | } |
| | | // } |
| | | |
| | | |
| | | // appController->wait(); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | // value["rtsp"] = "rtsp://admin:a1234567@192.168.1.202:554/h264/ch1/main/av_stream"; |
| | | |
| | | // cv::VideoCapture capture; |
| | | // int frameCount =0; |
| | | // capture.open("/home/basic/è§é¢/output.mp4"); |
| | | // while (capture.grab()) { |
| | | // frameCount++; |
| | | // } |
| | | // cout << "total time: "<<frameCount/25<<"s"<<endl; |
| New file |
| | |
| | | #include <iostream> |
| | | #include "AppController.h" |
| | | |
| | | #include <basic/util/file/FileUtil.h> |
| | | |
| | | using namespace std; |
| | | |
| | | int main(int argc, char **argv) { |
| | | |
| | | std::string strOutPath = "/home/bsk/test/"; |
| | | std::string strPath = "rtsp://admin:a1234567@192.168.1.201:554/h264/ch1/main/av_stream";; |
| | | Json::Value value; |
| | | value["rtsp"] = strPath; |
| | | RapidAppPipeController p(0, value, strOutPath); |
| | | p.start(); |
| | | // getchar(); |
| | | |
| | | while (p.getIsRunning()) { |
| | | usleep(40000); |
| | | } |
| | | p.stop(); |
| | | p.wait(); |
| | | return 0; |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(RecordVideo) |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build) |
| | | set(CMAKE_CXX_STANDARD 11) |
| | | set(CMAKE_BUILD_TYPE debug) |
| | | find_package(Qt5Core) |
| | | add_definitions(-DDEBUG_ERR -DDEBUG_INFO) |
| | | add_definitions(-DGLOG) |
| | | add_compile_options(-fPIC) |
| | | |
| | | SET(SOURCES |
| | | rpc/RecordVideo.cpp |
| | | RecordVideoI.cpp |
| | | ImageGrabberI.cpp |
| | | LoopRecordVideoI.cpp |
| | | LoopVideoRecorder.cpp |
| | | ../VideoServer/QiaoJia/DB/LDBTool.cpp |
| | | ./VideoRecorder.cpp |
| | | ./CommonFFmpegFunc.hpp |
| | | ../../BasicPlatForm/basic/util/opencv/CvUtil.cpp |
| | | ../../BasicPlatForm/basic/util/app/AppConfig.h |
| | | ../../BasicPlatForm/basic/util/app/AppPreference.hpp |
| | | ../../BasicPlatForm/basic/util/fastdfs/FastdfsClient.cpp |
| | | ../../BasicPlatForm/basic/pipe/TimerElement.cpp |
| | | ) |
| | | |
| | | SET(LIBS |
| | | glog |
| | | Ice |
| | | opencv_world |
| | | avformat |
| | | avcodec |
| | | swresample |
| | | swscale |
| | | avutil |
| | | bz2 dl z |
| | | Qt5Core |
| | | pthread |
| | | fastcommon |
| | | fdfsclient |
| | | jsoncpp |
| | | Qt5Core |
| | | Qt5Sql |
| | | uuid |
| | | ) |
| | | |
| | | include_directories( |
| | | ./rpc |
| | | ../../BasicPlatForm |
| | | ../../BasicPlatForm/libs/opencv/include |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/include |
| | | ../../BasicPlatForm/libs/ffmpeg/include |
| | | ../../BasicPlatForm/libs/FastDFS/include/fastcommon |
| | | ../../BasicPlatForm/libs/FastDFS/include/fastdfs |
| | | ../../BasicPlatForm/basic/pipe_element/ffmpeg/ffmpegRecoder |
| | | ../../BasicPlatForm/basic/pipe |
| | | ../../BasicPlatForm/libs/jsoncpp/include |
| | | ../../BasicPlatForm/libs/glog/include |
| | | ../../BasicPlatForm/libs/libuuid/include |
| | | |
| | | /usr/include/x86_64-linux-gnu/qt5 |
| | | /usr/include/x86_64-linux-gnu/qt5/QtCore/ |
| | | /usr/include/x86_64-linux-gnu/qt5/QtSql/ |
| | | #glog |
| | | ../../BasicPlatForm/libs/glog/include |
| | | ) |
| | | |
| | | link_directories( |
| | | #glog |
| | | ../../BasicPlatForm/libs/glog/lib |
| | | ../../BasicPlatForm/libs/Ice-3.7.0/lib64 |
| | | ../../BasicPlatForm/libs/opencv/lib |
| | | ../../BasicPlatForm/libs/ffmpeg/lib |
| | | ../../BasicPlatForm/libs/FastDFS/lib |
| | | ../../BasicPlatForm/libs/openssl/lib |
| | | ../../BasicPlatForm/libs/jsoncpp/lib |
| | | ../../BasicPlatForm/libs/libuuid/lib |
| | | ) |
| | | |
| | | |
| | | add_executable(${PROJECT_NAME} |
| | | main.cpp |
| | | ${SOURCES} |
| | | ) |
| | | |
| | | target_link_libraries(${PROJECT_NAME} |
| | | ${LIBS} |
| | | ) |
| New file |
| | |
| | | #ifndef COMMONFFMPEGFUNC_HPP |
| | | #define COMMONFFMPEGFUNC_HPP |
| | | |
| | | #include <basic/debug/Debug.h> |
| | | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | | #endif |
| | | |
| | | #include <libavcodec/avcodec.h> |
| | | #include <libavdevice/avdevice.h> |
| | | #include <libavformat/avformat.h> |
| | | #include <libavfilter/avfilter.h> |
| | | #include <libavutil/avutil.h> |
| | | #include <libswscale/swscale.h> |
| | | |
| | | #include <stdlib.h> |
| | | #include <stdio.h> |
| | | #include <string.h> |
| | | #include <math.h> |
| | | |
| | | |
| | | #ifdef __cplusplus |
| | | } |
| | | #endif |
| | | |
| | | class CommonFFmpeg |
| | | { |
| | | public: |
| | | CommonFFmpeg():m_pInFmtCtx(nullptr),m_pInVideoStream(nullptr),m_pDict(nullptr){} |
| | | ~CommonFFmpeg(){} |
| | | |
| | | public: |
| | | void init() |
| | | { |
| | | av_register_all(); |
| | | avformat_network_init(); |
| | | } |
| | | int rtspInputOpen(const char* rtsp) |
| | | { |
| | | av_dict_set(&m_pDict, "rtsp_transport", "tcp", 0); |
| | | int ret = avformat_open_input(&m_pInFmtCtx, rtsp, NULL, &m_pDict); |
| | | if (ret!=0) |
| | | { |
| | | fprintf(stderr, "could not open input file, ret: %d,info: %x\n",ret,AVERROR(ret)); |
| | | return ret; |
| | | } |
| | | ret = avformat_find_stream_info(m_pInFmtCtx, NULL); |
| | | if (ret<0) |
| | | { |
| | | fprintf(stderr, "could not find stream info\n"); |
| | | return ret; |
| | | } |
| | | |
| | | /* find first video stream */ |
| | | for (unsigned i=0; i<m_pInFmtCtx->nb_streams; i++) |
| | | { |
| | | if (m_pInFmtCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) |
| | | { |
| | | m_pInVideoStream = m_pInFmtCtx->streams[i]; |
| | | break; |
| | | } |
| | | } |
| | | if (m_pInVideoStream == NULL) |
| | | { |
| | | fprintf(stderr, "didn't find any video stream\n"); |
| | | return -1; |
| | | } |
| | | return 0; |
| | | } |
| | | void rtspInputClose() |
| | | { |
| | | if(m_pInFmtCtx!=nullptr) |
| | | avformat_close_input(&m_pInFmtCtx); |
| | | if(m_pDict!=nullptr) |
| | | av_dict_free(&m_pDict); |
| | | } |
| | | |
| | | void* rtspCreatePkg() |
| | | { |
| | | //g_pkg.lock(); |
| | | mutex().lock(); |
| | | AVPacket* pkt = nullptr; |
| | | try{pkt=new AVPacket();av_init_packet(pkt);} |
| | | catch (...){if(pkt!=nullptr){delete pkt;pkt=nullptr;}} |
| | | //g_pkg.unlock(); |
| | | mutex().unlock(); |
| | | return pkt; |
| | | } |
| | | void rtspDestroyPkg(void* packet) |
| | | { |
| | | mutex().lock(); |
| | | if(packet!=nullptr) |
| | | { |
| | | AVPacket* pkg = static_cast<AVPacket*>(packet); |
| | | av_free_packet(pkg); |
| | | delete pkg; |
| | | pkg = nullptr; |
| | | } |
| | | mutex().unlock(); |
| | | } |
| | | |
| | | int rtspReadPkg(void* packet) |
| | | { |
| | | mutex().lock(); |
| | | int ret = -1; |
| | | if(packet!=nullptr) |
| | | { |
| | | AVPacket* pkg = static_cast<AVPacket*>(packet); |
| | | ret = av_read_frame(m_pInFmtCtx, pkg); |
| | | } |
| | | mutex().unlock(); |
| | | return ret; |
| | | } |
| | | |
| | | void* getRtspStream() |
| | | { |
| | | return (void*)m_pInVideoStream; |
| | | } |
| | | |
| | | int fileOutOpen(const char* filename,void* inStream) |
| | | { |
| | | AVStream* pInstream = (AVStream*)inStream; |
| | | if(pInstream==nullptr) |
| | | {DBG("instream is null");return -1;} |
| | | int ret = avformat_alloc_output_context2(&m_pOutFmtCtx, NULL, NULL, filename); |
| | | if(ret<0) |
| | | { |
| | | fprintf(stderr, "avformat_alloc_output_context2 failed, errorCode: %d\n",AVERROR(ret)); |
| | | return -1; |
| | | } |
| | | /* |
| | | * since all input files are supposed to be identical (framerate, dimension, color format, ...) |
| | | * we can safely set output codec values from first input file |
| | | */ |
| | | m_pOutVideo_stream = avformat_new_stream(m_pOutFmtCtx, NULL); |
| | | { |
| | | AVCodecContext *c; |
| | | c = m_pOutVideo_stream->codec; |
| | | c->bit_rate = 400000; |
| | | c->codec_id = pInstream->codec->codec_id; |
| | | c->codec_type = pInstream->codec->codec_type; |
| | | c->time_base.num = pInstream->time_base.num; |
| | | c->time_base.den = pInstream->time_base.den; |
| | | fprintf(stderr, "time_base.num = %d time_base.den = %d\n", c->time_base.num, c->time_base.den); |
| | | c->width = pInstream->codec->width; |
| | | c->height = pInstream->codec->height; |
| | | c->pix_fmt = pInstream->codec->pix_fmt; |
| | | printf("%d %d %d", c->width, c->height, c->pix_fmt); |
| | | c->flags = pInstream->codec->flags; |
| | | c->flags |= CODEC_FLAG_GLOBAL_HEADER; |
| | | c->me_range = pInstream->codec->me_range; |
| | | c->max_qdiff = pInstream->codec->max_qdiff; |
| | | |
| | | c->qmin = pInstream->codec->qmin; |
| | | c->qmax = pInstream->codec->qmax; |
| | | |
| | | c->qcompress = pInstream->codec->qcompress; |
| | | } |
| | | ret =avio_open(&m_pOutFmtCtx->pb, filename, AVIO_FLAG_WRITE); |
| | | if(ret<0) |
| | | { |
| | | fprintf(stderr, "could not find stream info, errorCode: %d\n",AVERROR(ret)); |
| | | return -1; |
| | | } |
| | | |
| | | avformat_write_header(m_pOutFmtCtx, NULL); |
| | | } |
| | | |
| | | void fileOutClose() |
| | | { |
| | | av_write_trailer(m_pOutFmtCtx); |
| | | avio_close(m_pOutFmtCtx->pb); |
| | | avcodec_close(m_pOutFmtCtx->streams[0]->codec); |
| | | av_freep(&m_pOutFmtCtx->streams[0]->codec); |
| | | av_freep(&m_pOutFmtCtx->streams[0]); |
| | | |
| | | av_free(m_pOutFmtCtx); |
| | | m_pOutFmtCtx = nullptr; |
| | | } |
| | | |
| | | int fileWritePkg(void* packet) |
| | | { |
| | | mutex().lock(); |
| | | int ret = -1; |
| | | if(packet!=nullptr) |
| | | { |
| | | AVPacket* pkg = static_cast<AVPacket*>(packet); |
| | | //av_interleaved_write_frame(thisPtr->m_pOutFmtCtx, &i_pkt); |
| | | ret = av_write_frame(m_pOutFmtCtx, pkg); |
| | | } |
| | | mutex().unlock(); |
| | | return ret; |
| | | } |
| | | |
| | | bool isKeyFrame(void* packet) |
| | | { |
| | | bool ret = false; |
| | | if(packet!=nullptr) |
| | | { |
| | | AVPacket* pkg = static_cast<AVPacket*>(packet); |
| | | if(pkg->flags&AV_PKT_FLAG_KEY) ret = true; |
| | | } |
| | | return ret; |
| | | } |
| | | |
| | | long int getPkgDts(void* packet) |
| | | { |
| | | long int ret = 0; |
| | | if(packet!=nullptr) |
| | | { |
| | | AVPacket* pkg = static_cast<AVPacket*>(packet); |
| | | ret = pkg->dts; |
| | | } |
| | | return ret; |
| | | } |
| | | long int getPkgPts(void* packet) |
| | | { |
| | | long int ret = 0; |
| | | if(packet!=nullptr) |
| | | { |
| | | AVPacket* pkg = static_cast<AVPacket*>(packet); |
| | | ret = pkg->pts; |
| | | } |
| | | return ret; |
| | | } |
| | | |
| | | void conversion(void* packet,const long int& firstKeyPts,const long int& firstKeyDts,void* inVideoStream) |
| | | { |
| | | mutex().lock(); |
| | | if((packet!=nullptr)&&(inVideoStream!=nullptr)) |
| | | { |
| | | AVStream* inStream = (AVStream*)inVideoStream; |
| | | AVPacket* pkg = static_cast<AVPacket*>(packet); |
| | | pkg->pts -= firstKeyPts; |
| | | pkg->dts -= firstKeyDts; |
| | | pkg->pts = av_rescale_q_rnd(pkg->pts, inStream->time_base, |
| | | m_pOutVideo_stream->time_base, |
| | | (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX)); |
| | | pkg->dts = av_rescale_q_rnd(pkg->dts, inStream->time_base, |
| | | m_pOutVideo_stream->time_base, |
| | | (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX)); |
| | | pkg->duration = av_rescale_q(pkg->duration, inStream->time_base, |
| | | m_pOutVideo_stream->time_base); |
| | | pkg->pos = -1; |
| | | } |
| | | mutex().unlock(); |
| | | } |
| | | |
| | | private: |
| | | AVFormatContext * m_pInFmtCtx; |
| | | AVStream *m_pInVideoStream; |
| | | AVDictionary *m_pDict; |
| | | |
| | | AVFormatContext *m_pOutFmtCtx; |
| | | AVStream *m_pOutVideo_stream; |
| | | //static std::mutex g_pkg; |
| | | inline static int& n() { static int tn = 0; return tn;} |
| | | |
| | | inline static std::mutex& mutex(){static std::mutex mtx;return mtx;} |
| | | |
| | | }; |
| | | #endif |
| | | //std::mutex CommonFFmpeg::g_pkg; |
| New file |
| | |
| | | #include "ImageGrabberI.h" |
| | | #include <functional> |
| | | #include <algorithm> |
| | | #include <dirent.h> |
| | | #include <basic/debug/Debug.h> |
| | | #include <cstring> |
| | | #include <opencv2/opencv.hpp> |
| | | #include <QtCore/QDateTime> |
| | | #include <basic/util/opencv/CvUtil.h> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | |
| | | //è·åç®å½ä¸æææä»¶çåç§° |
| | | std::vector<std::string> forEachFile(const std::string &dir_name) { |
| | | std::vector<std::string> v; |
| | | auto dir = opendir(dir_name.data()); |
| | | struct dirent *ent; |
| | | int len = 0; |
| | | if (dir) { |
| | | while ((ent = readdir(dir)) != NULL) { |
| | | std::string p = std::string(ent->d_name); |
| | | len = strlen(p.data()); |
| | | if (len == 25) { |
| | | v.emplace_back(p); |
| | | } |
| | | } |
| | | closedir(dir); |
| | | } |
| | | return v; |
| | | } |
| | | |
| | | //å°è§é¢ä¸çæå®å¸§å为å¾ç |
| | | cv::Mat Video2Imag(std::string VideoName, int msec) { |
| | | cv::VideoCapture m; |
| | | cv::Mat img = cv::Mat(); |
| | | |
| | | m.open(VideoName); |
| | | m.set(CV_CAP_PROP_POS_MSEC, msec); |
| | | if (!m.isOpened()) { |
| | | ERR("è§é¢è¯»å
¥é误"); |
| | | return img; |
| | | } |
| | | |
| | | m >> img; |
| | | |
| | | return img; |
| | | } |
| | | |
| | | ImageGrabberI::ImageGrabberI() : fdfsClient("./client.conf") { |
| | | |
| | | } |
| | | |
| | | RecordVideo::ByteSequence |
| | | ImageGrabberI::grabImage(const Ice::Int index, const std::string &time, const Ice::Current &) { |
| | | ::RecordVideo::ByteSequence buffer; |
| | | QDateTime dt = QDateTime::fromString(time.data(), "yyyy-MM-dd hh:mm:ss"); |
| | | QDateTime dtCurrent = QDateTime::currentDateTime(); |
| | | qint64 diff = dtCurrent.toMSecsSinceEpoch() - dt.toMSecsSinceEpoch(); |
| | | if (diff > appPref.getLongData("user.timeout") || diff < appPref.getLongData("user.interval.duration")) { |
| | | return buffer; |
| | | } |
| | | std::string path = appPref.getStringData("user.loop.absolute.path"); |
| | | std::string absPath; |
| | | |
| | | if (path.empty()) { |
| | | ERR("è·¯å¾ä¸ºç©º!"); |
| | | return buffer; |
| | | } |
| | | |
| | | char last = path.back(); |
| | | if (last != '/') { |
| | | absPath = path + "/"; |
| | | } else { |
| | | absPath = path; |
| | | } |
| | | |
| | | std::string definitePath = absPath + QString::number(index).toStdString() + "/"; |
| | | |
| | | vec.clear(); |
| | | vec = forEachFile(definitePath); |
| | | std::sort(vec.begin(), vec.end()); |
| | | |
| | | if (vec.empty()) { |
| | | ERR("æ²¡ææ¾å°å½å¶è§é¢"); |
| | | return buffer; |
| | | } |
| | | |
| | | for (std::string &s : vec) { |
| | | std::string temp; |
| | | temp = s.substr(0, 21); |
| | | |
| | | QDateTime dtFile = QDateTime::fromString(temp.data(), "yyyyMMdd_hh:mm:ss:zzz"); |
| | | qint64 sub = dt.toMSecsSinceEpoch() - dtFile.toMSecsSinceEpoch(); |
| | | if (sub <= appPref.getLongData("user.interval.duration") && sub > 0) { |
| | | std::string fullPath = definitePath + s; |
| | | cv::Mat img = Video2Imag(fullPath, sub); |
| | | CvUtil::cvMat2Buffer(img, buffer); |
| | | return buffer; |
| | | } |
| | | } |
| | | |
| | | ERR("没æè¯¥æ¶æ®µçå½å¶è§é¢"); |
| | | return buffer; |
| | | } |
| | | |
| | | std::string ImageGrabberI::grabImageUrl(const Ice::Int index, const std::string &time, const Ice::Current &) { |
| | | std::string strHttpImgUrl; |
| | | ::RecordVideo::ByteSequence buffer = grabImage(index, time); |
| | | |
| | | if (buffer.empty()) { |
| | | return strHttpImgUrl; |
| | | } |
| | | |
| | | std::string strImgUrl; |
| | | fdfsClient.uploadFile(buffer, strImgUrl, "jpg"); |
| | | strHttpImgUrl = appPref.getStringData("user.ip.port") + "/" + strImgUrl; |
| | | return strHttpImgUrl; |
| | | } |
| New file |
| | |
| | | #ifndef IMAGEGRABBERI_H |
| | | #define IMAGEGRABBERI_H |
| | | |
| | | #include "RecordVideo.h" |
| | | #include <iostream> |
| | | #include <basic/util/fastdfs/FastdfsClient.h> |
| | | |
| | | class ImageGrabberI :public ::RecordVideo::ImageGrabber |
| | | { |
| | | public: |
| | | ImageGrabberI(); |
| | | |
| | | virtual ::RecordVideo::ByteSequence grabImage(const ::Ice::Int index,const ::std::string&time, const ::Ice::Current& = ::Ice::emptyCurrent); |
| | | virtual ::std::string grabImageUrl(const ::Ice::Int index,const ::std::string&time, const ::Ice::Current& = ::Ice::emptyCurrent); |
| | | |
| | | private: |
| | | std::vector<std::string> vec; |
| | | FastdfsClient fdfsClient; |
| | | }; |
| | | |
| | | #endif // IMAGEGRABBERI_H |
| New file |
| | |
| | | #include "LoopRecordVideoI.h" |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <QtCore/QDateTime> |
| | | #include <uuid/uuid.h> |
| | | #include "jsoncpp/json/json.h" |
| | | |
| | | LoopRecordVideoI::LoopRecordVideoI(int interval) : TimerElement(interval),db_c(nullptr){ |
| | | start(); |
| | | |
| | | } |
| | | |
| | | LoopRecordVideoI::~LoopRecordVideoI() { |
| | | qDeleteAll(m_mapRecorders); |
| | | if(db_c) |
| | | { |
| | | delete db_c; |
| | | db_c=nullptr; |
| | | } |
| | | } |
| | | |
| | | ::std::string |
| | | LoopRecordVideoI::addCamera(const ::std::string &index, const std::string &t_str_json, const Ice::Current &) { |
| | | DBG(t_str_json); |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | //"192.168.1.188/group1/M00/04/6C/wKgBvFuWLgeAJrdNAACdFDKB-U8853.jpg" |
| | | if (reader.parse(t_str_json, value)) { |
| | | // std::string filePathName = value["path"].asString(); |
| | | // appPref.setStringData("user.loop.absolute.path", filePathName); |
| | | std::string t_rtsp = value["rtsp"].asString(); |
| | | |
| | | if (m_mapRecorders.find(index) == m_mapRecorders.end()) { |
| | | INFO("addCamera << " << index << " time " << AppUtil::getTimeSecString()); |
| | | uuid_t t_uuid; |
| | | uuid_generate(t_uuid); |
| | | char str[36] = {0}; |
| | | uuid_unparse(t_uuid, str); |
| | | if(db_c==nullptr ) |
| | | { |
| | | db_c=new LDBTool; |
| | | } |
| | | LoopVideoRecorder *pRecorder = new LoopVideoRecorder(appPref.getLongData("user.interval.duration"), index, |
| | | t_rtsp,std::string(str),db_c); |
| | | //da yin luzhi wenjian ming |
| | | std::lock_guard<std::mutex> lock(m_map_mutex); |
| | | m_mapRecorders[index] = pRecorder; |
| | | return std::string(str); |
| | | } else { |
| | | INFO("re addCamera << " << index); |
| | | removeCamera(index); |
| | | return addCamera(index, t_str_json); |
| | | } |
| | | |
| | | } else { |
| | | ERR("Json error :: " << t_str_json); |
| | | |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | void LoopRecordVideoI::removeCamera(const ::std::string &index, const Ice::Current &) { |
| | | if (m_mapRecorders.find(index) != m_mapRecorders.end()) { |
| | | INFO("removeCamera << " << index); |
| | | m_mapRecorders[index]->stopTimer(); |
| | | std::lock_guard<std::mutex> lock(m_map_mutex); |
| | | if (m_mapRecorders[index] != NULL) { |
| | | delete m_mapRecorders.value(index); |
| | | } |
| | | m_mapRecorders[index] = NULL; |
| | | m_mapRecorders.remove(index); |
| | | } |
| | | } |
| | | |
| | | void LoopRecordVideoI::clearCamera(const Ice::Current &) { |
| | | auto iter = m_mapRecorders.begin(); |
| | | while (iter != m_mapRecorders.end()) { |
| | | iter.value()->stopTimer(); |
| | | delete iter.value(); |
| | | iter.value() = NULL; |
| | | m_mapRecorders.remove(iter.key()); |
| | | ++iter; |
| | | } |
| | | } |
| | | |
| | | void LoopRecordVideoI::feedDog(const ::std::string &index, const Ice::Current &) { |
| | | // INFO("feedDog"); |
| | | std::lock_guard<std::mutex> lock(m_mutex); |
| | | m_mapFeedDogTime[index] = QDateTime::currentDateTime(); |
| | | } |
| | | |
| | | void LoopRecordVideoI::timerFunc() { |
| | | m_mutex.lock(); |
| | | auto mapFeedDogTime = m_mapFeedDogTime; |
| | | m_mutex.unlock(); |
| | | auto iter = mapFeedDogTime.begin(); |
| | | while (iter != mapFeedDogTime.end()) { |
| | | qint64 current = QDateTime::currentDateTime().toMSecsSinceEpoch(); |
| | | qint64 feedDog = iter.value().toMSecsSinceEpoch(); |
| | | qint64 sub = current - feedDog; |
| | | if (sub > 3000) { |
| | | removeCamera(iter.key()); |
| | | } |
| | | ++iter; |
| | | } |
| | | } |
| New file |
| | |
| | | #ifndef LOOPRECORDVIDEOI_H |
| | | #define LOOPRECORDVIDEOI_H |
| | | |
| | | #include "RecordVideo.h" |
| | | #include <iostream> |
| | | #include <thread> |
| | | #include <QtCore/QMap> |
| | | #include "LoopVideoRecorder.h" |
| | | #include "TimerElement.h" |
| | | #include <mutex> |
| | | #include "../VideoServer/QiaoJia/DB/LDBTool.h" |
| | | class LoopRecordVideoI : public ::RecordVideo::LoopRecorder, TimerElement { |
| | | public: |
| | | LoopRecordVideoI(int interval = 10000); |
| | | |
| | | ~LoopRecordVideoI(); |
| | | |
| | | ::std::string addCamera(const ::std::string &index, const ::std::string &t_rtsp, const ::Ice::Current & = ::Ice::emptyCurrent); |
| | | |
| | | void removeCamera(const ::std::string &index, const ::Ice::Current & = ::Ice::emptyCurrent); |
| | | |
| | | void clearCamera(const ::Ice::Current & = ::Ice::emptyCurrent); |
| | | |
| | | void feedDog(const ::std::string &index, const ::Ice::Current & = ::Ice::emptyCurrent); |
| | | |
| | | void timerFunc(); |
| | | |
| | | private: |
| | | |
| | | QMap<std::string, LoopVideoRecorder *> m_mapRecorders; |
| | | QMap<std::string, QDateTime> m_mapFeedDogTime; |
| | | std::mutex m_mutex; |
| | | std::mutex m_map_mutex; |
| | | LDBTool* db_c; |
| | | }; |
| | | |
| | | #endif // LOOPRECORDVIDEOI_H |
| New file |
| | |
| | | #include "LoopVideoRecorder.h" |
| | | #include <functional> |
| | | #include <algorithm> |
| | | #include <dirent.h> |
| | | #include <cstdio> |
| | | #include <QtCore/QDateTime> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | //#include <sys/stat.h> |
| | | extern std::vector<std::string> forEachFile(const std::string &dir_name); |
| | | |
| | | //loop record video |
| | | void LoopVideoRecorder::loopRecordVideo() { |
| | | std::cout << "File " << __FILE__ << "FUNC " << __FUNCTION__ << " line " << __LINE__ << std::endl; |
| | | |
| | | if (m_strRtsp.empty()) { |
| | | ERR("rtsp为空!"); |
| | | return; |
| | | } |
| | | |
| | | //#todo get Path |
| | | |
| | | // std::string loopAbsPath = appPref.getStringData("user.loop.absolute.path"); |
| | | // std::cout << "File " << __FILE__ << "FUNC " << __FUNCTION__ << " line " << __LINE__ << std::endl; |
| | | // std::string loopAbsPath = getFullFileName(); |
| | | // if (loopAbsPath.empty()) { |
| | | // ERR("absolute.path为空"); |
| | | // return ; |
| | | // } |
| | | |
| | | // char last = loopAbsPath.back(); |
| | | // if (last != '/') { |
| | | // loopAbsPath = loopAbsPath + "/"; |
| | | // } |
| | | |
| | | |
| | | |
| | | // QString CmdMkdir = QString("cd %1 ; mkdir -p %2").arg(QString::fromStdString(loopAbsPath)).arg(QString::fromStdString(m_nIndex)); |
| | | // system(CmdMkdir.toLatin1().data()); |
| | | |
| | | std::string fullPath = getFullFileName(); |
| | | // std::string cmd="mkdir -p "+fullPath; |
| | | // system(cmd.c_str()); |
| | | //mkdir(fullPath.c_str(),S_IRWXU); |
| | | if(fullPath.empty()) |
| | | { |
| | | ERR("LoopVideoRecorder::getFullFileName() is empty"); |
| | | return ; |
| | | } |
| | | m_pVideoRcd = new VideoRecorder(fullPath,m_pathId, m_strRtsp, m_nInterval,m_db); |
| | | |
| | | |
| | | } |
| | | |
| | | void LoopVideoRecorder::stopTimer() { |
| | | stop(); |
| | | wait(); |
| | | } |
| | | |
| | | void LoopVideoRecorder::timerFunc() { |
| | | // loopRecordVideo(); |
| | | } |
| | | |
| | | LoopVideoRecorder::LoopVideoRecorder(int interval, std::string index, std::string rtsp,std::string pathId,LDBTool* db_c) |
| | | : TimerElement(interval), m_nInterval(interval), m_nIndex(index), m_strRtsp(rtsp),m_pathId(pathId),m_db(db_c){ |
| | | // start(); |
| | | // std::cout << "File " << __FILE__ << "FUNC " << __FUNCTION__ << " line " << __LINE__ << std::endl; |
| | | |
| | | loopRecordVideo(); |
| | | } |
| | | |
| | | LoopVideoRecorder::~LoopVideoRecorder() { |
| | | delete m_pVideoRcd; |
| | | } |
| | | std::string LoopVideoRecorder::getFullFileName() { |
| | | |
| | | //# ./camIndex/YYYYMM/DD/camIndex-YYYYMMDDHHMMSS/ |
| | | std::string t_FilePath = appPref.getStringData("user.loop.absolute.path"); |
| | | |
| | | if (t_FilePath.back() != '/') { |
| | | t_FilePath.push_back('/'); |
| | | } |
| | | char buf[24]; |
| | | |
| | | time_t t=time(nullptr); |
| | | // 20180901113048 2018-09-01 11:30:48 |
| | | strftime(buf,24,"%Y%m%d%H%M%S",localtime(&t)); |
| | | std::string t_strTime(buf); |
| | | //# ./camIndex/YYYYMM/DD/ |
| | | t_FilePath.append(m_nIndex + "/" + t_strTime.substr(0, 6)+ "/" +t_strTime.substr(6, 2) + "/"); |
| | | //camIndex-YYYYMMDDHH/camIndex-YYYYMMDDHH/ |
| | | t_FilePath.append(m_nIndex + "-" + t_strTime.substr(0,10) + "/"); |
| | | std::string t_cmd = "mkdir -p '"; |
| | | t_cmd.append(t_FilePath + "'"); |
| | | //#get path mkdir path |
| | | system(t_cmd.c_str()); |
| | | |
| | | return t_FilePath; |
| | | } |
| New file |
| | |
| | | #ifndef LOOPVIDEORECORDER_H |
| | | #define LOOPVIDEORECORDER_H |
| | | |
| | | #include <iostream> |
| | | #include <thread> |
| | | #include <functional> |
| | | #include <unistd.h> |
| | | #include "VideoRecorder.h" |
| | | #include <QtCore/QObject> |
| | | #include "TimerElement.h" |
| | | #include <queue> |
| | | |
| | | class LoopVideoRecorder : public TimerElement { |
| | | |
| | | public: |
| | | explicit LoopVideoRecorder(int interval, std::string index, std::string rtsp,std::string pathId,LDBTool* db_c); |
| | | |
| | | ~LoopVideoRecorder(); |
| | | |
| | | void loopRecordVideo(); |
| | | |
| | | void stopTimer(); |
| | | |
| | | private: |
| | | virtual void timerFunc() override; |
| | | std::string getFullFileName(); |
| | | |
| | | private: |
| | | std::string m_nIndex; |
| | | std::string m_strRtsp; |
| | | std::string m_pathId; |
| | | int m_nInterval; |
| | | VideoRecorder *m_pVideoRcd; |
| | | std::queue<VideoRecorder *> m_queManager; |
| | | LDBTool* m_db; |
| | | }; |
| | | |
| | | #endif // LOOPVIDEORECORDER_H |
| New file |
| | |
| | | #include "RecordVideoI.h" |
| | | #include <QtCore/QDateTime> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | |
| | | RecordVideoI::RecordVideoI() |
| | | { |
| | | |
| | | } |
| | | |
| | | std::string RecordVideoI::recordVideo(const std::string &rtsp, Ice::Long ms, const Ice::Current &) |
| | | { |
| | | QString rtspUrl = QString::fromStdString(rtsp); |
| | | |
| | | int ss = 1000; |
| | | int mi = ss * 60; |
| | | int hh = mi * 60; |
| | | |
| | | long hour = ms / hh; |
| | | long minute = (ms - hour * hh) / mi; |
| | | long second = (ms - hour * hh - minute * mi) / ss; |
| | | |
| | | QString strHour = QString("%1").arg(hour,2,10,QChar('0')); |
| | | QString strMinute = QString("%1").arg(minute,2,10,QChar('0')); |
| | | QString strSecond = QString("%1").arg(second,2,10,QChar('0')); |
| | | |
| | | QString currentTime = QDateTime::currentDateTime().toString("yyyyMMdd_hh:mm:ss:zzz"); |
| | | QString fileName = currentTime + ".mp4"; |
| | | QString CmdTouch = QString("touch %1").arg(fileName); |
| | | QString CmdOrder = QString("LD_LIBRARY_PATH=/usr/local/cuda/lib64 ffmpeg -y -i %1 -vcodec copy -acodec copy -t %2:%3:%4 %5/%6 &") |
| | | .arg(rtspUrl).arg(strHour).arg(strMinute) |
| | | .arg(strSecond).arg(QString::fromStdString(appPref.getStringData("user.absolute.path"))) |
| | | .arg(fileName); |
| | | |
| | | system(CmdTouch.toLatin1().data()); |
| | | system(CmdOrder.toLatin1().data()); |
| | | |
| | | return fileName.toStdString(); |
| | | } |
| New file |
| | |
| | | #ifndef RECORDVIDEOI_H |
| | | #define RECORDVIDEOI_H |
| | | |
| | | #include "RecordVideo.h" |
| | | |
| | | class RecordVideoI : public::RecordVideo::Recorder |
| | | { |
| | | public: |
| | | RecordVideoI(); |
| | | |
| | | virtual ::std::string recordVideo(const ::std::string& rtsp, ::Ice::Long ms, const ::Ice::Current& = ::Ice::emptyCurrent); |
| | | }; |
| | | |
| | | #endif // RECORDVIDEOI_H |
| New file |
| | |
| | | #include "VideoRecorder.h" |
| | | #include <unistd.h> |
| | | #include <QString> |
| | | |
| | | |
| | | VideoRecorder::VideoRecorder(const std::string &fullPath,const std::string &uuid, const std::string &strRtsp, const int mseconds,LDBTool* db) |
| | | : m_pInFmtCtx(nullptr), m_pInVideoStream(nullptr), m_pOutFmtCtx(nullptr), |
| | | m_pDict(nullptr), m_pOutVideo_stream(nullptr), m_bStatus(true),/*m_thd(recodeFunc,this),*/ |
| | | m_bStart(false), m_mseconds(mseconds), m_strfileName(""), m_uuid(uuid), m_bSave(false), |
| | | m_fullPath(fullPath),db_c(db){ |
| | | m_CommonFFmpeg.init(); |
| | | for (int i = 0; i < 3; i++) { |
| | | if (m_CommonFFmpeg.rtspInputOpen(strRtsp.c_str()) >= 0) { |
| | | m_thd = new std::thread(recodeFunc, this); |
| | | return; |
| | | } |
| | | usleep(20000); |
| | | } |
| | | } |
| | | |
| | | VideoRecorder::~VideoRecorder() { |
| | | |
| | | m_bSave = false; |
| | | m_bStatus = false; |
| | | m_thd->join(); |
| | | delete m_thd; |
| | | m_thd = nullptr; |
| | | m_CommonFFmpeg.rtspInputClose(); |
| | | } |
| | | |
| | | void VideoRecorder::thisRecodeFunc() { |
| | | while (m_bStatus) { |
| | | // std::string strDate; |
| | | //#todo get FilePath FileName |
| | | |
| | | ///#todo shengcheng luzhi wenjian ming |
| | | |
| | | |
| | | |
| | | long lDate = getCurrentUs(); |
| | | bool bFirstKeyFrame = true; |
| | | long int nFirstKeyPts = 0; |
| | | long int nFirstKeyDts = 0; |
| | | |
| | | if (m_strfileName.empty() && !m_bSave) { |
| | | GetFileName(m_strfileName); |
| | | |
| | | DBG("srtPath" << m_strfileName << "m_uuid" << m_uuid); |
| | | } else{ |
| | | DBG("m_strfileName:" << m_strfileName); |
| | | DBG("m_bSave:" << m_bSave); |
| | | } |
| | | |
| | | |
| | | m_CommonFFmpeg.fileOutOpen(m_strfileName.c_str(), m_CommonFFmpeg.getRtspStream()); |
| | | //#todo |
| | | while (m_bStatus && ((getCurrentUs() - lDate) < m_mseconds * 1000)) { |
| | | void *handle = m_CommonFFmpeg.rtspCreatePkg(); |
| | | if (m_CommonFFmpeg.rtspReadPkg(handle) < 0) { |
| | | if(bFirstKeyFrame){ |
| | | ERR("rtspReadPkg m_strfileName:" << m_strfileName.c_str() << "getRtspStream:" |
| | | << m_CommonFFmpeg.getRtspStream()); |
| | | usleep(20000);//20ms |
| | | m_bSave = false; |
| | | m_strfileName.clear(); |
| | | break; |
| | | } else{ |
| | | continue; |
| | | } |
| | | |
| | | } |
| | | |
| | | if (bFirstKeyFrame) { |
| | | |
| | | if (m_CommonFFmpeg.isKeyFrame(handle)) { |
| | | DBG("I"); |
| | | nFirstKeyPts = m_CommonFFmpeg.getPkgPts(handle); |
| | | nFirstKeyDts = m_CommonFFmpeg.getPkgDts(handle); |
| | | bFirstKeyFrame = false; |
| | | |
| | | if (!m_bSave && db_c) { |
| | | if (db_c->insertRecordVedioPath(QString::fromStdString(m_uuid), |
| | | QString::fromStdString(m_strfileName))) { |
| | | m_bSave = true; |
| | | } else { |
| | | ERR("insertRecordVedioPath DB ERR m_uuid=" << m_uuid.c_str() << "m_strfileName=" |
| | | << m_strfileName.c_str()); |
| | | } |
| | | } |
| | | } else { |
| | | // DBG("slice"); |
| | | m_CommonFFmpeg.rtspDestroyPkg(handle); |
| | | continue; |
| | | DBG("srtPath" << m_strfileName << "m_uuid" << m_uuid); |
| | | } |
| | | } |
| | | m_CommonFFmpeg.conversion(handle, nFirstKeyPts, nFirstKeyDts, |
| | | m_CommonFFmpeg.getRtspStream()); |
| | | |
| | | m_CommonFFmpeg.fileWritePkg(handle); |
| | | |
| | | m_CommonFFmpeg.rtspDestroyPkg(handle); |
| | | } |
| | | m_CommonFFmpeg.fileOutClose(); |
| | | |
| | | } |
| | | } |
| | | |
| | | long VideoRecorder::getCurrentUs() { |
| | | timeval time; |
| | | gettimeofday(&time, nullptr); |
| | | return time.tv_sec * 1000000 + time.tv_usec; |
| | | } |
| | | |
| | | long VideoRecorder::getCurrentUs(std::string &strDateTime) { |
| | | timeval time; |
| | | gettimeofday(&time, nullptr); |
| | | __time_t sec = time.tv_sec; |
| | | char buf[128] = {0}; |
| | | strftime(buf, 64, "%Y%m%d_%H:%M:%S", localtime(&sec)); |
| | | char szDateTime[128] = {0}; |
| | | sprintf(szDateTime, "%s/%s:%ld.mp4", m_strfileName.c_str(), buf, time.tv_usec / 1000); |
| | | strDateTime = szDateTime; |
| | | return time.tv_sec * 1000000 + time.tv_usec; |
| | | } |
| | | |
| | | void VideoRecorder::recodeFunc(void *arg) { |
| | | |
| | | VideoRecorder *thisPtr = (VideoRecorder *) arg; |
| | | thisPtr->thisRecodeFunc(); |
| | | } |
| | | |
| | | void VideoRecorder::GetFileName(std::string &fileName) { |
| | | //std::string tem="/home/basic/work_src/test_Rec/1"; |
| | | // timeval time; |
| | | // gettimeofday(&time, nullptr); |
| | | time_t t = time(nullptr); |
| | | |
| | | char buf[128] = {0}; |
| | | strftime(buf, 64, "%Y-%m-%d %H:%M:%S", localtime(&t)); |
| | | char szDateTime[256] = {0}; |
| | | sprintf(szDateTime, "%s%s.mp4", m_fullPath.c_str(), buf); |
| | | |
| | | fileName = szDateTime; |
| | | //std::cout << "File path " << fileName.c_str() << "FUNC " << __FUNCTION__ << " line " << __LINE__ << std::endl; |
| | | } |
| New file |
| | |
| | | #ifndef VIDEORECORDER_H |
| | | #define VIDEORECORDER_H |
| | | |
| | | #include<thread> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include "CommonFFmpegFunc.hpp" |
| | | #include "../VideoServer/QiaoJia/DB/LDBTool.h" |
| | | |
| | | struct AVStream; |
| | | struct AVDictionary; |
| | | struct AVFormatContext; |
| | | struct AVPacket; |
| | | |
| | | void ffmpegInit(); |
| | | |
| | | class VideoRecorder { |
| | | public: |
| | | VideoRecorder(const std::string& fullPath,const std::string &uuid, const std::string &strRtsp, const int mseconds,LDBTool* db); |
| | | |
| | | virtual ~VideoRecorder(); |
| | | |
| | | private: |
| | | AVFormatContext *m_pInFmtCtx; |
| | | AVStream *m_pInVideoStream; |
| | | |
| | | AVFormatContext *m_pOutFmtCtx; |
| | | AVStream *m_pOutVideo_stream; |
| | | AVDictionary *m_pDict; |
| | | bool m_bStatus; |
| | | |
| | | bool m_bStart; |
| | | |
| | | std::thread *m_thd; |
| | | |
| | | CommonFFmpeg m_CommonFFmpeg; |
| | | |
| | | int m_mseconds; |
| | | |
| | | std::string m_strfileName; |
| | | std::string m_uuid; |
| | | std::string m_fullPath; |
| | | LDBTool* db_c; |
| | | bool m_bSave; |
| | | private: |
| | | void thisRecodeFunc(); |
| | | |
| | | long getCurrentUs(); |
| | | |
| | | long getCurrentUs(std::string &strDateTime); |
| | | |
| | | void GetFileName(std::string &fileName); |
| | | |
| | | static void recodeFunc(void *); |
| | | }; |
| | | |
| | | #endif |
| New file |
| | |
| | | #include "VideoRecorderManager.h" |
| | | |
| | | VideoRecorderManager::VideoRecorderManager(int interval, std::string rtsp, std::string path, std::string fileName) |
| | | :TimerElement(interval),m_strPath(path),m_strFileName(fileName) |
| | | { |
| | | ClockTimer ct("VideoRecorderManager::VideoRecorderManager()"); |
| | | int nCount = 0; |
| | | while(nCount++ < 10) |
| | | { |
| | | if (m_videoRcd.start(rtsp,path+fileName) >= 0) |
| | | { |
| | | break; |
| | | } |
| | | usleep(10000);//10ms |
| | | } |
| | | |
| | | if (nCount >= 10) |
| | | { |
| | | ERR("open rtsp "<< rtsp <<" failed!"); |
| | | }else |
| | | { |
| | | m_dtRecordTime = QDateTime::currentDateTime(); |
| | | start(); |
| | | } |
| | | } |
| | | |
| | | double VideoRecorderManager::getLastUs() |
| | | { |
| | | return getCurrentUs(); |
| | | } |
| | | |
| | | void VideoRecorderManager::threadInitial() |
| | | { |
| | | lastUs = getLastUs(); |
| | | } |
| | | |
| | | void VideoRecorderManager::timerFunc() |
| | | { |
| | | ClockTimer ct("VideoRecorderManager::timerFunc()"); |
| | | m_videoRcd.stop(); |
| | | if (access((m_strPath+m_strFileName).c_str(),F_OK) != 0) |
| | | { |
| | | ERR("file not exist!"); |
| | | stop(); |
| | | return; |
| | | } |
| | | QString strMvCmd = QString("cd %1 ; mv %2 %3") |
| | | .arg(QString::fromStdString(m_strPath)) |
| | | .arg(QString::fromStdString(m_strFileName)) |
| | | .arg(m_dtRecordTime.toString("yyyyMMdd_hh:mm:ss:zzz")+".mp4"); |
| | | system(strMvCmd.toLatin1().data()); |
| | | |
| | | stop(); |
| | | } |
| New file |
| | |
| | | #ifndef VIDEORECORDERMANAGER_H |
| | | #define VIDEORECORDERMANAGER_H |
| | | |
| | | #include "TimerElement.h" |
| | | #include "VideoRecorder.h" |
| | | #include <QtCore/QDateTime> |
| | | |
| | | class VideoRecorderManager : public TimerElement |
| | | { |
| | | public: |
| | | VideoRecorderManager(int interval,std::string rtsp,std::string path,std::string fileName); |
| | | |
| | | virtual double getLastUs() override; |
| | | private: |
| | | virtual void timerFunc() override; |
| | | virtual void threadInitial() override; |
| | | private: |
| | | VideoRecorder m_videoRcd; |
| | | std::string m_strPath; |
| | | std::string m_strFileName; |
| | | QDateTime m_dtRecordTime; |
| | | |
| | | }; |
| | | |
| | | #endif // VIDEORECORDERMANAGER_H |
| New file |
| | |
| | | Ice.Default.Locator=StructureAppRegistry/Locator:default -p 4062 |
| New file |
| | |
| | | #include <iostream> |
| | | #include <QtCore/QDebug> |
| | | #include <Ice/Ice.h> |
| | | #include <IceUtil/IceUtil.h> |
| | | #include "RecordVideoI.h" |
| | | #include "ImageGrabberI.h" |
| | | #include "LoopRecordVideoI.h" |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/rpc/IceRpc.hpp> |
| | | #include <basic/util/app/AppConfig.h> |
| | | #include <basic/debug/Debug.h> |
| | | |
| | | |
| | | using namespace std; |
| | | |
| | | int main2(int argc, char **argv) { |
| | | SAVE_APP_ARGS; |
| | | ENABLEGLOG("~/work/log/"); |
| | | auto ich = Ice::initialize(argc, argv); |
| | | |
| | | std::string identity = ich->getProperties()->getProperty("user.record.video.identity"); |
| | | std::string identityCapture = ich->getProperties()->getProperty("user.capture.image.identity"); |
| | | std::string identityLoop = ich->getProperties()->getProperty("user.loop.record.video.identity"); |
| | | std::string adapterName = ich->getProperties()->getProperty("user.adapter.name"); |
| | | std::string absolutePath = ich->getProperties()->getProperty("user.absolute.path"); |
| | | std::string loopAbsolutePath = ich->getProperties()->getProperty("user.loop.absolute.path"); |
| | | std::string intervalDuration = ich->getProperties()->getProperty("user.interval.duration"); |
| | | std::string ipPort = ich->getProperties()->getProperty("user.ip.port"); |
| | | std::string timeOut = ich->getProperties()->getProperty("user.timeout"); |
| | | |
| | | appPref.setStringData("user.absolute.path", absolutePath); |
| | | appPref.setStringData("user.loop.absolute.path", loopAbsolutePath); |
| | | appPref.setLongData("user.interval.duration", atol(intervalDuration.c_str())); |
| | | appPref.setStringData("user.ip.port", ipPort); |
| | | appPref.setLongData("user.timeout", atol(timeOut.c_str())); |
| | | |
| | | auto adapter = ich->createObjectAdapter(adapterName); |
| | | adapter->add(new RecordVideoI(), Ice::stringToIdentity(identity)); |
| | | adapter->add(new ImageGrabberI(), Ice::stringToIdentity(identityCapture)); |
| | | adapter->add(new LoopRecordVideoI(), Ice::stringToIdentity(identityLoop)); |
| | | adapter->activate(); |
| | | ich->waitForShutdown(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | #include "jsoncpp/json/json.h" |
| | | |
| | | int main(int argc, char **argv) { |
| | | |
| | | SAVE_APP_ARGS; |
| | | ENABLEGLOG(GET_STR_CONFIG("logPath").c_str()); |
| | | auto ich = Ice::initialize(argc, argv); |
| | | |
| | | std::string identity = "RecordVideoServer"; |
| | | std::string identityCapture = "CaptureVideoImgServer"; |
| | | std::string identityLoop = "LoopRecordVideoServer"; |
| | | std::string adapterName = "RecordVideoServerAdapter"; |
| | | std::string absolutePath = "build"; |
| | | // std::string loopAbsolutePath = "/home/bsk/test/"; |
| | | std::string loopAbsolutePath = appConfig.getStringProperty("cutPath"); |
| | | std::string intervalDuration = "600000"; |
| | | std::string ipPort = "192.168.1.65:8888"; |
| | | std::string timeOut = "6000000"; |
| | | |
| | | appPref.setStringData("user.absolute.path", absolutePath); |
| | | appPref.setStringData("user.loop.absolute.path", loopAbsolutePath); |
| | | appPref.setLongData("user.interval.duration", atol(intervalDuration.c_str())); |
| | | appPref.setStringData("user.ip.port", ipPort); |
| | | appPref.setLongData("user.timeout", atol(timeOut.c_str())); |
| | | |
| | | // auto adapter = ich->createObjectAdapter(adapterName); |
| | | // adapter->add(new RecordVideoI(), Ice::stringToIdentity(identity)); |
| | | // adapter->add(new ImageGrabberI(), Ice::stringToIdentity(identityCapture)); |
| | | // adapter->add(new LoopRecordVideoI(), Ice::stringToIdentity(identityLoop)); |
| | | // adapter->activate(); |
| | | // ich->waitForShutdown(); |
| | | |
| | | // Ice::ObjectAdapterPtr adapter = ich->createObjectAdapterWithEndpoints(identityLoop + "Adapter", |
| | | // " tcp -p " + std::to_string(10010)); |
| | | // |
| | | // adapter->add(new LoopRecordVideoI, Ice::stringToIdentity(identityLoop)); |
| | | // adapter->activate(); |
| | | // ich->waitForShutdown(); |
| | | |
| | | IceRpcServer<LoopRecordVideoI> server("LoopRecordVideoServer", 10010, "tcp"); |
| | | server.setMessageSizeMax(1024 * 1024 * 50); |
| | | server.setPoolInitSize(5); |
| | | server.setPoolMaxSize(32); |
| | | server.runWaitShutDown(); |
| | | |
| | | return 0; |
| | | } |
| New file |
| | |
| | | // ********************************************************************** |
| | | // |
| | | // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. |
| | | // |
| | | // This copy of Ice is licensed to you under the terms described in the |
| | | // ICE_LICENSE file included in this distribution. |
| | | // |
| | | // ********************************************************************** |
| | | // |
| | | // Ice version 3.7.0 |
| | | // |
| | | // <auto-generated> |
| | | // |
| | | // Generated from file `RecordVideo.ice' |
| | | // |
| | | // Warning: do not edit this file. |
| | | // |
| | | // </auto-generated> |
| | | // |
| | | |
| | | #include <RecordVideo.h> |
| | | #include <IceUtil/PushDisableWarnings.h> |
| | | #include <Ice/LocalException.h> |
| | | #include <Ice/ValueFactory.h> |
| | | #include <Ice/OutgoingAsync.h> |
| | | #include <Ice/InputStream.h> |
| | | #include <Ice/OutputStream.h> |
| | | #include <IceUtil/PopDisableWarnings.h> |
| | | |
| | | #if defined(_MSC_VER) |
| | | # pragma warning(disable:4458) // declaration of ... hides class member |
| | | #elif defined(__clang__) |
| | | # pragma clang diagnostic ignored "-Wshadow" |
| | | #elif defined(__GNUC__) |
| | | # pragma GCC diagnostic ignored "-Wshadow" |
| | | #endif |
| | | |
| | | #ifndef ICE_IGNORE_VERSION |
| | | # if ICE_INT_VERSION / 100 != 307 |
| | | # error Ice version mismatch! |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 > 50 |
| | | # error Beta header file detected |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 < 0 |
| | | # error Ice patch level mismatch! |
| | | # endif |
| | | #endif |
| | | |
| | | #ifdef ICE_CPP11_MAPPING // C++11 mapping |
| | | |
| | | namespace |
| | | { |
| | | |
| | | const ::std::string iceC_RecordVideo_Recorder_ids[2] = |
| | | { |
| | | "::Ice::Object", |
| | | "::RecordVideo::Recorder" |
| | | }; |
| | | const ::std::string iceC_RecordVideo_Recorder_ops[] = |
| | | { |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping", |
| | | "recordVideo" |
| | | }; |
| | | const ::std::string iceC_RecordVideo_Recorder_recordVideo_name = "recordVideo"; |
| | | |
| | | const ::std::string iceC_RecordVideo_ImageGrabber_ids[2] = |
| | | { |
| | | "::Ice::Object", |
| | | "::RecordVideo::ImageGrabber" |
| | | }; |
| | | const ::std::string iceC_RecordVideo_ImageGrabber_ops[] = |
| | | { |
| | | "grabImage", |
| | | "grabImageUrl", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping" |
| | | }; |
| | | const ::std::string iceC_RecordVideo_ImageGrabber_grabImage_name = "grabImage"; |
| | | const ::std::string iceC_RecordVideo_ImageGrabber_grabImageUrl_name = "grabImageUrl"; |
| | | |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_ids[2] = |
| | | { |
| | | "::Ice::Object", |
| | | "::RecordVideo::LoopRecorder" |
| | | }; |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_ops[] = |
| | | { |
| | | "addCamera", |
| | | "clearCamera", |
| | | "feedDog", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping", |
| | | "removeCamera" |
| | | }; |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_addCamera_name = "addCamera"; |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_removeCamera_name = "removeCamera"; |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_clearCamera_name = "clearCamera"; |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_feedDog_name = "feedDog"; |
| | | |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::Recorder::ice_isA(::std::string s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_RecordVideo_Recorder_ids, iceC_RecordVideo_Recorder_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector<::std::string> |
| | | RecordVideo::Recorder::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector<::std::string>(&iceC_RecordVideo_Recorder_ids[0], &iceC_RecordVideo_Recorder_ids[2]); |
| | | } |
| | | |
| | | ::std::string |
| | | RecordVideo::Recorder::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::Recorder::ice_staticId() |
| | | { |
| | | static const ::std::string typeId = "::RecordVideo::Recorder"; |
| | | return typeId; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::Recorder::_iceD_recordVideo(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | ::std::string iceP_rtsp; |
| | | long long int iceP_ms; |
| | | istr->readAll(iceP_rtsp, iceP_ms); |
| | | inS.endReadParams(); |
| | | ::std::string ret = this->recordVideo(::std::move(iceP_rtsp), iceP_ms, current); |
| | | auto ostr = inS.startWriteParams(); |
| | | ostr->writeAll(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::Recorder::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_RecordVideo_Recorder_ops, iceC_RecordVideo_Recorder_ops + 5, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_RecordVideo_Recorder_ops) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_recordVideo(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::ImageGrabber::ice_isA(::std::string s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_RecordVideo_ImageGrabber_ids, iceC_RecordVideo_ImageGrabber_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector<::std::string> |
| | | RecordVideo::ImageGrabber::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector<::std::string>(&iceC_RecordVideo_ImageGrabber_ids[0], &iceC_RecordVideo_ImageGrabber_ids[2]); |
| | | } |
| | | |
| | | ::std::string |
| | | RecordVideo::ImageGrabber::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::ImageGrabber::ice_staticId() |
| | | { |
| | | static const ::std::string typeId = "::RecordVideo::ImageGrabber"; |
| | | return typeId; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::ImageGrabber::_iceD_grabImage(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | int iceP_index; |
| | | ::std::string iceP_time; |
| | | istr->readAll(iceP_index, iceP_time); |
| | | inS.endReadParams(); |
| | | ::RecordVideo::ByteSequence ret = this->grabImage(iceP_index, ::std::move(iceP_time), current); |
| | | auto ostr = inS.startWriteParams(); |
| | | ostr->writeAll(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::ImageGrabber::_iceD_grabImageUrl(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | int iceP_index; |
| | | ::std::string iceP_time; |
| | | istr->readAll(iceP_index, iceP_time); |
| | | inS.endReadParams(); |
| | | ::std::string ret = this->grabImageUrl(iceP_index, ::std::move(iceP_time), current); |
| | | auto ostr = inS.startWriteParams(); |
| | | ostr->writeAll(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::ImageGrabber::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_RecordVideo_ImageGrabber_ops, iceC_RecordVideo_ImageGrabber_ops + 6, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_RecordVideo_ImageGrabber_ops) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_grabImage(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_grabImageUrl(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 5: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::ice_isA(::std::string s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_RecordVideo_LoopRecorder_ids, iceC_RecordVideo_LoopRecorder_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector<::std::string> |
| | | RecordVideo::LoopRecorder::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector<::std::string>(&iceC_RecordVideo_LoopRecorder_ids[0], &iceC_RecordVideo_LoopRecorder_ids[2]); |
| | | } |
| | | |
| | | ::std::string |
| | | RecordVideo::LoopRecorder::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::LoopRecorder::ice_staticId() |
| | | { |
| | | static const ::std::string typeId = "::RecordVideo::LoopRecorder"; |
| | | return typeId; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceD_addCamera(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | ::std::string iceP_index; |
| | | ::std::string iceP_rtsp; |
| | | istr->readAll(iceP_index, iceP_rtsp); |
| | | inS.endReadParams(); |
| | | ::std::string ret = this->addCamera(::std::move(iceP_index), ::std::move(iceP_rtsp), current); |
| | | auto ostr = inS.startWriteParams(); |
| | | ostr->writeAll(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceD_removeCamera(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | ::std::string iceP_index; |
| | | istr->readAll(iceP_index); |
| | | inS.endReadParams(); |
| | | this->removeCamera(::std::move(iceP_index), current); |
| | | inS.writeEmptyParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceD_clearCamera(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | inS.readEmptyParams(); |
| | | this->clearCamera(current); |
| | | inS.writeEmptyParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceD_feedDog(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::OperationMode::Normal, current.mode); |
| | | auto istr = inS.startReadParams(); |
| | | ::std::string iceP_index; |
| | | istr->readAll(iceP_index); |
| | | inS.endReadParams(); |
| | | this->feedDog(::std::move(iceP_index), current); |
| | | inS.writeEmptyParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_RecordVideo_LoopRecorder_ops, iceC_RecordVideo_LoopRecorder_ops + 8, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_RecordVideo_LoopRecorder_ops) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_addCamera(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_clearCamera(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_feedDog(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 5: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 6: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | case 7: |
| | | { |
| | | return _iceD_removeCamera(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | RecordVideo::RecorderPrx::_iceI_recordVideo(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::std::string>>& outAsync, const ::std::string& iceP_rtsp, long long int iceP_ms, const ::Ice::Context& context) |
| | | { |
| | | _checkTwowayOnly(iceC_RecordVideo_Recorder_recordVideo_name); |
| | | outAsync->invoke(iceC_RecordVideo_Recorder_recordVideo_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_rtsp, iceP_ms); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | ::std::shared_ptr<::Ice::ObjectPrx> |
| | | RecordVideo::RecorderPrx::_newInstance() const |
| | | { |
| | | return ::IceInternal::createProxy<RecorderPrx>(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::RecorderPrx::ice_staticId() |
| | | { |
| | | return RecordVideo::Recorder::ice_staticId(); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::ImageGrabberPrx::_iceI_grabImage(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::RecordVideo::ByteSequence>>& outAsync, int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context) |
| | | { |
| | | _checkTwowayOnly(iceC_RecordVideo_ImageGrabber_grabImage_name); |
| | | outAsync->invoke(iceC_RecordVideo_ImageGrabber_grabImage_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_index, iceP_time); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::ImageGrabberPrx::_iceI_grabImageUrl(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::std::string>>& outAsync, int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context) |
| | | { |
| | | _checkTwowayOnly(iceC_RecordVideo_ImageGrabber_grabImageUrl_name); |
| | | outAsync->invoke(iceC_RecordVideo_ImageGrabber_grabImageUrl_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_index, iceP_time); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | ::std::shared_ptr<::Ice::ObjectPrx> |
| | | RecordVideo::ImageGrabberPrx::_newInstance() const |
| | | { |
| | | return ::IceInternal::createProxy<ImageGrabberPrx>(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::ImageGrabberPrx::ice_staticId() |
| | | { |
| | | return RecordVideo::ImageGrabber::ice_staticId(); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::LoopRecorderPrx::_iceI_addCamera(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::std::string>>& outAsync, const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::Ice::Context& context) |
| | | { |
| | | _checkTwowayOnly(iceC_RecordVideo_LoopRecorder_addCamera_name); |
| | | outAsync->invoke(iceC_RecordVideo_LoopRecorder_addCamera_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_index, iceP_rtsp); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::LoopRecorderPrx::_iceI_removeCamera(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<void>>& outAsync, const ::std::string& iceP_index, const ::Ice::Context& context) |
| | | { |
| | | outAsync->invoke(iceC_RecordVideo_LoopRecorder_removeCamera_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_index); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::LoopRecorderPrx::_iceI_clearCamera(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<void>>& outAsync, const ::Ice::Context& context) |
| | | { |
| | | outAsync->invoke(iceC_RecordVideo_LoopRecorder_clearCamera_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | nullptr, |
| | | nullptr); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::LoopRecorderPrx::_iceI_feedDog(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<void>>& outAsync, const ::std::string& iceP_index, const ::Ice::Context& context) |
| | | { |
| | | outAsync->invoke(iceC_RecordVideo_LoopRecorder_feedDog_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context, |
| | | [&](::Ice::OutputStream* ostr) |
| | | { |
| | | ostr->writeAll(iceP_index); |
| | | }, |
| | | nullptr); |
| | | } |
| | | |
| | | ::std::shared_ptr<::Ice::ObjectPrx> |
| | | RecordVideo::LoopRecorderPrx::_newInstance() const |
| | | { |
| | | return ::IceInternal::createProxy<LoopRecorderPrx>(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::LoopRecorderPrx::ice_staticId() |
| | | { |
| | | return RecordVideo::LoopRecorder::ice_staticId(); |
| | | } |
| | | |
| | | #else // C++98 mapping |
| | | |
| | | namespace |
| | | { |
| | | |
| | | const ::std::string iceC_RecordVideo_Recorder_recordVideo_name = "recordVideo"; |
| | | |
| | | const ::std::string iceC_RecordVideo_ImageGrabber_grabImage_name = "grabImage"; |
| | | |
| | | const ::std::string iceC_RecordVideo_ImageGrabber_grabImageUrl_name = "grabImageUrl"; |
| | | |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_addCamera_name = "addCamera"; |
| | | |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_removeCamera_name = "removeCamera"; |
| | | |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_clearCamera_name = "clearCamera"; |
| | | |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_feedDog_name = "feedDog"; |
| | | |
| | | } |
| | | ::IceProxy::Ice::Object* ::IceProxy::RecordVideo::upCast(::IceProxy::RecordVideo::Recorder* p) { return p; } |
| | | |
| | | void |
| | | ::IceProxy::RecordVideo::_readProxy(::Ice::InputStream* istr, ::IceInternal::ProxyHandle< ::IceProxy::RecordVideo::Recorder>& v) |
| | | { |
| | | ::Ice::ObjectPrx proxy; |
| | | istr->read(proxy); |
| | | if(!proxy) |
| | | { |
| | | v = 0; |
| | | } |
| | | else |
| | | { |
| | | v = new ::IceProxy::RecordVideo::Recorder; |
| | | v->_copyFrom(proxy); |
| | | } |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::RecordVideo::Recorder::_iceI_begin_recordVideo(const ::std::string& iceP_rtsp, ::Ice::Long iceP_ms, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | _checkTwowayOnly(iceC_RecordVideo_Recorder_recordVideo_name, sync); |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_RecordVideo_Recorder_recordVideo_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_RecordVideo_Recorder_recordVideo_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_rtsp); |
| | | ostr->write(iceP_ms); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_RecordVideo_Recorder_recordVideo_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | ::std::string |
| | | IceProxy::RecordVideo::Recorder::end_recordVideo(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | ::Ice::AsyncResult::_check(result, this, iceC_RecordVideo_Recorder_recordVideo_name); |
| | | ::std::string ret; |
| | | if(!result->_waitForResponse()) |
| | | { |
| | | try |
| | | { |
| | | result->_throwUserException(); |
| | | } |
| | | catch(const ::Ice::UserException& ex) |
| | | { |
| | | throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); |
| | | } |
| | | } |
| | | ::Ice::InputStream* istr = result->_startReadParams(); |
| | | istr->read(ret); |
| | | result->_endReadParams(); |
| | | return ret; |
| | | } |
| | | |
| | | ::IceProxy::Ice::Object* |
| | | IceProxy::RecordVideo::Recorder::_newInstance() const |
| | | { |
| | | return new Recorder; |
| | | } |
| | | |
| | | const ::std::string& |
| | | IceProxy::RecordVideo::Recorder::ice_staticId() |
| | | { |
| | | return ::RecordVideo::Recorder::ice_staticId(); |
| | | } |
| | | ::IceProxy::Ice::Object* ::IceProxy::RecordVideo::upCast(::IceProxy::RecordVideo::ImageGrabber* p) { return p; } |
| | | |
| | | void |
| | | ::IceProxy::RecordVideo::_readProxy(::Ice::InputStream* istr, ::IceInternal::ProxyHandle< ::IceProxy::RecordVideo::ImageGrabber>& v) |
| | | { |
| | | ::Ice::ObjectPrx proxy; |
| | | istr->read(proxy); |
| | | if(!proxy) |
| | | { |
| | | v = 0; |
| | | } |
| | | else |
| | | { |
| | | v = new ::IceProxy::RecordVideo::ImageGrabber; |
| | | v->_copyFrom(proxy); |
| | | } |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::RecordVideo::ImageGrabber::_iceI_begin_grabImage(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | _checkTwowayOnly(iceC_RecordVideo_ImageGrabber_grabImage_name, sync); |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_RecordVideo_ImageGrabber_grabImage_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_RecordVideo_ImageGrabber_grabImage_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_index); |
| | | ostr->write(iceP_time); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_RecordVideo_ImageGrabber_grabImage_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | ::RecordVideo::ByteSequence |
| | | IceProxy::RecordVideo::ImageGrabber::end_grabImage(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | ::Ice::AsyncResult::_check(result, this, iceC_RecordVideo_ImageGrabber_grabImage_name); |
| | | ::RecordVideo::ByteSequence ret; |
| | | if(!result->_waitForResponse()) |
| | | { |
| | | try |
| | | { |
| | | result->_throwUserException(); |
| | | } |
| | | catch(const ::Ice::UserException& ex) |
| | | { |
| | | throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); |
| | | } |
| | | } |
| | | ::Ice::InputStream* istr = result->_startReadParams(); |
| | | istr->read(ret); |
| | | result->_endReadParams(); |
| | | return ret; |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::RecordVideo::ImageGrabber::_iceI_begin_grabImageUrl(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | _checkTwowayOnly(iceC_RecordVideo_ImageGrabber_grabImageUrl_name, sync); |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_RecordVideo_ImageGrabber_grabImageUrl_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_RecordVideo_ImageGrabber_grabImageUrl_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_index); |
| | | ostr->write(iceP_time); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_RecordVideo_ImageGrabber_grabImageUrl_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | ::std::string |
| | | IceProxy::RecordVideo::ImageGrabber::end_grabImageUrl(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | ::Ice::AsyncResult::_check(result, this, iceC_RecordVideo_ImageGrabber_grabImageUrl_name); |
| | | ::std::string ret; |
| | | if(!result->_waitForResponse()) |
| | | { |
| | | try |
| | | { |
| | | result->_throwUserException(); |
| | | } |
| | | catch(const ::Ice::UserException& ex) |
| | | { |
| | | throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); |
| | | } |
| | | } |
| | | ::Ice::InputStream* istr = result->_startReadParams(); |
| | | istr->read(ret); |
| | | result->_endReadParams(); |
| | | return ret; |
| | | } |
| | | |
| | | ::IceProxy::Ice::Object* |
| | | IceProxy::RecordVideo::ImageGrabber::_newInstance() const |
| | | { |
| | | return new ImageGrabber; |
| | | } |
| | | |
| | | const ::std::string& |
| | | IceProxy::RecordVideo::ImageGrabber::ice_staticId() |
| | | { |
| | | return ::RecordVideo::ImageGrabber::ice_staticId(); |
| | | } |
| | | ::IceProxy::Ice::Object* ::IceProxy::RecordVideo::upCast(::IceProxy::RecordVideo::LoopRecorder* p) { return p; } |
| | | |
| | | void |
| | | ::IceProxy::RecordVideo::_readProxy(::Ice::InputStream* istr, ::IceInternal::ProxyHandle< ::IceProxy::RecordVideo::LoopRecorder>& v) |
| | | { |
| | | ::Ice::ObjectPrx proxy; |
| | | istr->read(proxy); |
| | | if(!proxy) |
| | | { |
| | | v = 0; |
| | | } |
| | | else |
| | | { |
| | | v = new ::IceProxy::RecordVideo::LoopRecorder; |
| | | v->_copyFrom(proxy); |
| | | } |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::RecordVideo::LoopRecorder::_iceI_begin_addCamera(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | _checkTwowayOnly(iceC_RecordVideo_LoopRecorder_addCamera_name, sync); |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_RecordVideo_LoopRecorder_addCamera_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_RecordVideo_LoopRecorder_addCamera_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_index); |
| | | ostr->write(iceP_rtsp); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_RecordVideo_LoopRecorder_addCamera_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | ::std::string |
| | | IceProxy::RecordVideo::LoopRecorder::end_addCamera(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | ::Ice::AsyncResult::_check(result, this, iceC_RecordVideo_LoopRecorder_addCamera_name); |
| | | ::std::string ret; |
| | | if(!result->_waitForResponse()) |
| | | { |
| | | try |
| | | { |
| | | result->_throwUserException(); |
| | | } |
| | | catch(const ::Ice::UserException& ex) |
| | | { |
| | | throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id()); |
| | | } |
| | | } |
| | | ::Ice::InputStream* istr = result->_startReadParams(); |
| | | istr->read(ret); |
| | | result->_endReadParams(); |
| | | return ret; |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::RecordVideo::LoopRecorder::_iceI_begin_removeCamera(const ::std::string& iceP_index, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_RecordVideo_LoopRecorder_removeCamera_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_RecordVideo_LoopRecorder_removeCamera_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_index); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_RecordVideo_LoopRecorder_removeCamera_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | void |
| | | IceProxy::RecordVideo::LoopRecorder::end_removeCamera(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | _end(result, iceC_RecordVideo_LoopRecorder_removeCamera_name); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::RecordVideo::LoopRecorder::_iceI_begin_clearCamera(const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_RecordVideo_LoopRecorder_clearCamera_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_RecordVideo_LoopRecorder_clearCamera_name, ::Ice::Normal, context); |
| | | result->writeEmptyParams(); |
| | | result->invoke(iceC_RecordVideo_LoopRecorder_clearCamera_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | void |
| | | IceProxy::RecordVideo::LoopRecorder::end_clearCamera(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | _end(result, iceC_RecordVideo_LoopRecorder_clearCamera_name); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr |
| | | IceProxy::RecordVideo::LoopRecorder::_iceI_begin_feedDog(const ::std::string& iceP_index, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync) |
| | | { |
| | | ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_RecordVideo_LoopRecorder_feedDog_name, del, cookie, sync); |
| | | try |
| | | { |
| | | result->prepare(iceC_RecordVideo_LoopRecorder_feedDog_name, ::Ice::Normal, context); |
| | | ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat); |
| | | ostr->write(iceP_index); |
| | | result->endWriteParams(); |
| | | result->invoke(iceC_RecordVideo_LoopRecorder_feedDog_name); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | result->abort(ex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | void |
| | | IceProxy::RecordVideo::LoopRecorder::end_feedDog(const ::Ice::AsyncResultPtr& result) |
| | | { |
| | | _end(result, iceC_RecordVideo_LoopRecorder_feedDog_name); |
| | | } |
| | | |
| | | ::IceProxy::Ice::Object* |
| | | IceProxy::RecordVideo::LoopRecorder::_newInstance() const |
| | | { |
| | | return new LoopRecorder; |
| | | } |
| | | |
| | | const ::std::string& |
| | | IceProxy::RecordVideo::LoopRecorder::ice_staticId() |
| | | { |
| | | return ::RecordVideo::LoopRecorder::ice_staticId(); |
| | | } |
| | | |
| | | RecordVideo::Recorder::~Recorder() |
| | | { |
| | | } |
| | | |
| | | ::Ice::Object* RecordVideo::upCast(::RecordVideo::Recorder* p) { return p; } |
| | | |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_RecordVideo_Recorder_ids[2] = |
| | | { |
| | | "::Ice::Object", |
| | | "::RecordVideo::Recorder" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::Recorder::ice_isA(const ::std::string& s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_RecordVideo_Recorder_ids, iceC_RecordVideo_Recorder_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector< ::std::string> |
| | | RecordVideo::Recorder::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector< ::std::string>(&iceC_RecordVideo_Recorder_ids[0], &iceC_RecordVideo_Recorder_ids[2]); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::Recorder::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::Recorder::ice_staticId() |
| | | { |
| | | #ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC |
| | | static const ::std::string typeId = "::RecordVideo::Recorder"; |
| | | return typeId; |
| | | #else |
| | | return iceC_RecordVideo_Recorder_ids[1]; |
| | | #endif |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::Recorder::_iceD_recordVideo(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::std::string iceP_rtsp; |
| | | ::Ice::Long iceP_ms; |
| | | istr->read(iceP_rtsp); |
| | | istr->read(iceP_ms); |
| | | inS.endReadParams(); |
| | | ::std::string ret = this->recordVideo(iceP_rtsp, iceP_ms, current); |
| | | ::Ice::OutputStream* ostr = inS.startWriteParams(); |
| | | ostr->write(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_RecordVideo_Recorder_all[] = |
| | | { |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping", |
| | | "recordVideo" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::Recorder::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_RecordVideo_Recorder_all, iceC_RecordVideo_Recorder_all + 5, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_RecordVideo_Recorder_all) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_recordVideo(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | RecordVideo::Recorder::_iceWriteImpl(::Ice::OutputStream* ostr) const |
| | | { |
| | | ostr->startSlice(ice_staticId(), -1, true); |
| | | Ice::StreamWriter< ::RecordVideo::Recorder, ::Ice::OutputStream>::write(ostr, *this); |
| | | ostr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::Recorder::_iceReadImpl(::Ice::InputStream* istr) |
| | | { |
| | | istr->startSlice(); |
| | | Ice::StreamReader< ::RecordVideo::Recorder, ::Ice::InputStream>::read(istr, *this); |
| | | istr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::_icePatchObjectPtr(RecorderPtr& handle, const ::Ice::ObjectPtr& v) |
| | | { |
| | | handle = ::RecordVideo::RecorderPtr::dynamicCast(v); |
| | | if(v && !handle) |
| | | { |
| | | IceInternal::Ex::throwUOE(::RecordVideo::Recorder::ice_staticId(), v); |
| | | } |
| | | } |
| | | |
| | | RecordVideo::ImageGrabber::~ImageGrabber() |
| | | { |
| | | } |
| | | |
| | | ::Ice::Object* RecordVideo::upCast(::RecordVideo::ImageGrabber* p) { return p; } |
| | | |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_RecordVideo_ImageGrabber_ids[2] = |
| | | { |
| | | "::Ice::Object", |
| | | "::RecordVideo::ImageGrabber" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::ImageGrabber::ice_isA(const ::std::string& s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_RecordVideo_ImageGrabber_ids, iceC_RecordVideo_ImageGrabber_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector< ::std::string> |
| | | RecordVideo::ImageGrabber::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector< ::std::string>(&iceC_RecordVideo_ImageGrabber_ids[0], &iceC_RecordVideo_ImageGrabber_ids[2]); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::ImageGrabber::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::ImageGrabber::ice_staticId() |
| | | { |
| | | #ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC |
| | | static const ::std::string typeId = "::RecordVideo::ImageGrabber"; |
| | | return typeId; |
| | | #else |
| | | return iceC_RecordVideo_ImageGrabber_ids[1]; |
| | | #endif |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::ImageGrabber::_iceD_grabImage(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::Ice::Int iceP_index; |
| | | ::std::string iceP_time; |
| | | istr->read(iceP_index); |
| | | istr->read(iceP_time); |
| | | inS.endReadParams(); |
| | | ::RecordVideo::ByteSequence ret = this->grabImage(iceP_index, iceP_time, current); |
| | | ::Ice::OutputStream* ostr = inS.startWriteParams(); |
| | | ostr->write(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::ImageGrabber::_iceD_grabImageUrl(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::Ice::Int iceP_index; |
| | | ::std::string iceP_time; |
| | | istr->read(iceP_index); |
| | | istr->read(iceP_time); |
| | | inS.endReadParams(); |
| | | ::std::string ret = this->grabImageUrl(iceP_index, iceP_time, current); |
| | | ::Ice::OutputStream* ostr = inS.startWriteParams(); |
| | | ostr->write(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_RecordVideo_ImageGrabber_all[] = |
| | | { |
| | | "grabImage", |
| | | "grabImageUrl", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::ImageGrabber::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_RecordVideo_ImageGrabber_all, iceC_RecordVideo_ImageGrabber_all + 6, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_RecordVideo_ImageGrabber_all) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_grabImage(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_grabImageUrl(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 5: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | RecordVideo::ImageGrabber::_iceWriteImpl(::Ice::OutputStream* ostr) const |
| | | { |
| | | ostr->startSlice(ice_staticId(), -1, true); |
| | | Ice::StreamWriter< ::RecordVideo::ImageGrabber, ::Ice::OutputStream>::write(ostr, *this); |
| | | ostr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::ImageGrabber::_iceReadImpl(::Ice::InputStream* istr) |
| | | { |
| | | istr->startSlice(); |
| | | Ice::StreamReader< ::RecordVideo::ImageGrabber, ::Ice::InputStream>::read(istr, *this); |
| | | istr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::_icePatchObjectPtr(ImageGrabberPtr& handle, const ::Ice::ObjectPtr& v) |
| | | { |
| | | handle = ::RecordVideo::ImageGrabberPtr::dynamicCast(v); |
| | | if(v && !handle) |
| | | { |
| | | IceInternal::Ex::throwUOE(::RecordVideo::ImageGrabber::ice_staticId(), v); |
| | | } |
| | | } |
| | | |
| | | RecordVideo::LoopRecorder::~LoopRecorder() |
| | | { |
| | | } |
| | | |
| | | ::Ice::Object* RecordVideo::upCast(::RecordVideo::LoopRecorder* p) { return p; } |
| | | |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_ids[2] = |
| | | { |
| | | "::Ice::Object", |
| | | "::RecordVideo::LoopRecorder" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::ice_isA(const ::std::string& s, const ::Ice::Current&) const |
| | | { |
| | | return ::std::binary_search(iceC_RecordVideo_LoopRecorder_ids, iceC_RecordVideo_LoopRecorder_ids + 2, s); |
| | | } |
| | | |
| | | ::std::vector< ::std::string> |
| | | RecordVideo::LoopRecorder::ice_ids(const ::Ice::Current&) const |
| | | { |
| | | return ::std::vector< ::std::string>(&iceC_RecordVideo_LoopRecorder_ids[0], &iceC_RecordVideo_LoopRecorder_ids[2]); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::LoopRecorder::ice_id(const ::Ice::Current&) const |
| | | { |
| | | return ice_staticId(); |
| | | } |
| | | |
| | | const ::std::string& |
| | | RecordVideo::LoopRecorder::ice_staticId() |
| | | { |
| | | #ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC |
| | | static const ::std::string typeId = "::RecordVideo::LoopRecorder"; |
| | | return typeId; |
| | | #else |
| | | return iceC_RecordVideo_LoopRecorder_ids[1]; |
| | | #endif |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceD_addCamera(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::std::string iceP_index; |
| | | ::std::string iceP_rtsp; |
| | | istr->read(iceP_index); |
| | | istr->read(iceP_rtsp); |
| | | inS.endReadParams(); |
| | | ::std::string ret = this->addCamera(iceP_index, iceP_rtsp, current); |
| | | ::Ice::OutputStream* ostr = inS.startWriteParams(); |
| | | ostr->write(ret); |
| | | inS.endWriteParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceD_removeCamera(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::std::string iceP_index; |
| | | istr->read(iceP_index); |
| | | inS.endReadParams(); |
| | | this->removeCamera(iceP_index, current); |
| | | inS.writeEmptyParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceD_clearCamera(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | inS.readEmptyParams(); |
| | | this->clearCamera(current); |
| | | inS.writeEmptyParams(); |
| | | return true; |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceD_feedDog(::IceInternal::Incoming& inS, const ::Ice::Current& current) |
| | | { |
| | | _iceCheckMode(::Ice::Normal, current.mode); |
| | | ::Ice::InputStream* istr = inS.startReadParams(); |
| | | ::std::string iceP_index; |
| | | istr->read(iceP_index); |
| | | inS.endReadParams(); |
| | | this->feedDog(iceP_index, current); |
| | | inS.writeEmptyParams(); |
| | | return true; |
| | | } |
| | | |
| | | namespace |
| | | { |
| | | const ::std::string iceC_RecordVideo_LoopRecorder_all[] = |
| | | { |
| | | "addCamera", |
| | | "clearCamera", |
| | | "feedDog", |
| | | "ice_id", |
| | | "ice_ids", |
| | | "ice_isA", |
| | | "ice_ping", |
| | | "removeCamera" |
| | | }; |
| | | |
| | | } |
| | | |
| | | bool |
| | | RecordVideo::LoopRecorder::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) |
| | | { |
| | | ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_RecordVideo_LoopRecorder_all, iceC_RecordVideo_LoopRecorder_all + 8, current.operation); |
| | | if(r.first == r.second) |
| | | { |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | |
| | | switch(r.first - iceC_RecordVideo_LoopRecorder_all) |
| | | { |
| | | case 0: |
| | | { |
| | | return _iceD_addCamera(in, current); |
| | | } |
| | | case 1: |
| | | { |
| | | return _iceD_clearCamera(in, current); |
| | | } |
| | | case 2: |
| | | { |
| | | return _iceD_feedDog(in, current); |
| | | } |
| | | case 3: |
| | | { |
| | | return _iceD_ice_id(in, current); |
| | | } |
| | | case 4: |
| | | { |
| | | return _iceD_ice_ids(in, current); |
| | | } |
| | | case 5: |
| | | { |
| | | return _iceD_ice_isA(in, current); |
| | | } |
| | | case 6: |
| | | { |
| | | return _iceD_ice_ping(in, current); |
| | | } |
| | | case 7: |
| | | { |
| | | return _iceD_removeCamera(in, current); |
| | | } |
| | | default: |
| | | { |
| | | assert(false); |
| | | throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void |
| | | RecordVideo::LoopRecorder::_iceWriteImpl(::Ice::OutputStream* ostr) const |
| | | { |
| | | ostr->startSlice(ice_staticId(), -1, true); |
| | | Ice::StreamWriter< ::RecordVideo::LoopRecorder, ::Ice::OutputStream>::write(ostr, *this); |
| | | ostr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::LoopRecorder::_iceReadImpl(::Ice::InputStream* istr) |
| | | { |
| | | istr->startSlice(); |
| | | Ice::StreamReader< ::RecordVideo::LoopRecorder, ::Ice::InputStream>::read(istr, *this); |
| | | istr->endSlice(); |
| | | } |
| | | |
| | | void |
| | | RecordVideo::_icePatchObjectPtr(LoopRecorderPtr& handle, const ::Ice::ObjectPtr& v) |
| | | { |
| | | handle = ::RecordVideo::LoopRecorderPtr::dynamicCast(v); |
| | | if(v && !handle) |
| | | { |
| | | IceInternal::Ex::throwUOE(::RecordVideo::LoopRecorder::ice_staticId(), v); |
| | | } |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | } |
| | | |
| | | #endif |
| New file |
| | |
| | | // ********************************************************************** |
| | | // |
| | | // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. |
| | | // |
| | | // This copy of Ice is licensed to you under the terms described in the |
| | | // ICE_LICENSE file included in this distribution. |
| | | // |
| | | // ********************************************************************** |
| | | // |
| | | // Ice version 3.7.0 |
| | | // |
| | | // <auto-generated> |
| | | // |
| | | // Generated from file `RecordVideo.ice' |
| | | // |
| | | // Warning: do not edit this file. |
| | | // |
| | | // </auto-generated> |
| | | // |
| | | |
| | | #ifndef __RecordVideo_h__ |
| | | #define __RecordVideo_h__ |
| | | |
| | | #include <IceUtil/PushDisableWarnings.h> |
| | | #include <Ice/ProxyF.h> |
| | | #include <Ice/ObjectF.h> |
| | | #include <Ice/ValueF.h> |
| | | #include <Ice/Exception.h> |
| | | #include <Ice/LocalObject.h> |
| | | #include <Ice/StreamHelpers.h> |
| | | #include <Ice/Comparable.h> |
| | | #include <Ice/Proxy.h> |
| | | #include <Ice/Object.h> |
| | | #include <Ice/GCObject.h> |
| | | #include <Ice/Value.h> |
| | | #include <Ice/Incoming.h> |
| | | #include <Ice/FactoryTableInit.h> |
| | | #include <IceUtil/ScopedArray.h> |
| | | #include <Ice/Optional.h> |
| | | #include <IceUtil/UndefSysMacros.h> |
| | | |
| | | #ifndef ICE_IGNORE_VERSION |
| | | # if ICE_INT_VERSION / 100 != 307 |
| | | # error Ice version mismatch! |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 > 50 |
| | | # error Beta header file detected |
| | | # endif |
| | | # if ICE_INT_VERSION % 100 < 0 |
| | | # error Ice patch level mismatch! |
| | | # endif |
| | | #endif |
| | | |
| | | #ifdef ICE_CPP11_MAPPING // C++11 mapping |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | class Recorder; |
| | | class RecorderPrx; |
| | | class ImageGrabber; |
| | | class ImageGrabberPrx; |
| | | class LoopRecorder; |
| | | class LoopRecorderPrx; |
| | | |
| | | } |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | using ByteSequence = ::std::vector<::Ice::Byte>; |
| | | |
| | | } |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | class Recorder : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | using ProxyType = RecorderPrx; |
| | | |
| | | virtual bool ice_isA(::std::string, const ::Ice::Current&) const override; |
| | | virtual ::std::vector<::std::string> ice_ids(const ::Ice::Current&) const override; |
| | | virtual ::std::string ice_id(const ::Ice::Current&) const override; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::std::string recordVideo(::std::string, long long int, const ::Ice::Current&) = 0; |
| | | bool _iceD_recordVideo(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&) override; |
| | | }; |
| | | |
| | | class ImageGrabber : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | using ProxyType = ImageGrabberPrx; |
| | | |
| | | virtual bool ice_isA(::std::string, const ::Ice::Current&) const override; |
| | | virtual ::std::vector<::std::string> ice_ids(const ::Ice::Current&) const override; |
| | | virtual ::std::string ice_id(const ::Ice::Current&) const override; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::RecordVideo::ByteSequence grabImage(int, ::std::string, const ::Ice::Current&) = 0; |
| | | bool _iceD_grabImage(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual ::std::string grabImageUrl(int, ::std::string, const ::Ice::Current&) = 0; |
| | | bool _iceD_grabImageUrl(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&) override; |
| | | }; |
| | | |
| | | class LoopRecorder : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | using ProxyType = LoopRecorderPrx; |
| | | |
| | | virtual bool ice_isA(::std::string, const ::Ice::Current&) const override; |
| | | virtual ::std::vector<::std::string> ice_ids(const ::Ice::Current&) const override; |
| | | virtual ::std::string ice_id(const ::Ice::Current&) const override; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::std::string addCamera(::std::string, ::std::string, const ::Ice::Current&) = 0; |
| | | bool _iceD_addCamera(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual void removeCamera(::std::string, const ::Ice::Current&) = 0; |
| | | bool _iceD_removeCamera(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual void clearCamera(const ::Ice::Current&) = 0; |
| | | bool _iceD_clearCamera(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual void feedDog(::std::string, const ::Ice::Current&) = 0; |
| | | bool _iceD_feedDog(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&) override; |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | class RecorderPrx : public virtual ::Ice::Proxy<RecorderPrx, ::Ice::ObjectPrx> |
| | | { |
| | | public: |
| | | |
| | | ::std::string recordVideo(const ::std::string& iceP_rtsp, long long int iceP_ms, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makePromiseOutgoing<::std::string>(true, this, &RecordVideo::RecorderPrx::_iceI_recordVideo, iceP_rtsp, iceP_ms, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto recordVideoAsync(const ::std::string& iceP_rtsp, long long int iceP_ms, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<::std::string>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<::std::string, P>(false, this, &RecordVideo::RecorderPrx::_iceI_recordVideo, iceP_rtsp, iceP_ms, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | recordVideoAsync(const ::std::string& iceP_rtsp, long long int iceP_ms, |
| | | ::std::function<void(::std::string)> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<::std::string>(response, ex, sent, this, &RecordVideo::RecorderPrx::_iceI_recordVideo, iceP_rtsp, iceP_ms, context); |
| | | } |
| | | |
| | | void _iceI_recordVideo(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::std::string>>&, const ::std::string&, long long int, const ::Ice::Context&); |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | RecorderPrx() = default; |
| | | friend ::std::shared_ptr<RecorderPrx> IceInternal::createProxy<RecorderPrx>(); |
| | | |
| | | virtual ::std::shared_ptr<::Ice::ObjectPrx> _newInstance() const override; |
| | | }; |
| | | |
| | | class ImageGrabberPrx : public virtual ::Ice::Proxy<ImageGrabberPrx, ::Ice::ObjectPrx> |
| | | { |
| | | public: |
| | | |
| | | ::RecordVideo::ByteSequence grabImage(int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makePromiseOutgoing<::RecordVideo::ByteSequence>(true, this, &RecordVideo::ImageGrabberPrx::_iceI_grabImage, iceP_index, iceP_time, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto grabImageAsync(int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<::RecordVideo::ByteSequence>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<::RecordVideo::ByteSequence, P>(false, this, &RecordVideo::ImageGrabberPrx::_iceI_grabImage, iceP_index, iceP_time, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | grabImageAsync(int iceP_index, const ::std::string& iceP_time, |
| | | ::std::function<void(::RecordVideo::ByteSequence)> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<::RecordVideo::ByteSequence>(response, ex, sent, this, &RecordVideo::ImageGrabberPrx::_iceI_grabImage, iceP_index, iceP_time, context); |
| | | } |
| | | |
| | | void _iceI_grabImage(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::RecordVideo::ByteSequence>>&, int, const ::std::string&, const ::Ice::Context&); |
| | | |
| | | ::std::string grabImageUrl(int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makePromiseOutgoing<::std::string>(true, this, &RecordVideo::ImageGrabberPrx::_iceI_grabImageUrl, iceP_index, iceP_time, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto grabImageUrlAsync(int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<::std::string>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<::std::string, P>(false, this, &RecordVideo::ImageGrabberPrx::_iceI_grabImageUrl, iceP_index, iceP_time, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | grabImageUrlAsync(int iceP_index, const ::std::string& iceP_time, |
| | | ::std::function<void(::std::string)> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<::std::string>(response, ex, sent, this, &RecordVideo::ImageGrabberPrx::_iceI_grabImageUrl, iceP_index, iceP_time, context); |
| | | } |
| | | |
| | | void _iceI_grabImageUrl(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::std::string>>&, int, const ::std::string&, const ::Ice::Context&); |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | ImageGrabberPrx() = default; |
| | | friend ::std::shared_ptr<ImageGrabberPrx> IceInternal::createProxy<ImageGrabberPrx>(); |
| | | |
| | | virtual ::std::shared_ptr<::Ice::ObjectPrx> _newInstance() const override; |
| | | }; |
| | | |
| | | class LoopRecorderPrx : public virtual ::Ice::Proxy<LoopRecorderPrx, ::Ice::ObjectPrx> |
| | | { |
| | | public: |
| | | |
| | | ::std::string addCamera(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makePromiseOutgoing<::std::string>(true, this, &RecordVideo::LoopRecorderPrx::_iceI_addCamera, iceP_index, iceP_rtsp, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto addCameraAsync(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<::std::string>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<::std::string, P>(false, this, &RecordVideo::LoopRecorderPrx::_iceI_addCamera, iceP_index, iceP_rtsp, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | addCameraAsync(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, |
| | | ::std::function<void(::std::string)> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<::std::string>(response, ex, sent, this, &RecordVideo::LoopRecorderPrx::_iceI_addCamera, iceP_index, iceP_rtsp, context); |
| | | } |
| | | |
| | | void _iceI_addCamera(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::std::string>>&, const ::std::string&, const ::std::string&, const ::Ice::Context&); |
| | | |
| | | void removeCamera(const ::std::string& iceP_index, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | _makePromiseOutgoing<void>(true, this, &RecordVideo::LoopRecorderPrx::_iceI_removeCamera, iceP_index, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto removeCameraAsync(const ::std::string& iceP_index, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<void>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<void, P>(false, this, &RecordVideo::LoopRecorderPrx::_iceI_removeCamera, iceP_index, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | removeCameraAsync(const ::std::string& iceP_index, |
| | | ::std::function<void()> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<void>(response, ex, sent, this, &RecordVideo::LoopRecorderPrx::_iceI_removeCamera, iceP_index, context); |
| | | } |
| | | |
| | | void _iceI_removeCamera(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<void>>&, const ::std::string&, const ::Ice::Context&); |
| | | |
| | | void clearCamera(const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | _makePromiseOutgoing<void>(true, this, &RecordVideo::LoopRecorderPrx::_iceI_clearCamera, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto clearCameraAsync(const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<void>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<void, P>(false, this, &RecordVideo::LoopRecorderPrx::_iceI_clearCamera, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | clearCameraAsync(::std::function<void()> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<void>(response, ex, sent, this, &RecordVideo::LoopRecorderPrx::_iceI_clearCamera, context); |
| | | } |
| | | |
| | | void _iceI_clearCamera(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<void>>&, const ::Ice::Context&); |
| | | |
| | | void feedDog(const ::std::string& iceP_index, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | _makePromiseOutgoing<void>(true, this, &RecordVideo::LoopRecorderPrx::_iceI_feedDog, iceP_index, context).get(); |
| | | } |
| | | |
| | | template<template<typename> class P = ::std::promise> |
| | | auto feedDogAsync(const ::std::string& iceP_index, const ::Ice::Context& context = Ice::noExplicitContext) |
| | | -> decltype(::std::declval<P<void>>().get_future()) |
| | | { |
| | | return _makePromiseOutgoing<void, P>(false, this, &RecordVideo::LoopRecorderPrx::_iceI_feedDog, iceP_index, context); |
| | | } |
| | | |
| | | ::std::function<void()> |
| | | feedDogAsync(const ::std::string& iceP_index, |
| | | ::std::function<void()> response, |
| | | ::std::function<void(::std::exception_ptr)> ex = nullptr, |
| | | ::std::function<void(bool)> sent = nullptr, |
| | | const ::Ice::Context& context = Ice::noExplicitContext) |
| | | { |
| | | return _makeLamdaOutgoing<void>(response, ex, sent, this, &RecordVideo::LoopRecorderPrx::_iceI_feedDog, iceP_index, context); |
| | | } |
| | | |
| | | void _iceI_feedDog(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<void>>&, const ::std::string&, const ::Ice::Context&); |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | LoopRecorderPrx() = default; |
| | | friend ::std::shared_ptr<LoopRecorderPrx> IceInternal::createProxy<LoopRecorderPrx>(); |
| | | |
| | | virtual ::std::shared_ptr<::Ice::ObjectPrx> _newInstance() const override; |
| | | }; |
| | | |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | |
| | | } |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | using RecorderPtr = ::std::shared_ptr<Recorder>; |
| | | using RecorderPrxPtr = ::std::shared_ptr<RecorderPrx>; |
| | | |
| | | using ImageGrabberPtr = ::std::shared_ptr<ImageGrabber>; |
| | | using ImageGrabberPrxPtr = ::std::shared_ptr<ImageGrabberPrx>; |
| | | |
| | | using LoopRecorderPtr = ::std::shared_ptr<LoopRecorder>; |
| | | using LoopRecorderPrxPtr = ::std::shared_ptr<LoopRecorderPrx>; |
| | | |
| | | } |
| | | |
| | | #else // C++98 mapping |
| | | |
| | | namespace IceProxy |
| | | { |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | class Recorder; |
| | | void _readProxy(::Ice::InputStream*, ::IceInternal::ProxyHandle< ::IceProxy::RecordVideo::Recorder>&); |
| | | ::IceProxy::Ice::Object* upCast(::IceProxy::RecordVideo::Recorder*); |
| | | |
| | | class ImageGrabber; |
| | | void _readProxy(::Ice::InputStream*, ::IceInternal::ProxyHandle< ::IceProxy::RecordVideo::ImageGrabber>&); |
| | | ::IceProxy::Ice::Object* upCast(::IceProxy::RecordVideo::ImageGrabber*); |
| | | |
| | | class LoopRecorder; |
| | | void _readProxy(::Ice::InputStream*, ::IceInternal::ProxyHandle< ::IceProxy::RecordVideo::LoopRecorder>&); |
| | | ::IceProxy::Ice::Object* upCast(::IceProxy::RecordVideo::LoopRecorder*); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | class Recorder; |
| | | ::Ice::Object* upCast(::RecordVideo::Recorder*); |
| | | typedef ::IceInternal::Handle< ::RecordVideo::Recorder> RecorderPtr; |
| | | typedef ::IceInternal::ProxyHandle< ::IceProxy::RecordVideo::Recorder> RecorderPrx; |
| | | typedef RecorderPrx RecorderPrxPtr; |
| | | void _icePatchObjectPtr(RecorderPtr&, const ::Ice::ObjectPtr&); |
| | | |
| | | class ImageGrabber; |
| | | ::Ice::Object* upCast(::RecordVideo::ImageGrabber*); |
| | | typedef ::IceInternal::Handle< ::RecordVideo::ImageGrabber> ImageGrabberPtr; |
| | | typedef ::IceInternal::ProxyHandle< ::IceProxy::RecordVideo::ImageGrabber> ImageGrabberPrx; |
| | | typedef ImageGrabberPrx ImageGrabberPrxPtr; |
| | | void _icePatchObjectPtr(ImageGrabberPtr&, const ::Ice::ObjectPtr&); |
| | | |
| | | class LoopRecorder; |
| | | ::Ice::Object* upCast(::RecordVideo::LoopRecorder*); |
| | | typedef ::IceInternal::Handle< ::RecordVideo::LoopRecorder> LoopRecorderPtr; |
| | | typedef ::IceInternal::ProxyHandle< ::IceProxy::RecordVideo::LoopRecorder> LoopRecorderPrx; |
| | | typedef LoopRecorderPrx LoopRecorderPrxPtr; |
| | | void _icePatchObjectPtr(LoopRecorderPtr&, const ::Ice::ObjectPtr&); |
| | | |
| | | } |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | typedef ::std::vector< ::Ice::Byte> ByteSequence; |
| | | |
| | | } |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | class Callback_Recorder_recordVideo_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_Recorder_recordVideo_Base> Callback_Recorder_recordVideoPtr; |
| | | |
| | | class Callback_ImageGrabber_grabImage_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_ImageGrabber_grabImage_Base> Callback_ImageGrabber_grabImagePtr; |
| | | |
| | | class Callback_ImageGrabber_grabImageUrl_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_ImageGrabber_grabImageUrl_Base> Callback_ImageGrabber_grabImageUrlPtr; |
| | | |
| | | class Callback_LoopRecorder_addCamera_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_LoopRecorder_addCamera_Base> Callback_LoopRecorder_addCameraPtr; |
| | | |
| | | class Callback_LoopRecorder_removeCamera_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_LoopRecorder_removeCamera_Base> Callback_LoopRecorder_removeCameraPtr; |
| | | |
| | | class Callback_LoopRecorder_clearCamera_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_LoopRecorder_clearCamera_Base> Callback_LoopRecorder_clearCameraPtr; |
| | | |
| | | class Callback_LoopRecorder_feedDog_Base : public virtual ::IceInternal::CallbackBase { }; |
| | | typedef ::IceUtil::Handle< Callback_LoopRecorder_feedDog_Base> Callback_LoopRecorder_feedDogPtr; |
| | | |
| | | } |
| | | |
| | | namespace IceProxy |
| | | { |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | class Recorder : public virtual ::Ice::Proxy<Recorder, ::IceProxy::Ice::Object> |
| | | { |
| | | public: |
| | | |
| | | ::std::string recordVideo(const ::std::string& iceP_rtsp, ::Ice::Long iceP_ms, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return end_recordVideo(_iceI_begin_recordVideo(iceP_rtsp, iceP_ms, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_recordVideo(const ::std::string& iceP_rtsp, ::Ice::Long iceP_ms, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_recordVideo(iceP_rtsp, iceP_ms, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_recordVideo(const ::std::string& iceP_rtsp, ::Ice::Long iceP_ms, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_recordVideo(iceP_rtsp, iceP_ms, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_recordVideo(const ::std::string& iceP_rtsp, ::Ice::Long iceP_ms, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_recordVideo(iceP_rtsp, iceP_ms, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_recordVideo(const ::std::string& iceP_rtsp, ::Ice::Long iceP_ms, const ::RecordVideo::Callback_Recorder_recordVideoPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_recordVideo(iceP_rtsp, iceP_ms, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_recordVideo(const ::std::string& iceP_rtsp, ::Ice::Long iceP_ms, const ::Ice::Context& context, const ::RecordVideo::Callback_Recorder_recordVideoPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_recordVideo(iceP_rtsp, iceP_ms, context, del, cookie); |
| | | } |
| | | |
| | | ::std::string end_recordVideo(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_recordVideo(const ::std::string&, ::Ice::Long, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | virtual ::IceProxy::Ice::Object* _newInstance() const; |
| | | }; |
| | | |
| | | class ImageGrabber : public virtual ::Ice::Proxy<ImageGrabber, ::IceProxy::Ice::Object> |
| | | { |
| | | public: |
| | | |
| | | ::RecordVideo::ByteSequence grabImage(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return end_grabImage(_iceI_begin_grabImage(iceP_index, iceP_time, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImage(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_grabImage(iceP_index, iceP_time, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImage(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_grabImage(iceP_index, iceP_time, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImage(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_grabImage(iceP_index, iceP_time, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImage(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::RecordVideo::Callback_ImageGrabber_grabImagePtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_grabImage(iceP_index, iceP_time, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImage(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context, const ::RecordVideo::Callback_ImageGrabber_grabImagePtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_grabImage(iceP_index, iceP_time, context, del, cookie); |
| | | } |
| | | |
| | | ::RecordVideo::ByteSequence end_grabImage(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_grabImage(::Ice::Int, const ::std::string&, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | ::std::string grabImageUrl(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return end_grabImageUrl(_iceI_begin_grabImageUrl(iceP_index, iceP_time, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImageUrl(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_grabImageUrl(iceP_index, iceP_time, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImageUrl(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_grabImageUrl(iceP_index, iceP_time, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImageUrl(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_grabImageUrl(iceP_index, iceP_time, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImageUrl(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::RecordVideo::Callback_ImageGrabber_grabImageUrlPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_grabImageUrl(iceP_index, iceP_time, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_grabImageUrl(::Ice::Int iceP_index, const ::std::string& iceP_time, const ::Ice::Context& context, const ::RecordVideo::Callback_ImageGrabber_grabImageUrlPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_grabImageUrl(iceP_index, iceP_time, context, del, cookie); |
| | | } |
| | | |
| | | ::std::string end_grabImageUrl(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_grabImageUrl(::Ice::Int, const ::std::string&, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | virtual ::IceProxy::Ice::Object* _newInstance() const; |
| | | }; |
| | | |
| | | class LoopRecorder : public virtual ::Ice::Proxy<LoopRecorder, ::IceProxy::Ice::Object> |
| | | { |
| | | public: |
| | | |
| | | ::std::string addCamera(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return end_addCamera(_iceI_begin_addCamera(iceP_index, iceP_rtsp, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_addCamera(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_addCamera(iceP_index, iceP_rtsp, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_addCamera(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_addCamera(iceP_index, iceP_rtsp, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_addCamera(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_addCamera(iceP_index, iceP_rtsp, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_addCamera(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::RecordVideo::Callback_LoopRecorder_addCameraPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_addCamera(iceP_index, iceP_rtsp, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_addCamera(const ::std::string& iceP_index, const ::std::string& iceP_rtsp, const ::Ice::Context& context, const ::RecordVideo::Callback_LoopRecorder_addCameraPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_addCamera(iceP_index, iceP_rtsp, context, del, cookie); |
| | | } |
| | | |
| | | ::std::string end_addCamera(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_addCamera(const ::std::string&, const ::std::string&, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | void removeCamera(const ::std::string& iceP_index, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | end_removeCamera(_iceI_begin_removeCamera(iceP_index, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_removeCamera(const ::std::string& iceP_index, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_removeCamera(iceP_index, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_removeCamera(const ::std::string& iceP_index, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_removeCamera(iceP_index, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_removeCamera(const ::std::string& iceP_index, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_removeCamera(iceP_index, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_removeCamera(const ::std::string& iceP_index, const ::RecordVideo::Callback_LoopRecorder_removeCameraPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_removeCamera(iceP_index, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_removeCamera(const ::std::string& iceP_index, const ::Ice::Context& context, const ::RecordVideo::Callback_LoopRecorder_removeCameraPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_removeCamera(iceP_index, context, del, cookie); |
| | | } |
| | | |
| | | void end_removeCamera(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_removeCamera(const ::std::string&, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | void clearCamera(const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | end_clearCamera(_iceI_begin_clearCamera(context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_clearCamera(const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_clearCamera(context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_clearCamera(const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_clearCamera(::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_clearCamera(const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_clearCamera(context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_clearCamera(const ::RecordVideo::Callback_LoopRecorder_clearCameraPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_clearCamera(::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_clearCamera(const ::Ice::Context& context, const ::RecordVideo::Callback_LoopRecorder_clearCameraPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_clearCamera(context, del, cookie); |
| | | } |
| | | |
| | | void end_clearCamera(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_clearCamera(const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | void feedDog(const ::std::string& iceP_index, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | end_feedDog(_iceI_begin_feedDog(iceP_index, context, ::IceInternal::dummyCallback, 0, true)); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_feedDog(const ::std::string& iceP_index, const ::Ice::Context& context = ::Ice::noExplicitContext) |
| | | { |
| | | return _iceI_begin_feedDog(iceP_index, context, ::IceInternal::dummyCallback, 0); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_feedDog(const ::std::string& iceP_index, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_feedDog(iceP_index, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_feedDog(const ::std::string& iceP_index, const ::Ice::Context& context, const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_feedDog(iceP_index, context, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_feedDog(const ::std::string& iceP_index, const ::RecordVideo::Callback_LoopRecorder_feedDogPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_feedDog(iceP_index, ::Ice::noExplicitContext, del, cookie); |
| | | } |
| | | |
| | | ::Ice::AsyncResultPtr begin_feedDog(const ::std::string& iceP_index, const ::Ice::Context& context, const ::RecordVideo::Callback_LoopRecorder_feedDogPtr& del, const ::Ice::LocalObjectPtr& cookie = 0) |
| | | { |
| | | return _iceI_begin_feedDog(iceP_index, context, del, cookie); |
| | | } |
| | | |
| | | void end_feedDog(const ::Ice::AsyncResultPtr&); |
| | | |
| | | private: |
| | | |
| | | ::Ice::AsyncResultPtr _iceI_begin_feedDog(const ::std::string&, const ::Ice::Context&, const ::IceInternal::CallbackBasePtr&, const ::Ice::LocalObjectPtr& cookie = 0, bool sync = false); |
| | | |
| | | public: |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | protected: |
| | | |
| | | virtual ::IceProxy::Ice::Object* _newInstance() const; |
| | | }; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | class Recorder : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | typedef RecorderPrx ProxyType; |
| | | typedef RecorderPtr PointerType; |
| | | |
| | | virtual ~Recorder(); |
| | | |
| | | virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::std::string recordVideo(const ::std::string&, ::Ice::Long, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_recordVideo(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | protected: |
| | | |
| | | virtual void _iceWriteImpl(::Ice::OutputStream*) const; |
| | | virtual void _iceReadImpl(::Ice::InputStream*); |
| | | }; |
| | | |
| | | inline bool operator==(const Recorder& lhs, const Recorder& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) == static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | inline bool operator<(const Recorder& lhs, const Recorder& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) < static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | class ImageGrabber : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | typedef ImageGrabberPrx ProxyType; |
| | | typedef ImageGrabberPtr PointerType; |
| | | |
| | | virtual ~ImageGrabber(); |
| | | |
| | | virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::RecordVideo::ByteSequence grabImage(::Ice::Int, const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_grabImage(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual ::std::string grabImageUrl(::Ice::Int, const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_grabImageUrl(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | protected: |
| | | |
| | | virtual void _iceWriteImpl(::Ice::OutputStream*) const; |
| | | virtual void _iceReadImpl(::Ice::InputStream*); |
| | | }; |
| | | |
| | | inline bool operator==(const ImageGrabber& lhs, const ImageGrabber& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) == static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | inline bool operator<(const ImageGrabber& lhs, const ImageGrabber& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) < static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | class LoopRecorder : public virtual ::Ice::Object |
| | | { |
| | | public: |
| | | |
| | | typedef LoopRecorderPrx ProxyType; |
| | | typedef LoopRecorderPtr PointerType; |
| | | |
| | | virtual ~LoopRecorder(); |
| | | |
| | | virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::emptyCurrent) const; |
| | | |
| | | static const ::std::string& ice_staticId(); |
| | | |
| | | virtual ::std::string addCamera(const ::std::string&, const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_addCamera(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual void removeCamera(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_removeCamera(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual void clearCamera(const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_clearCamera(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual void feedDog(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) = 0; |
| | | bool _iceD_feedDog(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&); |
| | | |
| | | protected: |
| | | |
| | | virtual void _iceWriteImpl(::Ice::OutputStream*) const; |
| | | virtual void _iceReadImpl(::Ice::InputStream*); |
| | | }; |
| | | |
| | | inline bool operator==(const LoopRecorder& lhs, const LoopRecorder& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) == static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | inline bool operator<(const LoopRecorder& lhs, const LoopRecorder& rhs) |
| | | { |
| | | return static_cast<const ::Ice::Object&>(lhs) < static_cast<const ::Ice::Object&>(rhs); |
| | | } |
| | | |
| | | } |
| | | |
| | | namespace Ice |
| | | { |
| | | |
| | | } |
| | | |
| | | namespace RecordVideo |
| | | { |
| | | |
| | | template<class T> |
| | | class CallbackNC_Recorder_recordVideo : public Callback_Recorder_recordVideo_Base, public ::IceInternal::TwowayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(const ::std::string&); |
| | | |
| | | CallbackNC_Recorder_recordVideo(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallbackNC<T>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::RecordVideo::RecorderPrx proxy = ::RecordVideo::RecorderPrx::uncheckedCast(result->getProxy()); |
| | | ::std::string ret; |
| | | try |
| | | { |
| | | ret = proxy->end_recordVideo(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::CallbackNC<T>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T> Callback_Recorder_recordVideoPtr |
| | | newCallback_Recorder_recordVideo(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::std::string&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_Recorder_recordVideo<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_Recorder_recordVideoPtr |
| | | newCallback_Recorder_recordVideo(T* instance, void (T::*cb)(const ::std::string&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_Recorder_recordVideo<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_Recorder_recordVideo : public Callback_Recorder_recordVideo_Base, public ::IceInternal::TwowayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const ::std::string&, const CT&); |
| | | |
| | | Callback_Recorder_recordVideo(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallback<T, CT>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::RecordVideo::RecorderPrx proxy = ::RecordVideo::RecorderPrx::uncheckedCast(result->getProxy()); |
| | | ::std::string ret; |
| | | try |
| | | { |
| | | ret = proxy->end_recordVideo(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::Callback<T, CT>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret, CT::dynamicCast(result->getCookie())); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_Recorder_recordVideoPtr |
| | | newCallback_Recorder_recordVideo(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::std::string&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_Recorder_recordVideo<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_Recorder_recordVideoPtr |
| | | newCallback_Recorder_recordVideo(T* instance, void (T::*cb)(const ::std::string&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_Recorder_recordVideo<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> |
| | | class CallbackNC_ImageGrabber_grabImage : public Callback_ImageGrabber_grabImage_Base, public ::IceInternal::TwowayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(const ::RecordVideo::ByteSequence&); |
| | | |
| | | CallbackNC_ImageGrabber_grabImage(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallbackNC<T>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::RecordVideo::ImageGrabberPrx proxy = ::RecordVideo::ImageGrabberPrx::uncheckedCast(result->getProxy()); |
| | | ::RecordVideo::ByteSequence ret; |
| | | try |
| | | { |
| | | ret = proxy->end_grabImage(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::CallbackNC<T>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T> Callback_ImageGrabber_grabImagePtr |
| | | newCallback_ImageGrabber_grabImage(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::RecordVideo::ByteSequence&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_ImageGrabber_grabImage<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_ImageGrabber_grabImagePtr |
| | | newCallback_ImageGrabber_grabImage(T* instance, void (T::*cb)(const ::RecordVideo::ByteSequence&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_ImageGrabber_grabImage<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_ImageGrabber_grabImage : public Callback_ImageGrabber_grabImage_Base, public ::IceInternal::TwowayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const ::RecordVideo::ByteSequence&, const CT&); |
| | | |
| | | Callback_ImageGrabber_grabImage(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallback<T, CT>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::RecordVideo::ImageGrabberPrx proxy = ::RecordVideo::ImageGrabberPrx::uncheckedCast(result->getProxy()); |
| | | ::RecordVideo::ByteSequence ret; |
| | | try |
| | | { |
| | | ret = proxy->end_grabImage(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::Callback<T, CT>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret, CT::dynamicCast(result->getCookie())); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_ImageGrabber_grabImagePtr |
| | | newCallback_ImageGrabber_grabImage(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::RecordVideo::ByteSequence&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_ImageGrabber_grabImage<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_ImageGrabber_grabImagePtr |
| | | newCallback_ImageGrabber_grabImage(T* instance, void (T::*cb)(const ::RecordVideo::ByteSequence&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_ImageGrabber_grabImage<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> |
| | | class CallbackNC_ImageGrabber_grabImageUrl : public Callback_ImageGrabber_grabImageUrl_Base, public ::IceInternal::TwowayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(const ::std::string&); |
| | | |
| | | CallbackNC_ImageGrabber_grabImageUrl(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallbackNC<T>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::RecordVideo::ImageGrabberPrx proxy = ::RecordVideo::ImageGrabberPrx::uncheckedCast(result->getProxy()); |
| | | ::std::string ret; |
| | | try |
| | | { |
| | | ret = proxy->end_grabImageUrl(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::CallbackNC<T>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T> Callback_ImageGrabber_grabImageUrlPtr |
| | | newCallback_ImageGrabber_grabImageUrl(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::std::string&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_ImageGrabber_grabImageUrl<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_ImageGrabber_grabImageUrlPtr |
| | | newCallback_ImageGrabber_grabImageUrl(T* instance, void (T::*cb)(const ::std::string&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_ImageGrabber_grabImageUrl<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_ImageGrabber_grabImageUrl : public Callback_ImageGrabber_grabImageUrl_Base, public ::IceInternal::TwowayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const ::std::string&, const CT&); |
| | | |
| | | Callback_ImageGrabber_grabImageUrl(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallback<T, CT>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::RecordVideo::ImageGrabberPrx proxy = ::RecordVideo::ImageGrabberPrx::uncheckedCast(result->getProxy()); |
| | | ::std::string ret; |
| | | try |
| | | { |
| | | ret = proxy->end_grabImageUrl(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::Callback<T, CT>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret, CT::dynamicCast(result->getCookie())); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_ImageGrabber_grabImageUrlPtr |
| | | newCallback_ImageGrabber_grabImageUrl(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::std::string&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_ImageGrabber_grabImageUrl<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_ImageGrabber_grabImageUrlPtr |
| | | newCallback_ImageGrabber_grabImageUrl(T* instance, void (T::*cb)(const ::std::string&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_ImageGrabber_grabImageUrl<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> |
| | | class CallbackNC_LoopRecorder_addCamera : public Callback_LoopRecorder_addCamera_Base, public ::IceInternal::TwowayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(const ::std::string&); |
| | | |
| | | CallbackNC_LoopRecorder_addCamera(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallbackNC<T>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::RecordVideo::LoopRecorderPrx proxy = ::RecordVideo::LoopRecorderPrx::uncheckedCast(result->getProxy()); |
| | | ::std::string ret; |
| | | try |
| | | { |
| | | ret = proxy->end_addCamera(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::CallbackNC<T>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T> Callback_LoopRecorder_addCameraPtr |
| | | newCallback_LoopRecorder_addCamera(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::std::string&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_addCamera<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_addCameraPtr |
| | | newCallback_LoopRecorder_addCamera(T* instance, void (T::*cb)(const ::std::string&), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_addCamera<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_LoopRecorder_addCamera : public Callback_LoopRecorder_addCamera_Base, public ::IceInternal::TwowayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const ::std::string&, const CT&); |
| | | |
| | | Callback_LoopRecorder_addCamera(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::TwowayCallback<T, CT>(obj, cb != 0, excb, sentcb), _response(cb) |
| | | { |
| | | } |
| | | |
| | | virtual void completed(const ::Ice::AsyncResultPtr& result) const |
| | | { |
| | | ::RecordVideo::LoopRecorderPrx proxy = ::RecordVideo::LoopRecorderPrx::uncheckedCast(result->getProxy()); |
| | | ::std::string ret; |
| | | try |
| | | { |
| | | ret = proxy->end_addCamera(result); |
| | | } |
| | | catch(const ::Ice::Exception& ex) |
| | | { |
| | | ::IceInternal::Callback<T, CT>::exception(result, ex); |
| | | return; |
| | | } |
| | | if(_response) |
| | | { |
| | | (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret, CT::dynamicCast(result->getCookie())); |
| | | } |
| | | } |
| | | |
| | | private: |
| | | |
| | | Response _response; |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_addCameraPtr |
| | | newCallback_LoopRecorder_addCamera(const IceUtil::Handle<T>& instance, void (T::*cb)(const ::std::string&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_addCamera<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_addCameraPtr |
| | | newCallback_LoopRecorder_addCamera(T* instance, void (T::*cb)(const ::std::string&, const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_addCamera<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> |
| | | class CallbackNC_LoopRecorder_removeCamera : public Callback_LoopRecorder_removeCamera_Base, public ::IceInternal::OnewayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(); |
| | | |
| | | CallbackNC_LoopRecorder_removeCamera(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::OnewayCallbackNC<T>(obj, cb, excb, sentcb) |
| | | { |
| | | } |
| | | }; |
| | | |
| | | template<class T> Callback_LoopRecorder_removeCameraPtr |
| | | newCallback_LoopRecorder_removeCamera(const IceUtil::Handle<T>& instance, void (T::*cb)(), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_removeCamera<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_removeCameraPtr |
| | | newCallback_LoopRecorder_removeCamera(const IceUtil::Handle<T>& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_removeCamera<T>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_removeCameraPtr |
| | | newCallback_LoopRecorder_removeCamera(T* instance, void (T::*cb)(), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_removeCamera<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_removeCameraPtr |
| | | newCallback_LoopRecorder_removeCamera(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_removeCamera<T>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_LoopRecorder_removeCamera : public Callback_LoopRecorder_removeCamera_Base, public ::IceInternal::OnewayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const CT&); |
| | | |
| | | Callback_LoopRecorder_removeCamera(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::OnewayCallback<T, CT>(obj, cb, excb, sentcb) |
| | | { |
| | | } |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_removeCameraPtr |
| | | newCallback_LoopRecorder_removeCamera(const IceUtil::Handle<T>& instance, void (T::*cb)(const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_removeCamera<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_removeCameraPtr |
| | | newCallback_LoopRecorder_removeCamera(const IceUtil::Handle<T>& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_removeCamera<T, CT>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_removeCameraPtr |
| | | newCallback_LoopRecorder_removeCamera(T* instance, void (T::*cb)(const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_removeCamera<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_removeCameraPtr |
| | | newCallback_LoopRecorder_removeCamera(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_removeCamera<T, CT>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> |
| | | class CallbackNC_LoopRecorder_clearCamera : public Callback_LoopRecorder_clearCamera_Base, public ::IceInternal::OnewayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(); |
| | | |
| | | CallbackNC_LoopRecorder_clearCamera(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::OnewayCallbackNC<T>(obj, cb, excb, sentcb) |
| | | { |
| | | } |
| | | }; |
| | | |
| | | template<class T> Callback_LoopRecorder_clearCameraPtr |
| | | newCallback_LoopRecorder_clearCamera(const IceUtil::Handle<T>& instance, void (T::*cb)(), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_clearCamera<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_clearCameraPtr |
| | | newCallback_LoopRecorder_clearCamera(const IceUtil::Handle<T>& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_clearCamera<T>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_clearCameraPtr |
| | | newCallback_LoopRecorder_clearCamera(T* instance, void (T::*cb)(), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_clearCamera<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_clearCameraPtr |
| | | newCallback_LoopRecorder_clearCamera(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_clearCamera<T>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_LoopRecorder_clearCamera : public Callback_LoopRecorder_clearCamera_Base, public ::IceInternal::OnewayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const CT&); |
| | | |
| | | Callback_LoopRecorder_clearCamera(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::OnewayCallback<T, CT>(obj, cb, excb, sentcb) |
| | | { |
| | | } |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_clearCameraPtr |
| | | newCallback_LoopRecorder_clearCamera(const IceUtil::Handle<T>& instance, void (T::*cb)(const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_clearCamera<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_clearCameraPtr |
| | | newCallback_LoopRecorder_clearCamera(const IceUtil::Handle<T>& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_clearCamera<T, CT>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_clearCameraPtr |
| | | newCallback_LoopRecorder_clearCamera(T* instance, void (T::*cb)(const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_clearCamera<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_clearCameraPtr |
| | | newCallback_LoopRecorder_clearCamera(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_clearCamera<T, CT>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> |
| | | class CallbackNC_LoopRecorder_feedDog : public Callback_LoopRecorder_feedDog_Base, public ::IceInternal::OnewayCallbackNC<T> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception&); |
| | | typedef void (T::*Sent)(bool); |
| | | typedef void (T::*Response)(); |
| | | |
| | | CallbackNC_LoopRecorder_feedDog(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::OnewayCallbackNC<T>(obj, cb, excb, sentcb) |
| | | { |
| | | } |
| | | }; |
| | | |
| | | template<class T> Callback_LoopRecorder_feedDogPtr |
| | | newCallback_LoopRecorder_feedDog(const IceUtil::Handle<T>& instance, void (T::*cb)(), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_feedDog<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_feedDogPtr |
| | | newCallback_LoopRecorder_feedDog(const IceUtil::Handle<T>& instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_feedDog<T>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_feedDogPtr |
| | | newCallback_LoopRecorder_feedDog(T* instance, void (T::*cb)(), void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_feedDog<T>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T> Callback_LoopRecorder_feedDogPtr |
| | | newCallback_LoopRecorder_feedDog(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0) |
| | | { |
| | | return new CallbackNC_LoopRecorder_feedDog<T>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> |
| | | class Callback_LoopRecorder_feedDog : public Callback_LoopRecorder_feedDog_Base, public ::IceInternal::OnewayCallback<T, CT> |
| | | { |
| | | public: |
| | | |
| | | typedef IceUtil::Handle<T> TPtr; |
| | | |
| | | typedef void (T::*Exception)(const ::Ice::Exception& , const CT&); |
| | | typedef void (T::*Sent)(bool , const CT&); |
| | | typedef void (T::*Response)(const CT&); |
| | | |
| | | Callback_LoopRecorder_feedDog(const TPtr& obj, Response cb, Exception excb, Sent sentcb) |
| | | : ::IceInternal::OnewayCallback<T, CT>(obj, cb, excb, sentcb) |
| | | { |
| | | } |
| | | }; |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_feedDogPtr |
| | | newCallback_LoopRecorder_feedDog(const IceUtil::Handle<T>& instance, void (T::*cb)(const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_feedDog<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_feedDogPtr |
| | | newCallback_LoopRecorder_feedDog(const IceUtil::Handle<T>& instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_feedDog<T, CT>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_feedDogPtr |
| | | newCallback_LoopRecorder_feedDog(T* instance, void (T::*cb)(const CT&), void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_feedDog<T, CT>(instance, cb, excb, sentcb); |
| | | } |
| | | |
| | | template<class T, typename CT> Callback_LoopRecorder_feedDogPtr |
| | | newCallback_LoopRecorder_feedDog(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&), void (T::*sentcb)(bool, const CT&) = 0) |
| | | { |
| | | return new Callback_LoopRecorder_feedDog<T, CT>(instance, 0, excb, sentcb); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endif |
| | | |
| | | #include <IceUtil/PopDisableWarnings.h> |
| | | #endif |
| New file |
| | |
| | | module RecordVideo |
| | | { |
| | | sequence<byte> ByteSequence; |
| | | |
| | | interface Recorder |
| | | { |
| | | string recordVideo(string rtsp,long ms); |
| | | } |
| | | |
| | | interface ImageGrabber |
| | | { |
| | | ByteSequence grabImage(int index,string time); |
| | | string grabImageUrl(int index,string time); |
| | | } |
| | | |
| | | interface LoopRecorder |
| | | { |
| | | string addCamera(string index,string rtsp); |
| | | void removeCamera(string index); |
| | | void clearCamera(); |
| | | void feedDog(string index); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | # Generated by slice2py - DO NOT EDIT! |
| | | # |
| | | |
| | | import Ice |
| | | Ice.updateModule("RecordVideo") |
| | | |
| | | # Modules: |
| | | import RecordVideo_ice |
| | | |
| | | # Submodules: |
| New file |
| | |
| | | # -*- coding: utf-8 -*- |
| | | # ********************************************************************** |
| | | # |
| | | # Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. |
| | | # |
| | | # This copy of Ice is licensed to you under the terms described in the |
| | | # ICE_LICENSE file included in this distribution. |
| | | # |
| | | # ********************************************************************** |
| | | # |
| | | # Ice version 3.7.0 |
| | | # |
| | | # <auto-generated> |
| | | # |
| | | # Generated from file `RecordVideo.ice' |
| | | # |
| | | # Warning: do not edit this file. |
| | | # |
| | | # </auto-generated> |
| | | # |
| | | |
| | | from sys import version_info as _version_info_ |
| | | import Ice, IcePy |
| | | |
| | | # Start of module RecordVideo |
| | | _M_RecordVideo = Ice.openModule('RecordVideo') |
| | | __name__ = 'RecordVideo' |
| | | |
| | | if '_t_ByteSequence' not in _M_RecordVideo.__dict__: |
| | | _M_RecordVideo._t_ByteSequence = IcePy.defineSequence('::RecordVideo::ByteSequence', (), IcePy._t_byte) |
| | | |
| | | _M_RecordVideo._t_Recorder = IcePy.defineValue('::RecordVideo::Recorder', Ice.Value, -1, (), False, True, None, ()) |
| | | |
| | | if 'RecorderPrx' not in _M_RecordVideo.__dict__: |
| | | _M_RecordVideo.RecorderPrx = Ice.createTempClass() |
| | | class RecorderPrx(Ice.ObjectPrx): |
| | | |
| | | def recordVideo(self, rtsp, ms, context=None): |
| | | return _M_RecordVideo.Recorder._op_recordVideo.invoke(self, ((rtsp, ms), context)) |
| | | |
| | | def recordVideoAsync(self, rtsp, ms, context=None): |
| | | return _M_RecordVideo.Recorder._op_recordVideo.invokeAsync(self, ((rtsp, ms), context)) |
| | | |
| | | def begin_recordVideo(self, rtsp, ms, _response=None, _ex=None, _sent=None, context=None): |
| | | return _M_RecordVideo.Recorder._op_recordVideo.begin(self, ((rtsp, ms), _response, _ex, _sent, context)) |
| | | |
| | | def end_recordVideo(self, _r): |
| | | return _M_RecordVideo.Recorder._op_recordVideo.end(self, _r) |
| | | |
| | | @staticmethod |
| | | def checkedCast(proxy, facetOrContext=None, context=None): |
| | | return _M_RecordVideo.RecorderPrx.ice_checkedCast(proxy, '::RecordVideo::Recorder', facetOrContext, context) |
| | | |
| | | @staticmethod |
| | | def uncheckedCast(proxy, facet=None): |
| | | return _M_RecordVideo.RecorderPrx.ice_uncheckedCast(proxy, facet) |
| | | |
| | | @staticmethod |
| | | def ice_staticId(): |
| | | return '::RecordVideo::Recorder' |
| | | _M_RecordVideo._t_RecorderPrx = IcePy.defineProxy('::RecordVideo::Recorder', RecorderPrx) |
| | | |
| | | _M_RecordVideo.RecorderPrx = RecorderPrx |
| | | del RecorderPrx |
| | | |
| | | _M_RecordVideo.Recorder = Ice.createTempClass() |
| | | class Recorder(Ice.Object): |
| | | |
| | | def ice_ids(self, current=None): |
| | | return ('::Ice::Object', '::RecordVideo::Recorder') |
| | | |
| | | def ice_id(self, current=None): |
| | | return '::RecordVideo::Recorder' |
| | | |
| | | @staticmethod |
| | | def ice_staticId(): |
| | | return '::RecordVideo::Recorder' |
| | | |
| | | def recordVideo(self, rtsp, ms, current=None): |
| | | raise NotImplementedError("servant method 'recordVideo' not implemented") |
| | | |
| | | def __str__(self): |
| | | return IcePy.stringify(self, _M_RecordVideo._t_RecorderDisp) |
| | | |
| | | __repr__ = __str__ |
| | | |
| | | _M_RecordVideo._t_RecorderDisp = IcePy.defineClass('::RecordVideo::Recorder', Recorder, (), None, ()) |
| | | Recorder._ice_type = _M_RecordVideo._t_RecorderDisp |
| | | |
| | | Recorder._op_recordVideo = IcePy.Operation('recordVideo', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (((), IcePy._t_string, False, 0), ((), IcePy._t_long, False, 0)), (), ((), IcePy._t_string, False, 0), ()) |
| | | |
| | | _M_RecordVideo.Recorder = Recorder |
| | | del Recorder |
| | | |
| | | _M_RecordVideo._t_ImageGrabber = IcePy.defineValue('::RecordVideo::ImageGrabber', Ice.Value, -1, (), False, True, None, ()) |
| | | |
| | | if 'ImageGrabberPrx' not in _M_RecordVideo.__dict__: |
| | | _M_RecordVideo.ImageGrabberPrx = Ice.createTempClass() |
| | | class ImageGrabberPrx(Ice.ObjectPrx): |
| | | |
| | | def grabImage(self, index, time, context=None): |
| | | return _M_RecordVideo.ImageGrabber._op_grabImage.invoke(self, ((index, time), context)) |
| | | |
| | | def grabImageAsync(self, index, time, context=None): |
| | | return _M_RecordVideo.ImageGrabber._op_grabImage.invokeAsync(self, ((index, time), context)) |
| | | |
| | | def begin_grabImage(self, index, time, _response=None, _ex=None, _sent=None, context=None): |
| | | return _M_RecordVideo.ImageGrabber._op_grabImage.begin(self, ((index, time), _response, _ex, _sent, context)) |
| | | |
| | | def end_grabImage(self, _r): |
| | | return _M_RecordVideo.ImageGrabber._op_grabImage.end(self, _r) |
| | | |
| | | def grabImageUrl(self, index, time, context=None): |
| | | return _M_RecordVideo.ImageGrabber._op_grabImageUrl.invoke(self, ((index, time), context)) |
| | | |
| | | def grabImageUrlAsync(self, index, time, context=None): |
| | | return _M_RecordVideo.ImageGrabber._op_grabImageUrl.invokeAsync(self, ((index, time), context)) |
| | | |
| | | def begin_grabImageUrl(self, index, time, _response=None, _ex=None, _sent=None, context=None): |
| | | return _M_RecordVideo.ImageGrabber._op_grabImageUrl.begin(self, ((index, time), _response, _ex, _sent, context)) |
| | | |
| | | def end_grabImageUrl(self, _r): |
| | | return _M_RecordVideo.ImageGrabber._op_grabImageUrl.end(self, _r) |
| | | |
| | | @staticmethod |
| | | def checkedCast(proxy, facetOrContext=None, context=None): |
| | | return _M_RecordVideo.ImageGrabberPrx.ice_checkedCast(proxy, '::RecordVideo::ImageGrabber', facetOrContext, context) |
| | | |
| | | @staticmethod |
| | | def uncheckedCast(proxy, facet=None): |
| | | return _M_RecordVideo.ImageGrabberPrx.ice_uncheckedCast(proxy, facet) |
| | | |
| | | @staticmethod |
| | | def ice_staticId(): |
| | | return '::RecordVideo::ImageGrabber' |
| | | _M_RecordVideo._t_ImageGrabberPrx = IcePy.defineProxy('::RecordVideo::ImageGrabber', ImageGrabberPrx) |
| | | |
| | | _M_RecordVideo.ImageGrabberPrx = ImageGrabberPrx |
| | | del ImageGrabberPrx |
| | | |
| | | _M_RecordVideo.ImageGrabber = Ice.createTempClass() |
| | | class ImageGrabber(Ice.Object): |
| | | |
| | | def ice_ids(self, current=None): |
| | | return ('::Ice::Object', '::RecordVideo::ImageGrabber') |
| | | |
| | | def ice_id(self, current=None): |
| | | return '::RecordVideo::ImageGrabber' |
| | | |
| | | @staticmethod |
| | | def ice_staticId(): |
| | | return '::RecordVideo::ImageGrabber' |
| | | |
| | | def grabImage(self, index, time, current=None): |
| | | raise NotImplementedError("servant method 'grabImage' not implemented") |
| | | |
| | | def grabImageUrl(self, index, time, current=None): |
| | | raise NotImplementedError("servant method 'grabImageUrl' not implemented") |
| | | |
| | | def __str__(self): |
| | | return IcePy.stringify(self, _M_RecordVideo._t_ImageGrabberDisp) |
| | | |
| | | __repr__ = __str__ |
| | | |
| | | _M_RecordVideo._t_ImageGrabberDisp = IcePy.defineClass('::RecordVideo::ImageGrabber', ImageGrabber, (), None, ()) |
| | | ImageGrabber._ice_type = _M_RecordVideo._t_ImageGrabberDisp |
| | | |
| | | ImageGrabber._op_grabImage = IcePy.Operation('grabImage', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (((), IcePy._t_int, False, 0), ((), IcePy._t_string, False, 0)), (), ((), _M_RecordVideo._t_ByteSequence, False, 0), ()) |
| | | ImageGrabber._op_grabImageUrl = IcePy.Operation('grabImageUrl', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (((), IcePy._t_int, False, 0), ((), IcePy._t_string, False, 0)), (), ((), IcePy._t_string, False, 0), ()) |
| | | |
| | | _M_RecordVideo.ImageGrabber = ImageGrabber |
| | | del ImageGrabber |
| | | |
| | | _M_RecordVideo._t_LoopRecorder = IcePy.defineValue('::RecordVideo::LoopRecorder', Ice.Value, -1, (), False, True, None, ()) |
| | | |
| | | if 'LoopRecorderPrx' not in _M_RecordVideo.__dict__: |
| | | _M_RecordVideo.LoopRecorderPrx = Ice.createTempClass() |
| | | class LoopRecorderPrx(Ice.ObjectPrx): |
| | | |
| | | def addCamera(self, index, rtsp, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_addCamera.invoke(self, ((index, rtsp), context)) |
| | | |
| | | def addCameraAsync(self, index, rtsp, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_addCamera.invokeAsync(self, ((index, rtsp), context)) |
| | | |
| | | def begin_addCamera(self, index, rtsp, _response=None, _ex=None, _sent=None, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_addCamera.begin(self, ((index, rtsp), _response, _ex, _sent, context)) |
| | | |
| | | def end_addCamera(self, _r): |
| | | return _M_RecordVideo.LoopRecorder._op_addCamera.end(self, _r) |
| | | |
| | | def removeCamera(self, index, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_removeCamera.invoke(self, ((index, ), context)) |
| | | |
| | | def removeCameraAsync(self, index, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_removeCamera.invokeAsync(self, ((index, ), context)) |
| | | |
| | | def begin_removeCamera(self, index, _response=None, _ex=None, _sent=None, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_removeCamera.begin(self, ((index, ), _response, _ex, _sent, context)) |
| | | |
| | | def end_removeCamera(self, _r): |
| | | return _M_RecordVideo.LoopRecorder._op_removeCamera.end(self, _r) |
| | | |
| | | def clearCamera(self, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_clearCamera.invoke(self, ((), context)) |
| | | |
| | | def clearCameraAsync(self, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_clearCamera.invokeAsync(self, ((), context)) |
| | | |
| | | def begin_clearCamera(self, _response=None, _ex=None, _sent=None, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_clearCamera.begin(self, ((), _response, _ex, _sent, context)) |
| | | |
| | | def end_clearCamera(self, _r): |
| | | return _M_RecordVideo.LoopRecorder._op_clearCamera.end(self, _r) |
| | | |
| | | def feedDog(self, index, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_feedDog.invoke(self, ((index, ), context)) |
| | | |
| | | def feedDogAsync(self, index, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_feedDog.invokeAsync(self, ((index, ), context)) |
| | | |
| | | def begin_feedDog(self, index, _response=None, _ex=None, _sent=None, context=None): |
| | | return _M_RecordVideo.LoopRecorder._op_feedDog.begin(self, ((index, ), _response, _ex, _sent, context)) |
| | | |
| | | def end_feedDog(self, _r): |
| | | return _M_RecordVideo.LoopRecorder._op_feedDog.end(self, _r) |
| | | |
| | | @staticmethod |
| | | def checkedCast(proxy, facetOrContext=None, context=None): |
| | | return _M_RecordVideo.LoopRecorderPrx.ice_checkedCast(proxy, '::RecordVideo::LoopRecorder', facetOrContext, context) |
| | | |
| | | @staticmethod |
| | | def uncheckedCast(proxy, facet=None): |
| | | return _M_RecordVideo.LoopRecorderPrx.ice_uncheckedCast(proxy, facet) |
| | | |
| | | @staticmethod |
| | | def ice_staticId(): |
| | | return '::RecordVideo::LoopRecorder' |
| | | _M_RecordVideo._t_LoopRecorderPrx = IcePy.defineProxy('::RecordVideo::LoopRecorder', LoopRecorderPrx) |
| | | |
| | | _M_RecordVideo.LoopRecorderPrx = LoopRecorderPrx |
| | | del LoopRecorderPrx |
| | | |
| | | _M_RecordVideo.LoopRecorder = Ice.createTempClass() |
| | | class LoopRecorder(Ice.Object): |
| | | |
| | | def ice_ids(self, current=None): |
| | | return ('::Ice::Object', '::RecordVideo::LoopRecorder') |
| | | |
| | | def ice_id(self, current=None): |
| | | return '::RecordVideo::LoopRecorder' |
| | | |
| | | @staticmethod |
| | | def ice_staticId(): |
| | | return '::RecordVideo::LoopRecorder' |
| | | |
| | | def addCamera(self, index, rtsp, current=None): |
| | | raise NotImplementedError("servant method 'addCamera' not implemented") |
| | | |
| | | def removeCamera(self, index, current=None): |
| | | raise NotImplementedError("servant method 'removeCamera' not implemented") |
| | | |
| | | def clearCamera(self, current=None): |
| | | raise NotImplementedError("servant method 'clearCamera' not implemented") |
| | | |
| | | def feedDog(self, index, current=None): |
| | | raise NotImplementedError("servant method 'feedDog' not implemented") |
| | | |
| | | def __str__(self): |
| | | return IcePy.stringify(self, _M_RecordVideo._t_LoopRecorderDisp) |
| | | |
| | | __repr__ = __str__ |
| | | |
| | | _M_RecordVideo._t_LoopRecorderDisp = IcePy.defineClass('::RecordVideo::LoopRecorder', LoopRecorder, (), None, ()) |
| | | LoopRecorder._ice_type = _M_RecordVideo._t_LoopRecorderDisp |
| | | |
| | | LoopRecorder._op_addCamera = IcePy.Operation('addCamera', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (((), IcePy._t_string, False, 0), ((), IcePy._t_string, False, 0)), (), ((), IcePy._t_string, False, 0), ()) |
| | | LoopRecorder._op_removeCamera = IcePy.Operation('removeCamera', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (((), IcePy._t_string, False, 0),), (), None, ()) |
| | | LoopRecorder._op_clearCamera = IcePy.Operation('clearCamera', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (), (), None, ()) |
| | | LoopRecorder._op_feedDog = IcePy.Operation('feedDog', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (((), IcePy._t_string, False, 0),), (), None, ()) |
| | | |
| | | _M_RecordVideo.LoopRecorder = LoopRecorder |
| | | del LoopRecorder |
| | | |
| | | # End of module RecordVideo |
| QiaoJiaSystem/RecordVideo/rpc/test2.py
QiaoJiaSystem/RecordVideo/rpc/testClient.py
QiaoJiaSystem/StructureApp/AppPipeController.cpp
QiaoJiaSystem/StructureApp/AppPipeController.h
QiaoJiaSystem/StructureApp/AppPipeControllerTest.cpp
QiaoJiaSystem/StructureApp/CMakeLists.txt
QiaoJiaSystem/StructureApp/FaceExtractElement.cpp
QiaoJiaSystem/StructureApp/FaceExtractElement.h
QiaoJiaSystem/StructureApp/FaceRpcElement.cpp
QiaoJiaSystem/StructureApp/FaceRpcElement.h
QiaoJiaSystem/StructureApp/ImageDrawElement.cpp
QiaoJiaSystem/StructureApp/ImageDrawElement.h
QiaoJiaSystem/StructureApp/JudgmentRetrogradeTool.cpp
QiaoJiaSystem/StructureApp/JudgmentRetrogradeTool.h
QiaoJiaSystem/StructureApp/NewRecordVideoElement.cpp
QiaoJiaSystem/StructureApp/NewRecordVideoElement.h
QiaoJiaSystem/StructureApp/PerimeterElement.cpp
QiaoJiaSystem/StructureApp/PerimeterElement.h
QiaoJiaSystem/StructureApp/RecordVideoElement.cpp
QiaoJiaSystem/StructureApp/RecordVideoElement.h
QiaoJiaSystem/StructureApp/StructureAppI.cpp
QiaoJiaSystem/StructureApp/StructureAppI.h
QiaoJiaSystem/StructureApp/TrackingTrigger.cpp
QiaoJiaSystem/StructureApp/TrackingTrigger.h
QiaoJiaSystem/StructureApp/YoloRpcElement.cpp
QiaoJiaSystem/StructureApp/YoloRpcElement.h
QiaoJiaSystem/StructureApp/main.cpp
QiaoJiaSystem/StructureApp/rpc/Basic/__init__.py
QiaoJiaSystem/StructureApp/rpc/Structure/__init__.py
QiaoJiaSystem/StructureApp/rpc/StructureApp.cpp
QiaoJiaSystem/StructureApp/rpc/StructureApp.h
QiaoJiaSystem/StructureApp/rpc/StructureApp.ice
QiaoJiaSystem/StructureApp/rpc/StructureApp_ice.py
QiaoJiaSystem/VideoAnalysFromHC/BaiscSDKAnalysVideo.cpp
QiaoJiaSystem/VideoAnalysFromHC/BaiscSDKAnalysVideo.h
QiaoJiaSystem/VideoAnalysFromHC/CMakeLists.txt
QiaoJiaSystem/VideoAnalysFromHC/DBManageClass.cpp
QiaoJiaSystem/VideoAnalysFromHC/DBManageClass.h
QiaoJiaSystem/VideoAnalysFromHC/HcAnalysVideo.cpp
QiaoJiaSystem/VideoAnalysFromHC/HcAnalysVideo.h
QiaoJiaSystem/VideoAnalysFromHC/HcDowloadElement.cpp
QiaoJiaSystem/VideoAnalysFromHC/HcDowloadElement.h
QiaoJiaSystem/VideoAnalysFromHC/HcRecord.cpp
QiaoJiaSystem/VideoAnalysFromHC/HcRecord.h
QiaoJiaSystem/VideoAnalysFromHC/PerimeterAlarmManager.cpp
QiaoJiaSystem/VideoAnalysFromHC/PerimeterAlarmManager.h
QiaoJiaSystem/VideoAnalysFromHC/RtspAnalysElement.cpp
QiaoJiaSystem/VideoAnalysFromHC/RtspAnalysElement.h
QiaoJiaSystem/VideoAnalysFromHC/TestThreads.cpp
QiaoJiaSystem/VideoAnalysFromHC/TestThreads.h
QiaoJiaSystem/VideoAnalysFromHC/main.cpp
QiaoJiaSystem/VideoAnalysFromHC/mySem.hpp
QiaoJiaSystem/VideoAnalysFromHC/myThread.cpp
QiaoJiaSystem/VideoAnalysFromHC/myThread.h
QiaoJiaSystem/VideoServer/CMakeLists.txt
QiaoJiaSystem/VideoServer/QiaoJia/DB/DB.pri
QiaoJiaSystem/VideoServer/QiaoJia/DB/DBStruct.h
QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.cpp
QiaoJiaSystem/VideoServer/QiaoJia/DB/LDBTool.h
QiaoJiaSystem/VideoServer/QiaoJia/DB/config.db
QiaoJiaSystem/VideoServer/QiaoJia/QiaoJia.pro
QiaoJiaSystem/VideoServer/QiaoJia/QiaoJia.pro.user
QiaoJiaSystem/VideoServer/QiaoJia/dbtest.h
QiaoJiaSystem/VideoServer/QiaoJia/dispatchTool/cutManage.cpp
QiaoJiaSystem/VideoServer/QiaoJia/dispatchTool/cutManage.h
QiaoJiaSystem/VideoServer/QiaoJia/dispatchTool/dispathdatatype.hpp
QiaoJiaSystem/VideoServer/QiaoJia/dispatchTool/loadManage.cpp
QiaoJiaSystem/VideoServer/QiaoJia/dispatchTool/loadManage.h
QiaoJiaSystem/VideoServer/QiaoJia/dispatchTool/sdkHdlManage.cpp
QiaoJiaSystem/VideoServer/QiaoJia/dispatchTool/sdkHdlManage.h
QiaoJiaSystem/VideoServer/QiaoJia/dispatchTool/taskmanage.h
QiaoJiaSystem/VideoServer/QiaoJia/main.cpp
QiaoJiaSystem/VideoServer/QiaoJia/mySem.hpp
QiaoJiaSystem/VideoServer/QiaoJia/myThread.cpp
QiaoJiaSystem/VideoServer/QiaoJia/myThread.h
QiaoJiaSystem/VideoServer/QiaoJia/widget.cpp
QiaoJiaSystem/VideoServer/QiaoJia/widget.h
QiaoJiaSystem/VideoServer/QiaoJia/widget.ui
QiaoJiaSystem/YoloServer/CMakeLists.txt
QiaoJiaSystem/YoloServer/DnDetect.cpp
QiaoJiaSystem/YoloServer/DnDetect.h
QiaoJiaSystem/YoloServer/ImageDrawElement.cpp
QiaoJiaSystem/YoloServer/ImageDrawElement.h
QiaoJiaSystem/YoloServer/YoloDetectClientTest.cpp
QiaoJiaSystem/YoloServer/YoloDetectServerI.cpp
QiaoJiaSystem/YoloServer/YoloDetectServerI.h
QiaoJiaSystem/YoloServer/main.cpp
QiaoJiaSystem/YoloServer/rpc/YoloServer.cpp
QiaoJiaSystem/YoloServer/rpc/YoloServer.h
QiaoJiaSystem/YoloServer/rpc/YoloServer.ice
QiaoJiaSystem/YoloServer/rpc/gen.sh
QiaoJiaSystem/build/DataWebServer
QiaoJiaSystem/build/FaceDetectServer
QiaoJiaSystem/build/FaceExtractServer
QiaoJiaSystem/build/FaceSearchServer
QiaoJiaSystem/build/KeepRight
QiaoJiaSystem/build/LocalDataDB
QiaoJiaSystem/build/PerimeterAlarm
QiaoJiaSystem/build/StructureApp
QiaoJiaSystem/build/VideoAnalysFromHC
QiaoJiaSystem/build/WebFDSClient.conf
QiaoJiaSystem/build/cfg/coco.data
QiaoJiaSystem/build/cfg/yolov3-voc.cfg
QiaoJiaSystem/build/cfg/yolov3.cfg
QiaoJiaSystem/build/config.db
QiaoJiaSystem/build/config.json
QiaoJiaSystem/build/configjson说明.txt
QiaoJiaSystem/build/data/coco.names
QiaoJiaSystem/build/data/coco9k.map
QiaoJiaSystem/build/data/labels/100_0.png
QiaoJiaSystem/build/data/labels/100_1.png
QiaoJiaSystem/build/data/labels/100_2.png
QiaoJiaSystem/build/data/labels/100_3.png
QiaoJiaSystem/build/data/labels/100_4.png
QiaoJiaSystem/build/data/labels/100_5.png
QiaoJiaSystem/build/data/labels/100_6.png
QiaoJiaSystem/build/data/labels/100_7.png
QiaoJiaSystem/build/data/labels/101_0.png
QiaoJiaSystem/build/data/labels/101_1.png
QiaoJiaSystem/build/data/labels/101_2.png
QiaoJiaSystem/build/data/labels/101_3.png
QiaoJiaSystem/build/data/labels/101_4.png
QiaoJiaSystem/build/data/labels/101_5.png
QiaoJiaSystem/build/data/labels/101_6.png
QiaoJiaSystem/build/data/labels/101_7.png
QiaoJiaSystem/build/data/labels/102_0.png
QiaoJiaSystem/build/data/labels/102_1.png
QiaoJiaSystem/build/data/labels/102_2.png
QiaoJiaSystem/build/data/labels/102_3.png
QiaoJiaSystem/build/data/labels/102_4.png
QiaoJiaSystem/build/data/labels/102_5.png
QiaoJiaSystem/build/data/labels/102_6.png
QiaoJiaSystem/build/data/labels/102_7.png
QiaoJiaSystem/build/data/labels/103_0.png
QiaoJiaSystem/build/data/labels/103_1.png
QiaoJiaSystem/build/data/labels/103_2.png
QiaoJiaSystem/build/data/labels/103_3.png
QiaoJiaSystem/build/data/labels/103_4.png
QiaoJiaSystem/build/data/labels/103_5.png
QiaoJiaSystem/build/data/labels/103_6.png
QiaoJiaSystem/build/data/labels/103_7.png
QiaoJiaSystem/build/data/labels/104_0.png
QiaoJiaSystem/build/data/labels/104_1.png
QiaoJiaSystem/build/data/labels/104_2.png
QiaoJiaSystem/build/data/labels/104_3.png
QiaoJiaSystem/build/data/labels/104_4.png
QiaoJiaSystem/build/data/labels/104_5.png
QiaoJiaSystem/build/data/labels/104_6.png
QiaoJiaSystem/build/data/labels/104_7.png
QiaoJiaSystem/build/data/labels/105_0.png
QiaoJiaSystem/build/data/labels/105_1.png
QiaoJiaSystem/build/data/labels/105_2.png
QiaoJiaSystem/build/data/labels/105_3.png
QiaoJiaSystem/build/data/labels/105_4.png
QiaoJiaSystem/build/data/labels/105_5.png
QiaoJiaSystem/build/data/labels/105_6.png
QiaoJiaSystem/build/data/labels/105_7.png
QiaoJiaSystem/build/data/labels/106_0.png
QiaoJiaSystem/build/data/labels/106_1.png
QiaoJiaSystem/build/data/labels/106_2.png
QiaoJiaSystem/build/data/labels/106_3.png
QiaoJiaSystem/build/data/labels/106_4.png
QiaoJiaSystem/build/data/labels/106_5.png
QiaoJiaSystem/build/data/labels/106_6.png
QiaoJiaSystem/build/data/labels/106_7.png
QiaoJiaSystem/build/data/labels/107_0.png
QiaoJiaSystem/build/data/labels/107_1.png
QiaoJiaSystem/build/data/labels/107_2.png
QiaoJiaSystem/build/data/labels/107_3.png
QiaoJiaSystem/build/data/labels/107_4.png
QiaoJiaSystem/build/data/labels/107_5.png
QiaoJiaSystem/build/data/labels/107_6.png
QiaoJiaSystem/build/data/labels/107_7.png
QiaoJiaSystem/build/data/labels/108_0.png
QiaoJiaSystem/build/data/labels/108_1.png
QiaoJiaSystem/build/data/labels/108_2.png
QiaoJiaSystem/build/data/labels/108_3.png
QiaoJiaSystem/build/data/labels/108_4.png
QiaoJiaSystem/build/data/labels/108_5.png
QiaoJiaSystem/build/data/labels/108_6.png
QiaoJiaSystem/build/data/labels/108_7.png
QiaoJiaSystem/build/data/labels/109_0.png
QiaoJiaSystem/build/data/labels/109_1.png
QiaoJiaSystem/build/data/labels/109_2.png
QiaoJiaSystem/build/data/labels/109_3.png
QiaoJiaSystem/build/data/labels/109_4.png
QiaoJiaSystem/build/data/labels/109_5.png
QiaoJiaSystem/build/data/labels/109_6.png
QiaoJiaSystem/build/data/labels/109_7.png
QiaoJiaSystem/build/data/labels/110_0.png
QiaoJiaSystem/build/data/labels/110_1.png
QiaoJiaSystem/build/data/labels/110_2.png
QiaoJiaSystem/build/data/labels/110_3.png
QiaoJiaSystem/build/data/labels/110_4.png
QiaoJiaSystem/build/data/labels/110_5.png
QiaoJiaSystem/build/data/labels/110_6.png
QiaoJiaSystem/build/data/labels/110_7.png
QiaoJiaSystem/build/data/labels/111_0.png
QiaoJiaSystem/build/data/labels/111_1.png
QiaoJiaSystem/build/data/labels/111_2.png
QiaoJiaSystem/build/data/labels/111_3.png
QiaoJiaSystem/build/data/labels/111_4.png
QiaoJiaSystem/build/data/labels/111_5.png
QiaoJiaSystem/build/data/labels/111_6.png
QiaoJiaSystem/build/data/labels/111_7.png
QiaoJiaSystem/build/data/labels/112_0.png
QiaoJiaSystem/build/data/labels/112_1.png
QiaoJiaSystem/build/data/labels/112_2.png
QiaoJiaSystem/build/data/labels/112_3.png
QiaoJiaSystem/build/data/labels/112_4.png
QiaoJiaSystem/build/data/labels/112_5.png
QiaoJiaSystem/build/data/labels/112_6.png
QiaoJiaSystem/build/data/labels/112_7.png
QiaoJiaSystem/build/data/labels/113_0.png
QiaoJiaSystem/build/data/labels/113_1.png
QiaoJiaSystem/build/data/labels/113_2.png
QiaoJiaSystem/build/data/labels/113_3.png
QiaoJiaSystem/build/data/labels/113_4.png
QiaoJiaSystem/build/data/labels/113_5.png
QiaoJiaSystem/build/data/labels/113_6.png
QiaoJiaSystem/build/data/labels/113_7.png
QiaoJiaSystem/build/data/labels/114_0.png
QiaoJiaSystem/build/data/labels/114_1.png
QiaoJiaSystem/build/data/labels/114_2.png
QiaoJiaSystem/build/data/labels/114_3.png
QiaoJiaSystem/build/data/labels/114_4.png
QiaoJiaSystem/build/data/labels/114_5.png
QiaoJiaSystem/build/data/labels/114_6.png
QiaoJiaSystem/build/data/labels/114_7.png
QiaoJiaSystem/build/data/labels/115_0.png
QiaoJiaSystem/build/data/labels/115_1.png
QiaoJiaSystem/build/data/labels/115_2.png
QiaoJiaSystem/build/data/labels/115_3.png
QiaoJiaSystem/build/data/labels/115_4.png
QiaoJiaSystem/build/data/labels/115_5.png
QiaoJiaSystem/build/data/labels/115_6.png
QiaoJiaSystem/build/data/labels/115_7.png
QiaoJiaSystem/build/data/labels/116_0.png
QiaoJiaSystem/build/data/labels/116_1.png
QiaoJiaSystem/build/data/labels/116_2.png
QiaoJiaSystem/build/data/labels/116_3.png
QiaoJiaSystem/build/data/labels/116_4.png
QiaoJiaSystem/build/data/labels/116_5.png
QiaoJiaSystem/build/data/labels/116_6.png
QiaoJiaSystem/build/data/labels/116_7.png
QiaoJiaSystem/build/data/labels/117_0.png
QiaoJiaSystem/build/data/labels/117_1.png
QiaoJiaSystem/build/data/labels/117_2.png
QiaoJiaSystem/build/data/labels/117_3.png
QiaoJiaSystem/build/data/labels/117_4.png
QiaoJiaSystem/build/data/labels/117_5.png
QiaoJiaSystem/build/data/labels/117_6.png
QiaoJiaSystem/build/data/labels/117_7.png
QiaoJiaSystem/build/data/labels/118_0.png
QiaoJiaSystem/build/data/labels/118_1.png
QiaoJiaSystem/build/data/labels/118_2.png
QiaoJiaSystem/build/data/labels/118_3.png
QiaoJiaSystem/build/data/labels/118_4.png
QiaoJiaSystem/build/data/labels/118_5.png
QiaoJiaSystem/build/data/labels/118_6.png
QiaoJiaSystem/build/data/labels/118_7.png
QiaoJiaSystem/build/data/labels/119_0.png
QiaoJiaSystem/build/data/labels/119_1.png
QiaoJiaSystem/build/data/labels/119_2.png
QiaoJiaSystem/build/data/labels/119_3.png
QiaoJiaSystem/build/data/labels/119_4.png
QiaoJiaSystem/build/data/labels/119_5.png
QiaoJiaSystem/build/data/labels/119_6.png
QiaoJiaSystem/build/data/labels/119_7.png
QiaoJiaSystem/build/data/labels/120_0.png
QiaoJiaSystem/build/data/labels/120_1.png
QiaoJiaSystem/build/data/labels/120_2.png
QiaoJiaSystem/build/data/labels/120_3.png
QiaoJiaSystem/build/data/labels/120_4.png
QiaoJiaSystem/build/data/labels/120_5.png
QiaoJiaSystem/build/data/labels/120_6.png
QiaoJiaSystem/build/data/labels/120_7.png
QiaoJiaSystem/build/data/labels/121_0.png
QiaoJiaSystem/build/data/labels/121_1.png
QiaoJiaSystem/build/data/labels/121_2.png
QiaoJiaSystem/build/data/labels/121_3.png
QiaoJiaSystem/build/data/labels/121_4.png
QiaoJiaSystem/build/data/labels/121_5.png
QiaoJiaSystem/build/data/labels/121_6.png
QiaoJiaSystem/build/data/labels/121_7.png
QiaoJiaSystem/build/data/labels/122_0.png
QiaoJiaSystem/build/data/labels/122_1.png
QiaoJiaSystem/build/data/labels/122_2.png
QiaoJiaSystem/build/data/labels/122_3.png
QiaoJiaSystem/build/data/labels/122_4.png
QiaoJiaSystem/build/data/labels/122_5.png
QiaoJiaSystem/build/data/labels/122_6.png
QiaoJiaSystem/build/data/labels/122_7.png
QiaoJiaSystem/build/data/labels/123_0.png
QiaoJiaSystem/build/data/labels/123_1.png
QiaoJiaSystem/build/data/labels/123_2.png
QiaoJiaSystem/build/data/labels/123_3.png
QiaoJiaSystem/build/data/labels/123_4.png
QiaoJiaSystem/build/data/labels/123_5.png
QiaoJiaSystem/build/data/labels/123_6.png
QiaoJiaSystem/build/data/labels/123_7.png
QiaoJiaSystem/build/data/labels/124_0.png
QiaoJiaSystem/build/data/labels/124_1.png
QiaoJiaSystem/build/data/labels/124_2.png
QiaoJiaSystem/build/data/labels/124_3.png
QiaoJiaSystem/build/data/labels/124_4.png
QiaoJiaSystem/build/data/labels/124_5.png
QiaoJiaSystem/build/data/labels/124_6.png
QiaoJiaSystem/build/data/labels/124_7.png
QiaoJiaSystem/build/data/labels/125_0.png
QiaoJiaSystem/build/data/labels/125_1.png
QiaoJiaSystem/build/data/labels/125_2.png
QiaoJiaSystem/build/data/labels/125_3.png
QiaoJiaSystem/build/data/labels/125_4.png
QiaoJiaSystem/build/data/labels/125_5.png
QiaoJiaSystem/build/data/labels/125_6.png
QiaoJiaSystem/build/data/labels/125_7.png
QiaoJiaSystem/build/data/labels/126_0.png
QiaoJiaSystem/build/data/labels/126_1.png
QiaoJiaSystem/build/data/labels/126_2.png
QiaoJiaSystem/build/data/labels/126_3.png
QiaoJiaSystem/build/data/labels/126_4.png
QiaoJiaSystem/build/data/labels/126_5.png
QiaoJiaSystem/build/data/labels/126_6.png
QiaoJiaSystem/build/data/labels/126_7.png
QiaoJiaSystem/build/data/labels/32_0.png
QiaoJiaSystem/build/data/labels/32_1.png
QiaoJiaSystem/build/data/labels/32_2.png
QiaoJiaSystem/build/data/labels/32_3.png
QiaoJiaSystem/build/data/labels/32_4.png
QiaoJiaSystem/build/data/labels/32_5.png
QiaoJiaSystem/build/data/labels/32_6.png
QiaoJiaSystem/build/data/labels/32_7.png
QiaoJiaSystem/build/data/labels/33_0.png
QiaoJiaSystem/build/data/labels/33_1.png
QiaoJiaSystem/build/data/labels/33_2.png
QiaoJiaSystem/build/data/labels/33_3.png
QiaoJiaSystem/build/data/labels/33_4.png
QiaoJiaSystem/build/data/labels/33_5.png
QiaoJiaSystem/build/data/labels/33_6.png
QiaoJiaSystem/build/data/labels/33_7.png
QiaoJiaSystem/build/data/labels/34_0.png
QiaoJiaSystem/build/data/labels/34_1.png
QiaoJiaSystem/build/data/labels/34_2.png
QiaoJiaSystem/build/data/labels/34_3.png
QiaoJiaSystem/build/data/labels/34_4.png
QiaoJiaSystem/build/data/labels/34_5.png
QiaoJiaSystem/build/data/labels/34_6.png
QiaoJiaSystem/build/data/labels/34_7.png
QiaoJiaSystem/build/data/labels/35_0.png
QiaoJiaSystem/build/data/labels/35_1.png
QiaoJiaSystem/build/data/labels/35_2.png
QiaoJiaSystem/build/data/labels/35_3.png
QiaoJiaSystem/build/data/labels/35_4.png
QiaoJiaSystem/build/data/labels/35_5.png
QiaoJiaSystem/build/data/labels/35_6.png
QiaoJiaSystem/build/data/labels/35_7.png
QiaoJiaSystem/build/data/labels/36_0.png
QiaoJiaSystem/build/data/labels/36_1.png
QiaoJiaSystem/build/data/labels/36_2.png
QiaoJiaSystem/build/data/labels/36_3.png
QiaoJiaSystem/build/data/labels/36_4.png
QiaoJiaSystem/build/data/labels/36_5.png
QiaoJiaSystem/build/data/labels/36_6.png
QiaoJiaSystem/build/data/labels/36_7.png
QiaoJiaSystem/build/data/labels/37_0.png
QiaoJiaSystem/build/data/labels/37_1.png
QiaoJiaSystem/build/data/labels/37_2.png
QiaoJiaSystem/build/data/labels/37_3.png
QiaoJiaSystem/build/data/labels/37_4.png
QiaoJiaSystem/build/data/labels/37_5.png
QiaoJiaSystem/build/data/labels/37_6.png
QiaoJiaSystem/build/data/labels/37_7.png
QiaoJiaSystem/build/data/labels/38_0.png
QiaoJiaSystem/build/data/labels/38_1.png
QiaoJiaSystem/build/data/labels/38_2.png
QiaoJiaSystem/build/data/labels/38_3.png
QiaoJiaSystem/build/data/labels/38_4.png
QiaoJiaSystem/build/data/labels/38_5.png
QiaoJiaSystem/build/data/labels/38_6.png
QiaoJiaSystem/build/data/labels/38_7.png
QiaoJiaSystem/build/data/labels/39_0.png
QiaoJiaSystem/build/data/labels/39_1.png
QiaoJiaSystem/build/data/labels/39_2.png
QiaoJiaSystem/build/data/labels/39_3.png
QiaoJiaSystem/build/data/labels/39_4.png
QiaoJiaSystem/build/data/labels/39_5.png
QiaoJiaSystem/build/data/labels/39_6.png
QiaoJiaSystem/build/data/labels/39_7.png
QiaoJiaSystem/build/data/labels/40_0.png
QiaoJiaSystem/build/data/labels/40_1.png
QiaoJiaSystem/build/data/labels/40_2.png
QiaoJiaSystem/build/data/labels/40_3.png
QiaoJiaSystem/build/data/labels/40_4.png
QiaoJiaSystem/build/data/labels/40_5.png
QiaoJiaSystem/build/data/labels/40_6.png
QiaoJiaSystem/build/data/labels/40_7.png
QiaoJiaSystem/build/data/labels/41_0.png
QiaoJiaSystem/build/data/labels/41_1.png
QiaoJiaSystem/build/data/labels/41_2.png
QiaoJiaSystem/build/data/labels/41_3.png
QiaoJiaSystem/build/data/labels/41_4.png
QiaoJiaSystem/build/data/labels/41_5.png
QiaoJiaSystem/build/data/labels/41_6.png
QiaoJiaSystem/build/data/labels/41_7.png
QiaoJiaSystem/build/data/labels/42_0.png
QiaoJiaSystem/build/data/labels/42_1.png
QiaoJiaSystem/build/data/labels/42_2.png
QiaoJiaSystem/build/data/labels/42_3.png
QiaoJiaSystem/build/data/labels/42_4.png
QiaoJiaSystem/build/data/labels/42_5.png
QiaoJiaSystem/build/data/labels/42_6.png
QiaoJiaSystem/build/data/labels/42_7.png
QiaoJiaSystem/build/data/labels/43_0.png
QiaoJiaSystem/build/data/labels/43_1.png
QiaoJiaSystem/build/data/labels/43_2.png
QiaoJiaSystem/build/data/labels/43_3.png
QiaoJiaSystem/build/data/labels/43_4.png
QiaoJiaSystem/build/data/labels/43_5.png
QiaoJiaSystem/build/data/labels/43_6.png
QiaoJiaSystem/build/data/labels/43_7.png
QiaoJiaSystem/build/data/labels/44_0.png
QiaoJiaSystem/build/data/labels/44_1.png
QiaoJiaSystem/build/data/labels/44_2.png
QiaoJiaSystem/build/data/labels/44_3.png
QiaoJiaSystem/build/data/labels/44_4.png
QiaoJiaSystem/build/data/labels/44_5.png
QiaoJiaSystem/build/data/labels/44_6.png
QiaoJiaSystem/build/data/labels/44_7.png
QiaoJiaSystem/build/data/labels/45_0.png
QiaoJiaSystem/build/data/labels/45_1.png
QiaoJiaSystem/build/data/labels/45_2.png
QiaoJiaSystem/build/data/labels/45_3.png
QiaoJiaSystem/build/data/labels/45_4.png
QiaoJiaSystem/build/data/labels/45_5.png
QiaoJiaSystem/build/data/labels/45_6.png
QiaoJiaSystem/build/data/labels/45_7.png
QiaoJiaSystem/build/data/labels/46_0.png
QiaoJiaSystem/build/data/labels/46_1.png
QiaoJiaSystem/build/data/labels/46_2.png
QiaoJiaSystem/build/data/labels/46_3.png
QiaoJiaSystem/build/data/labels/46_4.png
QiaoJiaSystem/build/data/labels/46_5.png
QiaoJiaSystem/build/data/labels/46_6.png
QiaoJiaSystem/build/data/labels/46_7.png
QiaoJiaSystem/build/data/labels/47_0.png
QiaoJiaSystem/build/data/labels/47_1.png
QiaoJiaSystem/build/data/labels/47_2.png
QiaoJiaSystem/build/data/labels/47_3.png
QiaoJiaSystem/build/data/labels/47_4.png
QiaoJiaSystem/build/data/labels/47_5.png
QiaoJiaSystem/build/data/labels/47_6.png
QiaoJiaSystem/build/data/labels/47_7.png
QiaoJiaSystem/build/data/labels/48_0.png
QiaoJiaSystem/build/data/labels/48_1.png
QiaoJiaSystem/build/data/labels/48_2.png
QiaoJiaSystem/build/data/labels/48_3.png
QiaoJiaSystem/build/data/labels/48_4.png
QiaoJiaSystem/build/data/labels/48_5.png
QiaoJiaSystem/build/data/labels/48_6.png
QiaoJiaSystem/build/data/labels/48_7.png
QiaoJiaSystem/build/data/labels/49_0.png
QiaoJiaSystem/build/data/labels/49_1.png
QiaoJiaSystem/build/data/labels/49_2.png
QiaoJiaSystem/build/data/labels/49_3.png
QiaoJiaSystem/build/data/labels/49_4.png
QiaoJiaSystem/build/data/labels/49_5.png
QiaoJiaSystem/build/data/labels/49_6.png
QiaoJiaSystem/build/data/labels/49_7.png
QiaoJiaSystem/build/data/labels/50_0.png
QiaoJiaSystem/build/data/labels/50_1.png
QiaoJiaSystem/build/data/labels/50_2.png
QiaoJiaSystem/build/data/labels/50_3.png
QiaoJiaSystem/build/data/labels/50_4.png
QiaoJiaSystem/build/data/labels/50_5.png
QiaoJiaSystem/build/data/labels/50_6.png
QiaoJiaSystem/build/data/labels/50_7.png
QiaoJiaSystem/build/data/labels/51_0.png
QiaoJiaSystem/build/data/labels/51_1.png
QiaoJiaSystem/build/data/labels/51_2.png
QiaoJiaSystem/build/data/labels/51_3.png
QiaoJiaSystem/build/data/labels/51_4.png
QiaoJiaSystem/build/data/labels/51_5.png
QiaoJiaSystem/build/data/labels/51_6.png
QiaoJiaSystem/build/data/labels/51_7.png
QiaoJiaSystem/build/data/labels/52_0.png
QiaoJiaSystem/build/data/labels/52_1.png
QiaoJiaSystem/build/data/labels/52_2.png
QiaoJiaSystem/build/data/labels/52_3.png
QiaoJiaSystem/build/data/labels/52_4.png
QiaoJiaSystem/build/data/labels/52_5.png
QiaoJiaSystem/build/data/labels/52_6.png
QiaoJiaSystem/build/data/labels/52_7.png
QiaoJiaSystem/build/data/labels/53_0.png
QiaoJiaSystem/build/data/labels/53_1.png
QiaoJiaSystem/build/data/labels/53_2.png
QiaoJiaSystem/build/data/labels/53_3.png
QiaoJiaSystem/build/data/labels/53_4.png
QiaoJiaSystem/build/data/labels/53_5.png
QiaoJiaSystem/build/data/labels/53_6.png
QiaoJiaSystem/build/data/labels/53_7.png
QiaoJiaSystem/build/data/labels/54_0.png
QiaoJiaSystem/build/data/labels/54_1.png
QiaoJiaSystem/build/data/labels/54_2.png
QiaoJiaSystem/build/data/labels/54_3.png
QiaoJiaSystem/build/data/labels/54_4.png
QiaoJiaSystem/build/data/labels/54_5.png
QiaoJiaSystem/build/data/labels/54_6.png
QiaoJiaSystem/build/data/labels/54_7.png
QiaoJiaSystem/build/data/labels/55_0.png
QiaoJiaSystem/build/data/labels/55_1.png
QiaoJiaSystem/build/data/labels/55_2.png
QiaoJiaSystem/build/data/labels/55_3.png
QiaoJiaSystem/build/data/labels/55_4.png
QiaoJiaSystem/build/data/labels/55_5.png
QiaoJiaSystem/build/data/labels/55_6.png
QiaoJiaSystem/build/data/labels/55_7.png
QiaoJiaSystem/build/data/labels/56_0.png
QiaoJiaSystem/build/data/labels/56_1.png
QiaoJiaSystem/build/data/labels/56_2.png
QiaoJiaSystem/build/data/labels/56_3.png
QiaoJiaSystem/build/data/labels/56_4.png
QiaoJiaSystem/build/data/labels/56_5.png
QiaoJiaSystem/build/data/labels/56_6.png
QiaoJiaSystem/build/data/labels/56_7.png
QiaoJiaSystem/build/data/labels/57_0.png
QiaoJiaSystem/build/data/labels/57_1.png
QiaoJiaSystem/build/data/labels/57_2.png
QiaoJiaSystem/build/data/labels/57_3.png
QiaoJiaSystem/build/data/labels/57_4.png
QiaoJiaSystem/build/data/labels/57_5.png
QiaoJiaSystem/build/data/labels/57_6.png
QiaoJiaSystem/build/data/labels/57_7.png
QiaoJiaSystem/build/data/labels/58_0.png
QiaoJiaSystem/build/data/labels/58_1.png
QiaoJiaSystem/build/data/labels/58_2.png
QiaoJiaSystem/build/data/labels/58_3.png
QiaoJiaSystem/build/data/labels/58_4.png
QiaoJiaSystem/build/data/labels/58_5.png
QiaoJiaSystem/build/data/labels/58_6.png
QiaoJiaSystem/build/data/labels/58_7.png
QiaoJiaSystem/build/data/labels/59_0.png
QiaoJiaSystem/build/data/labels/59_1.png
QiaoJiaSystem/build/data/labels/59_2.png
QiaoJiaSystem/build/data/labels/59_3.png
QiaoJiaSystem/build/data/labels/59_4.png
QiaoJiaSystem/build/data/labels/59_5.png
QiaoJiaSystem/build/data/labels/59_6.png
QiaoJiaSystem/build/data/labels/59_7.png
QiaoJiaSystem/build/data/labels/60_0.png
QiaoJiaSystem/build/data/labels/60_1.png
QiaoJiaSystem/build/data/labels/60_2.png
QiaoJiaSystem/build/data/labels/60_3.png
QiaoJiaSystem/build/data/labels/60_4.png
QiaoJiaSystem/build/data/labels/60_5.png
QiaoJiaSystem/build/data/labels/60_6.png
QiaoJiaSystem/build/data/labels/60_7.png
QiaoJiaSystem/build/data/labels/61_0.png
QiaoJiaSystem/build/data/labels/61_1.png
QiaoJiaSystem/build/data/labels/61_2.png
QiaoJiaSystem/build/data/labels/61_3.png
QiaoJiaSystem/build/data/labels/61_4.png
QiaoJiaSystem/build/data/labels/61_5.png
QiaoJiaSystem/build/data/labels/61_6.png
QiaoJiaSystem/build/data/labels/61_7.png
QiaoJiaSystem/build/data/labels/62_0.png
QiaoJiaSystem/build/data/labels/62_1.png
QiaoJiaSystem/build/data/labels/62_2.png
QiaoJiaSystem/build/data/labels/62_3.png
QiaoJiaSystem/build/data/labels/62_4.png
QiaoJiaSystem/build/data/labels/62_5.png
QiaoJiaSystem/build/data/labels/62_6.png
QiaoJiaSystem/build/data/labels/62_7.png
QiaoJiaSystem/build/data/labels/63_0.png
QiaoJiaSystem/build/data/labels/63_1.png
QiaoJiaSystem/build/data/labels/63_2.png
QiaoJiaSystem/build/data/labels/63_3.png
QiaoJiaSystem/build/data/labels/63_4.png
QiaoJiaSystem/build/data/labels/63_5.png
QiaoJiaSystem/build/data/labels/63_6.png
QiaoJiaSystem/build/data/labels/63_7.png
QiaoJiaSystem/build/data/labels/64_0.png
QiaoJiaSystem/build/data/labels/64_1.png
QiaoJiaSystem/build/data/labels/64_2.png
QiaoJiaSystem/build/data/labels/64_3.png
QiaoJiaSystem/build/data/labels/64_4.png
QiaoJiaSystem/build/data/labels/64_5.png
QiaoJiaSystem/build/data/labels/64_6.png
QiaoJiaSystem/build/data/labels/64_7.png
QiaoJiaSystem/build/data/labels/65_0.png
QiaoJiaSystem/build/data/labels/65_1.png
QiaoJiaSystem/build/data/labels/65_2.png
QiaoJiaSystem/build/data/labels/65_3.png
QiaoJiaSystem/build/data/labels/65_4.png
QiaoJiaSystem/build/data/labels/65_5.png
QiaoJiaSystem/build/data/labels/65_6.png
QiaoJiaSystem/build/data/labels/65_7.png
QiaoJiaSystem/build/data/labels/66_0.png
QiaoJiaSystem/build/data/labels/66_1.png
QiaoJiaSystem/build/data/labels/66_2.png
QiaoJiaSystem/build/data/labels/66_3.png
QiaoJiaSystem/build/data/labels/66_4.png
QiaoJiaSystem/build/data/labels/66_5.png
QiaoJiaSystem/build/data/labels/66_6.png
QiaoJiaSystem/build/data/labels/66_7.png
QiaoJiaSystem/build/data/labels/67_0.png
QiaoJiaSystem/build/data/labels/67_1.png
QiaoJiaSystem/build/data/labels/67_2.png
QiaoJiaSystem/build/data/labels/67_3.png
QiaoJiaSystem/build/data/labels/67_4.png
QiaoJiaSystem/build/data/labels/67_5.png
QiaoJiaSystem/build/data/labels/67_6.png
QiaoJiaSystem/build/data/labels/67_7.png
QiaoJiaSystem/build/data/labels/68_0.png
QiaoJiaSystem/build/data/labels/68_1.png
QiaoJiaSystem/build/data/labels/68_2.png
QiaoJiaSystem/build/data/labels/68_3.png
QiaoJiaSystem/build/data/labels/68_4.png
QiaoJiaSystem/build/data/labels/68_5.png
QiaoJiaSystem/build/data/labels/68_6.png
QiaoJiaSystem/build/data/labels/68_7.png
QiaoJiaSystem/build/data/labels/69_0.png
QiaoJiaSystem/build/data/labels/69_1.png
QiaoJiaSystem/build/data/labels/69_2.png
QiaoJiaSystem/build/data/labels/69_3.png
QiaoJiaSystem/build/data/labels/69_4.png
QiaoJiaSystem/build/data/labels/69_5.png
QiaoJiaSystem/build/data/labels/69_6.png
QiaoJiaSystem/build/data/labels/69_7.png
QiaoJiaSystem/build/data/labels/70_0.png
QiaoJiaSystem/build/data/labels/70_1.png
QiaoJiaSystem/build/data/labels/70_2.png
QiaoJiaSystem/build/data/labels/70_3.png
QiaoJiaSystem/build/data/labels/70_4.png
QiaoJiaSystem/build/data/labels/70_5.png
QiaoJiaSystem/build/data/labels/70_6.png
QiaoJiaSystem/build/data/labels/70_7.png
QiaoJiaSystem/build/data/labels/71_0.png
QiaoJiaSystem/build/data/labels/71_1.png
QiaoJiaSystem/build/data/labels/71_2.png
QiaoJiaSystem/build/data/labels/71_3.png
QiaoJiaSystem/build/data/labels/71_4.png
QiaoJiaSystem/build/data/labels/71_5.png
QiaoJiaSystem/build/data/labels/71_6.png
QiaoJiaSystem/build/data/labels/71_7.png
QiaoJiaSystem/build/data/labels/72_0.png
QiaoJiaSystem/build/data/labels/72_1.png
QiaoJiaSystem/build/data/labels/72_2.png
QiaoJiaSystem/build/data/labels/72_3.png
QiaoJiaSystem/build/data/labels/72_4.png
QiaoJiaSystem/build/data/labels/72_5.png
QiaoJiaSystem/build/data/labels/72_6.png
QiaoJiaSystem/build/data/labels/72_7.png
QiaoJiaSystem/build/data/labels/73_0.png
QiaoJiaSystem/build/data/labels/73_1.png
QiaoJiaSystem/build/data/labels/73_2.png
QiaoJiaSystem/build/data/labels/73_3.png
QiaoJiaSystem/build/data/labels/73_4.png
QiaoJiaSystem/build/data/labels/73_5.png
QiaoJiaSystem/build/data/labels/73_6.png
QiaoJiaSystem/build/data/labels/73_7.png
QiaoJiaSystem/build/data/labels/74_0.png
QiaoJiaSystem/build/data/labels/74_1.png
QiaoJiaSystem/build/data/labels/74_2.png
QiaoJiaSystem/build/data/labels/74_3.png
QiaoJiaSystem/build/data/labels/74_4.png
QiaoJiaSystem/build/data/labels/74_5.png
QiaoJiaSystem/build/data/labels/74_6.png
QiaoJiaSystem/build/data/labels/74_7.png
QiaoJiaSystem/build/data/labels/75_0.png
QiaoJiaSystem/build/data/labels/75_1.png
QiaoJiaSystem/build/data/labels/75_2.png
QiaoJiaSystem/build/data/labels/75_3.png
QiaoJiaSystem/build/data/labels/75_4.png
QiaoJiaSystem/build/data/labels/75_5.png
QiaoJiaSystem/build/data/labels/75_6.png
QiaoJiaSystem/build/data/labels/75_7.png
QiaoJiaSystem/build/data/labels/76_0.png
QiaoJiaSystem/build/data/labels/76_1.png
QiaoJiaSystem/build/data/labels/76_2.png
QiaoJiaSystem/build/data/labels/76_3.png
QiaoJiaSystem/build/data/labels/76_4.png
QiaoJiaSystem/build/data/labels/76_5.png
QiaoJiaSystem/build/data/labels/76_6.png
QiaoJiaSystem/build/data/labels/76_7.png
QiaoJiaSystem/build/data/labels/77_0.png
QiaoJiaSystem/build/data/labels/77_1.png
QiaoJiaSystem/build/data/labels/77_2.png
QiaoJiaSystem/build/data/labels/77_3.png
QiaoJiaSystem/build/data/labels/77_4.png
QiaoJiaSystem/build/data/labels/77_5.png
QiaoJiaSystem/build/data/labels/77_6.png
QiaoJiaSystem/build/data/labels/77_7.png
QiaoJiaSystem/build/data/labels/78_0.png
QiaoJiaSystem/build/data/labels/78_1.png
QiaoJiaSystem/build/data/labels/78_2.png
QiaoJiaSystem/build/data/labels/78_3.png
QiaoJiaSystem/build/data/labels/78_4.png
QiaoJiaSystem/build/data/labels/78_5.png
QiaoJiaSystem/build/data/labels/78_6.png
QiaoJiaSystem/build/data/labels/78_7.png
QiaoJiaSystem/build/data/labels/79_0.png
QiaoJiaSystem/build/data/labels/79_1.png
QiaoJiaSystem/build/data/labels/79_2.png
QiaoJiaSystem/build/data/labels/79_3.png
QiaoJiaSystem/build/data/labels/79_4.png
QiaoJiaSystem/build/data/labels/79_5.png
QiaoJiaSystem/build/data/labels/79_6.png
QiaoJiaSystem/build/data/labels/79_7.png
QiaoJiaSystem/build/data/labels/80_0.png
QiaoJiaSystem/build/data/labels/80_1.png
QiaoJiaSystem/build/data/labels/80_2.png
QiaoJiaSystem/build/data/labels/80_3.png
QiaoJiaSystem/build/data/labels/80_4.png
QiaoJiaSystem/build/data/labels/80_5.png
QiaoJiaSystem/build/data/labels/80_6.png
QiaoJiaSystem/build/data/labels/80_7.png
QiaoJiaSystem/build/data/labels/81_0.png
QiaoJiaSystem/build/data/labels/81_1.png
QiaoJiaSystem/build/data/labels/81_2.png
QiaoJiaSystem/build/data/labels/81_3.png
QiaoJiaSystem/build/data/labels/81_4.png
QiaoJiaSystem/build/data/labels/81_5.png
QiaoJiaSystem/build/data/labels/81_6.png
QiaoJiaSystem/build/data/labels/81_7.png
QiaoJiaSystem/build/data/labels/82_0.png
QiaoJiaSystem/build/data/labels/82_1.png
QiaoJiaSystem/build/data/labels/82_2.png
QiaoJiaSystem/build/data/labels/82_3.png
QiaoJiaSystem/build/data/labels/82_4.png
QiaoJiaSystem/build/data/labels/82_5.png
QiaoJiaSystem/build/data/labels/82_6.png
QiaoJiaSystem/build/data/labels/82_7.png
QiaoJiaSystem/build/data/labels/83_0.png
QiaoJiaSystem/build/data/labels/83_1.png
QiaoJiaSystem/build/data/labels/83_2.png
QiaoJiaSystem/build/data/labels/83_3.png
QiaoJiaSystem/build/data/labels/83_4.png
QiaoJiaSystem/build/data/labels/83_5.png
QiaoJiaSystem/build/data/labels/83_6.png
QiaoJiaSystem/build/data/labels/83_7.png
QiaoJiaSystem/build/data/labels/84_0.png
QiaoJiaSystem/build/data/labels/84_1.png
QiaoJiaSystem/build/data/labels/84_2.png
QiaoJiaSystem/build/data/labels/84_3.png
QiaoJiaSystem/build/data/labels/84_4.png
QiaoJiaSystem/build/data/labels/84_5.png
QiaoJiaSystem/build/data/labels/84_6.png
QiaoJiaSystem/build/data/labels/84_7.png
QiaoJiaSystem/build/data/labels/85_0.png
QiaoJiaSystem/build/data/labels/85_1.png
QiaoJiaSystem/build/data/labels/85_2.png
QiaoJiaSystem/build/data/labels/85_3.png
QiaoJiaSystem/build/data/labels/85_4.png
QiaoJiaSystem/build/data/labels/85_5.png
QiaoJiaSystem/build/data/labels/85_6.png
QiaoJiaSystem/build/data/labels/85_7.png
QiaoJiaSystem/build/data/labels/86_0.png
QiaoJiaSystem/build/data/labels/86_1.png
QiaoJiaSystem/build/data/labels/86_2.png
QiaoJiaSystem/build/data/labels/86_3.png
QiaoJiaSystem/build/data/labels/86_4.png
QiaoJiaSystem/build/data/labels/86_5.png
QiaoJiaSystem/build/data/labels/86_6.png
QiaoJiaSystem/build/data/labels/86_7.png
QiaoJiaSystem/build/data/labels/87_0.png
QiaoJiaSystem/build/data/labels/87_1.png
QiaoJiaSystem/build/data/labels/87_2.png
QiaoJiaSystem/build/data/labels/87_3.png
QiaoJiaSystem/build/data/labels/87_4.png
QiaoJiaSystem/build/data/labels/87_5.png
QiaoJiaSystem/build/data/labels/87_6.png
QiaoJiaSystem/build/data/labels/87_7.png
QiaoJiaSystem/build/data/labels/88_0.png
QiaoJiaSystem/build/data/labels/88_1.png
QiaoJiaSystem/build/data/labels/88_2.png
QiaoJiaSystem/build/data/labels/88_3.png
QiaoJiaSystem/build/data/labels/88_4.png
QiaoJiaSystem/build/data/labels/88_5.png
QiaoJiaSystem/build/data/labels/88_6.png
QiaoJiaSystem/build/data/labels/88_7.png
QiaoJiaSystem/build/data/labels/89_0.png
QiaoJiaSystem/build/data/labels/89_1.png
QiaoJiaSystem/build/data/labels/89_2.png
QiaoJiaSystem/build/data/labels/89_3.png
QiaoJiaSystem/build/data/labels/89_4.png
QiaoJiaSystem/build/data/labels/89_5.png
QiaoJiaSystem/build/data/labels/89_6.png
QiaoJiaSystem/build/data/labels/89_7.png
QiaoJiaSystem/build/data/labels/90_0.png
QiaoJiaSystem/build/data/labels/90_1.png
QiaoJiaSystem/build/data/labels/90_2.png
QiaoJiaSystem/build/data/labels/90_3.png
QiaoJiaSystem/build/data/labels/90_4.png
QiaoJiaSystem/build/data/labels/90_5.png
QiaoJiaSystem/build/data/labels/90_6.png
QiaoJiaSystem/build/data/labels/90_7.png
QiaoJiaSystem/build/data/labels/91_0.png
QiaoJiaSystem/build/data/labels/91_1.png
QiaoJiaSystem/build/data/labels/91_2.png
QiaoJiaSystem/build/data/labels/91_3.png
QiaoJiaSystem/build/data/labels/91_4.png
QiaoJiaSystem/build/data/labels/91_5.png
QiaoJiaSystem/build/data/labels/91_6.png
QiaoJiaSystem/build/data/labels/91_7.png
QiaoJiaSystem/build/data/labels/92_0.png
QiaoJiaSystem/build/data/labels/92_1.png
QiaoJiaSystem/build/data/labels/92_2.png
QiaoJiaSystem/build/data/labels/92_3.png
QiaoJiaSystem/build/data/labels/92_4.png
QiaoJiaSystem/build/data/labels/92_5.png
QiaoJiaSystem/build/data/labels/92_6.png
QiaoJiaSystem/build/data/labels/92_7.png
QiaoJiaSystem/build/data/labels/93_0.png
QiaoJiaSystem/build/data/labels/93_1.png
QiaoJiaSystem/build/data/labels/93_2.png
QiaoJiaSystem/build/data/labels/93_3.png
QiaoJiaSystem/build/data/labels/93_4.png
QiaoJiaSystem/build/data/labels/93_5.png
QiaoJiaSystem/build/data/labels/93_6.png
QiaoJiaSystem/build/data/labels/93_7.png
QiaoJiaSystem/build/data/labels/94_0.png
QiaoJiaSystem/build/data/labels/94_1.png
QiaoJiaSystem/build/data/labels/94_2.png
QiaoJiaSystem/build/data/labels/94_3.png
QiaoJiaSystem/build/data/labels/94_4.png
QiaoJiaSystem/build/data/labels/94_5.png
QiaoJiaSystem/build/data/labels/94_6.png
QiaoJiaSystem/build/data/labels/94_7.png
QiaoJiaSystem/build/data/labels/95_0.png
QiaoJiaSystem/build/data/labels/95_1.png
QiaoJiaSystem/build/data/labels/95_2.png
QiaoJiaSystem/build/data/labels/95_3.png
QiaoJiaSystem/build/data/labels/95_4.png
QiaoJiaSystem/build/data/labels/95_5.png
QiaoJiaSystem/build/data/labels/95_6.png
QiaoJiaSystem/build/data/labels/95_7.png
QiaoJiaSystem/build/data/labels/96_0.png
QiaoJiaSystem/build/data/labels/96_1.png
QiaoJiaSystem/build/data/labels/96_2.png
QiaoJiaSystem/build/data/labels/96_3.png
QiaoJiaSystem/build/data/labels/96_4.png
QiaoJiaSystem/build/data/labels/96_5.png
QiaoJiaSystem/build/data/labels/96_6.png
QiaoJiaSystem/build/data/labels/96_7.png
QiaoJiaSystem/build/data/labels/97_0.png
QiaoJiaSystem/build/data/labels/97_1.png
QiaoJiaSystem/build/data/labels/97_2.png
QiaoJiaSystem/build/data/labels/97_3.png
QiaoJiaSystem/build/data/labels/97_4.png
QiaoJiaSystem/build/data/labels/97_5.png
QiaoJiaSystem/build/data/labels/97_6.png
QiaoJiaSystem/build/data/labels/97_7.png
QiaoJiaSystem/build/data/labels/98_0.png
QiaoJiaSystem/build/data/labels/98_1.png
QiaoJiaSystem/build/data/labels/98_2.png
QiaoJiaSystem/build/data/labels/98_3.png
QiaoJiaSystem/build/data/labels/98_4.png
QiaoJiaSystem/build/data/labels/98_5.png
QiaoJiaSystem/build/data/labels/98_6.png
QiaoJiaSystem/build/data/labels/98_7.png
QiaoJiaSystem/build/data/labels/99_0.png
QiaoJiaSystem/build/data/labels/99_1.png
QiaoJiaSystem/build/data/labels/99_2.png
QiaoJiaSystem/build/data/labels/99_3.png
QiaoJiaSystem/build/data/labels/99_4.png
QiaoJiaSystem/build/data/labels/99_5.png
QiaoJiaSystem/build/data/labels/99_6.png
QiaoJiaSystem/build/data/labels/99_7.png
QiaoJiaSystem/build/data/labels/make_labels.py
QiaoJiaSystem/build/data/voc.names
QiaoJiaSystem/build/erl_crash.dump
QiaoJiaSystem/build/fastDfsClient.conf
QiaoJiaSystem/build/killAll.sh
QiaoJiaSystem/build/runAll.sh
QiaoJiaSystem/build/runTestCutImage.sh
QiaoJiaSystem/build/runWebSer.sh
QiaoJiaSystem/build/scpToSer.sh
QiaoJiaSystem/build/startAllServer.sh
QiaoJiaSystem/build/startHC.sh
QiaoJiaSystem/build/syncDBClient
QiaoJiaSystem/build/testLoadDB.sh
QiaoJiaSystem/build/test_cpu_mem.sh
QiaoJiaSystem/build/yolov3.weights
QiaoJiaSystem/runPath.sh |