multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/TMCETestUIEngineCmdWriteSdpToFile.cpp
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:    Implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDES
       
    22 
       
    23 #include "TMCETestUIEngineCmdWriteSdpToFile.h"
       
    24 #include "CMCETestUIQuestionSingleSelection.h"
       
    25 #include "CMCETestUIQuestionDataQuery.h"
       
    26 #include "CMCETestUIEngineSession.h"
       
    27 #include <MCESession.h>
       
    28 #include <mcemediastream.h>
       
    29 #include <mcertpsource.h>
       
    30 #include <f32file.h>
       
    31 
       
    32 _LIT( KSdpFile, "c:\\system\\data\\sdp.txt" );
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // TMCETestUIEngineCmdFCSendSession::TMCETestUIEngineCmdFCSendSession
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 TMCETestUIEngineCmdWriteSdpToFile::TMCETestUIEngineCmdWriteSdpToFile( 
       
    39 		            CMCETestUIEngine& aEngine,
       
    40 		            CMCETestUIEngineSession& aSession )
       
    41     : TMCETestUIEngineCmdBase( aEngine ),
       
    42       iSession( aSession )
       
    43     {
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // TMCETestUIEngineCmdFCSendSession::ExecuteL
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 EXPORT_C void TMCETestUIEngineCmdWriteSdpToFile::ExecuteL()
       
    51 	{
       
    52     RFs fs;
       
    53 	if( fs.Connect() != KErrNone )
       
    54 		{
       
    55 		return;
       
    56 		}
       
    57 	RFile out;
       
    58 	if( !out.Replace( fs, KSdpFile, EFileWrite | EFileShareAny ) )
       
    59 		{
       
    60 		MDesC8Array* sdp = iSession.Session().SessionSDPLinesL();
       
    61 		User::LeaveIfNull( sdp );
       
    62 		for( int i = 0; i < sdp->MdcaCount(); i++ )
       
    63 		    {
       
    64 		    TInt err = out.Write( sdp->MdcaPoint(i) );
       
    65 		    User::LeaveIfError( err );
       
    66 		    }
       
    67 		delete sdp;
       
    68 		
       
    69 		const RPointerArray<CMceMediaStream>& streams = iSession.Session().Streams();
       
    70         
       
    71         for( int i = 0; i < streams.Count(); i++ )
       
    72 		    {
       
    73 		    MDesC8Array* sdpmedia = streams[i]->MediaAttributeLinesL();
       
    74 	    	User::LeaveIfNull( sdpmedia );
       
    75 	    	
       
    76 	    	if( streams[i]->Source()->Type() == KMceRTPSource )
       
    77 	    	    {
       
    78 	    	    TInt err = out.Write( _L8("Writing main stream media DL:\r\n") );
       
    79     		    User::LeaveIfError( err );
       
    80 	    	    }
       
    81 	        else
       
    82 	            {
       
    83 	            TInt err = out.Write( _L8("Writing main stream media UL:\r\n") );
       
    84     		    User::LeaveIfError( err );
       
    85 	            }
       
    86 	            
       
    87 		    for( int i = 0; i < sdpmedia->MdcaCount(); i++ )
       
    88     		    {
       
    89     		    TInt err = out.Write( sdpmedia->MdcaPoint(i) );
       
    90     		    User::LeaveIfError( err );
       
    91     		    }
       
    92     		delete sdpmedia; 
       
    93     		    
       
    94     		if( streams[i]->BoundStream() )
       
    95                 {
       
    96                 CMceMediaStream* boundStream = &streams[i]->BoundStreamL();
       
    97                 TInt err = out.Write( _L8("Writing bound stream media:\r\n") );
       
    98     		    User::LeaveIfError( err );
       
    99     		    
       
   100     		    MDesC8Array* sdpmediabound = boundStream->MediaAttributeLinesL();
       
   101 	    	    User::LeaveIfNull( sdpmediabound );
       
   102     		    
       
   103     		    for( int i = 0; i < sdpmediabound->MdcaCount(); i++ )
       
   104         		    {
       
   105         		    TInt err = out.Write( sdpmediabound->MdcaPoint(i) );
       
   106         		    User::LeaveIfError( err );
       
   107         		    }
       
   108         		delete sdpmediabound;
       
   109                 }
       
   110 		    }
       
   111 		out.Close();
       
   112 		}
       
   113 	fs.Close();
       
   114 	iEngine.EngineStateChangedL();    
       
   115 	}
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // TMCETestUIEngineCmdFCSendSession::Caption
       
   119 // -----------------------------------------------------------------------------
       
   120 //
       
   121 EXPORT_C const TDesC& TMCETestUIEngineCmdWriteSdpToFile::Caption() const
       
   122 	{
       
   123 	return KCommandCaptionWriteSdpToFile;
       
   124 	}
       
   125 
       
   126 
       
   127 
       
   128 
       
   129 // End of File