epoc32/include/remconinterfaceselector.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
     1.1 --- a/epoc32/include/remconinterfaceselector.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/remconinterfaceselector.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,9 +1,9 @@
     1.4  // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5  // All rights reserved.
     1.6  // This component and the accompanying materials are made available
     1.7 -// 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
     1.8 +// under the terms of "Eclipse Public License v1.0"
     1.9  // which accompanies this distribution, and is available
    1.10 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.12  //
    1.13  // Initial Contributors:
    1.14  // Nokia Corporation - initial contribution.
    1.15 @@ -13,8 +13,6 @@
    1.16  // Description:
    1.17  //
    1.18  
    1.19 -
    1.20 -
    1.21  /**
    1.22   @file
    1.23   @publishedAll
    1.24 @@ -27,13 +25,22 @@
    1.25  #include <e32base.h>
    1.26  #include <remcon/messagetype.h>
    1.27  #include <remcon/clienttype.h>
    1.28 -#include <remcon/remconclient.h>
    1.29 +#include <remcon/playertype.h>
    1.30  #include <remcon/remconinterfaceif.h>
    1.31  #include <remconaddress.h>
    1.32  
    1.33  class CRemConInterfaceBase;
    1.34 +class CBulkReceiver;
    1.35  class CReceiver;
    1.36  class MRemConErrorObserver;
    1.37 +class RRemConInterfaceFeatures;
    1.38 +class RSpecificThreadCallBack;
    1.39 +class CRemConInterfaceDetailsArray;
    1.40 +class RNestableLock;
    1.41 +class RRemConController;
    1.42 +class RRemConTarget;
    1.43 +class RRemConBulk;
    1.44 +class RRemCon;
    1.45  
    1.46  // Panic information
    1.47  _LIT(KRemConIfSelPanicCat, "RemConIfSel");
    1.48 @@ -89,6 +96,10 @@
    1.49  	/** An implementation of CRemConInterfaceBase::GetInterface does not 
    1.50  	provide an implementation of MRemConInterfaceIf. */
    1.51  	ERemConIfSelNoInterfaceImplementation = 10,
    1.52 +	
    1.53 +	/** A client has created bulk interfaces in multiple different threads,
    1.54 +	all bulk interfaces must be created in the same thread*/
    1.55 +	ERemConIfSelMultipleBulkInterfaceThreads = 11,
    1.56  	};
    1.57  
    1.58  /**
    1.59 @@ -119,6 +130,18 @@
    1.60  	*/
    1.61  	IMPORT_C void RegisterInterfaceL(CRemConInterfaceBase& aInterface);
    1.62  	
    1.63 +	/**
    1.64 +	Register the interface with the selector. This is called by the 
    1.65 +	interface's BaseConstructL. Takes ownership of aInterface.
    1.66 +	 This function is not to be called outside of remconinterfacebase.dll. It is available for compatibility with previous
    1.67 +	 versions, but it is intended to be called only by CRemConInterfaceBase::BaseConstructL.
    1.68 +	 CRemConInterfaceBase-derived classes should indirectly perform a RegisterInterfaceL, by calling
    1.69 +	 CRemConInterfaceBase::BaseConstructL from their construction functions.
    1.70 +	@param aInterface The interface.
    1.71 +	@param aRemConInterfaceFeatures The operation IDs of the interface.  Ownership is retained by the caller.  Any necessary
    1.72 +			data will be copied by the interface selector.
    1.73 +	*/
    1.74 +	void RegisterInterfaceL(CRemConInterfaceBase& aInterface, RRemConInterfaceFeatures& aRemConInterfaceFeatures);
    1.75  	/** 
    1.76  	Register an error observer.  This is provided to allow the client to
    1.77  	discover when an error has occurred passively.
    1.78 @@ -183,6 +206,14 @@
    1.79  	IMPORT_C void OpenTargetL();
    1.80  
    1.81  	/**
    1.82 +	Opens a target session to RemCon.
    1.83 +	@param aPlayerType The type of player
    1.84 +	@param aPlayerSubType The sub-type of the player
    1.85 +	@param aPlayerName  The name of the player in UTF-8.
    1.86 +	@leave KErrInUse If a target session is already open.
    1.87 +	*/
    1.88 +	IMPORT_C void OpenTargetL(TPlayerType aPlayerType, TPlayerSubType aPlayerSubType, const TDesC8& aPlayerName);
    1.89 +	/**
    1.90  	Sends a message to the remote device(s).
    1.91  	There should be only one command and response outstanding at any one time.
    1.92  	Send cannot be called again until aStatus is completed.
    1.93 @@ -223,9 +254,18 @@
    1.94  		TRemConMessageSubType aMsgSubType,
    1.95  		const TDesC8& aData = KNullDesC8());
    1.96  
    1.97 +	/**
    1.98 +	Sends a 
    1.99 +	*/
   1.100 +	IMPORT_C void SendNotify(TRequestStatus& aStatus, 
   1.101 +			TUid aInterfaceUid,
   1.102 +			TUint aOperationId, 
   1.103 +			TRemConMessageType aMsgType,
   1.104 +			TRemConMessageSubType aMsgSubType,
   1.105 +			const TDesC8& aData = KNullDesC8());
   1.106  	
   1.107  	/**
   1.108 -	@internalTechnology
   1.109 +	This method is for internal sub-system use only and should be not be used otherwise.
   1.110  	Sends a message to the remote device(s), without waiting for the send to complete
   1.111  	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
   1.112  	sending the message.
   1.113 @@ -240,7 +280,7 @@
   1.114  		const TDesC8& aData = KNullDesC8());
   1.115  	
   1.116  	/**
   1.117 -	@internalTechnology
   1.118 +	This method is for internal sub-system use only and should be not be used otherwise.
   1.119  	Sends a message to the remote device(s), without waiting for the send to complete
   1.120  	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
   1.121  	sending the message.
   1.122 @@ -265,6 +305,44 @@
   1.123  	@return KErrNone.
   1.124  	*/
   1.125  	IMPORT_C TInt SendCancel(TRemConMessageType aMsgType);
   1.126 +	
   1.127 +	/**
   1.128 +	This method is for internal sub-system use only and should be not be used otherwise.
   1.129 +	Sends a message to the remote device(s) through the bulk path.
   1.130 +	There should be only one response outstanding at any one time.
   1.131 +	Send cannot be called again until aStatus is completed.
   1.132 +	@panic RemConClient 4 If a send is already outstanding
   1.133 +	@param aStatus TRequestStatus for asynchronous completion.
   1.134 +	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
   1.135 +	sending the message.
   1.136 +	@param aOperationId The interface-specific operation identifier.
   1.137 +	@param aData Any associated message data in interface-specific format.
   1.138 +	*/
   1.139 +	IMPORT_C void SendBulk(TRequestStatus& aStatus, 
   1.140 +		TUid aInterfaceUid,
   1.141 +		TUint aOperationId,
   1.142 +		const TDesC8& aData = KNullDesC8());
   1.143 +	
   1.144 +	/**
   1.145 +	This method is for internal sub-system use only and should be not be used otherwise.
   1.146 +	Sends a message to the remote device(s) through the bulk path, without 
   1.147 +	waiting for the send to complete.
   1.148 +	@param aInterfaceUid The UID of the concrete (outer-layer) interface 
   1.149 +	sending the message.
   1.150 +	@param aOperationId The interface-specific operation identifier.
   1.151 +	@param aData Any associated message data in interface-specific format.
   1.152 +	*/
   1.153 +	IMPORT_C TInt SendBulkUnreliable(
   1.154 +		TUid aInterfaceUid,
   1.155 +		TUint aOperationId,
   1.156 +		const TDesC8& aData = KNullDesC8());
   1.157 +
   1.158 +	/**
   1.159 +	This method is for internal sub-system use only and should be not be used otherwise.
   1.160 +	Cancels interest in the completion of a BulkSend request.
   1.161 +	@return KErrNone.
   1.162 +	*/
   1.163 +	IMPORT_C TInt SendBulkCancel();
   1.164  
   1.165  	/**
   1.166  	Only called internally, by the Active Object which sucks messages out of 
   1.167 @@ -272,6 +350,8 @@
   1.168  	the type of the session doing the receiving.
   1.169  	@param aInterfaceUid Interface UID of the new message.
   1.170  	@param aOperationId Operation ID of the new message.
   1.171 +	@param aMsgSubType The message subtype.
   1.172 +	@param aRemoteAddress The address of the remote which sent the message.
   1.173  	@param aData Data associated with the new message.
   1.174  	@param aType The type of session which received the message (from which 
   1.175  	the type of the message can be interpolated).
   1.176 @@ -279,8 +359,21 @@
   1.177  	void ReceiveComplete(TUid aInterfaceUid, 
   1.178  		TUint aOperationId, 
   1.179  		TRemConMessageSubType aMsgSubType,
   1.180 +		const TRemConAddress& aRemoteAddress,
   1.181  		const TDesC8& aData,
   1.182  		TRemConClientType aType);
   1.183 +	
   1.184 +	/**
   1.185 +	Only called internally, by the Active Object which sucks messages out of 
   1.186 +	RemCon. Note that the message type is not given- it is interpolated from 
   1.187 +	the type of the session doing the receiving.
   1.188 +	@param aInterfaceUid Interface UID of the new message.
   1.189 +	@param aOperationId Operation ID of the new message.
   1.190 +	@param aData Data associated with the new message.
   1.191 +	*/
   1.192 +	void BulkReceiveComplete(TUid aInterfaceUid, 
   1.193 +		TUint aOperationId,
   1.194 +		const TDesC8& aData);
   1.195  
   1.196  	/**
   1.197  	Only called internally, by the Active Object which sucks messages out of 
   1.198 @@ -291,6 +384,22 @@
   1.199  		   messages can be received.
   1.200  	*/
   1.201  	void Error(TInt aError);
   1.202 +	
   1.203 +	/**
   1.204 +	Only called internally, by the Active Object which sucks messages out of 
   1.205 +	RemCon Bulk Server.  This is called in the case of a session error.
   1.206 +	
   1.207 +	@param The error that has occurred.  If this is KErrServerTerminated, the
   1.208 +		   error is fatal and the session must be restarted before any new 
   1.209 +		   messages can be received.
   1.210 +	*/
   1.211 +	void BulkError(TInt aError);
   1.212 +	
   1.213 +	/**
   1.214 +	Only called internally, by the Active Object which sucks messages out of
   1.215 +	RemCon (bulk server).
   1.216 +	*/
   1.217 +	void BulkSessionConnectL();
   1.218  
   1.219  	/**
   1.220  	Getter for the current set of connections in the system (not just those 
   1.221 @@ -329,23 +438,37 @@
   1.222  
   1.223  private:
   1.224  	CRemConInterfaceSelector();
   1.225 +	void ConstructL();
   1.226  
   1.227  private: // utility
   1.228  	void AssertSession(RRemCon* aSess, TInt aPanicCode) const;
   1.229  	TInt TryToReconnect();
   1.230 +	TInt TryToReconnectBulk();
   1.231 +	void OpenTargetCommonL();
   1.232 +	void RegisterInterfaceCommonL(CRemConInterfaceBase& aInterface, const TDesC8& aFeatures);
   1.233 +	void RegisterInterestedApisL(TRemConClientType aType);
   1.234 +	
   1.235 +	void EstablishBulkThreadBindingL();
   1.236 +	
   1.237 +	static TInt StaticBulkCleanup(TAny* aSelf);
   1.238 +	void BulkCleanup();
   1.239 +	TBool BulkOpened() const;
   1.240  
   1.241  private: // owned
   1.242 -	RPointerArray<CRemConInterfaceBase> iInterfaces;
   1.243 +	CRemConInterfaceDetailsArray* iInterfaces;
   1.244  
   1.245 -	RRemConController iControllerSession;
   1.246 -	RRemConTarget iTargetSession;
   1.247 +	RRemConController* iControllerSession;
   1.248 +	RRemConTarget* iTargetSession;
   1.249 +	RRemConBulk* iBulkSession;
   1.250  
   1.251  	CReceiver* iTargetReceiver;
   1.252  	CReceiver* iControllerReceiver;
   1.253 +	CBulkReceiver* iBulkReceiver;
   1.254  
   1.255  	/** For all registered interfaces, this is the size of the biggest 
   1.256  	operation-associated data lump. */
   1.257 -	TUint iMaxDataLength;
   1.258 +	TUint iControlMaxDataLength;
   1.259 +	TUint iBulkMaxDataLength;
   1.260  
   1.261  	// The session to use for NotifyConnectionsChange and 
   1.262  	// NotifyConnectionsChangeCancel. It doesn't matter which we use- just one 
   1.263 @@ -356,7 +479,12 @@
   1.264  	RRemCon* iNotificationSession;
   1.265  	
   1.266  	TRemConAddress iAddress;
   1.267 -
   1.268 +	
   1.269 +	RHeap* iBulkHeap;
   1.270 +	RThread iBulkThread;
   1.271 +	RHeap* iSharedThreadHeap;
   1.272 +	RSpecificThreadCallBack* iBulkCleanupCall;
   1.273 +	RNestableLock*	iLock;
   1.274  private: // unowned	
   1.275  	MRemConErrorObserver* iErrorObserver;
   1.276  	};