locationmgmt/networkgateway/inc/agpschannel.h
changeset 0 9cfd9a3ee49c
equal deleted inserted replaced
-1:000000000000 0:9cfd9a3ee49c
       
     1 // Copyright (c) 2006-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 // Definition of assistance data channel component.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef AGPSCHANNEL_H_
       
    25 #define AGPSCHANNEL_H_
       
    26 
       
    27 #include <e32hashtab.h>
       
    28 #include "lbscommoninternaldatatypes.h"
       
    29 #include "lbsnetinternalapi.h"
       
    30 #include "lbsassistancedatacacheapi.h"
       
    31 
       
    32 #include "lbsagpsngmsgs.h"
       
    33 
       
    34 //
       
    35 // Asssitance Data Channel
       
    36 //
       
    37 
       
    38 /** Observer for the A-GPS interface
       
    39 */
       
    40 class MAgpsObserver
       
    41 	{
       
    42 public:
       
    43 	virtual void OnAssistanceDataRequest(TLbsAsistanceDataGroupInt aDataItemMask) = 0;
       
    44 	virtual void OnSelfLocationRequest(const TLbsNetSessionIdInt& aSessionId, const TLbsNetPosRequestOptionsAssistanceInt& aOptions) = 0;
       
    45 	virtual void OnSelfLocationCancel(const TLbsNetSessionIdInt& aSessionId, TInt aReason) = 0;
       
    46 	virtual void OnSystemStatusAdvice(TBool aTracking) = 0;
       
    47 	};
       
    48 
       
    49 /** 
       
    50 Buffers incoming assistance data msgs.
       
    51 Used when a channel is busy.
       
    52 */
       
    53 class RAssistanceDataMsgBuffer
       
    54 	{
       
    55 public:
       
    56 	RAssistanceDataMsgBuffer();
       
    57 	void OpenL();
       
    58 	void Close();
       
    59 	
       
    60 	void Write(const TLbsNetAssistanceDataResponseMsg& aMsg);
       
    61 	void Read(TLbsNetAssistanceDataResponseMsg& aMsg);
       
    62 	TBool IsEmpty() const;
       
    63 	
       
    64 private:
       
    65 
       
    66 private:
       
    67 	class TBufferItem
       
    68 		{
       
    69 	public:
       
    70 		TBufferItem();
       
    71 		
       
    72 		TBool iValid;
       
    73 		TInt  iReason;
       
    74 		};
       
    75 	RArray<TBufferItem> iBuffer;
       
    76 	TBool				iEmpty;
       
    77 	TBufferItem iErrGeneric;
       
    78 	};
       
    79 	
       
    80 /** Communicates with the AGPS manager over an internal API 
       
    81 */
       
    82 class CAgpsChannel : public CActive, private MLbsNetChannelObserver
       
    83 	{
       
    84 public:
       
    85 	static CAgpsChannel* NewL(MAgpsObserver& aObserver);
       
    86 	~CAgpsChannel();
       
    87 	
       
    88     void SendAssistanceDataResponse(TInt aError, 
       
    89     								TLbsAsistanceDataGroupInt aMask, 
       
    90     								const RLbsAssistanceDataBuilderSet& aData);
       
    91     void SendSessionComplete(TInt aReason, const TLbsNetSessionIdInt& aSessionId);
       
    92 
       
    93 private:
       
    94 	CAgpsChannel(MAgpsObserver& aObserver);
       
    95 	void ConstructL();
       
    96 	
       
    97 	// from MLbsNetChannelObserver
       
    98 	void ProcessNetChannelMessage(RLbsNetChannel::TLbsNetChannelId aChannelId, const TLbsNetInternalMsgBase& aMessage);
       
    99 	
       
   100 	// from CActive
       
   101 	void RunL();
       
   102 	void DoCancel();
       
   103 	TInt RunError(TInt aError);
       
   104 
       
   105 	// Helpers	
       
   106 	void SetAssistanceDataCacheL(const RLbsAssistanceDataBuilderSet& aData);
       
   107 	
       
   108 private:
       
   109 	TLbsNetSessionCompleteAgpsMsg iSessionCompleteMsgBuffer;
       
   110 	TBool					      iSessionCompleteMsgValid;
       
   111 	RAssistanceDataMsgBuffer      iAssistanceDataMsgBuffer;
       
   112 	
       
   113 	MAgpsObserver& 		 iObserver;
       
   114 	RAssistanceDataCache iAssistanceDataCache;
       
   115 	RLbsNetChannel 		 iAGPSChannel;
       
   116 	};
       
   117 
       
   118 #endif // AGPSCHANNEL_H_