networkprotocolmodules/suplprotocolmodule/SuplPushAPI/src/lbssuplpushreceiver.cpp
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2007-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 // The receiver part of the SUPL Push API.
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <lbs/lbssuplpushreceiver.h>
       
    20 #include <lbs/lbssuplpushcommon.h>
       
    21 #include "lbsdevloggermacros.h"
       
    22 
       
    23 #include "lbssuplpushreceiverimpl.h"
       
    24 
       
    25 //=============================================================================
       
    26 // MLbsSuplPushRecObserver
       
    27 //=============================================================================
       
    28 /**
       
    29 Provides the version of the observer interface. This can be used by the library 
       
    30 to determine the functionality supported by the client application.
       
    31 
       
    32 @return Version of the observer interface.
       
    33 */  
       
    34 EXPORT_C TVersion MLbsSuplPushRecObserver::Version() const
       
    35 	{
       
    36 	LBSLOG(ELogP1, "MLbsSuplPushRecObserver::Version() Begin\n");
       
    37 	LBSLOG(ELogP1, "MLbsSuplPushRecObserver::Version() End\n");
       
    38 	return TVersion(1, 0, 0);
       
    39 	}
       
    40 
       
    41 
       
    42 /**
       
    43 Should not be used. Provides for future expansion of the observer interface. 
       
    44 */  
       
    45 /*virtual*/ EXPORT_C TAny* MLbsSuplPushRecObserver::ExtendedInterface
       
    46 	(
       
    47 	TInt  /*aFunctionNumber*/,
       
    48 	TAny* /*aPtr1*/,
       
    49 	TAny* /*aPtr2*/
       
    50 	)
       
    51 	{
       
    52 	LBSLOG(ELogP1, "MLbsSuplPushRecObserver::Version() Begin\n");
       
    53 	LBSLOG(ELogP1, "MLbsSuplPushRecObserver::Version() End\n");
       
    54 	return NULL;
       
    55 	}
       
    56 
       
    57 
       
    58 //=============================================================================
       
    59 // CLbsSuplPushRec
       
    60 //=============================================================================
       
    61 /**
       
    62 Opens all the SUPL Push channels and starts listening for incoming SUPL INIT messages.
       
    63 
       
    64 @param aObserver [In] A reference to an observer waiting for SUPL INIT messages.
       
    65 
       
    66 @return an Instance of the interface. The calling application becomes the
       
    67 owner of the returned instance and is responsible its disposal.
       
    68 
       
    69 @capability NetworkServices
       
    70 @capability ReadDeviceData
       
    71 */
       
    72 EXPORT_C CLbsSuplPushRec* CLbsSuplPushRec::NewL(MLbsSuplPushRecObserver& aObserver)
       
    73 	{
       
    74 	LBSLOG(ELogP1, "CLbsSuplPushRec::NewL() Begin\n");
       
    75 	LBSLOG(ELogP8, "->S CLbsSuplPushRec::NewL() SuplPush\n");
       
    76 	CLbsSuplPushRec* newObj = new (ELeave) CLbsSuplPushRec();
       
    77 	CleanupStack::PushL(newObj);
       
    78 	newObj->ConstructL(aObserver);
       
    79 	CleanupStack::Pop(newObj);
       
    80 	LBSLOG(ELogP1, "CLbsSuplPushRec::NewL() End\n");
       
    81 	return newObj;
       
    82 	}
       
    83 	
       
    84 /**
       
    85 Closes the interface and disposes all open or used resources.
       
    86 */
       
    87 CLbsSuplPushRec::~CLbsSuplPushRec()
       
    88 	{
       
    89 	LBSLOG(ELogP1, "CLbsSuplPushRec::~CLbsSuplPushRec() Begin\n");
       
    90 	LBSLOG(ELogP8, "->S CLbsSuplPushRec::~CLbsSuplPushRec() SuplPush\n");
       
    91 	delete iImpl;
       
    92 	iImpl = NULL;
       
    93 	LBSLOG(ELogP1, "CLbsSuplPushRec::~CLbsSuplPushRec() End\n");
       
    94 	}
       
    95 	
       
    96 /**
       
    97 Default constructor.
       
    98 @internalComponent
       
    99 */
       
   100 CLbsSuplPushRec::CLbsSuplPushRec()
       
   101 	{
       
   102 	LBSLOG(ELogP1, "CLbsSuplPushRec::CLbsSuplPushRec() Begin\n");
       
   103 	LBSLOG(ELogP1, "CLbsSuplPushRec::CLbsSuplPushRec() End\n");
       
   104 	}
       
   105 
       
   106 /**
       
   107 2nd phase constructor. 
       
   108 Creates and assigns all the required internal resources.
       
   109 
       
   110 @param aObserver [In] A reference to an observer waiting for SUPL INIT messages.
       
   111 
       
   112 @internalComponent
       
   113 */
       
   114 void CLbsSuplPushRec::ConstructL(MLbsSuplPushRecObserver& aObserver)
       
   115 	{
       
   116 	LBSLOG(ELogP1, "CLbsSuplPushRec::ConstructL() Begin\n");
       
   117 	iImpl = CLbsSuplPushRecImpl::NewL(aObserver);
       
   118 	LBSLOG(ELogP1, "CLbsSuplPushRec::ConstructL() End\n");
       
   119 	}
       
   120 
       
   121 /**
       
   122 Sends a confirmation of receiving a SUPL INIT message.
       
   123 The function is not intended to report any details about the success or failure
       
   124 of an MT-LR request or server connection.
       
   125 It is only to confirm that the SUPL INIT message has been received by the SUPL
       
   126 Protocol Module.
       
   127 
       
   128 @param aError    [In] KErrNone if successful. KErrArgument if the structure 
       
   129                       or content of the received SUPL INIT message was incorrect. 
       
   130 @param aChannel  [In] The channel Id.
       
   131 @param aReqId    [In] An Id of the request.
       
   132 @param aReserved [In] Reserved for future use.
       
   133 
       
   134 @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   135 	
       
   136 @see MLbsSuplPushRecObserver::OnSuplInit()
       
   137 
       
   138 @capability NetworkServices
       
   139 @capability ReadDeviceData
       
   140 */
       
   141 EXPORT_C TInt CLbsSuplPushRec::SuplInitComplete(TLbsSuplPushChannel aChannel, 
       
   142 												TLbsSuplPushRequestId aReqId, 
       
   143 												TInt aError, 
       
   144 												TInt aReserved)
       
   145 	{
       
   146 	LBSLOG(ELogP1, "CLbsSuplPushRec::SuplInitComplete() Begin\n");
       
   147 	LBSLOG(ELogP9, "->S CLbsSuplPushRec::SuplInitComplete() SuplPush\n");
       
   148 	TInt err = iImpl->SuplInitComplete(aChannel, aReqId, aError, aReserved);
       
   149 	LBSLOG2(ELogP9, "  > TLbsSuplPushChannel aChannel = %d\n", aChannel);
       
   150 	LBSLOG2(ELogP9, "  > TLbsSuplPushRequestId aReqId = %d\n", aReqId);
       
   151 	LBSLOG2(ELogP9, "  > TInt aError = %d\n", aError);
       
   152 	LBSLOG2(ELogP9, "  Return  = %d\n", err);
       
   153 	LBSLOG(ELogP1, "CLbsSuplPushRec::SuplInitComplete() End\n");
       
   154 	return err;
       
   155 	}
       
   156