#ifndef __MOBILEDIAL_CLIENT_G_H #define __MOBILEDIAL_CLIENT_G_H #pragma once // This code is generated by spgen tool! #include "MobileDial_def_g.h" namespace MobileDial { class MobileDialService_ClientBase : public CClientSessionBase { public: MobileDialService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {} protected: virtual ~MobileDialService_ClientBase() {} public: ErrorCodeEnum Connect(CSmartPointer &spAsyncWait) { CSmartPointer pFunc = m_pEntityBase->GetFunction(); ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, "MobileDial", "MobileDialService", spAsyncWait); if (Error == Error_Succeed) { m_bSysManaged = true; } return Error; } ErrorCodeEnum Connect() { CSmartPointer spAsyncWait; ErrorCodeEnum Error = Connect(spAsyncWait); if (Error == Error_Succeed) { Error = spAsyncWait->WaitAnswer(); } return Error; } ErrorCodeEnum Query(MobileDialService_Query_Req &Req, CSmartPointer &spAsyncWait, DWORD dwTimeout) { CSmartPointer pFunc = GetFunction(); CAutoBuffer Buf = SpObject2Buffer(Req); return pFunc->AsyncRequest(MobileDialService_Method_Query, MobileDialService_MethodSignature_Query, Buf, spAsyncWait, dwTimeout); } ErrorCodeEnum Query(MobileDialService_Query_Req &Req, MobileDialService_Query_Ans &Ans, DWORD dwTimeout) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = Query(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } ErrorCodeEnum Query(MobileDialService_Query_Req &Req, MobileDialService_Query_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = Query(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } ErrorCodeEnum GetDevInfo(MobileDialService_GetDevInfo_Req &Req, CSmartPointer &spAsyncWait, DWORD dwTimeout) { CSmartPointer pFunc = GetFunction(); CAutoBuffer Buf = SpObject2Buffer(Req); return pFunc->AsyncRequest(MobileDialService_Method_GetDevInfo, MobileDialService_MethodSignature_GetDevInfo, Buf, spAsyncWait, dwTimeout); } ErrorCodeEnum GetDevInfo(MobileDialService_GetDevInfo_Req &Req, MobileDialService_GetDevInfo_Ans &Ans, DWORD dwTimeout) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = GetDevInfo(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } ErrorCodeEnum GetDevInfo(MobileDialService_GetDevInfo_Req &Req, MobileDialService_GetDevInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError) { CSmartPointer spAsyncWait; ErrorCodeEnum Error = GetDevInfo(Req, spAsyncWait, dwTimeout); if (Error == Error_Succeed) { bool bEnd = false; Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, dwTimeout); LOG_ASSERT(Error || bEnd); } return Error; } ErrorCodeEnum ShowDialog(MobileDialService_ShowDialog_Info &Info) { CSmartPointer pFunc = GetFunction(); CAutoBuffer Buf = SpObject2Buffer(Info); return pFunc->OnewayCall(MobileDialService_Method_ShowDialog, MobileDialService_MethodSignature_ShowDialog, Buf); } bool SafeDelete() { if (!m_bSysManaged) { delete this; } return m_bSysManaged; } protected: bool m_bSysManaged; CEntityBase *m_pEntityBase; }; /////////////////////////// } // namespace MobileDial #endif // __MOBILEDIAL_CLIENT_G_H