diff -r 000000000000 -r 667063e416a2 supl/locationsuplfw/gateway/src/epos_csuplnetinitiatedsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/supl/locationsuplfw/gateway/src/epos_csuplnetinitiatedsession.cpp Tue Feb 02 01:06:48 2010 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for SUPL subsessions +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include + +#include "epos_suplterminalipc.h" +#include "epos_suplterminalerrors.h" +#include "epos_csuplprotocolmanagerbase.h" + +#include "epos_csuplsessionmanager.h" +#include "epos_csuplglobal.h" +#include "epos_csuplserverpanic.h" +#include "epos_csuplipcsubsession.h" +#include "epos_csuplnetinitiatedsession.h" +#include "epos_mnetinitiatedobserver.h" + + +// CONSTANTS +//#ifdef _DEBUG +_LIT(KTraceFileName, "SUPL_GW::epos_csuplnetinitiatedsession.cpp"); +//#endif + +// ==================== LOCAL FUNCTIONS ==================== + + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CSuplNetInitiatedSession::CSuplNetInitiatedSession() + { + } + +// EPOC default constructor can leave. +void CSuplNetInitiatedSession::ConstructL(CSuplSessionManager& aSessnMgr, CSUPLProtocolManagerBase::TSuplReqType aReqType,CSuplServer* aServer,HBufC8* aClientBuf) + { + + DEBUG_TRACE("CSuplNetInitiatedSession::ConstructL", __LINE__) + RSuplTerminalSubSession::TSuplServiceType suplService; + TInt majorVersion = KErrNotFound; + TInt err = aSessnMgr.GetSUPLMessageVersionL(majorVersion,aClientBuf->Des()); + + if(majorVersion == 1) + suplService = RSuplTerminalSubSession::ESUPL_1_0; + else + suplService = RSuplTerminalSubSession::ESUPL_2_0; + + iSuplSession = aSessnMgr.CreateNewSessionL(aReqType, 0, suplService ); + iSuplSession->SetSUPLVersion(majorVersion); + iSuplSessnReq = CSuplSessionRequest::NewL(aSessnMgr, iSuplSession, aServer); + + + } + +// Two-phased constructor. +CSuplNetInitiatedSession* CSuplNetInitiatedSession::NewLC(CSuplSessionManager& aSessnMgr, CSUPLProtocolManagerBase::TSuplReqType aReqType,CSuplServer* aServer,HBufC8* aClientBuf) + { + DEBUG_TRACE("CSuplNetInitiatedSession::NewLC", __LINE__) + CSuplNetInitiatedSession* self = new (ELeave) CSuplNetInitiatedSession(); + CleanupClosePushL(*self); + self->ConstructL(aSessnMgr, aReqType,aServer,aClientBuf); + return self; + } + +// Destructor +CSuplNetInitiatedSession::~CSuplNetInitiatedSession() + { + DEBUG_TRACE("CSuplNetInitiatedSession::~CSuplIPCSubSession", __LINE__) + delete iSuplSessnReq; + delete iClientBuf; + iClientBuf = NULL; + } + + + + + + +// --------------------------------------------------------- +// CSuplNetInitiatedSession::RequestComplete +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CSuplNetInitiatedSession::RequestComplete( + const RMessage2& aMessage, + TInt aCompleteCode) + { + DEBUG_TRACE("CSuplNetInitiatedSession::RequestComplete", __LINE__) + if (!aMessage.IsNull()) + { + aMessage.Complete(aCompleteCode); + } + } + // --------------------------------------------------------- +// CSuplNetInitiatedSession::GetHandle +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +/*TInt CSuplNetInitiatedSession::GetHandle() +{ + DEBUG_TRACE("CSuplNetInitiatedSession::GetHandle", __LINE__) + TInt aId=iHandle; + return aId; +}*/ + +// --------------------------------------------------------- +// CSuplNetInitiatedSession::ForwardMessageL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// + +void CSuplNetInitiatedSession::ForwardMessageL(const RMessage2& aMessage) +{ + DEBUG_TRACE("CSuplNetInitiatedSession::ForwardMessageL", __LINE__) +/* TInt length=clientBuf->Length(); + iClientBuf=HBufC8::NewL(length); + *iClientBuf=*clientBuf;*/ + if (iSuplSession != NULL) + { + delete iClientBuf; + iClientBuf = NULL; + + iClientBuf = SuplGlobal::CopyClientBuffer8LC(aMessage, 0); + CleanupStack::Pop(iClientBuf); + RequestComplete(aMessage,KErrNone); + iSuplSessnReq->ForwardMessageRequestL(iSuplSession,iHandle,iClientBuf); + } + else + RequestComplete(aMessage,KErrNotReady); + +} +// --------------------------------------------------------- +// CSuplNetInitiatedSession::SetHandle +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +/*void CSuplNetInitiatedSession::SetHandle(TInt aHandle) +{ + DEBUG_TRACE("CSuplNetInitiatedSession::SetHandle", __LINE__) + iHandle=aHandle; +}*/ + +void CSuplNetInitiatedSession::DestroySession(CSuplSessionManager* aSessionMgr) +{ + if(aSessionMgr) + aSessionMgr->DestroySession(iSuplSession); +} + +// End of File +