multimediacommsengine/mmcesrv/mmceevent/src/mceeventsubscribemoidlestate.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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:    Initial state for MO event.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <siprefresh.h>
       
    24 #include <sipsubscribedialogassoc.h>
       
    25 #include <sipmessageelements.h>
       
    26 #include "mceeventsubscribemoidlestate.h"
       
    27 #include "mcesipevent.h"
       
    28 #include "mcesipeventhelper.h"
       
    29 #include "mceeventslogs.h"
       
    30 
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CMceEventSubscribeMoIdleState::CMceEventSubscribeMoIdleState
       
    35 // C++ default constructor can NOT contain any code, that
       
    36 // might leave.
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CMceEventSubscribeMoIdleState::CMceEventSubscribeMoIdleState()
       
    40     {
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CMceEventSubscribeMoIdleState::~CMceEventSubscribeMoIdleState
       
    45 // Destructor
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CMceEventSubscribeMoIdleState::~CMceEventSubscribeMoIdleState()
       
    49     {
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CMceEventSubscribeMoIdleState::ProcessSubscribeStateL
       
    54 // Ápply concrete state.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 void CMceEventSubscribeMoIdleState::HandleL( CMceComEvent& aEvent )
       
    58     {  
       
    59     MCEEVENTS_DEBUG("CMceEventSubscribeMoIdleState::ProcessSubscribeStateL, Entry");
       
    60     User::LeaveIfError( aEvent.SIPEvent().Dialog() ?
       
    61         KErrNone : KMceEventStateError );
       
    62         
       
    63     User::LeaveIfError( aEvent.SIPEvent().Dialog()->Type() == 
       
    64         SIPStrings::StringF( SipStrConsts::ESubscribe ) ?
       
    65         KErrNone : KMceEventStateError );
       
    66         
       
    67     // create message elements.
       
    68     CSIPMessageElements* msgElem = MCESIPEventHelper::CreateMessageElementsLC(
       
    69                                                     aEvent,
       
    70                                                     SipStrConsts::ESubscribe,
       
    71                                                     aEvent.RefreshInterval() );
       
    72     CleanupStack::Pop( msgElem );		
       
    73 	CleanupStack::PushL( msgElem );					    
       
    74     // create refresh    
       
    75     CSIPRefresh* refresh = CSIPRefresh::NewL();
       
    76     CleanupStack::PushL( refresh );
       
    77     
       
    78     // send subscribe
       
    79     CSIPClientTransaction* transaction = 
       
    80         static_cast<CSIPSubscribeDialogAssoc*> 
       
    81         ( aEvent.SIPEvent().Dialog())->SendSubscribeL( msgElem, refresh );
       
    82     CleanupStack::Pop( refresh );
       
    83     CleanupStack::Pop( msgElem );
       
    84    	CleanupStack::PushL( transaction );
       
    85     // save the transaction    
       
    86     aEvent.SIPEvent().SetPendingTransactionL( transaction );
       
    87 	CleanupStack::Pop( transaction );
       
    88     // Set the next state
       
    89     aEvent.EventContext().SetCurrentStateL( aEvent, 
       
    90                                             KMceEstablishingEventStateIndex );
       
    91 	MCEEVENTS_DEBUG("CMceEventSubscribeMoIdleState::ProcessSubscribeStateL, Exit");                                            
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CMceEventSubscribeMoIdleState::HandleReceiveRequestL
       
    96 // Ápply concrete state.
       
    97 // Be noticed that it will be also update, unsubscribe
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 void CMceEventSubscribeMoIdleState::HandleReceiveRequestL(
       
   101 												CMceComEvent& /*aEvent*/ )
       
   102 	{
       
   103 	User::Leave( KMceEventStateError );
       
   104 	}
       
   105 	
       
   106 // -----------------------------------------------------------------------------
       
   107 // CMceEventSubscribeMoIdleState::HandleResponseReceivedL
       
   108 // Ápply concrete state.
       
   109 // Be noticed that it will be also update, unsubscribe
       
   110 // -----------------------------------------------------------------------------
       
   111 //	
       
   112 void CMceEventSubscribeMoIdleState::HandleResponseReceivedL(
       
   113 												CMceComEvent& /*aEvent*/ )
       
   114 	{
       
   115 	User::Leave( KMceEventStateError );
       
   116 	}
       
   117 
       
   118 //  End of File