| | |
| | | //
|
| | | // Created by pansen on 2017/8/4.
|
| | | //
|
| | | #include "RemoteFuncServer.h"
|
| | |
|
| | | RtspFaceDetectClient rtspFaceDetectClient;
|
| | |
|
| | | const RtspFaceDetectClient& getRtspFaceDetectClient(){
|
| | | return rtspFaceDetectClient;
|
| | | }
|
| | |
|
| | | //#todo
|
| | | RtspFaceDetectClient::RtspFaceDetectClient():rpcClient("127.0.0.1",8111),
|
| | | client(rpcClient.getMain<RtspFaceDetect>())
|
| | | {}
|
| | | void RtspFaceDetectClient::fireFaceCountListener(int cameraIndex, int faceCount){
|
| | | auto req = client.fireFaceCountListenerRequest();
|
| | | req.setCameraIndex(cameraIndex);
|
| | | req.setFaceCount(faceCount);
|
| | | auto send = req.send();
|
| | | send.wait(rpcClient.getWaitScope());
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | //#todo
|
| | | ::kj::Promise<void> RtspFaceViewImpl::RtspFaceViewImpl() {}
|
| | | ::kj::Promise<void> RtspFaceViewImpl::~RtspFaceViewImpl(){}
|
| | |
|
| | | ::kj::Promise<void> RtspFaceViewImpl::getFaceList(GetFaceListContext context) override{}
|
| | | ::kj::Promise<void> RtspFaceViewImpl::getFaceImages(GetFaceImagesContext context) override{}
|
| | | ::kj::Promise<void> RtspFaceViewImpl::setFaceLabel(SetFaceLabelContext context) override {}
|
| | | // |
| | | // Created by pansen on 2017/8/4. |
| | | // |
| | | #include "AppConfig.h" |
| | | #include "RemoteFuncServer.h" |
| | | #include "RemoteFunc.h" |
| | | #include "RtspNativeCodecJNIServer.h" |
| | | |
| | | #include <string> |
| | | #include <iostream> |
| | | using namespace std; |
| | | |
| | | AppConfig config("data/config.cfg"); |
| | | RemoteServer<RtspFaceViewImpl> remoteServer(config.getStringValue("local_ip"), config.getIntValue("local_port")); |
| | | //RemoteServer<RtspFaceViewImpl> remoteServer("192.168.1.97", 8112); |
| | | static RtspFaceDetectClient* rtspFaceDetectClient = nullptr; |
| | | |
| | | void startRemoteServer() |
| | | { |
| | | remoteServer.start(); |
| | | } |
| | | |
| | | RtspFaceDetectClient * getRtspFaceDetectClient() |
| | | { |
| | | if(rtspFaceDetectClient == nullptr) |
| | | rtspFaceDetectClient = new RtspFaceDetectClient; |
| | | return rtspFaceDetectClient; |
| | | } |
| | | |
| | | //#todo 构造函数修改 |
| | | RtspFaceDetectClient::RtspFaceDetectClient() : |
| | | rpcClient(nullptr) |
| | | { |
| | | } |
| | | |
| | | RtspFaceDetect::Client* RtspFaceDetectClient::getClient() |
| | | { |
| | | LOG_INFO << "new client @ " << (int*)client << LOG_ENDL; |
| | | |
| | | if (client == nullptr) { |
| | | LOG_INFO << "new client 2" << LOG_ENDL; |
| | | try |
| | | { |
| | | client = new RtspFaceDetect::Client(getEzRpcClient()->getMain<RtspFaceDetect>()); |
| | | } |
| | | catch (const kj::Exception& e) |
| | | { |
| | | LOG_ERROR << "new client error" << LOG_ENDL; |
| | | delete client; |
| | | client = nullptr; |
| | | throw e; |
| | | } |
| | | } |
| | | return client; |
| | | } |
| | | |
| | | ::kj::WaitScope &RtspFaceDetectClient::getWaitScope() |
| | | { |
| | | return getEzRpcClient()->getWaitScope(); |
| | | } |
| | | |
| | | capnp::EzRpcClient * RtspFaceDetectClient::getEzRpcClient() |
| | | { |
| | | if (rpcClient == nullptr) { |
| | | try |
| | | { |
| | | // rpcClient = new capnp::EzRpcClient("192.168.1.97", 8111); |
| | | rpcClient = new capnp::EzRpcClient(config.getStringValue("server_ip"), config.getIntValue("server_port")); |
| | | } |
| | | catch (const kj::Exception& e) |
| | | { |
| | | delete rpcClient; |
| | | rpcClient = nullptr; |
| | | throw e; |
| | | } |
| | | } |
| | | return rpcClient; |
| | | } |
| | | |
| | | ::kj::Promise<void> RtspFaceViewImpl::getFaceList(GetFaceListContext context) |
| | | { |
| | | LOG_ERROR <<"getFaceList :start !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL; |
| | | auto results = context.getResults(); |
| | | remoteGetFaceList(context.getParams(), results); |
| | | |
| | | return kj::READY_NOW; |
| | | } |
| | | |
| | | ::kj::Promise<void> RtspFaceViewImpl::getFaceImages(GetFaceImagesContext context) |
| | | { |
| | | auto results = context.getResults(); |
| | | remoteGetFaceListImage(context.getParams(), results); |
| | | LOG_ERROR <<"getFaceImages : !!!!!!!!!!!!!!"<< LOG_ENDL; |
| | | return kj::READY_NOW; |
| | | } |
| | | |
| | | ::kj::Promise<void> RtspFaceViewImpl::setFaceLabel(SetFaceLabelContext context) |
| | | { |
| | | LOG_ERROR <<"setFaceLabel : !!!!!!!!!!!!"<< LOG_ENDL; |
| | | auto results = context.getResults(); |
| | | |
| | | remoteSetFaceLabel(context.getParams(), results); |
| | | |
| | | return kj::READY_NOW; |
| | | } |