multimediacommsengine/tsrc/testdriver/siptester/ttcnresolverplugin2/src/ttcn2gresolverplugin.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2007 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 #include "ttcn2gresolverplugin.h"
       
    19 #include "sdpmediafield.h"
       
    20 
       
    21 // -----------------------------------------------------------------------------
       
    22 // CTTCN2GResolverPlugin::NewL
       
    23 // -----------------------------------------------------------------------------
       
    24 //
       
    25 CTTCN2GResolverPlugin* CTTCN2GResolverPlugin::NewL()
       
    26 	{
       
    27 	CTTCN2GResolverPlugin* self = new( ELeave )CTTCN2GResolverPlugin;
       
    28 	CleanupStack::PushL( self );
       
    29 	self->ConstructL();
       
    30 	CleanupStack::Pop( self );
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CTTCN2GResolverPlugin::CTTCN2GResolverPlugin
       
    36 // -----------------------------------------------------------------------------
       
    37 //	
       
    38 CTTCN2GResolverPlugin::CTTCN2GResolverPlugin()
       
    39     {
       
    40     }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CTTCN2GResolverPlugin::ConstructL
       
    44 // -----------------------------------------------------------------------------
       
    45 //    
       
    46 void CTTCN2GResolverPlugin::ConstructL()
       
    47     {
       
    48     User::LeaveIfError( iSimulator.Connect() );
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CTTCN2GResolverPlugin::~CTTCN2GResolverPlugin
       
    53 // -----------------------------------------------------------------------------
       
    54 //	
       
    55 CTTCN2GResolverPlugin::~CTTCN2GResolverPlugin()
       
    56     {
       
    57     iSimulator.Close();
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CTTCN2GResolverPlugin::MatchAcceptContactsL
       
    62 // From CSIPResolvedClient2
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 TBool CTTCN2GResolverPlugin::MatchAcceptContactsL(
       
    66     RStringF /*aMethod*/,
       
    67     const CUri8& /*aRequestUri*/,
       
    68     const RPointerArray<CSIPHeaderBase>& /*aHeaders*/,
       
    69     const TDesC8& /*aContent*/,
       
    70     const CSIPContentTypeHeader* /*aContentType*/,
       
    71     TUid& aClientUid)
       
    72     {
       
    73     return Match( 
       
    74         RSipClientSimulator::ESipAcceptContactHeaderMatch, aClientUid );
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CTTCN2GResolverPlugin::MatchEventL
       
    79 // From CSIPResolvedClient2
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 TBool CTTCN2GResolverPlugin::MatchEventL(
       
    83     RStringF /*aMethod*/,
       
    84     const CUri8& /*aRequestUri*/,
       
    85     const RPointerArray<CSIPHeaderBase>& /*aHeaders*/,
       
    86     const TDesC8& /*aContent*/,
       
    87     const CSIPContentTypeHeader* /*aContentType*/,
       
    88     TUid& aClientUid)
       
    89     {
       
    90     return Match( RSipClientSimulator::ESipEventHeaderMatch, aClientUid );
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CTTCN2GResolverPlugin::MatchRequestL
       
    95 // From CSIPResolvedClient2
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 TBool CTTCN2GResolverPlugin::MatchRequestL(
       
    99     RStringF /*aMethod*/,
       
   100     const CUri8& /*aRequestUri*/,
       
   101     const RPointerArray<CSIPHeaderBase>& /*aHeaders*/,
       
   102     const TDesC8& /*aContent*/,
       
   103     const CSIPContentTypeHeader* /*aContentType*/,
       
   104     TUid& aClientUid)
       
   105     {
       
   106     return Match( RSipClientSimulator::ESipRequestMatch, aClientUid );
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CTTCN2GResolverPlugin::ConnectSupported
       
   111 // From CSIPResolvedClient2
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 TBool CTTCN2GResolverPlugin::ConnectSupported()
       
   115     {
       
   116     return ETrue;
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CTTCN2GResolverPlugin::ConnectL
       
   121 // From CSIPResolvedClient2
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 void CTTCN2GResolverPlugin::ConnectL( 
       
   125     const TUid& aClientUid )
       
   126     {
       
   127     User::LeaveIfError( iSimulator.ConnectClient( aClientUid ) );
       
   128     }
       
   129 
       
   130 // -----------------------------------------------------------------------------
       
   131 // CTTCN2GResolverPlugin::CancelConnect
       
   132 // From CSIPResolvedClient2
       
   133 // -----------------------------------------------------------------------------
       
   134 //        
       
   135 void CTTCN2GResolverPlugin::CancelConnect(
       
   136     const TUid& /*aClientUid*/ )
       
   137     {
       
   138     }
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CTTCN2GResolverPlugin::SupportedContentTypesL
       
   142 // From CSIPResolvedClient2
       
   143 // -----------------------------------------------------------------------------
       
   144 //        
       
   145 RPointerArray<CSIPContentTypeHeader> 
       
   146 					CTTCN2GResolverPlugin::SupportedContentTypesL()
       
   147     {
       
   148     TUid tmpUid;
       
   149     return (iSimulator.ClientSupportedContentTypesL( tmpUid ));
       
   150     }
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // CTTCN2GResolverPlugin::SupportedSdpMediasL
       
   154 // From CSIPResolvedClient2
       
   155 // -----------------------------------------------------------------------------
       
   156 //        
       
   157 RPointerArray<CSdpMediaField> 
       
   158 					CTTCN2GResolverPlugin::SupportedSdpMediasL()
       
   159     {
       
   160     TUid tmpUid;
       
   161     return (iSimulator.ClientSupportedMediaFieldsL( tmpUid ));
       
   162     }
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // CTTCN2GResolverPlugin::AddClientSpecificHeadersForOptionsResponseL
       
   166 // From CSIPResolvedClient2
       
   167 // -----------------------------------------------------------------------------
       
   168 //        
       
   169 void CTTCN2GResolverPlugin::AddClientSpecificHeadersForOptionsResponseL( 
       
   170 								RPointerArray<CSIPHeaderBase>& /*aHeaders*/ )
       
   171     {
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CTTCN2GResolverPlugin::Match
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 TBool CTTCN2GResolverPlugin::Match(
       
   179     RSipClientSimulator::TMatchType aMatchType,
       
   180     TUid& aClientUid )
       
   181     {
       
   182     TBool match( EFalse );
       
   183     RSipClientSimulator::TMatchType matchType;
       
   184     TUid tmpUid;
       
   185     User::LeaveIfError( iSimulator.GetClientMatchType( matchType, tmpUid ) );
       
   186     if ( matchType == aMatchType )
       
   187         {
       
   188         match = ETrue;
       
   189         aClientUid.iUid = tmpUid.iUid;
       
   190         }
       
   191     return match;
       
   192     }