networkprotocolmodules/suplprotocolmodule/SuplPushAPI/src/lbssuplpushreceiverimpl.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 // Internal implementation of the receiver's part of the SUPL Push API
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21  @deprecated
       
    22 */
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <centralrepository.h>
       
    26 #include "lbsdevloggermacros.h"
       
    27 
       
    28 #include "lbssuplpushreceiverimpl.h"
       
    29 #include "lbssuplpushreceiverchannel.h"
       
    30 #include "lbsrootcenrepdefs.h"
       
    31 
       
    32 //=============================================================================
       
    33 // CLbsSuplPushRecImpl
       
    34 //=============================================================================
       
    35 /**
       
    36 Opens all the SUPL Push channels and starts listening for incoming SUPL INIT messages.
       
    37 
       
    38 @param aObserver [In] A reference to an observer waiting for SUPL INIT messages.
       
    39 
       
    40 @return an instance of the interface. The calling object becomes the
       
    41 owner of the returned instance and is responsible its disposal.
       
    42 
       
    43 @see CLbsSuplPushRec::NewL
       
    44 */
       
    45 CLbsSuplPushRecImpl* CLbsSuplPushRecImpl::NewL(MLbsSuplPushRecObserver& aObserver)
       
    46 	{
       
    47 	LBSLOG(ELogP1, "CLbsSuplPushRecImpl::NewL() Begin\n");
       
    48 	CLbsSuplPushRecImpl* newObj = new (ELeave) CLbsSuplPushRecImpl();
       
    49 	CleanupStack::PushL(newObj);
       
    50 	newObj->ConstructL(aObserver);
       
    51 	CleanupStack::Pop(newObj);
       
    52 	LBSLOG(ELogP1, "CLbsSuplPushRecImpl::NewL() End\n");
       
    53 	return newObj;
       
    54 	}
       
    55 	
       
    56 /**
       
    57 Deletes all channels used. 
       
    58 
       
    59 @see CLbsSuplPushRec::~CLbsSuplPushRec
       
    60 */
       
    61 CLbsSuplPushRecImpl::~CLbsSuplPushRecImpl()
       
    62 	{
       
    63 	LBSLOG(ELogP1, "CLbsSuplPushRecImpl::~CLbsSuplPushRecImpl() Begin\n");
       
    64 	delete iSmsChannel;
       
    65 	delete iWapPushChannel;
       
    66 	LBSLOG(ELogP1, "CLbsSuplPushRecImpl::~CLbsSuplPushRecImpl() End\n");
       
    67 	}
       
    68 	
       
    69 
       
    70 /**
       
    71 The 2nd phase constructor. Constructs both channels, which start to listen for new messages.
       
    72 
       
    73 @param aObserver [In] A reference to an observer waiting for SUPL INIT messages.
       
    74  
       
    75 @see CLbsSuplPushRecImpl::NewL
       
    76 */
       
    77 void CLbsSuplPushRecImpl::ConstructL(MLbsSuplPushRecObserver& aObserver)
       
    78 	{
       
    79 	LBSLOG(ELogP1, "CLbsSuplPushRecImpl::ConstructL() Begin\n");
       
    80 	// Get the CategoryUid from the cenrep file owned by LbsRoot.
       
    81 	TInt category;
       
    82 	CRepository* rep = CRepository::NewLC(KLbsCenRepUid);
       
    83 	TInt err = rep->Get(KSuplPushAPIKey, category);
       
    84 	User::LeaveIfError(err);
       
    85 	CleanupStack::PopAndDestroy(rep);
       
    86 	
       
    87 	iSmsChannel = CLbsSuplPushRecChannel::NewL(ELbsSuplPushChannelSMS, aObserver,TSecureId(category));
       
    88 	iWapPushChannel = CLbsSuplPushRecChannel::NewL(ELbsSuplPushChannelWAP, aObserver, TSecureId(category));
       
    89 	LBSLOG(ELogP1, "CLbsSuplPushRecImpl::ConstructL() End\n");
       
    90 	}
       
    91 
       
    92 
       
    93 /**
       
    94 Sends a confirmation of receiving a SUPL INIT message.
       
    95 The function is not intended to report any details about the success or failure
       
    96 of an MT-LR request or server connection.
       
    97 It is only to confirm that the SUPL INIT message has been received by the SUPL
       
    98 Protocol Module.
       
    99 
       
   100 The current implementation of the SUPL Push API does not use this function, 
       
   101 so its body is empty. 
       
   102 
       
   103 @param aChannel  [In] The channel Id.
       
   104 @param aError    [In] KErrNone if successful. KErrArgument if the structure 
       
   105                       or content of the received SUPL INIT message was incorrect. 
       
   106 @param aReqId    [In] An Id of the request.
       
   107 @param aReserved [In] Reserved for future use.
       
   108 
       
   109 @return KErrNone if successful, otherwise another of the system-wide error codes.
       
   110 	
       
   111 @see MLbsSuplPushRecObserver::OnSuplInit  
       
   112 @see CLbsSuplPushRec::SuplInitComplete
       
   113 */
       
   114 TInt CLbsSuplPushRecImpl::SuplInitComplete(TLbsSuplPushChannel /*aChannel*/, 
       
   115 												TLbsSuplPushRequestId /*aReqId*/, 
       
   116 												TInt /*aError*/, 
       
   117 												TInt /*aReserved*/)
       
   118 	{
       
   119 	LBSLOG(ELogP1, "CLbsSuplPushRecImpl::ConstructL() Begin\n");
       
   120 	LBSLOG(ELogP1, "CLbsSuplPushRecImpl::ConstructL() End\n");
       
   121 	//Intentionally left blank
       
   122 	return KErrNone;
       
   123 	}
       
   124