mmsharing/mmshavailability/tsrc/ut_availability/Stubs/src/sipprofileregistry.cpp
changeset 0 f0cf47e981f9
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     1 /*
       
     2 * Copyright (c) 2003 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 "sip.h"
       
    22 #include "CSipSseTestTls.h"
       
    23 #include "sipconnection.h"
       
    24 #include "sipprofileregistry.h"
       
    25 #include "sipprofileregistryobserver.h"
       
    26 #include "sipprofile.h"
       
    27 #include "musunittesting.h"
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CSIPProfileRegistry::NewL
       
    33 // Two-phased constructor.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 EXPORT_C CSIPProfileRegistry* CSIPProfileRegistry::NewL(
       
    37 	CSIP& aSip,
       
    38 	MSIPProfileRegistryObserver& aObserver)
       
    39 	{
       
    40     CSIPProfileRegistry* self = CSIPProfileRegistry::NewLC(aSip, aObserver);
       
    41     CleanupStack::Pop(self);
       
    42     return self;
       
    43 	}
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CSIPProfileRegistry::NewLC
       
    47 // Two-phased constructor.
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 EXPORT_C CSIPProfileRegistry* CSIPProfileRegistry::NewLC(
       
    51 	CSIP& aSip,
       
    52 	MSIPProfileRegistryObserver& aObserver)
       
    53 	{
       
    54 	CSIPProfileRegistry* self = new (ELeave) CSIPProfileRegistry(aSip, aObserver);
       
    55     CleanupStack::PushL(self);
       
    56     self->ConstructL();
       
    57     return self;
       
    58 	}
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CSIPProfileRegistry::~CSIPProfileRegistry
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 EXPORT_C CSIPProfileRegistry::~CSIPProfileRegistry()
       
    65 	{
       
    66 	
       
    67 	}
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CSIPProfileRegistry::EnableL
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 EXPORT_C void CSIPProfileRegistry::EnableL(CSIPProfile& /*aSIPProfile*/,
       
    74 						MSIPConnectionObserver& /*&aObserver*/)
       
    75 	{
       
    76 	TBool reg = ETrue;     
       
    77     CSipSseTestTls* tls = CSipSseTestTls::Storage();
       
    78     if ( tls )
       
    79         {
       
    80         reg = tls->RegisterSent();
       
    81         }
       
    82 	}
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CSIPProfileRegistry::Disable
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 EXPORT_C TInt CSIPProfileRegistry::Disable(CSIPProfile& aProfile )
       
    89 	{
       
    90 	TInt err = KErrNone;
       
    91     CSipSseTestTls* tls = CSipSseTestTls::Storage();
       
    92     if ( tls )
       
    93         {
       
    94         tls->SetRegisterStatus( EFalse );
       
    95         }
       
    96 	//aProfile.ConcreteProfile().SetLastRegistrationError(KErrNone);
       
    97 	//TRAPD(err, DisableProfileL(aProfile));
       
    98 	return err;
       
    99 	}
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CSIPProfileRegistry::SIP
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 EXPORT_C CSIP& CSIPProfileRegistry::SIP() const
       
   106 	{
       
   107 	return iSip;
       
   108 	}
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CSIPProfileRegistry::ConnectionL
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 //EXPORT_C CSIPConnection* CSIPProfileRegistry::ConnectionL(
       
   115 //						/*CSIPProfile& aSIPProfile*/)
       
   116 //	{
       
   117 	//TUint32 apId(0);
       
   118 	//__ASSERT_ALWAYS (iConnectionObserver != 0, User::Leave (KErrArgument));
       
   119 	//aSIPProfile.GetParameter(KSIPAccessPointId, apId);
       
   120 	//CSIPConnection* connection = iSip.Connection(apId);
       
   121 	//if (connection == 0)
       
   122 	//	{
       
   123 	//	connection = CSIPConnection::NewL(iSip, apId, 
       
   124 	//		*iConnectionObserver);
       
   125 	//	}
       
   126 	//return connection;
       
   127 //	}
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CSIPProfileRegistry::IsEnabled
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 EXPORT_C TBool CSIPProfileRegistry::IsEnabled(const CSIPProfile& aSIPProfile ) const
       
   134 	{
       
   135     CSipSseTestTls* tls = CSipSseTestTls::Storage();
       
   136     if ( tls )
       
   137         {
       
   138         return tls->RegisterStatus();
       
   139         }
       
   140     return EFalse;
       
   141 	}
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CSIPProfileRegistry::CSIPProfileRegistry
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 CSIPProfileRegistry::CSIPProfileRegistry(
       
   148 	CSIP& aSip,
       
   149 	MSIPProfileRegistryObserver& aObserver):
       
   150 	CSIPProfileRegistryBase(aObserver), iSip(aSip)
       
   151 	{
       
   152     CSipSseTestTls* tls = CSipSseTestTls::Storage();
       
   153     if ( tls )
       
   154         {
       
   155         tls->StoreRegistry( aObserver );
       
   156         }
       
   157 	}
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CSIPProfileRegistry::ConstructL
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 void CSIPProfileRegistry::ConstructL()
       
   164 	{
       
   165 	BaseConstructL();
       
   166 	}
       
   167 
       
   168 // -----------------------------------------------------------------------------
       
   169 // CSIPProfileRegistry::NewInstanceL
       
   170 // -----------------------------------------------------------------------------
       
   171 //
       
   172 CSIPProfile* CSIPProfileRegistry::NewInstanceL()
       
   173 	{
       
   174     return CSIPProfile::NewL(this);
       
   175 	}
       
   176