remotecontrol/remotecontrolfw/bearerplugin/public/remconbearerplugin.h
changeset 51 20ac952a623c
equal deleted inserted replaced
48:22de2e391156 51:20ac952a623c
       
     1 // Copyright (c) 2004-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef REMCONBEARERPLUGIN_H
       
    23 #define REMCONBEARERPLUGIN_H
       
    24 
       
    25 #include <e32base.h>
       
    26 
       
    27 class MRemConBearerObserver;
       
    28 class TBearerParams;
       
    29 class TRemConAddress;
       
    30 
       
    31 /** 
       
    32 The UID of the RemCon bearer interface. Implementors of new bearers are 
       
    33 implementing this interface. The bearer interface is simply a means of 
       
    34 supplying implementations of the 'bearer API' to RemCon. The bearer API may 
       
    35 change over time, so this extension pattern is used.
       
    36 */
       
    37 const TInt KRemConBearerInterfaceUid = 0x10204546;
       
    38 
       
    39 /**
       
    40 Base class for bearer plugins.
       
    41 */
       
    42 class CRemConBearerPlugin : public CBase
       
    43 	{
       
    44 public: // used by RemCon to create and destroy bearer instances
       
    45 	/** 
       
    46 	Constructor.
       
    47 	@param aParams Parameters from RemCon, used to initialise the 
       
    48 	implementation.
       
    49 	@return Ownership of a new bearer plugin.
       
    50 	*/
       
    51 	IMPORT_C static CRemConBearerPlugin* NewL(TBearerParams& aParams);
       
    52 
       
    53 	/** Destructor. */
       
    54 	IMPORT_C ~CRemConBearerPlugin();
       
    55 
       
    56 public:
       
    57 	/**
       
    58 	Called by RemCon server to get a pointer to an object which implements the 
       
    59 	bearer API with UID aUid. This is a mechanism for allowing future change 
       
    60 	to the bearer API without breaking BC in existing (non-updated) bearer 
       
    61 	plugins.
       
    62 	@param aUid The UID of a bearer API
       
    63 	@return A pointer to an object which implements the interface identified 
       
    64 	by aUid or NULL if the interface is not implemented.
       
    65 	*/
       
    66 	virtual TAny* GetInterface(TUid aUid) = 0;
       
    67 
       
    68 	/**
       
    69 	Called by RemCon to query the bearer's implementation UID.
       
    70 	@return The bearer's implementation UID.
       
    71 	*/
       
    72 	IMPORT_C TUid Uid() const;
       
    73 
       
    74 protected: // called by concrete bearer plugins
       
    75 	/** 
       
    76 	Constructor
       
    77 	@param aParams Parameters from RemCon, used to initialise the 
       
    78 	implementation.
       
    79 	*/
       
    80 	IMPORT_C CRemConBearerPlugin(TBearerParams& aParams);
       
    81 
       
    82 	/**
       
    83 	Accessor for the observer.
       
    84 	@return The observer.
       
    85 	*/
       
    86 	IMPORT_C MRemConBearerObserver& Observer();
       
    87 
       
    88 private: // unowned
       
    89 	MRemConBearerObserver& iObserver;
       
    90 
       
    91 private: // owned
       
    92 	/**
       
    93 	UID set by ECOM when the instance is created. Used when the instance is 
       
    94 	destroyed.
       
    95 	*/
       
    96 	TUid iInstanceId;
       
    97 
       
    98 	/**
       
    99 	Implementation UID of concrete instance.
       
   100 	*/
       
   101 	const TUid iImplementationUid;
       
   102 
       
   103 	/** 
       
   104 	Pad for BC-friendly future change.
       
   105 	*/
       
   106 	TAny* iPad;
       
   107 	};
       
   108 
       
   109 #endif // REMCONBEARERPLUGIN_H