accessoryservices/accessoryremotecontrol/inc/remcontspcontroller/remcontspcontroller.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implements Target Selector Plugin (TSP) used by Symbian's 
       
    15 *				 Remote Control Framework. TSP controls sending of operations
       
    16 *			     between Series 60 components and remote targets.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef CREMCONTSPCONTROLLER_H
       
    22 #define CREMCONTSPCONTROLLER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <remcontargetselectorplugin.h>
       
    27 #include <remcontargetselectorplugininterface.h>
       
    28 #include <e32property.h>
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 // MACROS
       
    33 
       
    34 // DATA TYPES
       
    35 
       
    36 // FUNCTION PROTOTYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CRemConLogger;
       
    40 class TClientInfo;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  Controls delivering of commands between Series 60 components and remote 
       
    46 *  targets.
       
    47 *
       
    48 *  @lib RemConTspController.dll
       
    49 *  @since Series 60 3.0
       
    50 */
       
    51 class CRemConTspController : public CRemConTargetSelectorPlugin,
       
    52 			     public MRemConTargetSelectorPluginInterfaceV2
       
    53 	{
       
    54 	public:		// Constructors and destructor
       
    55 		
       
    56 		/**
       
    57         * Two-phased constructor.
       
    58         */
       
    59 		static CRemConTspController* NewL( 
       
    60 			MRemConTargetSelectorPluginObserver& aObserver );
       
    61 		
       
    62 		/**
       
    63         * Destructor.
       
    64         */
       
    65 		virtual ~CRemConTspController();
       
    66 	
       
    67 	public: 	// Functions from base classes
       
    68 	
       
    69 	protected:  // New functions
       
    70 	
       
    71 	protected:  // Functions from base classes
       
    72 	
       
    73 	private:
       
    74 		
       
    75 		/**
       
    76         * C++ default constructor.
       
    77         */
       
    78         CRemConTspController( MRemConTargetSelectorPluginObserver& aObserver );
       
    79                 
       
    80 	private: // from CRemConTargetSelectorPlugin
       
    81 		
       
    82 		/**
       
    83         * Called by RemCon server to get a pointer to an object which 
       
    84         * implements the TSP interface with UID aUid. This is a mechanism 
       
    85         * for allowing future change to the TSP API without breaking BC 
       
    86         * in existing (non-updated) TSPs.
       
    87         * @since Series 60 3.0
       
    88         * @param aUid	Queried TSP interface version.
       
    89         * @return TAny	A pointer to implementation of this TSP version, if 
       
    90         *				quaried TSP interface version is the one implemented 
       
    91         *				by this TSP. Otherwise a NULL will be returned.	
       
    92         */
       
    93 		TAny* GetInterface( TUid aUid );
       
    94 
       
    95 	private: // from MRemConTargetSelectorPluginInterface
       
    96 	
       
    97 		/**
       
    98 		* Called by RemCon server to get the TSP to address an outgoing 
       
    99 		* command (from a connectionless controller client) to zero or 
       
   100 		* more remote targets.
       
   101 		* @since Series 60 3.0
       
   102 		* @param aInterfaceUid 		The UID of the client interface.
       
   103 		* @param aOperationId 		The operation ID of the command.
       
   104 		* @param aSender The 		TClientInfo of the sending session.
       
   105 		* @param aConnections 		An empty collection of connections. 
       
   106 		*							TRemConAddresses must be made on the heap.
       
   107 		*							RemCon takes ownership of any items in the 
       
   108 		*							collection. 
       
   109 		* @params aBearerSecurity 	Contains all the bearer security policies.
       
   110 		* @return TAny				void 
       
   111 		*/
       
   112 		void AddressOutgoingCommand(
       
   113 							TUid aInterfaceUid,
       
   114 							TUint aOperationId, 
       
   115 							const TClientInfo& aSender,
       
   116 							TSglQue<TRemConAddress>& aConnections,
       
   117 							TSglQue<TBearerSecurity>& aBearerSecurity );
       
   118 		
       
   119 		/**
       
   120 		* Called by RemCon server to find out from the TSP whether the given 
       
   121 		* connection-oriented controller client is permitted to send the given 
       
   122 		* command to remote target.
       
   123 		* @since Series 60 3.0
       
   124 		* @param aInterfaceUid 		The UID of the client interface.
       
   125 		* @param aOperationId 		The operation ID of the command.
       
   126 		* @param aSender 			The TClientInfo of the sending session.
       
   127 		* @param aConnection 		The remote the command will be sent over if
       
   128 		*							permission is granted.
       
   129 		* @return void				 
       
   130 		*/	
       
   131 		void PermitOutgoingCommand(
       
   132 							TUid aInterfaceUid,
       
   133 							TUint aOperationId, 
       
   134 							const TClientInfo& aSender,
       
   135 							const TRemConAddress& aConnection );
       
   136 		
       
   137 		/** 
       
   138 		* Called by RemCon server to cancel the current AddressOutgoingCommand 
       
   139 		* or PermitOutgoingCommand command.
       
   140 		* @since Series 60 3.0
       
   141 		* @return void 
       
   142 		*/					
       
   143 		void CancelOutgoingCommand();
       
   144 	
       
   145 		/**
       
   146 		* Called by RemCon server to get the TSP to address an incoming command 
       
   147 		* (from a remote target to zero or more Series 60 components). There's 
       
   148 		* no 'cancel' method for AddressIncomingCommand.
       
   149 		* @since Series 60 3.0
       
   150 		* @param aInterfaceUid 	The UID of the client interface.
       
   151 		* @param aOperationId 	The operation ID of the command.
       
   152 		* @param aClients 		A collection of existing target clients. TSP's 
       
   153 		*						responsibility is to modify this parameter, if 
       
   154 		*						it wants that command will not be sent to all 
       
   155 		*						proposed clients. Thus, when this method has 
       
   156 		*						been finished, aClients will include those 
       
   157 		*						target clients to whom command should be sent.
       
   158 		* @return void  
       
   159 		*/
       
   160 		void AddressIncomingCommand(
       
   161 							TUid aInterfaceUid,
       
   162 							TUint aOperationId, 
       
   163 							TSglQue<TClientInfo>& aClients );
       
   164 	
       
   165 	/**
       
   166 	* Called by RemCon to get the TSP to decide which client should be
       
   167 	* allowed to respond to a command.
       
   168 	* @param aInterfaceUid The UID of the client interface.
       
   169 	* @param aOperationId The operation ID of the command.
       
   170 	* @param aClient The client which is trying to send a response
       
   171 	* @param aClients A list of clients which are still expected to respond,
       
   172 	*         including the one specified in aClient
       
   173 	*/
       
   174 	void PermitOutgoingResponse(
       
   175 			TUid aInterfaceUid,
       
   176 			TUint aOperationId,
       
   177 			const TClientInfo& aClient,
       
   178 			TClientInfoConstIter& aClients); 
       
   179 
       
   180 	/** 
       
   181 	* Called by RemCon to cancel the current PermitOutgoingResponse request.
       
   182 	*/
       
   183 	void CancelOutgoingResponse(); 
       
   184 	
       
   185 	/**
       
   186 	* Called by RemCon to get the TSP to address an incoming notify (from a 
       
   187 	* remote to zero or more target clients). 
       
   188 	* @param aInterfaceUid The UID of the client interface.
       
   189 	* @param aOperationId The operation ID of the command.
       
   190 	* @param aClients A collection of existing target clients. The implementor 
       
   191 	*         may wish to start a target client and call IncomingNotifyAddressed
       
   192 	*         with a new TClientInfo. The new TClientInfo item must be made on the stack. 
       
   193 	*         Note when creating the new TClientInfo, only the process ID needs to 
       
   194 	*         be correctly populated.
       
   195 	*/
       
   196 	void AddressIncomingNotify(
       
   197 			TUid aInterfaceUid,
       
   198 			TUint aOperationId,
       
   199 			TSglQue<TClientInfo>& aClients); 
       
   200 
       
   201 	public:     // Data
       
   202 	
       
   203 	protected:  // Data
       
   204 	
       
   205 	private:    // Data
       
   206 		
       
   207 		// Interface to P&S key that returns call state
       
   208         RProperty iProperty;
       
   209 	
       
   210 	public:     // Friend classes
       
   211 	
       
   212 	protected:  // Friend classes
       
   213 	
       
   214 	private:    // Friend classes
       
   215 
       
   216 	};
       
   217 
       
   218 #endif		// CREMCONTSPCONTROLLER_H