remotecontrol/remotecontrolfw/client/intermediate/public/remconinterfacebase.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  @publishedAll
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef REMCONINTERFACEBASE_H
       
    23 #define REMCONINTERFACEBASE_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <remcon/clienttype.h>
       
    27 #include <remcon/remconinterfacefeatures.h>
       
    28 
       
    29 class CRemConInterfaceSelector;
       
    30 class CRemConInterfaceBaseExtension;
       
    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.
       
    73 	@return The interface type.
       
    74 	*/
       
    75 	TRemConClientType Type() const;
       
    76 	
       
    77 	/**
       
    78 	Determine whether this is a bulk or control interface.
       
    79 	@return ETrue if this interface is a bulk interface
       
    80 			EFalse if this interface is a control interface
       
    81 	*/
       
    82 	TBool Bulk() const;
       
    83 	
       
    84 	/**
       
    85 	Determine whether this is a target or controller interface.
       
    86 	@return ETrue if this interface is a target interface
       
    87 			EFalse if this interface is a controller interface
       
    88 	*/
       
    89 	static TBool Target(TRemConClientType aType);
       
    90 
       
    91 protected:
       
    92 	/** 
       
    93 	Constructor.
       
    94 	@param aInterfaceUid The UID of the interface.
       
    95 	@param aMaxLength The maximum length of any operation-specific data in the 
       
    96 	interface being registered.
       
    97 	@param aInterfaceSelector The interface selector.
       
    98 	*/
       
    99 	IMPORT_C CRemConInterfaceBase(TUid aInterfaceUid, 
       
   100 		TUint aMaxLength, 
       
   101 		CRemConInterfaceSelector& aInterfaceSelector,
       
   102 		TRemConClientType aType);
       
   103 
       
   104 	/** Must be called by concrete types at construction time. Registers the 
       
   105 	interface with the interface selector. */
       
   106 	IMPORT_C void BaseConstructL();
       
   107 
       
   108 	/** Must be called by concrete types at construction time. Registers the 
       
   109 	interface with the interface selector.
       
   110 	@param aRemConInterfaceFeatures Features associocated with the interface
       
   111 	*/
       
   112 	IMPORT_C void BaseConstructL(RRemConInterfaceFeatures& aRemConInterfaceFeatures);
       
   113 	
       
   114 	/** Must be called by concrete types at construction time. Registers the 
       
   115 		interface with the interface selector.
       
   116 	@param aRemConInterfaceFeatures Features associated with the interface
       
   117 	@param aBulkInterface Specifies whether this interface is a control or bulk interface
       
   118 	Only available for use by Outer Layer interfaces.
       
   119 	*/
       
   120 	IMPORT_C void BaseConstructL(RRemConInterfaceFeatures& aRemConInterfaceFeatures, TBool aBulkInterface);
       
   121 	
       
   122 	/** 
       
   123 	Accessor for the interface selector. 
       
   124 	@return The interface selector.
       
   125 	*/
       
   126 	IMPORT_C CRemConInterfaceSelector& InterfaceSelector();
       
   127 
       
   128 private: // owned
       
   129 	/** The UID of the concrete (derived) interface. */
       
   130 	TUid iInterfaceUid; 
       
   131 
       
   132 	/** Max length of operation-specific data in this interface. */
       
   133 	TUint iMaxLength; 
       
   134 
       
   135 	/** The type of the interface- controller or target. */
       
   136 	const TRemConClientType iType;
       
   137 
       
   138 	/** 
       
   139 	Extension instance for RemCon Interface Base.
       
   140 	*/
       
   141 	CRemConInterfaceBaseExtension* iExtension;
       
   142 
       
   143 private: // unowned
       
   144 	CRemConInterfaceSelector& iInterfaceSelector;
       
   145 	};
       
   146 
       
   147 #endif // REMCONINTERFACEBASE_H