mmsharing/mmshavailability/tsrc/ut_availability/Stubs/src/musavasipadapterimp.cpp
changeset 22 496ad160a278
parent 0 f0cf47e981f9
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "musavasipadapterimp.h"
       
    20 #include <sipservertransaction.h>
       
    21 
       
    22 
       
    23 // -------------------------------------------------------------------------
       
    24 // Two-phased constructor.
       
    25 // -------------------------------------------------------------------------
       
    26 //
       
    27 CMusAvaSipAdapterImp* CMusAvaSipAdapterImp::NewL()
       
    28 	{
       
    29 	CMusAvaSipAdapterImp* self = new (ELeave) CMusAvaSipAdapterImp();
       
    30 	CleanupStack::PushL (self);
       
    31 	self->ConstructL();
       
    32 	CleanupStack::Pop();
       
    33 	return self;
       
    34 	}
       
    35 	
       
    36 // -------------------------------------------------------------------------
       
    37 // C++ destructor.
       
    38 // -------------------------------------------------------------------------
       
    39 //
       
    40 CMusAvaSipAdapterImp::~CMusAvaSipAdapterImp()
       
    41     {
       
    42     CleanServerTransaction();
       
    43     delete iInviteAssoc;
       
    44     }
       
    45     
       
    46 // -------------------------------------------------------------------------
       
    47 // Symbian second-phase constructor.
       
    48 // -------------------------------------------------------------------------
       
    49 //
       
    50 void CMusAvaSipAdapterImp::ConstructL()
       
    51 	{
       
    52 	}
       
    53 
       
    54 // -------------------------------------------------------------------------
       
    55 // C++ constructor.
       
    56 // -------------------------------------------------------------------------
       
    57 //
       
    58 CMusAvaSipAdapterImp::CMusAvaSipAdapterImp() 
       
    59 	{
       
    60 
       
    61 	}
       
    62 
       
    63 // -------------------------------------------------------------------------
       
    64 // CMusAvaSipAdapterImp::Reset()
       
    65 // -------------------------------------------------------------------------
       
    66 //	
       
    67 void CMusAvaSipAdapterImp::Reset()
       
    68     {
       
    69     iClientTransaction = NULL;
       
    70     CleanServerTransaction();
       
    71     iState = CSIPConnection::EInit;
       
    72     iError = KErrNone;
       
    73     iRegBinding = NULL;
       
    74     iRefresh = NULL;
       
    75     iDialogAssoc = NULL;
       
    76     iDialog = NULL;
       
    77     iIapId = 0;
       
    78     delete iInviteAssoc;
       
    79     iInviteAssoc = NULL;
       
    80     iTransaction = NULL;
       
    81     iReturnCode = KErrNone;
       
    82     }
       
    83 
       
    84 void CMusAvaSipAdapterImp::CleanServerTransaction()
       
    85     {
       
    86     if ( iServerTransctionOwned )
       
    87         {
       
    88         delete iServerTransaction;
       
    89         }
       
    90     iServerTransaction = NULL;
       
    91     }
       
    92     
       
    93 void CMusAvaSipAdapterImp::SetServerTransaction( CSIPServerTransaction& aTransaction )
       
    94     {
       
    95     iServerTransctionOwned = EFalse;
       
    96     iServerTransaction = &aTransaction;
       
    97     }
       
    98  
       
    99 void CMusAvaSipAdapterImp::SetServerTransaction( CSIPServerTransaction* aTransaction )
       
   100     {
       
   101     iServerTransctionOwned = ETrue;
       
   102     iServerTransaction = aTransaction;
       
   103     }
       
   104        
       
   105 TInt CMusAvaSipAdapterImp::IncomingRequest( TUint32 aIapId,
       
   106                           CSIPServerTransaction* aTransaction )
       
   107     {
       
   108     if ( iReturnCode != KErrNone )
       
   109         {
       
   110         return iReturnCode;
       
   111         }
       
   112     iIapId = aIapId;
       
   113     CleanServerTransaction();
       
   114     SetServerTransaction( aTransaction );
       
   115     return iReturnCode;
       
   116     }
       
   117 
       
   118 TInt CMusAvaSipAdapterImp::TimedOut( CSIPServerTransaction& aTransaction )
       
   119     {
       
   120     if ( iReturnCode != KErrNone )
       
   121         {
       
   122         return iReturnCode;
       
   123         }
       
   124     CleanServerTransaction();
       
   125     SetServerTransaction( aTransaction );
       
   126     return iReturnCode;
       
   127     }
       
   128 
       
   129 TInt CMusAvaSipAdapterImp::IncomingRequest( CSIPServerTransaction* aTransaction )
       
   130     {
       
   131     if ( iReturnCode != KErrNone )
       
   132         {
       
   133         return iReturnCode;
       
   134         }
       
   135     CleanServerTransaction();
       
   136     SetServerTransaction( aTransaction );
       
   137     return iReturnCode;
       
   138     }
       
   139 
       
   140 TInt CMusAvaSipAdapterImp::IncomingRequest( CSIPServerTransaction* aTransaction,
       
   141 					      CSIPDialog& aDialog )
       
   142     {
       
   143     if ( iReturnCode != KErrNone )
       
   144         {
       
   145         return iReturnCode;
       
   146         }
       
   147         
       
   148     CleanServerTransaction();
       
   149     SetServerTransaction( aTransaction );
       
   150     iDialog = &aDialog;
       
   151     return iReturnCode;
       
   152     }
       
   153 
       
   154 TInt CMusAvaSipAdapterImp::IncomingResponse( CSIPClientTransaction& aTransaction )
       
   155     {
       
   156     if ( iReturnCode != KErrNone )
       
   157         {
       
   158         return iReturnCode;
       
   159         }
       
   160     iClientTransaction = &aTransaction;
       
   161     return iReturnCode;
       
   162     }
       
   163 
       
   164 TInt CMusAvaSipAdapterImp::IncomingResponse (
       
   165 					CSIPClientTransaction& aTransaction,
       
   166 					CSIPDialogAssocBase& aDialogAssoc )
       
   167     {
       
   168     if ( iReturnCode != KErrNone )
       
   169         {
       
   170         return iReturnCode;
       
   171         }
       
   172     iClientTransaction = &aTransaction;
       
   173     iDialogAssoc = &aDialogAssoc;
       
   174     return iReturnCode;
       
   175     }
       
   176 
       
   177 TInt CMusAvaSipAdapterImp::IncomingResponse(
       
   178 					CSIPClientTransaction& aTransaction,
       
   179 					CSIPInviteDialogAssoc* aDialogAssoc )
       
   180     {
       
   181     if ( iReturnCode != KErrNone )
       
   182         {
       
   183         return iReturnCode;
       
   184         }
       
   185     iClientTransaction = &aTransaction;
       
   186     delete iInviteAssoc;
       
   187     iInviteAssoc = aDialogAssoc;
       
   188     return iReturnCode;
       
   189     }
       
   190 
       
   191 TInt CMusAvaSipAdapterImp::IncomingResponse( CSIPClientTransaction& aTransaction,
       
   192                            CSIPRegistrationBinding& aRegistration )
       
   193     {
       
   194     if ( iReturnCode != KErrNone )
       
   195         {
       
   196         return iReturnCode;
       
   197         }
       
   198     iClientTransaction = &aTransaction;
       
   199     iRegBinding = &aRegistration;
       
   200     return iReturnCode;
       
   201     }
       
   202 
       
   203 TInt CMusAvaSipAdapterImp::ErrorOccured( TInt aError,
       
   204                        CSIPTransactionBase& aTransaction )
       
   205     {
       
   206     if ( iReturnCode != KErrNone )
       
   207         {
       
   208         return iReturnCode;
       
   209         }
       
   210     iError = aError;
       
   211     iTransaction = &aTransaction;
       
   212     return iReturnCode;
       
   213     }
       
   214 
       
   215 TInt CMusAvaSipAdapterImp::ErrorOccured( TInt aError,
       
   216 				       CSIPClientTransaction& aTransaction,
       
   217 					   CSIPRegistrationBinding& aRegistration )
       
   218     {
       
   219     if ( iReturnCode != KErrNone )
       
   220         {
       
   221         return iReturnCode;
       
   222         }
       
   223     iError = aError;
       
   224     iClientTransaction = &aTransaction;
       
   225     iRegBinding = &aRegistration;
       
   226     return iReturnCode;
       
   227     }
       
   228      
       
   229 TInt CMusAvaSipAdapterImp::ErrorOccured( TInt aError,
       
   230 				       CSIPTransactionBase& aTransaction,
       
   231 					   CSIPDialogAssocBase& aDialogAssoc )
       
   232     {
       
   233     if ( iReturnCode != KErrNone )
       
   234         {
       
   235         return iReturnCode;
       
   236         }
       
   237     iError = aError;
       
   238     iTransaction = &aTransaction;
       
   239     iDialogAssoc = &aDialogAssoc;
       
   240     return iReturnCode;
       
   241     }
       
   242 
       
   243 TInt CMusAvaSipAdapterImp::ErrorOccured( TInt aError, CSIPRefresh& aSIPRefresh )
       
   244     {
       
   245     if ( iReturnCode != KErrNone )
       
   246         {
       
   247         return iReturnCode;
       
   248         }
       
   249     iError = aError;
       
   250     iRefresh = &aSIPRefresh;
       
   251     return iReturnCode;
       
   252     }
       
   253 
       
   254 TInt CMusAvaSipAdapterImp::ErrorOccured( TInt aError,
       
   255     CSIPRegistrationBinding& aRegistration )
       
   256     {
       
   257     if ( iReturnCode != KErrNone )
       
   258         {
       
   259         return iReturnCode;
       
   260         }
       
   261     iError = aError;
       
   262     iRegBinding = &aRegistration;
       
   263     return iReturnCode;
       
   264     }
       
   265 
       
   266 TInt CMusAvaSipAdapterImp::ErrorOccured( TInt aError,			
       
   267 					   CSIPDialogAssocBase& aDialogAssoc )
       
   268     {
       
   269     if ( iReturnCode != KErrNone )
       
   270         {
       
   271         return iReturnCode;
       
   272         }
       
   273     iError = aError;
       
   274     iDialogAssoc = &aDialogAssoc;
       
   275     return iReturnCode;
       
   276     }
       
   277 
       
   278 TInt CMusAvaSipAdapterImp::InviteCompleted( CSIPClientTransaction& aTransaction )
       
   279     {
       
   280     if ( iReturnCode != KErrNone )
       
   281         {
       
   282         return iReturnCode;
       
   283         }
       
   284     iClientTransaction = &aTransaction;
       
   285     return iReturnCode;
       
   286     }
       
   287 
       
   288 TInt CMusAvaSipAdapterImp::InviteCanceled( CSIPServerTransaction& aTransaction )
       
   289     {
       
   290     if ( iReturnCode != KErrNone )
       
   291         {
       
   292         return iReturnCode;
       
   293         }
       
   294     CleanServerTransaction();
       
   295     SetServerTransaction( aTransaction );
       
   296     return iReturnCode;
       
   297     }
       
   298                 
       
   299 TInt CMusAvaSipAdapterImp::ConnectionStateChanged( CSIPConnection::TState aState )
       
   300     {
       
   301     if ( iReturnCode != KErrNone )
       
   302         {
       
   303         return iReturnCode;
       
   304         }
       
   305     iState = aState;
       
   306     return iReturnCode;
       
   307     }
       
   308