messagingfw/suplsmshandler/test/testserver/src/Te_LbsSuplPush.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     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 // A test proxy class for the CTe_LbsSuplPush class
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21  @prototype
       
    22 */
       
    23 
       
    24 #include "Te_LbsSuplPush.h"
       
    25 
       
    26 MLbsSuplPushObserver* CTe_LbsSuplPush::iTestObserver;
       
    27 
       
    28 /**
       
    29 Static factory method for creating an instance of the CTe_LbsSuplPush class.
       
    30 
       
    31 @param aChannel  [In] The channel to be used for message delivering.
       
    32 @param aObserver [In] The observer to receive message delivery notifications.
       
    33 
       
    34 @return An instance of the class. The calling application becomes the
       
    35 owner of the returned instance and is responsible its disposal.
       
    36 
       
    37 @leave If a error happens, it leaves with one of the system error codes.
       
    38 */
       
    39 CTe_LbsSuplPush* CTe_LbsSuplPush::NewL(TLbsSuplPushChannel aChannel, MLbsSuplPushObserver& aObserver)
       
    40 	{
       
    41 	__ASSERT_ALWAYS(iTestObserver!=0, User::Invariant());
       
    42 	
       
    43 	CTe_LbsSuplPush* newObj = new (ELeave) CTe_LbsSuplPush(aObserver);
       
    44 	CleanupStack::PushL(newObj);
       
    45 	newObj->ConstructL(aChannel);
       
    46 	CleanupStack::Pop(newObj);
       
    47 	return newObj;
       
    48 	}
       
    49 
       
    50 
       
    51 /**
       
    52 Constructor.
       
    53 
       
    54 @param aObserver [In] The observer to receive message delivery notifications.
       
    55 */
       
    56 CTe_LbsSuplPush::CTe_LbsSuplPush(MLbsSuplPushObserver& aObserver) : iObserver(aObserver)
       
    57 	{
       
    58 	//Intentionally left blank
       
    59 	}
       
    60 
       
    61 /**
       
    62 Destructor. Deletes the original class object.
       
    63 */
       
    64 CTe_LbsSuplPush::~CTe_LbsSuplPush()
       
    65 	{
       
    66 	delete iImpl;
       
    67 	}
       
    68 
       
    69 /**
       
    70 2nd phase constructor. Creates the original class object that implements the main functionality.
       
    71 
       
    72 @param aChannel  [In] The channel to be used for message delivering.
       
    73 
       
    74 @leave If a error happens, it leaves with one of the system error codes.
       
    75 
       
    76 @see CTe_LbsSuplPush::NewL
       
    77 */
       
    78 void CTe_LbsSuplPush::ConstructL(TLbsSuplPushChannel aChannel)
       
    79 	{
       
    80 	//Please note that the object itself is passed here as the notification observer
       
    81 	iImpl = CLbsSuplPush::NewL(aChannel, *this);
       
    82 	}
       
    83 
       
    84 /**
       
    85 Wrapper over the CLbsSuplPush::SuplInit method.
       
    86 
       
    87 @param aReqId [Out] Channel unique request Id.
       
    88 @param aMsg   [In]  A buffer containing a SUPL INIT message.
       
    89 @param aReserverd   [In]  Rserved for future use.
       
    90 @return An error code related to the synchronous part of the request.
       
    91 
       
    92 @see CLbsSuplPush::SuplInit
       
    93 */
       
    94 TInt CTe_LbsSuplPush::SuplInit(TLbsSuplPushRequestId& aReqId, const TDesC8& aMsg,TInt /*aReserved*/)
       
    95 	{
       
    96 	return iImpl->SuplInit(aReqId, aMsg, 0);
       
    97 	}
       
    98 
       
    99 /**
       
   100 Overrides pure virtual MLbsSuplPushObserver::OnSuplInitComplete. Notifies both the external static
       
   101 observer (usually a test step) and the internal observer (usually the being tested class using the 
       
   102 CLbsSuplPush class).
       
   103 	
       
   104 @param aChannel  [In] The channel the call-back is related to.
       
   105 @param aReqId    [In] An Id of the request the call-back is related to.
       
   106 @param aError    [In] KErrNone if successful, KErrTimeout if it was not possible to deliver
       
   107                       the request before the timeout period, KErrArgument if the structure 
       
   108                       or content of the SUPL INIT message was incorrect. 
       
   109                       Any system wide error code otherwise.
       
   110 @param aReserved [In] Reserved for future use.
       
   111 	
       
   112 @see MLbsSuplPushObserver::OnSuplInitComplete
       
   113 */
       
   114 void CTe_LbsSuplPush::OnSuplInitComplete(TLbsSuplPushChannel aChannel, TLbsSuplPushRequestId aReqId, 
       
   115 		TInt aError, TInt aReserved)
       
   116 	{
       
   117 	iObserver.OnSuplInitComplete(aChannel, aReqId, aError, aReserved);
       
   118 	iTestObserver->OnSuplInitComplete(aChannel, aReqId, aError, aReserved);
       
   119 	}