multimediacommsengine/mmcefloorctrlengine/inc/fcpluginengine.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 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:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CFCPLUGINENGINE_H
       
    22 #define CFCPLUGINENGINE_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "fcinterface.h"
       
    27 #include <ecom/ecom.h>
       
    28 #include "fcmessageobserver.h"
       
    29 #include "fcpluginstore.h"
       
    30 #include "fcobserver.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CFCPlugInInfo;
       
    34 class TFCInterfaceInitParams;
       
    35 class TFCPlugInIter;
       
    36 class CFCSession;
       
    37 class CSdpFmtAttributeField;
       
    38 class CSdpDocument;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 * Class provides functions for using Floor Control Plugin
       
    44 * @lib CFCPlugInEngine.lib
       
    45 */
       
    46 class CFCPlugInEngine : public CBase,
       
    47 			public MFCPlugInstore, public MFCMessageObserver
       
    48 	{
       
    49 	public: // Constructors and destructor
       
    50 
       
    51 		/**
       
    52 		* Constructs an object; leaves on failure.
       
    53 		* @param aFCObserver an interface for requesting floor control events
       
    54 		* @return new instance
       
    55 		*/
       
    56 		IMPORT_C static CFCPlugInEngine* NewL(MFCObserver& aFCObserver);
       
    57 
       
    58 		/**
       
    59 		* Constructs an object and adds the pointer to the cleanup stack;
       
    60 		* leaves on failure.
       
    61 		* @param aFCObserver an interface for requesting FC events
       
    62 		* @return new instance
       
    63 		*/
       
    64 		IMPORT_C static CFCPlugInEngine* NewLC(	MFCObserver& aFCObserver);
       
    65 
       
    66 		/**
       
    67 		* Destructor
       
    68 		*/
       
    69 		IMPORT_C ~CFCPlugInEngine();
       
    70 		
       
    71 		/**
       
    72 		* Gets all supported Floor contrl PlugIn
       
    73 		* @return supported Floor control plugins names (e.g. TBCP);
       
    74         *  the ownership is transferred
       
    75 		*/
       
    76 		IMPORT_C CDesC8Array* SupportedProtocolL();
       
    77 		
       
    78 		/**
       
    79 		* Gets the specific Floor contrl PlugIn
       
    80 		* @return specific Floor control plugins name (e.g. TBCP);
       
    81         *  the ownership is transferred
       
    82 		*/
       
    83 		IMPORT_C MFCPlugIn* PlugInByNameL(const TDesC8& aProtocolName) ;
       
    84 		
       
    85 		/**
       
    86 		* Gets the new FC session. 
       
    87 		* @param aType, Plugin type
       
    88 		* @param aIapId, The IAP ID
       
    89 		* @param aPort, The port to be used-
       
    90 		* @return const CFCSession&, reference to FC session 
       
    91         *  function will leave if there is no suitable plugIn           
       
    92 		*/
       
    93 		IMPORT_C CFCSession& CreateNewSessionL(const TDesC8& aType, 
       
    94 		                                             TUint32 aIapId,
       
    95 		                                             TUint32 aPort);		
       
    96 		
       
    97 		
       
    98 		/**
       
    99 		* Updates the FC session local port.
       
   100 		* @param aSession, reference to FC session.
       
   101 		* @param aNewPort, the new port.
       
   102         */
       
   103         IMPORT_C void SetSessionPortL( CFCSession& aFCSession, TUint32 aNewPort );
       
   104 		
       
   105 		/**
       
   106 		* Updates the FC session local port and the receiving status.
       
   107 		* KFCDefaultPort means that the session will no be receiving.
       
   108 		* @param aSession, reference to FC session.
       
   109 		* @param aNewPort, the new port.
       
   110         */
       
   111         IMPORT_C void UpdateSessionL( CFCSession& aFCSession, TUint32 aNewPort );
       
   112 		
       
   113 		/**
       
   114 		* Releases the FC session.
       
   115 		* @param aSession, reference to FC session.
       
   116         */
       
   117 		IMPORT_C void ReleaseSession(const CFCSession& aSession);
       
   118 		
       
   119 		/**
       
   120 		* Gets the set of media format level attributes.
       
   121 		* @return RPointerArray<CSdpFmtAttributeField>&: The set of media 
       
   122         *  format level attributes.
       
   123 		*/
       
   124 		IMPORT_C RPointerArray<CSdpFmtAttributeField>& 
       
   125 			FormatAttributeFieldsL(const CFCSession& aSession);
       
   126 		
       
   127 		/**
       
   128 		* Sets media format level attributes.
       
   129 		* @param aAttributes, The set of media format level attributes.
       
   130 		*/
       
   131 		IMPORT_C void SetFormatAttributeFieldsL(const CFCSession& aSession, 
       
   132 						RPointerArray<CSdpFmtAttributeField>* aAttributes);
       
   133         
       
   134 		/**
       
   135 		* Reads remote parameters of FC from offer/answer document.
       
   136 		* @param aSession FC Session
       
   137 		* @param aSdpDocument SDP document containing offer/answer
       
   138 		*/
       
   139 		IMPORT_C void PeekDocumentL(const CFCSession& aSession, const CSdpDocument& aSdpDocument);
       
   140 
       
   141 		/**
       
   142 		* Modifies local parameters of FC to offer document.
       
   143 		* Adds a media line or modifies existing one.
       
   144 		* @param aSession FC Session
       
   145 		* @param aSdpDocument SDP document containing offer.
       
   146 		*/
       
   147 		IMPORT_C void UpdateOfferL(const CFCSession& aSession, CSdpDocument& aSdpDocument);
       
   148 		
       
   149 		/**
       
   150 		* Modifies local parameters of FC to answer document.
       
   151 		* @param aSession FC Session
       
   152 		* @param aSdpDocument SDP document containing answer, updating the port and addr only
       
   153 		*/
       
   154 		IMPORT_C void UpdateAnswerL(const CFCSession& aSession, CSdpDocument& aSdpDocument);
       
   155 				
       
   156 		/**
       
   157 		* Session is ready to send, Socket is open, and start to listen
       
   158 		* @param aSession FC Session
       
   159 		*/
       
   160 		IMPORT_C void StartConnectionL( const CFCSession& aSession );
       
   161 		
       
   162 		/**
       
   163 		* Send the Data to the predefined addresses
       
   164 		* @param aSession FC Session
       
   165 		* @param aData, sending via this plugIn
       
   166 		*/
       
   167 		IMPORT_C void SendToNetL( const CFCSession& aSession, 
       
   168 		                          HBufC8* aData );
       
   169 		
       
   170 		/**
       
   171 		* Returns truth value whether or not this the plugin is 
       
   172 		* to be receive data in this sessions port. Leaves with
       
   173 		* KErrNotFound, if the session is not found.
       
   174 		* @param aSession FC Session
       
   175 		*/
       
   176 		IMPORT_C TBool IsReceiverL( const CFCSession& aSession );
       
   177 		
       
   178 		/**
       
   179 		* Checks if the floor control paramaters have changed for
       
   180 		* the given session. Leaves with KErrNotFound, if the 
       
   181 		* session is not found.
       
   182 		* @param aSession FC Session
       
   183 		*/
       
   184 		IMPORT_C TBool UpdateNeededL( const CFCSession& aSession );
       
   185 		
       
   186 		
       
   187 	public:	// From MFCMessageObserver	
       
   188 			
       
   189 		/**
       
   190 		* Called by a FloorControl plugin
       
   191 		* @param aData, Receving Data
       
   192 		* @param aPlugIn, The plug-in
       
   193 		*/
       
   194 		void ReceivedData(HBufC8* aData, MFCPlugIn* aPlugIn ) ;
       
   195 
       
   196 		/**
       
   197 		* Called by a FloorControl plugin
       
   198 		* @param aErrCode KErrNone if connection succesfully, otherwise
       
   199 		*		 one of the system-wide error codes.
       
   200 		* @param aPlugIn, The plug-in
       
   201 		*/
       
   202 		void ErrorNotify( TInt aErrCode, MFCPlugIn* aPlugIn ) ;
       
   203   	
       
   204 	public: 
       
   205 
       
   206 		/**
       
   207 		* Gets all PlugIn 
       
   208 		* @return the iterator of plugin
       
   209 		*/
       
   210 		TFCPlugInIter& FCPlugInIter();
       
   211 		
       
   212 		/**
       
   213 		* Load the plugin uses the pre-difined UID
       
   214 		*/
       
   215 		void ListMechanismImplementationsL();
       
   216 		
       
   217       
       
   218 	private:
       
   219 		// Constructor
       
   220 		CFCPlugInEngine(MFCObserver& aFCObserver);
       
   221 		
       
   222 		void ConstructL();
       
   223 		
       
   224 		static void ArrayCleanup(TAny* aArray);
       
   225 		
       
   226 		CFCSession* FindFCSession( MFCPlugIn* aPlugIn );
       
   227 	
       
   228 	private:	
       
   229 		//data
       
   230 		MFCObserver& iFCObserver;
       
   231 		RPointerArray< CFCPlugInInfo > iFCPlugIns;
       
   232 		TFCPlugInIter iFCPlugInIter;
       
   233 		RPointerArray<CFCSession> iFCSessions;
       
   234     
       
   235     private: // EUnit
       
   236         friend class UT_CFCPlugInEngine;
       
   237 		
       
   238 	};
       
   239 
       
   240 #endif // CFCPlugInEngine_H
       
   241 
       
   242 // End of File