locationmgmt/networkgateway/src/netgatewayasynccallback.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 01:50:39 +0200
changeset 0 9cfd9a3ee49c
permissions -rw-r--r--
Revision: 201002 Kit: 201005

// Copyright (c) 2008-2009 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:
// The asynchronous callbacks used by the Network Gateway
// 
//

#include <lbs/lbsnetprotocolbase.h>

#include "netgatewayasynccallback.h"
#include "lbsdevloggermacros.h"

#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
#include "lbsnetextintversions.h"
#endif


/**
@file
@internalComponent
@released
*/

CRejectPrivacyRequestCallback* CRejectPrivacyRequestCallback::NewL()
	{
	return new(ELeave) CRejectPrivacyRequestCallback;
	}

CRejectPrivacyRequestCallback::CRejectPrivacyRequestCallback() : CAsyncCallBack(EPriorityHigh)
	{
	}

CRejectPrivacyRequestCallback::~CRejectPrivacyRequestCallback()
	{	
	Cancel();
	}

void CRejectPrivacyRequestCallback::CallBack(CLbsNetworkProtocolBase* aProtocol, 
		const TLbsNetSessionId& aSessionId)
	{
	Cancel();
	iProtocol = aProtocol;
	iSessionId = aSessionId;
	CAsyncCallBack::CallBack();
	}

void CRejectPrivacyRequestCallback::RunL()
	{
	__ASSERT_DEBUG(iProtocol, User::Invariant());
	if(!iProtocol)
		{
		return;
		}
	
	CLbsNetworkProtocolBase2* networkProtocolExt = reinterpret_cast<CLbsNetworkProtocolBase2*>
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS	
					(iProtocol->ExtendedInterface(CLbsNetworkProtocolBase::EExtInterface2,0,0));
#else
					(iProtocol->ExtendedInterface(ELbsNetExtInterface2,0,0));
#endif

				
	if (networkProtocolExt != NULL)
		{
		networkProtocolExt->RespondPrivacyRequest(iSessionId, CLbsNetworkProtocolBase::EPrivacyResponseRejected, KErrAccessDenied);
		}
	else 
		{
		iProtocol->RespondPrivacyRequest(iSessionId, CLbsNetworkProtocolBase::EPrivacyResponseRejected);
		}
				
	LBSLOG(ELogP9, "->A CLbsNetworkProtocolBase::RespondPrivacyRequest() ProtocolModule\n");
	LBSLOG(ELogP9, "  > TLbsNetMtLrReponseMsg msg.SessionId()  = \n");
	LBSLOG_SESSIONID(iSessionId);
	LBSLOG2(ELogP9, "  > TLbsNetMtLrReponseMsg msg.Response()  = %d", CLbsNetworkProtocolBase::EPrivacyResponseRejected);
	}