networkprotocolmodules/suplprotocolmodule/SuplPushAPI/src/lbssuplpush.cpp
changeset 36 b47902b73a93
parent 0 9cfd9a3ee49c
equal deleted inserted replaced
35:a2efdd544abf 36:b47902b73a93
       
     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 // Location Based Services SUPL Push API
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @deprecated
       
    21 */
       
    22 
       
    23 
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <lbs/lbssuplpush.h>
       
    27 #include "lbsdevloggermacros.h"
       
    28 
       
    29 #include "lbssuplpushimpl.h"
       
    30 
       
    31 
       
    32 //=============================================================================
       
    33 // MLbsSuplPushObserver
       
    34 //=============================================================================
       
    35 /**
       
    36 Provides the version of the observer interface. This can be used by the library 
       
    37 to determine the functionality supported by the client application.
       
    38 
       
    39 @return Version of the observer interface.
       
    40 */  
       
    41 EXPORT_C TVersion MLbsSuplPushObserver::Version() const
       
    42 	{
       
    43 	LBSLOG(ELogP1, "MLbsSuplPushObserver::Version() Begin\n");
       
    44 	LBSLOG(ELogP1, "MLbsSuplPushObserver::Version() End\n");
       
    45 	return TVersion(1, 0, 0);
       
    46 	}
       
    47 
       
    48 
       
    49 /**
       
    50 Should not be used. Provides for future expansion of the observer interface. 
       
    51 */  
       
    52 /*virtual*/ EXPORT_C TAny* MLbsSuplPushObserver::ExtendedInterface
       
    53 	(
       
    54 	TInt  /*aFunctionNumber*/,
       
    55 	TAny* /*aPtr1*/,
       
    56 	TAny* /*aPtr2*/
       
    57 	)
       
    58 	{
       
    59 	LBSLOG(ELogP1, "MLbsSuplPushObserver::ExtendedInterface() Begin\n");
       
    60 	LBSLOG(ELogP1, "MLbsSuplPushObserver::ExtendedInterface() End\n");
       
    61 	return NULL;
       
    62 	}
       
    63 
       
    64 
       
    65 /**
       
    66 Opens a new SUPL Push channel to the LBS sub-system.
       
    67 
       
    68 @param aChannel  [In] The id of the channel to be opened.
       
    69 @param aObserver [In] A reference to an observer waiting for request completion call-backs.
       
    70 
       
    71 @return an Instance of the interface. The calling application becomes the
       
    72 owner of the returned instance and is responsible for its disposal.
       
    73 
       
    74 @capability NetworkServices
       
    75 @capability ReadDeviceData
       
    76 */
       
    77 EXPORT_C CLbsSuplPush* CLbsSuplPush::NewL(TLbsSuplPushChannel aChannel, MLbsSuplPushObserver& aObserver)
       
    78 	{
       
    79 	LBSLOG(ELogP1, "CLbsSuplPush::NewL() Begin\n");
       
    80 	LBSLOG(ELogP8, "->S CLbsSuplPush::NewL() SuplPush\n");
       
    81 	CLbsSuplPush* newObj = new (ELeave) CLbsSuplPush();
       
    82 	CleanupStack::PushL(newObj);
       
    83 	newObj->ConstructL(aChannel, aObserver);
       
    84 	LBSLOG(ELogP1, "CLbsSuplPush::NewL() End\n");
       
    85 	CleanupStack::Pop(newObj);
       
    86 	return newObj;
       
    87 	}
       
    88 	
       
    89 /**
       
    90 Closes the interface and disposes all open or used resources.
       
    91 */
       
    92 CLbsSuplPush::~CLbsSuplPush()
       
    93 	{
       
    94 	LBSLOG(ELogP1, "CLbsSuplPush::~CLbsSuplPush() Begin\n");
       
    95 	LBSLOG(ELogP8, "->S CLbsSuplPush::~CLbsSuplPush() SuplPush\n");
       
    96 	delete iImpl;
       
    97 	iImpl = NULL;
       
    98 	LBSLOG(ELogP1, "CLbsSuplPush::~CLbsSuplPush() End\n");
       
    99 	}
       
   100 	
       
   101 /**
       
   102 Default constructor.
       
   103 @internalComponent
       
   104 */
       
   105 CLbsSuplPush::CLbsSuplPush()
       
   106 	{
       
   107 	LBSLOG(ELogP1, "CLbsSuplPush::CLbsSuplPush() Begin\n");
       
   108 	LBSLOG(ELogP1, "CLbsSuplPush::CLbsSuplPush() End\n");
       
   109 	}
       
   110 
       
   111 /**
       
   112 2nd phase constructor. 
       
   113 Creates and assigns all the required internal resources.
       
   114 
       
   115 @param aChannel  The id of the channel to be opened.
       
   116 @param aObserver A reference to an observer waiting for request completion call-backs.
       
   117 
       
   118 @internalComponent
       
   119 */
       
   120 void CLbsSuplPush::ConstructL(TLbsSuplPushChannel aChannel, MLbsSuplPushObserver& aObserver)
       
   121 	{
       
   122 	LBSLOG(ELogP1, "CLbsSuplPush::ConstructL() Begin\n");
       
   123 	iImpl = CLbsSuplPushImpl::NewL(aChannel, aObserver);
       
   124 	LBSLOG(ELogP1, "CLbsSuplPush::ConstructL() End\n");
       
   125 	}
       
   126 
       
   127 /**
       
   128 Sends a SUPL INIT message to the LBS sub-system. If the channel is busy
       
   129 sending a previous message the new one will be queued. The request completion code 
       
   130 is received through a call-back.
       
   131 
       
   132 Please note that only one thread can actively use a channel at any time. Simultaneous
       
   133 use of a channel by multiple threads may cause some of the requests to time out.
       
   134 
       
   135 A system requiring concurrent access to a channel must provide its own access 
       
   136 control mechanism.
       
   137 
       
   138 @param aReqId [Out] Channel unique request Id.
       
   139 @param aMsg   [In]  A buffer containing a SUPL INIT message.
       
   140 @param aReserved [In] Reserved for future use.
       
   141 
       
   142 @return An error code related to the synchronous part of the request - KErrNone if successful, KErrArgument if 
       
   143 the message has a wrong size, KErrNotReady if the LBS can't be started, KErrPermissionDenied if the calling process
       
   144 has not enough capabilities, or another system error code.
       
   145 
       
   146 @see MLbsSuplPushObserver::OnSuplInitComplete()
       
   147 
       
   148 @capability NetworkServices
       
   149 @capability ReadDeviceData
       
   150 */
       
   151 EXPORT_C TInt CLbsSuplPush::SuplInit(TLbsSuplPushRequestId& aReqId, const TDesC8& aMsg, TInt aReserved)
       
   152 	{
       
   153 	LBSLOG(ELogP1, "CLbsSuplPush::SuplInit() Begin\n");
       
   154 	LBSLOG(ELogP9, "->A CLbsSuplPush::SuplInit() SuplPush\n");
       
   155 	
       
   156 	TInt res = iImpl->SuplInit(aReqId, aMsg, aReserved);
       
   157 	
       
   158 	LBSLOG2(ELogP9, "  < TLbsSuplPushRequestId& aReqId = %d\n", aReqId);
       
   159 	LBSLOG2(ELogP9, "  Return  = %d\n", res);
       
   160 	LBSLOG(ELogP1, "CLbsSuplPush::SuplInit() End\n");
       
   161 	return res;
       
   162 	}