baseconnectionproviders/refcpr/inc/ReferenceCPR_connProvFactory.h
branchRCL_3
changeset 25 9d7ce34704c8
equal deleted inserted replaced
24:00c6709d25aa 25:9d7ce34704c8
       
     1 // Copyright (c) 2005-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 // Reference Connection Provider Factory class definition.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #if !defined(__REFERENCECPR_CONNPROVFACTORY_H__)
       
    24 #define __REFERENCECPR_CONNPROVFACTORY_H__
       
    25 
       
    26 
       
    27 #include <comms-infras/ss_connprov.h>
       
    28 #include <ss_select.h>
       
    29 
       
    30 
       
    31 //phony protocol family id, replace with the actual
       
    32 const TUint KReferenceConnectionProviderFactoryId = 0xF0F0; 
       
    33 
       
    34 class CReferenceProviderFactory : public CConnectionProviderFactoryBase
       
    35 /**This is a sample/reference derivation of the connection provider factory.
       
    36 Each such derivation should be able to produce a specific type of connection providers,
       
    37 where the type usually denotes a particular technology (e.g.: IP, UMTS, SIP).
       
    38 A connection provider factory is also responsible for handling selection,
       
    39 i.e.: given or having access to all sorts of input (connection preferences, policies, 
       
    40 bearer availablity) the factory should be able to select the provider on the given 
       
    41 level and select the provider type on the level below.
       
    42 
       
    43 @internalComponent
       
    44 @released since v9.2
       
    45 */
       
    46  	{
       
    47 public:
       
    48 
       
    49 	static CReferenceProviderFactory* NewL(TAny* aParentContainer);
       
    50 
       
    51 protected:   
       
    52 	CReferenceProviderFactory(TUint aFactoryId, CConnectionFactoryContainer& aParentContainer);
       
    53 	virtual CConnectionProviderBase* DoCreateProviderL();	
       
    54 	virtual MProviderSelector* DoSelectProvider( Meta::SMetaData& aPreferences, ISelectionNotify& aSelectionNotify, const RMessagePtr2* aMessage );
       
    55 	virtual MProviderSelector* DoSelectNextLayerProvider( Meta::SMetaData& aPreferences, ISelectionNotify& aSelectionNotify, const RMessagePtr2* aMessage );
       
    56 	virtual void DoEnumerateConnectionsL(RPointerArray<TConnectionInfo>& aConnectionInfoPtrArray);
       
    57 	};
       
    58 
       
    59 
       
    60 
       
    61 
       
    62 class XConnectionFindSameLowerLayerQuery : public MCommsFactoryQuery
       
    63 /**
       
    64 
       
    65 @internalComponent
       
    66 @released since v9.2
       
    67 */
       
    68  	{
       
    69 public:
       
    70 	XConnectionFindSameLowerLayerQuery( CConnectionProviderBase* aConnectionProviderBase ) :
       
    71 		iConnectionProviderBase( aConnectionProviderBase )
       
    72 		{
       
    73 		}
       
    74 
       
    75 protected:
       
    76 	CConnectionProviderBase* iConnectionProviderBase;
       
    77 
       
    78 public:
       
    79 	virtual TMatchResult Match( TFactoryObjectInfo& aConnectionInfo );
       
    80 	};
       
    81 
       
    82 
       
    83 
       
    84 
       
    85 
       
    86 class CReferenceSelector : public CBase, public MProviderSelector
       
    87 /**
       
    88 
       
    89 @internalComponent
       
    90 @released since v9.2
       
    91 */
       
    92 	{
       
    93 public:	
       
    94 	CReferenceSelector(ISelectionNotify& aNotify, CReferenceProviderFactory& aFactory);
       
    95 
       
    96 	TInt Select(Meta::SMetaData& aPreferences, const RMessagePtr2* aMessage);
       
    97 	void SelectComplete(CConnectionProviderBase* aConnProvider, TInt aError);
       
    98 	void ProgressNotification(TInt aStage, TInt aError);
       
    99 	void LayerUp(TInt aError);
       
   100 	void ServiceChangeNotification(TUint32 aId, const TDesC& aType);
       
   101 	void SubConnectionEvent(CSubConnectionProviderBase* aSubConnNextLayerProvider, const TSubConnectionEvent& aSubConnectionEvent);
       
   102 	void Detach();
       
   103 	
       
   104 	virtual TInt Cancel();
       
   105 	virtual TInt Cancel(TInt aReason, const RMessage2* aMessage);
       
   106 	
       
   107 protected:
       
   108     	
       
   109 	virtual ~CReferenceSelector();	
       
   110 private:
       
   111     //ISelectionNotify must be stored by value, cos' it's just a short-lived wrapper class.
       
   112     //It doesn't exist as a someone that waits for the completion, but stores refereneces
       
   113     //to the one that does.
       
   114     ISelectionNotify iNotify;
       
   115     CReferenceProviderFactory& iFactory;
       
   116     MProviderSelector* iNextLayerSelector;
       
   117 	};
       
   118 
       
   119 
       
   120 #endif // __REFERENCECPR_CONNPROVFACTORY_H__