mmsharing/mmshavailability/tsrc/ut_availability/Stubs/src/sipprofilestub.cpp
changeset 22 496ad160a278
parent 0 f0cf47e981f9
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2002 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 //  INCLUDE FILES
       
    20 
       
    21 #include "sipprofile.h"
       
    22 //#include "sipmanagedprofile.h"
       
    23 #include "sipprofileregistry.h"
       
    24 #include "CSipSseTestTls.h"
       
    25 //#include "sipconcreteprofile.h"
       
    26 //#include "SIPProfileTypeInfo.h"
       
    27 //_LIT8(KSIPProfileExtenstionParameter, "%u");
       
    28 //const TUint KProfileBufferSize = 25;
       
    29 
       
    30 _LIT8(KSIPProfileDefAOR, "user@aa");
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CSIPProfile::NewL
       
    37 // Two-phased constructor.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CSIPProfile* CSIPProfile::NewL(CSIPProfileRegistry* aSIPRegistry)
       
    41 	{
       
    42     CSIPProfile* self = CSIPProfile::NewLC (aSIPRegistry);
       
    43     CleanupStack::Pop();
       
    44     return self;
       
    45 	}
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CSIPProfile::NewLC
       
    49 // Two-phased constructor.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CSIPProfile* CSIPProfile::NewLC(CSIPProfileRegistry* aSIPRegistry)
       
    53 	{
       
    54 	CSIPProfile* self = new(ELeave)CSIPProfile(aSIPRegistry);
       
    55     CleanupStack::PushL (self);
       
    56     self->ConstructL ();
       
    57     return self;
       
    58 	}
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CSIPProfile::~CSIPProfile
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 EXPORT_C CSIPProfile::~CSIPProfile()
       
    65 	{
       
    66 	delete iRegisteredContact;
       
    67 	if ( iArray )
       
    68 	    {
       
    69 	    if ( iArray->Count() > 0 )
       
    70 	        {
       
    71 	        iArray->Reset();    
       
    72 	        }
       
    73 	    delete iArray;
       
    74 	    }
       
    75 	}
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // 
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 EXPORT_C const TSIPProfileTypeInfo& CSIPProfile::Type() const
       
    82     {
       
    83     return iTypeInfo;
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CSIPProfile::GetParameter
       
    88 // -----------------------------------------------------------------------------
       
    89 //	
       
    90 EXPORT_C TInt CSIPProfile::GetParameter( TUint32 /*aParam*/, 
       
    91                                          TDesC8 const *& aVal ) const
       
    92 	{
       
    93 	if ( iRegisteredContact )
       
    94 	    {
       
    95 	    aVal = iRegisteredContact;
       
    96 	    return KErrNone;
       
    97 	    }
       
    98 	else{
       
    99 	    return KErrNotFound;
       
   100 	    }
       
   101 	}	
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CSIPProfile::GetParameter
       
   105 // -----------------------------------------------------------------------------
       
   106 //	
       
   107 EXPORT_C TInt CSIPProfile::GetParameter(TUint32 aParam, TUint32& aVal) const
       
   108 	{
       
   109 	CSipSseTestTls* tls = CSipSseTestTls::Storage();
       
   110 	if ( tls )
       
   111 	    {
       
   112 	    if ( tls->iProfileBehavior == KSIPProfileIdFetchFails && 
       
   113 	         aParam == KSIPProfileId )
       
   114 	        {
       
   115 	        return KErrNotFound;
       
   116 	        }
       
   117 	    else if ( tls->iProfileBehavior == KSIPIapIdFetchFails && 
       
   118 	              aParam == KSIPAccessPointId )
       
   119 	        {
       
   120 	        return KErrNotFound;
       
   121 	        }
       
   122 	    }
       
   123 	    
       
   124     if ( iTUint32ValueError == KErrNone )
       
   125 	    {
       
   126 	    aVal = iTUint32Value;
       
   127 	    }
       
   128 	return iTUint32ValueError;
       
   129 	}	
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CSIPProfile::GetParameter
       
   133 // -----------------------------------------------------------------------------
       
   134 //	
       
   135 EXPORT_C TInt CSIPProfile::GetParameter(TUint32 aParam, TBool& aVal) const
       
   136 	{
       
   137 	if ( iTBoolValueError == KErrNone )
       
   138 	    {
       
   139 	    if ( aParam == KSIPDefaultProfile )
       
   140 	        {
       
   141 	        aVal = iIsDefaultProfile;
       
   142 	        }
       
   143 	    else
       
   144 	        {
       
   145 	        aVal = iTBoolValue;
       
   146 	        }
       
   147 	    }
       
   148 	    
       
   149 	return iTBoolValueError;
       
   150 	}
       
   151 
       
   152 
       
   153 // -----------------------------------------------------------------------------
       
   154 // CSIPProfile::GetParameter
       
   155 // -----------------------------------------------------------------------------
       
   156 //	
       
   157 EXPORT_C TInt CSIPProfile::GetParameter( TUint32 /*aParam*/, 
       
   158                                          MDesC8Array const *& aVal) const
       
   159     {
       
   160     if ( iArray )
       
   161         {
       
   162         aVal = iArray;
       
   163         }
       
   164     else
       
   165         {
       
   166         aVal = NULL;
       
   167         }
       
   168     return KErrNone;
       
   169     }
       
   170 
       
   171 	
       
   172 // -----------------------------------------------------------------------------
       
   173 // CSIPProfile::CSIPProfile
       
   174 // -----------------------------------------------------------------------------
       
   175 //	
       
   176 CSIPProfile::CSIPProfile(CSIPProfileRegistryBase* aRegistry):
       
   177 	iSIPProfileRegistry(aRegistry), 
       
   178 	iEnabled(EFalse),
       
   179 	iTUint32Value( 1 ),
       
   180     iTUint32ValueError( KErrNone ),
       
   181     iTBoolValue( ETrue ),
       
   182     iTBoolValueError( KErrNone ),
       
   183     iIsDefaultProfile( EFalse )
       
   184 	{
       
   185 	iTypeInfo.iSIPProfileClass = TSIPProfileTypeInfo::EInternet;
       
   186 	}
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 // CSIPProfile::ConstructL
       
   190 // -----------------------------------------------------------------------------
       
   191 //	
       
   192 void CSIPProfile::ConstructL()
       
   193 	{
       
   194 	}
       
   195 
       
   196 // -----------------------------------------------------------------------------
       
   197 // CSIPProfile::IsContextActive
       
   198 // -----------------------------------------------------------------------------
       
   199 //	
       
   200 TBool CSIPProfile::IsContextActive() const
       
   201 	{
       
   202 	return ETrue;
       
   203 	}
       
   204 	
       
   205 // -----------------------------------------------------------------------------
       
   206 // CSIPProfile::ContextId
       
   207 // -----------------------------------------------------------------------------
       
   208 //	
       
   209 TUint32 CSIPProfile::ContextId() const
       
   210 	{
       
   211 	return 1;
       
   212 	}
       
   213 
       
   214 // end of file