networkprotocolmodules/suplprotocolmodule/SuplProtocol/src/suplgatewayinterface.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This file provides the class implementation of the ECOM plug-in 
       
    15 // interface for the SUPL Protocol Module.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21  @internalTechnology
       
    22  @deprecated
       
    23 */
       
    24 
       
    25 #include <ecom/implementationproxy.h>
       
    26 #include "suplgatewayinterface.h"
       
    27 #include "supldevloggermacros.h"
       
    28 
       
    29 
       
    30 /** The unique ID of this plug-in implementation.
       
    31 This corresponds to the implementation UID specified in the .rss file
       
    32 for this protocol module.
       
    33 */
       
    34 const TInt KPluginUidValue = 0x10285A9D;
       
    35 
       
    36 
       
    37 //=============================================================================
       
    38 // CSuplGatewayInterface
       
    39 //=============================================================================
       
    40 
       
    41 /** Static public constructor.
       
    42 @param aObserver Plug-in parameters, which includes a reference 
       
    43 to this protocol module's observer.
       
    44 @return A new instance of the CSuplGatewayInterface class.
       
    45 */
       
    46 CSuplGatewayInterface* CSuplGatewayInterface::NewL(TAny* aParam)
       
    47 	{
       
    48 	SUPLLOG(ELogP1, "CSuplGatewayInterface::NewL() Begin\n");
       
    49 	TLbsNetProtocolModuleParams* param = reinterpret_cast<TLbsNetProtocolModuleParams*>(aParam);
       
    50 	CSuplGatewayInterface* self = new (ELeave) CSuplGatewayInterface(static_cast<MLbsNetworkProtocolObserver2&>(param->Observer()));
       
    51 	CleanupStack::PushL(self);
       
    52 	self->ConstructL();
       
    53 	CleanupStack::Pop(self);
       
    54 	SUPLLOG(ELogP1, "CSuplGatewayInterface::NewL() End\n");
       
    55 	return self;
       
    56 	}
       
    57 
       
    58 
       
    59 /** Standard destructor.
       
    60 */  
       
    61 CSuplGatewayInterface::~CSuplGatewayInterface()
       
    62 	{
       
    63 	SUPLLOG(ELogP1, "CSuplGatewayInterface::~CSuplGatewayInterface() Begin\n");
       
    64 	delete iManager;
       
    65 	SUPLLOG(ELogP1, "CSuplGatewayInterface::~CSuplGatewayInterface() End\n");
       
    66 	}
       
    67 
       
    68 
       
    69 /** Default constructor
       
    70 @param aObserver Reference to this protocol module's observer.
       
    71 */
       
    72 CSuplGatewayInterface::CSuplGatewayInterface(MLbsNetworkProtocolObserver2& aObserver)
       
    73 : iObserver(aObserver)
       
    74 	{
       
    75 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CSuplGatewayInterface() Begin\n");
       
    76 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CSuplGatewayInterface() End\n");
       
    77 	}
       
    78 
       
    79 
       
    80 /** Second stage private constructor.
       
    81 */
       
    82 void CSuplGatewayInterface::ConstructL()
       
    83 	{
       
    84 	SUPLLOG(ELogP1, "CSuplGatewayInterface::ConstructL() Begin\n");
       
    85 	iManager = CSuplProtocolManager::NewL(*this);
       
    86 	SUPLLOG(ELogP1, "CSuplGatewayInterface::ConstructL() End\n");
       
    87 	}
       
    88 
       
    89 
       
    90 /** Send a response to a privacy request to the network.
       
    91 @see CLbsNetworkProtocolBase::RespondPrivacyRequest()
       
    92 */
       
    93 void CSuplGatewayInterface::RespondPrivacyRequest(const TLbsNetSessionId& aSessionId, const TLbsPrivacyResponse& aResponse, TInt aReason)
       
    94 	{	
       
    95 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RespondPrivacyRequest() Begin\n");
       
    96 	SUPLLOG(ELogP7, "CSuplGatewayInterface::RespondPrivacyRequest\n");
       
    97 	iManager->PrivacyResp(aSessionId, aResponse, aReason);
       
    98 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RespondPrivacyRequest() End\n");
       
    99 	}
       
   100 
       
   101 /** Send a response to a location request to the network.
       
   102 @see CLbsNetworkProtocolBase::RespondLocationRequest()
       
   103 */
       
   104 void CSuplGatewayInterface::RespondLocationRequest(const TLbsNetSessionId& aSessionId, TInt aReason, 
       
   105 												const TPositionInfoBase& aPosInfo)
       
   106 	{
       
   107 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RespondLocationRequest() Begin\n");
       
   108 	SUPLLOG(ELogP7, "CSuplGatewayInterface::RespondLocationRequest\n");
       
   109 	iManager->LocationResp(aSessionId, aReason, aPosInfo);
       
   110 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RespondLocationRequest() End\n");
       
   111 	}
       
   112 
       
   113 /** Send a request for GPS assistance data to the network.
       
   114 LBS does not currently send valid infomation in the sessionIdArray
       
   115 @see CLbsNetworkProtocolBase::RequestAssistanceData()
       
   116 */
       
   117 void CSuplGatewayInterface::RequestAssistanceData(TLbsAsistanceDataGroup aDataRequestMask,
       
   118 												const TLbsNetSessionIdArray& /*aSessionIdArray*/)
       
   119 	{
       
   120 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RequestAssistanceData() Begin\n");
       
   121 	SUPLLOG(ELogP7, "CSuplGatewayInterface::RequestAssistanceData\n");
       
   122 	iManager->AssistanceDataReq(aDataRequestMask);
       
   123 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RequestAssistanceData() End\n");
       
   124 	}
       
   125 
       
   126 /** Send a request for an approximate location based on the current network cell to the network.
       
   127 @see CLbsNetworkProtocolBase::RequestNetworkLocation()
       
   128 */
       
   129 void CSuplGatewayInterface::RequestNetworkLocation(const TLbsNetSessionId& aSessionId,
       
   130 							const TLbsNetPosRequestOptionsBase& aOptions)
       
   131 	{	
       
   132 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RequestNetworkLocation() Begin\n");
       
   133 	SUPLLOG(ELogP7, "CSuplGatewayInterface::RequestNetworkLocation\n");
       
   134 	iManager->NetworkBasedLocationReq(aSessionId, aOptions);
       
   135 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RequestNetworkLocation() End\n");
       
   136 	}
       
   137 
       
   138 
       
   139 /** Tell the protocol module to finish the current network based location request.
       
   140 @see CLbsNetworkProtocolBase::CancelNetworkLocation()
       
   141 */
       
   142 void CSuplGatewayInterface::CancelNetworkLocation(const TLbsNetSessionId& aSessionId,
       
   143 							TInt aReason)
       
   144 	{
       
   145 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CancelNetworkLocation() Begin\n");
       
   146 	SUPLLOG(ELogP7, "CSuplGatewayInterface::CancelNetworkLocation\n");
       
   147 	iManager->NetworkBasedLocationCompleteInd(aSessionId, aReason);
       
   148 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CancelNetworkLocation() End\n");
       
   149 	}
       
   150 
       
   151 
       
   152 /** Request self locate.
       
   153 @see CLbsNetworkProtocolBase::RequestSelfLocation()
       
   154 */
       
   155 void CSuplGatewayInterface::RequestSelfLocation(const TLbsNetSessionId& aSessionId,
       
   156 							const TLbsNetPosRequestOptionsBase& aOptions)	
       
   157 	{
       
   158 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RequestSelfLocation() Begin\n");
       
   159 	SUPLLOG(ELogP7, "CSuplGatewayInterface::RequestSelfLocation\n");
       
   160 	iManager->SelfLocationReq(aSessionId, aOptions);
       
   161 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RequestSelfLocation() End\n");
       
   162 	}
       
   163 
       
   164 /** Cancel request for self locate.
       
   165 @see CLbsNetworkProtocolBase::CancelSelfLocation()
       
   166 */
       
   167 void CSuplGatewayInterface::CancelSelfLocation(const TLbsNetSessionId& aSessionId,
       
   168 							TInt  aReason)
       
   169 	{
       
   170 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CancelSelfLocation() Begin\n");
       
   171 	SUPLLOG(ELogP7, "CSuplGatewayInterface::CancelSelfLocation\n");
       
   172 	iManager->SelfLocationCompleteInd(aSessionId, aReason);
       
   173 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CancelSelfLocation() End\n");
       
   174 	}
       
   175 
       
   176 /** Lbs System Status information.
       
   177 @see CLbsNetworkProtocolBase::AdviceSystemStatus()
       
   178 */
       
   179 void CSuplGatewayInterface::AdviceSystemStatus(TLbsSystemStatus aStatus)
       
   180 	{	
       
   181 	SUPLLOG(ELogP1, "CSuplGatewayInterface::AdviceSystemStatus() Begin\n");
       
   182 	SUPLLOG(ELogP7, "CSuplGatewayInterface::AdviceSystemStatus\n");
       
   183 	iManager->SystemStatusInd(aStatus);
       
   184 	SUPLLOG(ELogP1, "CSuplGatewayInterface::AdviceSystemStatus() End\n");
       
   185 	}
       
   186 
       
   187 /** Send a request to send the handsets location to a third party to the network.
       
   188 This procedure is not supported by SUPL version 1. This method forwards the request
       
   189 to the handler of unsupported procedures.
       
   190 @see CLbsNetworkProtocolBase::RequestTransmitLocation()
       
   191 */
       
   192 void CSuplGatewayInterface::RequestTransmitLocation(
       
   193 									const TLbsNetSessionId& aSessionId,
       
   194 									const TDesC& aDestination,
       
   195 									TInt aPriority,
       
   196 									const TLbsNetPosRequestOptionsBase& aOptions)
       
   197 	{
       
   198 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RequestTransmitLocation() Begin\n");
       
   199 	SUPLLOG(ELogP7, "CSuplGatewayInterface::RequestTransmitLocation\n");
       
   200 	iManager->TransmitLocationReq(aSessionId, aDestination, aPriority, aOptions);
       
   201 	SUPLLOG(ELogP1, "CSuplGatewayInterface::RequestTransmitLocation() End\n");
       
   202 	}
       
   203 
       
   204 /** Tell the protocol module to end the current send location to third party request.
       
   205 This procedure is not supported by SUPL version 1. This method forwards the request
       
   206 to the handler of unsupported procedures.
       
   207 @see CLbsNetworkProtocolBase::CancelTransmitLocation()
       
   208 */
       
   209 void CSuplGatewayInterface::CancelTransmitLocation(const TLbsNetSessionId& aSessionId, TInt aReason)
       
   210 	{
       
   211 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CancelTransmitLocation() Begin\n");
       
   212 	SUPLLOG(ELogP7, "CSuplGatewayInterface::CancelTransmitLocation\n");
       
   213 	iManager->TransmitLocationCompleteInd(aSessionId, aReason);
       
   214 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CancelTransmitLocation() End\n");
       
   215 	}
       
   216 
       
   217 
       
   218 /** Send privacy request to protocol module's observer.
       
   219 @param aSessionId The Id of the location session within the LBS sub-system.
       
   220 @param aEmergency ETrue if this is an emergency privacy request, EFalse otherwise.
       
   221 @param aPrivacy Type of privacy request specified by the network.
       
   222 @param aRequestInfo Data about the external requestor of this handsets location.
       
   223 
       
   224 @see MLbsNetworkProtocolObserver2::ProcessPrivacyRequest()
       
   225 */
       
   226 void CSuplGatewayInterface::PrivacyReq(const TLbsNetSessionId& aSessionId, TBool aEmergency, 
       
   227 					const TLbsNetPosRequestPrivacy& aPrivacy,
       
   228 					const TLbsExternalRequestInfo& aRequestInfo)
       
   229 	{
       
   230 	SUPLLOG(ELogP1, "CSuplGatewayInterface::PrivacyReq() Begin\n");
       
   231 	SUPLLOG(ELogP7, "CSuplGatewayInterface::PrivacyReq\n");
       
   232 	iObserver.ProcessPrivacyRequest(aSessionId, aEmergency, aPrivacy, aRequestInfo);
       
   233 	SUPLLOG(ELogP1, "CSuplGatewayInterface::PrivacyReq() End\n");
       
   234 	}
       
   235 
       
   236 
       
   237 /** Send network-based location to protocol module's observer.
       
   238 @param aReferenceLocation The network-based reference location.
       
   239 
       
   240 @see MLbsNetworkProtocolObserver2::ProcessNetworkBasedLocation() 
       
   241 */
       
   242 void CSuplGatewayInterface::NetworkLocationInd(const TLbsNetSessionId& aSessionId, 
       
   243 					const TPositionInfoBase& aPosInfo)
       
   244 	{
       
   245 	SUPLLOG(ELogP1, "CSuplGatewayInterface::NetworkLocationInd() Begin\n");
       
   246 	SUPLLOG(ELogP7, "CSuplGatewayInterface::NetworkLocationInd\n");
       
   247 	iObserver.ProcessLocationUpdate(aSessionId, aPosInfo);
       
   248 	SUPLLOG(ELogP1, "CSuplGatewayInterface::NetworkLocationInd() End\n");
       
   249 	}
       
   250 
       
   251 
       
   252 /** Send assistance data to protocol module's observer.
       
   253 @param aGroupMask This identifies the data group relevant for this indication.
       
   254 @param aData This holds GPS assistance data to be delivered to LBS.
       
   255 @param aReason A general error associated with assistance data retrieval.
       
   256 
       
   257 @see MLbsNetworkProtocolObserver2::ProcessAssistanceData() 
       
   258 */
       
   259 void CSuplGatewayInterface::AssistanceDataInd(const TLbsAsistanceDataGroup& aGroupMask,
       
   260 						const RLbsAssistanceDataBuilderSet& aData, TInt aReason)
       
   261 	{
       
   262 	SUPLLOG(ELogP1, "CSuplGatewayInterface::AssistanceDataInd() Begin\n");
       
   263 	SUPLLOG(ELogP7, "CSuplGatewayInterface::AssistanceDataInd\n");
       
   264 	// LBS does not yet support arrays of session IDs in the assistance data
       
   265 	// notification.
       
   266 	TLbsNetSessionIdArray dummySessIdArray;
       
   267 	iObserver.ProcessAssistanceData(aGroupMask, aData, aReason, dummySessIdArray);
       
   268 	SUPLLOG(ELogP1, "CSuplGatewayInterface::AssistanceDataInd() End\n");
       
   269 	}
       
   270 
       
   271 
       
   272 /** Send location request to protocol module's observer.
       
   273 @param aSessionId The Id of the location session within the LBS sub-system.
       
   274 @param aEmergency ETrue if this is an emergency request, EFalse otherwise.
       
   275 @param aType The type of location request. The type is determined by preceding
       
   276 			 requests and other context information that only the network
       
   277 			 protocol module knows about. So it is the responsibility
       
   278 			 of the network protocol module to set the type of each request.
       
   279 @param aQuality The network-requested quality of service (QoS) of the 
       
   280 				location calculation.
       
   281 
       
   282 @see MLbsNetworkProtocolObserver2::ProcessLocationRequest() 
       
   283 */
       
   284 void CSuplGatewayInterface::LocationReq(const TLbsNetSessionId& aSessionId,
       
   285 					const MLbsNetworkProtocolObserver2::TLbsNetProtocolService& aType, 
       
   286 					const TLbsNetPosRequestQuality& aQuality,
       
   287 					const TLbsNetPosRequestMethod& aPosMethod)
       
   288 	{
       
   289 	SUPLLOG(ELogP1, "CSuplGatewayInterface::LocationReq() Begin\n");
       
   290 	SUPLLOG(ELogP7, "CSuplGatewayInterface::LocationReq\n");
       
   291 	iObserver.ProcessLocationRequest(aSessionId, EFalse, aType, aQuality, aPosMethod);
       
   292 	SUPLLOG(ELogP1, "CSuplGatewayInterface::LocationReq() End\n");
       
   293 	}
       
   294 
       
   295 
       
   296 /** Send session complete indication to protocol module's observer.
       
   297 @param aSessionId The Id of the session completed.
       
   298 @param aReason Reason for the completion of the request. 
       
   299 			KErrNone if the request is successfully completed, otherwise
       
   300 			it is one of a range of error codes.
       
   301 
       
   302 @see MLbsNetworkProtocolObserver2::ProcessSessionComplete() 
       
   303 */
       
   304 void CSuplGatewayInterface::SessionCompleteInd(const TLbsNetSessionId& aSessionId, TInt aReason)
       
   305 	{
       
   306 	SUPLLOG(ELogP1, "CSuplGatewayInterface::SessionCompleteInd() Begin\n");
       
   307 	SUPLLOG(ELogP7, "CSuplGatewayInterface::SessionCompleteInd\n");
       
   308 	iObserver.ProcessSessionComplete(aSessionId, aReason);
       
   309 	SUPLLOG(ELogP1, "CSuplGatewayInterface::SessionCompleteInd() End\n");
       
   310 	}
       
   311 
       
   312 
       
   313 /** Network request for LBS capabilities
       
   314 @param aCapabilities The object to hold the returned capabilities from LBS.
       
   315 
       
   316 @see MLbsNetworkProtocolObserver2::GetCapabilities() 
       
   317 */
       
   318 void CSuplGatewayInterface::GetCapabilities(TLbsNetPosCapabilities& aCapabilities)
       
   319 	{
       
   320 	SUPLLOG(ELogP1, "CSuplGatewayInterface::GetCapabilities() Begin\n");
       
   321 	SUPLLOG(ELogP7, "CSuplGatewayInterface::GetCapabilities\n");
       
   322 	iObserver.GetCurrentCapabilities(aCapabilities);
       
   323 	SUPLLOG(ELogP1, "CSuplGatewayInterface::GetCapabilities() End\n");
       
   324 	}
       
   325 
       
   326 
       
   327 /** Advise LBS of a change in active service status
       
   328 @param aActiveServiceMask A mask specifying the currently active services.
       
   329 
       
   330 @see MLbsNetworkProtocolObserver2::StatusUpdate() 
       
   331 */
       
   332 void CSuplGatewayInterface::StatusUpdate(MLbsNetworkProtocolObserver2::TLbsNetProtocolServiceMask aActiveServiceMask)
       
   333 	{
       
   334 	SUPLLOG(ELogP1, "CSuplGatewayInterface::StatusUpdate() Begin\n");
       
   335 	SUPLLOG(ELogP7, "CSuplGatewayInterface::StatusUpdate\n");
       
   336 	iObserver.ProcessStatusUpdate(aActiveServiceMask);
       
   337 	SUPLLOG(ELogP1, "CSuplGatewayInterface::StatusUpdate() End\n");
       
   338 	}
       
   339 
       
   340 
       
   341 /** This method for cancelling an MTLR is currently not used by LBS
       
   342 Its effect in the MTLR state machine is the same as a location update
       
   343 with KErrCancel, hence the implementation.
       
   344 */
       
   345 void CSuplGatewayInterface::CancelExternalLocation(const TLbsNetSessionId& aSessionId,
       
   346 								TInt /*aReason*/)
       
   347 	{
       
   348 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CancelExternalLocation() Begin\n");
       
   349 	SUPLLOG(ELogP7, "CSuplGatewayInterface::CancelExternalLocation\n");
       
   350 	TPositionInfo aDummyPosition;
       
   351 	iManager->LocationResp(aSessionId, KErrCancel, aDummyPosition);
       
   352 	SUPLLOG(ELogP1, "CSuplGatewayInterface::CancelExternalLocation() End\n");
       
   353 	}
       
   354 
       
   355 /** Defines the plug-in interface implementation UIDs, required by ECOM.
       
   356 */
       
   357 const TImplementationProxy ImplementationTable[] = 
       
   358     {
       
   359     IMPLEMENTATION_PROXY_ENTRY(KPluginUidValue, CSuplGatewayInterface::NewL)
       
   360     };
       
   361 
       
   362 
       
   363 /** Exported function for ECOM to retrieve implementations table
       
   364 */
       
   365 EXPORT_C 
       
   366 const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   367     {
       
   368 	SUPLLOG(ELogP1, "CSuplGatewayInterface::StatusUpdate() Begin\n");
       
   369     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   370 
       
   371     SUPLLOG(ELogP1, "CSuplGatewayInterface::StatusUpdate() End\n");
       
   372     return ImplementationTable;
       
   373     }
       
   374