epoc32/include/remcon/remconinterfacebase.h
branchSymbian2
changeset 2 2fe1408b6811
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedPartner
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef REMCONINTERFACEBASE_H
       
    25 #define REMCONINTERFACEBASE_H
       
    26 
       
    27 #include <e32base.h>
       
    28 #include <remcon/clienttype.h>
       
    29 
       
    30 class CRemConInterfaceSelector;
       
    31 
       
    32 /**
       
    33 Base class for outer layer APIs. 
       
    34 */
       
    35 class CRemConInterfaceBase : public CBase
       
    36 	{
       
    37 public: 
       
    38 	/** Destructor */
       
    39 	IMPORT_C ~CRemConInterfaceBase();
       
    40 
       
    41 public: // called by the ultimate client
       
    42 	/** 
       
    43 	Cancels the currently outstanding asynchronous send request. 
       
    44 	@return KErrNone.
       
    45 	*/
       
    46 	IMPORT_C TInt Cancel();
       
    47 
       
    48 public: // called by the interface selector
       
    49 	/**
       
    50 	Called by the interface selector to get a pointer to an object which 
       
    51 	implements the interface API with UID aUid. This is a mechanism for 
       
    52 	allowing future change to the interface API without breaking BC in 
       
    53 	existing (non-updated) interfaces.
       
    54 	*/
       
    55 	virtual TAny* GetInterfaceIf(TUid aUid) = 0;
       
    56 
       
    57 	/** 
       
    58 	Accessor for the interface's UID. 
       
    59 	@return The interface's UID.
       
    60 	*/
       
    61 	TUid InterfaceUid() const;
       
    62 
       
    63 	/** 
       
    64 	Accessor for the maximum length of operation-specific data in this 
       
    65 	interface. 
       
    66 	@return The size in bytes of a buffer needed to hold the largest single 
       
    67 	payload of operation-associated data in this interface.
       
    68 	*/
       
    69 	TUint MaxLength() const;
       
    70 
       
    71 	/**
       
    72 	Accessor for the type of the interface- either controller or target.
       
    73 	@return The interface type.
       
    74 	*/
       
    75 	TRemConClientType Type() const;
       
    76 
       
    77 protected:
       
    78 	/** 
       
    79 	Constructor.
       
    80 	@param aInterfaceUid The UID of the interface.
       
    81 	@param aMaxLength The maximum length of any operation-specific data in the 
       
    82 	interface being registered.
       
    83 	@param aInterfaceSelector The interface selector.
       
    84 	*/
       
    85 	IMPORT_C CRemConInterfaceBase(TUid aInterfaceUid, 
       
    86 		TUint aMaxLength, 
       
    87 		CRemConInterfaceSelector& aInterfaceSelector,
       
    88 		TRemConClientType aType);
       
    89 
       
    90 	/** Must be called by concrete types at construction time. Registers the 
       
    91 	interface with the interface selector. */
       
    92 	IMPORT_C void BaseConstructL();
       
    93 
       
    94 	/** 
       
    95 	Accessor for the interface selector. 
       
    96 	@return The interface selector.
       
    97 	*/
       
    98 	IMPORT_C CRemConInterfaceSelector& InterfaceSelector();
       
    99 
       
   100 private: // owned
       
   101 	/** The UID of the concrete (derived) interface. */
       
   102 	TUid iInterfaceUid; 
       
   103 
       
   104 	/** Max length of operation-specific data in this interface. */
       
   105 	TUint iMaxLength; 
       
   106 
       
   107 	/** The type of the interface- controller or target. */
       
   108 	const TRemConClientType iType;
       
   109 
       
   110 	/** 
       
   111 	Pad for BC-friendly future change.
       
   112 	*/
       
   113 	TAny* iPad;
       
   114 
       
   115 private: // unowned
       
   116 	CRemConInterfaceSelector& iInterfaceSelector;
       
   117 	};
       
   118 
       
   119 #endif // REMCONINTERFACEBASE_H