multimediacommsengine/tsrc/MMCTestDriver/MCETester/inc/TTcMCECommandBase.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:    See class definition below.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __TTCMCECOMMANDBASE_H__
       
    21 #define __TTCMCECOMMANDBASE_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include "TTcCommandBase.h"
       
    25 #include "CTcMCEContext.h"
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 
       
    30 
       
    31 
       
    32 // CLASS DEFINITION
       
    33 /**
       
    34  * TTcSIPCommandBase implements the base class for all SIP commands.
       
    35  * It provides common SIP related functionality for
       
    36  * accessing request and creating responses.
       
    37  */
       
    38 class TTcMceCommandBase
       
    39 	: public TTcCommandBase
       
    40 	{
       
    41 	protected:	// Constructors and destructor
       
    42 
       
    43 		/**
       
    44 		 * Constructor.
       
    45 		 *
       
    46 		 * @param aContext SIP test context
       
    47 		 */
       
    48 		TTcMceCommandBase( MTcTestContext& aContext );
       
    49 
       
    50 	protected: // New methods
       
    51 
       
    52 		// Add here parameter extraction functions when needed
       
    53 		
       
    54 		/**
       
    55          * Extracts profileId and returns it as a integer
       
    56          *
       
    57          * @return profileId
       
    58          */
       
    59 		TInt ExtractProfileIdL();
       
    60 		
       
    61 		/**
       
    62 		 * Extracts array from CTRL request
       
    63 		 *
       
    64 		 * @param aName Name of the array to be extracted.
       
    65 		 * @param aIsMandatory ETrue if the object is required.
       
    66 		 * @return Pointer to array. Null if not found
       
    67 		 *         and object is not required. Ownership is transferred.
       
    68 		 * @exceptions Leaves with KTcErrMandatoryParameterNotFound if the 
       
    69 		 *			   object is required but cannot be found.
       
    70 		 */
       
    71 		CDesC8Array* ExtractArrayL(const TDesC8& aName, 
       
    72 								   TBool aIsMandatory = ETrue);
       
    73 		
       
    74 		/**
       
    75 		 * Extracts SIP headers from CTRL request
       
    76 		 *
       
    77 		 * @param aIsMandatory ETrue if the headers are required.
       
    78 		 * @return Pointer to array including headers. Null if not found
       
    79 		 *         and headers are not required. Ownership is transferred.
       
    80 		 * @exceptions Leaves with KTcErrMandatoryParameterNotFound if headers 
       
    81 		 *			   are required but cannot be found.
       
    82 		 */
       
    83 		CDesC8Array* ExtractHeadersL(TBool aIsMandatory = ETrue);
       
    84 
       
    85 		/**
       
    86 		 * Converts any TPtrC8 to HBufC*
       
    87 		 *
       
    88 		 * @param ptr Descriptor to be converted
       
    89 		 * @return Converted descriptor. Null if param is not a valid pointer.
       
    90 		 *         Ownership is transferred.
       
    91 		 */
       
    92 		HBufC8* HBufCParameterL( TPtrC8 ptr );
       
    93 
       
    94 		/**
       
    95 		 * Returns the default profile, or a user defined profile
       
    96 		 * if a RegistryId is present in the CTLR request.
       
    97 		 *
       
    98 		 * @return Reference to a profile container.
       
    99 		 */
       
   100 		CTcMCEProfileContainer& SelectProfileL();
       
   101 		
       
   102 		/**
       
   103 		 * Searches for a ProfileId field from the CTRL request. Fetches
       
   104 		 * the associated Profile object from the test context's
       
   105 		 * profile registry.
       
   106 		 *
       
   107 		 * @param aIsMandatory ETrue if the object is required.
       
   108 		 * @return reference to Profile object or leaves if profile for wanted
       
   109 		 *         id is not found
       
   110 		 * @exceptions Leaves with KTcErrMandatoryIdNotFound if
       
   111 		 *			   a required object or object id cannot be found.
       
   112 		 */
       
   113 		CSIPProfile& GetProfileL( CTcMCEProfileContainer& aProfileContainer );
       
   114 
       
   115 	
       
   116 		// Response creation functions
       
   117 
       
   118 		/**
       
   119 		 * Try to find an existing TestClientIds structure from the
       
   120 		 * CTRL response. Create one if it cannot be found and add
       
   121 		 * all possible Id items to it.
       
   122 		 *
       
   123 		 * @return Reference to the structure parameter containing
       
   124 		 *		   pre-created TestClient Ids.
       
   125 		 */
       
   126 		CTcStructure& FindCreateTestClientIdsL();
       
   127 
       
   128 		/**
       
   129 		 * Adds a TestClientId item to the CTRL response. Ownership is
       
   130 		 * is transferred.
       
   131 		 *
       
   132 		 * NOTE!! This function uses CleanupStack for safe array insertion.
       
   133 		 * You must not call CleanupStack::PushL()/Pop() when calling this!!
       
   134 		 *
       
   135 		 * @param aName Id name (e.g. "RequestId")
       
   136 		 * @param aObject Id of this object is looked up from the registry
       
   137 		 *				  and added to the response. aObject is registered
       
   138 		 *				  if it's not already in the registry.
       
   139 		 */
       
   140 		void AddIdResponseL( const TDesC8& aName, const CBase* aObject );
       
   141 
       
   142         /**
       
   143 		 * Adds a TestClientId item to the CTRL response. Ownership is
       
   144 		 * is NOT transferred.
       
   145 		 *
       
   146 		 * @param aName Id name (e.g. "RequestId")
       
   147 		 * @param aObject Id of this object is looked up from the registry
       
   148 		 *				  and added to the response. aObject is registered
       
   149 		 *				  if it's not already in the registry.
       
   150 		 */
       
   151         void AddIdResponseL( const TDesC8& aName, const CBase& aObject );
       
   152 		 
       
   153 		/**
       
   154 		 * Adds headers to CTRL response. Ownership is NOT transferred.
       
   155 		 * @param aHeaders Headers to be added to response.
       
   156 		 */
       
   157 		void AddHeadersL( const CDesC8Array* aHeaders );
       
   158 		  
       
   159 		/*
       
   160 		 * Adds session state enumeration's textual correspondent to response
       
   161 		 *
       
   162 		 * @param aState State, which textual correspondent is added to response
       
   163 		 */
       
   164 		void AddTextualSessionStateL( TInt aState );
       
   165 
       
   166 		/*
       
   167 		 * Adds stream state enumeration's textual correspondent to response
       
   168 		 *
       
   169 		 * @param aState State, which textual correspondent is added to response
       
   170          * @param aBound If ETrue, param's name is "StreamStateText", else
       
   171          *               "BoundStreamStateText"
       
   172 		 */
       
   173 		void AddTextualStreamStateL( TBool aState, TBool aBound );
       
   174 
       
   175 
       
   176 		/*
       
   177 		 * Adds media stream state enumeration's textual correspondent to response
       
   178 		 *
       
   179 		 * @param aState State, which textual correspondent is added to response         
       
   180 		 */
       
   181 		 void AddTextualMediaStreamStateL( TInt aState );
       
   182 
       
   183 			
       
   184 				
       
   185 		/*
       
   186 		 * Adds event state enumeration's textual correspondent to response
       
   187 		 *
       
   188 		 * @param aState State, which textual correspondent is added to response
       
   189 		 */
       
   190 		void AddTextualEventStateL( TInt aState );
       
   191 
       
   192 		/*
       
   193 		 * Adds refer state enumeration's textual correspondent to response
       
   194 		 *
       
   195 		 * @param aState State, which textual correspondent is added to response
       
   196 		 */
       
   197 		void AddTextualReferStateL( TInt aState );
       
   198 
       
   199 
       
   200 	protected:	// Data
       
   201 
       
   202 		/// Reference to the MCE test context. Not owned.
       
   203 		CTcMCEContext& iContext;
       
   204 
       
   205 		/// CleanupStack push count
       
   206 		TInt iPushed;
       
   207 
       
   208 	};
       
   209 
       
   210 #endif // __TTCMCECOMMANDBASE_H__