telephonyprotocols/pdplayer/inc/pdptiermanager.h
changeset 69 b982c3e940f3
parent 0 3553901f7fa8
equal deleted inserted replaced
59:ac20d6a0a19d 69:b982c3e940f3
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    22 #define SYMBIAN_PDPTIERMANAGER_H
    22 #define SYMBIAN_PDPTIERMANAGER_H
    23 
    23 
    24 #include <comms-infras/coretiermanager.h>
    24 #include <comms-infras/coretiermanager.h>
    25 #include <comms-infras/contentionmanager.h>
    25 #include <comms-infras/contentionmanager.h>
    26 #include <etelpckt.h>
    26 #include <etelpckt.h>
       
    27 #include <pdp_contention.h>
    27 using namespace ESock;
    28 using namespace ESock;
    28 
    29 
    29 class CMBMSEngine;
    30 class CMBMSEngine;
    30 class CContextStatusMonitor;
    31 class CContextStatusMonitor;
    31 class CContextTypeChecker;
    32 class CContextTypeChecker;
    35 	{
    36 	{
    36 public:	
    37 public:	
    37 	virtual void PacketServiceAttachedCallbackL() = 0;
    38 	virtual void PacketServiceAttachedCallbackL() = 0;
    38 	};
    39 	};
    39 
    40 
    40 class MContextEventsObserver
       
    41 	{
       
    42 public:
       
    43 	virtual void PrimaryContextAddedL(const TName* aContextName) = 0;
       
    44 	virtual void SecondaryContextAdded(const TName* aContextName) = 0;
       
    45 	virtual void PrimaryContextDeleted(const CContextStatusMonitor* aContextStatusMonitor) = 0;
       
    46 	virtual void ContextMonitoringError(const CContextStatusMonitor* aContextStatusMonitor, TInt aError) = 0;
       
    47 	virtual void ContextTypeCheckingError(const TName* aContextName, TInt aError) = 0;
       
    48 	};
       
    49 
       
    50 class CContextStatusMonitor : public CActive
       
    51 	{
       
    52 public:
       
    53 	CContextStatusMonitor(RPacketService& aPacketService, MContextEventsObserver& aCallback);
       
    54 	~CContextStatusMonitor();
       
    55 
       
    56 public:
       
    57 	TBool StartL(const TName& aContextName);
       
    58 	inline TBool IsPassedThroughActiveState() const;
       
    59 
       
    60 private:
       
    61 	void RunL();
       
    62 	void DoCancel();
       
    63 	TInt RunError(TInt aError);
       
    64 
       
    65 private:
       
    66 	RPacketService& iPacketService;
       
    67 	RPacketContext iPacketContext;
       
    68 	RPacketContext::TContextStatus iContextStatus;
       
    69 	MContextEventsObserver& iCallback;
       
    70 	TName iContextName;
       
    71 	TBool iWasActive;
       
    72 	};
       
    73 
       
    74 
       
    75 class CPrimaryContextsMonitor : public CActive, MContextEventsObserver
       
    76 	{
       
    77 	enum TState {EEnumeratingContexts, EGettingInfo, EListening};
       
    78 public:
       
    79 	CPrimaryContextsMonitor(RPacketService& aPacketService, MContentionObserver& aCallback);
       
    80 	~CPrimaryContextsMonitor();
       
    81 public:
       
    82 	void StartL();
       
    83 
       
    84 // from MContextEventsObserver
       
    85 	void PrimaryContextAddedL(const TName* aContextName);
       
    86 	void SecondaryContextAdded(const TName* aContextName);
       
    87 	void PrimaryContextDeleted(const CContextStatusMonitor* aContextStatusMonitor);
       
    88 	void ContextMonitoringError(const CContextStatusMonitor* aContextStatusMonitor, TInt aError);
       
    89 	void ContextTypeCheckingError(const TName* aContextName, TInt aError);
       
    90 
       
    91 private:
       
    92 	void RunL();
       
    93 	void DoCancel();
       
    94 	TInt RunError(TInt aError);
       
    95 	void DeleteContextStatusMonitor(const CContextStatusMonitor* aContextStatusMonitor);
       
    96 	void SwitchStateL();
       
    97 	void StartContextStatusMonitoringL(const TName& aContextName);
       
    98 	void RemoveContextNameAndCheckNext(const TName* aContextName);
       
    99 	void ProcessError(TInt aError);
       
   100 
       
   101 private:
       
   102 	RPointerArray<CContextStatusMonitor> iContextMonitors;
       
   103 	RPointerArray<TName> iAddedContextsNames;
       
   104 	CContextTypeChecker* iContextTypeChecker;
       
   105 	RPacketService& iPacketService;
       
   106 	TState iState;
       
   107 	RPacketService::TNifInfoV2 iCurrentNifInfo;
       
   108 	TInt iInitialNifsCount;
       
   109 	TInt iCurrentNifIndex;
       
   110 	TBool iFirstContextAdded;
       
   111 	MContentionObserver& iCallback;
       
   112 	};
       
   113 
       
   114 class CContextTypeChecker : public CActive
       
   115 	{
       
   116 public:
       
   117 	CContextTypeChecker(RPacketService& aPacketService, MContextEventsObserver& aCallback);
       
   118 	~CContextTypeChecker();
       
   119 
       
   120 public:
       
   121 	void Start(const TName* aContextName);
       
   122 	void RunL();
       
   123 	TInt RunError(TInt aError);
       
   124 	void DoCancel();
       
   125 
       
   126 private:
       
   127 	RPacketService& iPacketService;
       
   128 	const TName* iContextName;
       
   129 	MContextEventsObserver& iCallback;
       
   130 	TInt iCountInNif;
       
   131 	};
       
   132 
       
   133 class CPdpContentionManager : public CContentionManager
       
   134 	{
       
   135 public:
       
   136 	static CPdpContentionManager* NewL(const ESock::CTierManagerBase& aTierManager, RPacketService& aPacketService);
       
   137 	~CPdpContentionManager();
       
   138 
       
   139 public:
       
   140 	void StartMonitoringL();
       
   141 
       
   142 private:
       
   143 	void ConstructL(RPacketService& aPacketService);
       
   144 	CPdpContentionManager(const ESock::CTierManagerBase& aTierManager);
       
   145 
       
   146 private:
       
   147 	// from CContentionManager
       
   148 	virtual void ContentionResolved(const TContentionRequestItem& aContentionRequest, TBool aResult);
       
   149 	virtual void ContentionOccured(ESock::CMetaConnectionProviderBase& aMcpr);
       
   150 	virtual void ReportContentionAvailabilityStatus(ESock::CMetaConnectionProviderBase& aMcpr, const ESock::TAvailabilityStatus& aStatus) const;
       
   151 	
       
   152 private:
       
   153 	CPrimaryContextsMonitor* iPrimaryContextsMonitor;
       
   154 	};
       
   155 
    41 
   156 //PDP Tier Manager
    42 //PDP Tier Manager
   157 class CPDPTierManager : public CCoreTierManager, public MPacketServiceNotifier
    43 class CPDPTierManager : public CCoreTierManager, public MPacketServiceNotifier
   158 	{
    44 	{
   159 public:
    45 public:
   174 private:
    60 private:
   175     void ConstructL();
    61     void ConstructL();
   176 
    62 
   177 private:
    63 private:
   178 	CMBMSEngine* iMBMSEngine;
    64 	CMBMSEngine* iMBMSEngine;
       
    65 #ifdef SYMBIAN_NETWORKING_CONTENTION_MANAGEMENT
   179 	CPdpContentionManager* iPdpContentionManager;
    66 	CPdpContentionManager* iPdpContentionManager;
       
    67 #endif
       
    68 	
   180 	};
    69 	};
   181 
    70 
   182 inline TBool CContextStatusMonitor::IsPassedThroughActiveState() const
    71 
   183 	{
       
   184 	return iWasActive;
       
   185 	}
       
   186 
    72 
   187 #endif // SYMBIAN_PDPTIERMANAGER_H
    73 #endif // SYMBIAN_PDPTIERMANAGER_H
   188 
    74