From b4edb9b542a8399484b892cddb72ef79975f1a8e Mon Sep 17 00:00:00 2001 From: pans <pans@454eff88-639b-444f-9e54-f578c98de674> Date: 星期五, 04 八月 2017 14:46:20 +0800 Subject: [PATCH] add RemoteFunc --- VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFunc.h | 18 ++++++ VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFunc.cpp | 4 + VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.cpp | 5 + VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.h | 37 ++++++++++++ VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.cpp | 32 ++++++++++ VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.h | 46 +++++++++++++++ 6 files changed, 142 insertions(+), 0 deletions(-) diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFunc.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFunc.cpp new file mode 100644 index 0000000..72565ef --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFunc.cpp @@ -0,0 +1,4 @@ +// +// Created by pansen on 2017/8/4. +// + diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFunc.h b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFunc.h new file mode 100644 index 0000000..487cd8d --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFunc.h @@ -0,0 +1,18 @@ +// +// Created by pansen on 2017/8/4. +// + +#ifndef RTSPNATIVECODEC_REMOTEFUNC_H +#define RTSPNATIVECODEC_REMOTEFUNC_H + +#include <iostream> +#include "RemoteMethod.proto.h" +#include "CameraWrapperServer.h" + +class RemoteFunc{ +public: + +}; + +#endif //RTSPNATIVECODEC_REMOTEFUNC_H + diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.cpp new file mode 100644 index 0000000..b423f48 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.cpp @@ -0,0 +1,5 @@ +// +// Created by pansen on 2017/8/4. +// + + diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.h b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.h new file mode 100644 index 0000000..bff5df3 --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.h @@ -0,0 +1,37 @@ +// +// Created by pansen on 2017/8/4. +// + +#ifndef RTSPNATIVECODEC_REMOTEMETHODCLIENT_H +#define RTSPNATIVECODEC_REMOTEMETHODCLIENT_H + +#include <iostream> +#include <capnp/ez-rpc.h> +#include "RemoteMethod.proto.h" +#include "CameraWrapperServer.h" + +const RtspFaceView::Client getRtspFaceViewClient(); + +class RtspFaceViewClient{ +public: + RtspFaceViewClient(); + ~RtspFaceViewClient(); + + RtspFaceView::GetFaceListResults::Reader getFaceList(int cameraIndex); + RtspFaceView::GetFaceListResults::Reader getFaceImages(int cameraIndex); + void setFaceLable(int cameraIndex,int trackId,std::string label); + +private: + capnp::EzRpcClient rpcClient; + RtspFaceDetect::Client client; +}; + +class RtspFaceDetectImpl final : public RtspFaceDetect::Server{ +public: + RtspFaceDetectImpl(); + ~RtspFaceDetectImpl(); + + virtual ::kj::Promise<void> fireFaceCountListener(FireFaceCountListenerContext context) override ; +}; + +#endif //RTSPNATIVECODEC_REMOTEMETHODCLIENT_H diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.cpp new file mode 100644 index 0000000..b768f8a --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.cpp @@ -0,0 +1,32 @@ +// +// 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 {} diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.h b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.h new file mode 100644 index 0000000..5cf671e --- /dev/null +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.h @@ -0,0 +1,46 @@ +// +// Created by pansen on 2017/8/4. +// + +#ifndef RTSPNATIVECODEC_REMOTEMETHODSERVER_H +#define RTSPNATIVECODEC_REMOTEMETHODSERVER_H + +#include <iostream> +#include <capnp/ez-rpc.h> +#include "RemoteMethod.proto.h" +#include "CameraWrapperServer.h" + +const RtspFaceDetectClient& getRtspFaceDetectClient(); + +class RtspFaceDetectClient{ +public: + RtspFaceDetectClient(); + ~RtspFaceDetectClient(); + + void fireFaceCountListener(int cameraIndex, int faceCount); + +private: + capnp::EzRpcClient rpcClient; + RtspFaceDetect::Client client; +}; + +class RtspFaceViewImpl final : public RtspFaceView::Server { +public: + RtspFaceViewImpl(); + + ~RtspFaceViewImpl(); + + virtual ::kj::Promise<void> getFaceList(GetFaceListContext context) override; + + + virtual ::kj::Promise<void> getFaceImages(GetFaceImagesContext context) override; + + virtual ::kj::Promise<void> setFaceLabel(SetFaceLabelContext context) override ; + +private: + CameraWrapper cameraWrapper; +}; + + + +#endif //RTSPNATIVECODEC_REMOTEMETHODSERVER_H -- Gitblit v1.8.0