#ifndef __LIVENESSDETECTION_CLIENT_G_H #define __LIVENESSDETECTION_CLIENT_G_H #pragma once // This code is generated by spgen tool! #include "LivenessDetection_def_g.h" namespace LivenessDetection { class LivenessDetectionService_ClientBase : public CClientSessionBase { public: explicit LivenessDetectionService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {} LivenessDetectionService_ClientBase* operator () (const linkContext &curLink) { m_context = curLink; return this; } protected: virtual ~LivenessDetectionService_ClientBase() { /// override by user } public: void OnConnectSucceed() { bSessionClosed = false; } void OnClose(ErrorCodeEnum) { Dbg("session closed."); bSessionClosed = true; } bool QuerySessionClosed() { return bSessionClosed; } ErrorCodeEnum Connect(CSmartPointer &spAsyncWait) { CSmartPointer pFunc = m_pEntityBase->GetFunction(); ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, "LivenessDetection", "LivenessDetectionService", spAsyncWait); if (Error == Error_Succeed) { m_bSysManaged = true; bSessionClosed = false; } return Error; } ErrorCodeEnum Connect() { CSmartPointer spAsyncWait; ErrorCodeEnum Error = Connect(spAsyncWait); if (Error == Error_Succeed) { Error = spAsyncWait->WaitAnswer(); } return Error; } ErrorCodeEnum StartLivenessDetection(LivenessDetectionService_StartLivenessDetection_Req &Req, CSmartPointer &spAsyncWait, DWORD dwTimeout) { CSmartPointer pFunc = GetFunction(); CAutoBuffer Buf = SpObject2Buffer(Req); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } auto ret = pFunc->AsyncRequest(LivenessDetectionService_Method_StartLivenessDetection, LivenessDetectionService_MethodSignature_StartLivenessDetection, Buf, spAsyncWait, m_context, dwTimeout); m_context.clear(); return ret; } ErrorCodeEnum StartLivenessDetection(LivenessDetectionService_StartLivenessDetection_Req &Req, LivenessDetectionService_StartLivenessDetection_Ans &Ans, DWORD dwTimeout) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = StartLivenessDetection(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } ErrorCodeEnum StartLivenessDetection(LivenessDetectionService_StartLivenessDetection_Req &Req, LivenessDetectionService_StartLivenessDetection_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = StartLivenessDetection(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } ErrorCodeEnum StartLivenessDetection(LivenessDetectionService_StartLivenessDetection_Req &Req, LivenessDetectionService_StartLivenessDetection_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = StartLivenessDetection(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; CSimpleString str; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } ErrorCodeEnum StopLivenessDetection(LivenessDetectionService_StopLivenessDetection_Req &Req, CSmartPointer &spAsyncWait, DWORD dwTimeout) { CSmartPointer pFunc = GetFunction(); CAutoBuffer Buf = SpObject2Buffer(Req); if (m_context.checkEmpty()) { m_context.AutoGenerate(); DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")(); m_context = m_context.upgradeLink(); } auto ret = pFunc->AsyncRequest(LivenessDetectionService_Method_StopLivenessDetection, LivenessDetectionService_MethodSignature_StopLivenessDetection, Buf, spAsyncWait, m_context, dwTimeout); m_context.clear(); return ret; } ErrorCodeEnum StopLivenessDetection(LivenessDetectionService_StopLivenessDetection_Req &Req, LivenessDetectionService_StopLivenessDetection_Ans &Ans, DWORD dwTimeout) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = StopLivenessDetection(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } ErrorCodeEnum StopLivenessDetection(LivenessDetectionService_StopLivenessDetection_Req &Req, LivenessDetectionService_StopLivenessDetection_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = StopLivenessDetection(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } ErrorCodeEnum StopLivenessDetection(LivenessDetectionService_StopLivenessDetection_Req &Req, LivenessDetectionService_StopLivenessDetection_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = StopLivenessDetection(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; CSimpleString str; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } bool SafeDelete() { if (!m_bSysManaged) { delete this; } return m_bSysManaged; } protected: bool m_bSysManaged; CEntityBase *m_pEntityBase; linkContext m_context; bool bSessionClosed; }; /////////////////////////// } // namespace LivenessDetection #endif // __LIVENESSDETECTION_CLIENT_G_H