mmsharing/livecommsui/lcui/tsrc/mustester/Stubs/sipprofilestub/src/sipprofileregistrystub.cpp
branchRCL_3
changeset 23 bc78a40cd63c
parent 22 73a1feb507fb
child 24 6c57ef9392d2
equal deleted inserted replaced
22:73a1feb507fb 23:bc78a40cd63c
     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 "sipconnection.h"
       
    23 #include "sipprofileregistry.h"
       
    24 #include "sipprofileregistryobserver.h"
       
    25 #include "sipprofile.h"
       
    26 //#include "sipconcreteprofile.h"
       
    27 
       
    28 // STUB stuff
       
    29 
       
    30 void CSIPProfileBehaviorTls::OpenL()
       
    31 	{
       
    32     CSIPProfileBehaviorTls* self = new (ELeave) CSIPProfileBehaviorTls();
       
    33     Dll::SetTls( self );
       
    34 	}
       
    35 
       
    36 void CSIPProfileBehaviorTls::Close ()
       
    37 	{
       
    38 	CSIPProfileBehaviorTls* self = Storage();
       
    39     delete self;
       
    40     Dll::SetTls( NULL );
       
    41 	}
       
    42 
       
    43 	
       
    44 CSIPProfileBehaviorTls* CSIPProfileBehaviorTls::Storage()
       
    45 	{
       
    46 	return static_cast<CSIPProfileBehaviorTls*>(Dll::Tls());
       
    47 	}
       
    48 
       
    49 void CSIPProfileBehaviorTls::Reset()
       
    50     {
       
    51     iRegistryBehavior = 0;
       
    52     iProfileBehavior = 0;
       
    53     iConnectionBehavior = 0;
       
    54     }
       
    55     
       
    56 CSIPProfileBehaviorTls::CSIPProfileBehaviorTls()
       
    57 	{
       
    58 	}
       
    59 	
       
    60 CSIPProfileBehaviorTls::~CSIPProfileBehaviorTls()
       
    61 	{
       
    62 	}
       
    63 	
       
    64 
       
    65 // ============================ MEMBER FUNCTIONS ===============================
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CSIPProfileRegistry::NewL
       
    69 // Two-phased constructor.
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 EXPORT_C CSIPProfileRegistry* CSIPProfileRegistry::NewL(
       
    73 	CSIP& aSip,
       
    74 	MSIPProfileRegistryObserver& aObserver)
       
    75 	{
       
    76     CSIPProfileRegistry* self = CSIPProfileRegistry::NewLC(aSip, aObserver);
       
    77     CleanupStack::Pop(self);
       
    78     return self;
       
    79 	}
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CSIPProfileRegistry::NewLC
       
    83 // Two-phased constructor.
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 EXPORT_C CSIPProfileRegistry* CSIPProfileRegistry::NewLC(
       
    87 	CSIP& aSip,
       
    88 	MSIPProfileRegistryObserver& aObserver)
       
    89 	{
       
    90 	CSIPProfileRegistry* self = new (ELeave) CSIPProfileRegistry(aSip, aObserver);
       
    91     CleanupStack::PushL(self);
       
    92     self->ConstructL();
       
    93     return self;
       
    94 	}
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CSIPProfileRegistry::~CSIPProfileRegistry
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 EXPORT_C CSIPProfileRegistry::~CSIPProfileRegistry()
       
   101 	{
       
   102 	
       
   103 	}
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CSIPProfileRegistry::EnableL
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 EXPORT_C void CSIPProfileRegistry::EnableL(CSIPProfile& /*aSIPProfile*/,
       
   110 						MSIPConnectionObserver& /*&aObserver*/)
       
   111 	{
       
   112 	//__ASSERT_ALWAYS (!aSIPProfile.IsEnabled(), User::Leave (KErrArgument));
       
   113 	//aSIPProfile.ConcreteProfile().SetLastRegistrationError(KErrNone);
       
   114 	//iConnectionObserver = &aObserver;
       
   115 
       
   116 	//EnableProfileL(aSIPProfile);
       
   117 	}
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CSIPProfileRegistry::Disable
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 EXPORT_C TInt CSIPProfileRegistry::Disable(CSIPProfile& /*aProfile*/)
       
   124 	{
       
   125 	TInt err = KErrNone;
       
   126 	iProfileDisabled = ETrue;
       
   127 	//aProfile.ConcreteProfile().SetLastRegistrationError(KErrNone);
       
   128 	//TRAPD(err, DisableProfileL(aProfile));
       
   129 	return err;
       
   130 	}
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CSIPProfileRegistry::SIP
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 EXPORT_C CSIP& CSIPProfileRegistry::SIP() const
       
   137 	{
       
   138 	return iSip;
       
   139 	}
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CSIPProfileRegistry::ConnectionL
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 //EXPORT_C CSIPConnection* CSIPProfileRegistry::ConnectionL(
       
   146 //						/*CSIPProfile& aSIPProfile*/)
       
   147 //	{
       
   148 	//TUint32 apId(0);
       
   149 	//__ASSERT_ALWAYS (iConnectionObserver != 0, User::Leave (KErrArgument));
       
   150 	//aSIPProfile.GetParameter(KSIPAccessPointId, apId);
       
   151 	//CSIPConnection* connection = iSip.Connection(apId);
       
   152 	//if (connection == 0)
       
   153 	//	{
       
   154 	//	connection = CSIPConnection::NewL(iSip, apId, 
       
   155 	//		*iConnectionObserver);
       
   156 	//	}
       
   157 	//return connection;
       
   158 //	}
       
   159 
       
   160 // -----------------------------------------------------------------------------
       
   161 // CSIPProfileRegistry::IsEnabled
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 EXPORT_C TBool CSIPProfileRegistry::IsEnabled(const CSIPProfile& /*aSIPProfile*/) const
       
   165 	{
       
   166 	//iProfileEnabled = ETrue;
       
   167 	return ETrue;
       
   168 	}
       
   169 
       
   170 // -----------------------------------------------------------------------------
       
   171 // CSIPProfileRegistry::CSIPProfileRegistry
       
   172 // -----------------------------------------------------------------------------
       
   173 //
       
   174 CSIPProfileRegistry::CSIPProfileRegistry(
       
   175 	CSIP& aSip,
       
   176 	MSIPProfileRegistryObserver& aObserver):
       
   177 	CSIPProfileRegistryBase(aObserver), iSip(aSip)
       
   178 	{
       
   179 	
       
   180 	}
       
   181 
       
   182 // -----------------------------------------------------------------------------
       
   183 // CSIPProfileRegistry::ConstructL
       
   184 // -----------------------------------------------------------------------------
       
   185 //
       
   186 void CSIPProfileRegistry::ConstructL()
       
   187 	{
       
   188 	CSIPProfileBehaviorTls* tls = CSIPProfileBehaviorTls::Storage();
       
   189 	if ( tls )
       
   190 	    {
       
   191 	    if ( tls->iRegistryBehavior == KRegistryLeaveAtConstruct )
       
   192 	        {
       
   193 	        User::Leave( KErrGeneral );
       
   194 	        }
       
   195 	    }
       
   196 	BaseConstructL();
       
   197 
       
   198 	}
       
   199 
       
   200 // -----------------------------------------------------------------------------
       
   201 // CSIPProfileRegistry::NewInstanceL
       
   202 // -----------------------------------------------------------------------------
       
   203 //
       
   204 CSIPProfile* CSIPProfileRegistry::NewInstanceL()
       
   205 	{
       
   206     return CSIPProfile::NewL(this);
       
   207 	}
       
   208