|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : SIPExSIPEstablishedState.cpp 00004 * Part of : SIPExSIPEngine 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2004-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 // INCLUDE FILES 00017 #include "SIPExSIPEstablishedState.h" 00018 #include "SIPExSIPEngine.h" 00019 00020 #include <sipstrings.h> 00021 #include <SipStrConsts.h> 00022 00023 // ============================ MEMBER FUNCTIONS =============================== 00024 00025 // ----------------------------------------------------------------------------- 00026 // CSIPExSIPEstablishedState::CSIPExSIPEstablishedState 00027 // (other items were commented in a header). 00028 // ----------------------------------------------------------------------------- 00029 // 00030 CSIPExSIPEstablishedState::CSIPExSIPEstablishedState() 00031 { 00032 } 00033 00034 // ----------------------------------------------------------------------------- 00035 // CSIPExSIPEstablishedState::~CSIPExSIPEstablishedState 00036 // (other items were commented in a header). 00037 // ----------------------------------------------------------------------------- 00038 // 00039 EXPORT_C CSIPExSIPEstablishedState::~CSIPExSIPEstablishedState() 00040 { 00041 } 00042 00043 // ----------------------------------------------------------------------------- 00044 // CSIPExSIPEstablishedState::NewL() 00045 // (other items were commented in a header). 00046 // ----------------------------------------------------------------------------- 00047 // 00048 EXPORT_C CSIPExSIPEstablishedState* CSIPExSIPEstablishedState::NewL() 00049 { 00050 CSIPExSIPEstablishedState* self = 00051 new (ELeave) CSIPExSIPEstablishedState(); 00052 return self; 00053 } 00054 00055 // ----------------------------------------------------------------------------- 00056 // CSIPExSIPEstablishedState::LinkStates() 00057 // (other items were commented in a header). 00058 // ----------------------------------------------------------------------------- 00059 // 00060 void CSIPExSIPEstablishedState::LinkStates( 00061 CSIPExSIPStateBase& aTerminatingState, 00062 CSIPExSIPStateBase& aTerminatedState ) 00063 { 00064 iTerminatingState = &aTerminatingState; 00065 iTerminatedState = &aTerminatedState; 00066 } 00067 00068 00069 // ----------------------------------------------------------------------------- 00070 // CSIPExSIPEstablishedState::EndSessionL() 00071 // (other items were commented in a header). 00072 // ----------------------------------------------------------------------------- 00073 void CSIPExSIPEstablishedState::EndSessionL( CSIPExSIPEngine& aEngine ) 00074 { 00075 // Get the current Dialog Association 00076 CSIPInviteDialogAssoc& dialogAssoc = aEngine.DialogAssoc(); 00077 // Create the Message Elements object 00078 CSIPMessageElements* msgElements = aEngine.CreateMessageElementsLC(); 00079 00080 // Use the Dialog Association to send BYE request 00081 CSIPClientTransaction* tx = dialogAssoc.SendByeL( msgElements ); 00082 aEngine.SetClientTx( tx ); 00083 00084 CleanupStack::Pop( msgElements ); 00085 00086 aEngine.SetCurrentState( iTerminatingState ); 00087 } 00088 00089 00090 // ----------------------------------------------------------------------------- 00091 // CSIPExSIPEstablishedState::ByeReceivedL() 00092 // (other items were commented in a header). 00093 // ----------------------------------------------------------------------------- 00094 void CSIPExSIPEstablishedState::ByeReceivedL( 00095 CSIPExSIPEngine& aEngine, 00096 CSIPServerTransaction& aTransaction ) 00097 { 00098 // Create and send response 00099 CSIPResponseElements* elem = 00100 CSIPResponseElements::NewLC( 00101 200, SIPStrings::StringF( SipStrConsts::EPhraseOk ) ); 00102 aTransaction.SendResponseL( elem ); 00103 CleanupStack::Pop( elem ); 00104 00105 // Inform observer 00106 aEngine.Observer()->SessionEnded(); 00107 00108 // Set state ??? 00109 aEngine.SetCurrentState( iTerminatedState ); 00110 } 00111 00112 00113 // ----------------------------------------------------------------------------- 00114 // CSIPExSIPEstablishedState::ResponseReceivedL() 00115 // (other items were commented in a header). 00116 // ----------------------------------------------------------------------------- 00117 void CSIPExSIPEstablishedState::ResponseReceivedL( 00118 CSIPExSIPEngine& aEngine, 00119 CSIPClientTransaction& aTransaction ) 00120 { 00121 // We might receive some 200 (OK) responses from the network 00122 // after the session has been established. These should be 00123 // ACKed, other responses indicate errors. 00124 00125 const CSIPResponseElements* respElem = aTransaction.ResponseElements(); 00126 00127 TUint statusCode = respElem->StatusCode(); 00128 00129 if ( statusCode >= 200 && statusCode < 300 ) 00130 { 00131 // Send ACK to remote party 00132 CSIPInviteDialogAssoc& dialogAssoc = aEngine.DialogAssoc(); 00133 dialogAssoc.SendAckL( aTransaction ); 00134 } 00135 else 00136 { 00137 aEngine.Observer()->EngineError( statusCode ); 00138 } 00139 } 00140 00141 00142 // ----------------------------------------------------------------------------- 00143 // CSIPExSIPStateBase::AckReceivedL() 00144 // (other items were commented in a header). 00145 // ----------------------------------------------------------------------------- 00146 void CSIPExSIPEstablishedState::AckReceivedL( 00147 CSIPExSIPEngine& aEngine, 00148 CSIPServerTransaction& /* aTransaction */) 00149 { 00150 aEngine.Observer()->InviteAcceptedByUs(); 00151 } 00152 00153 // End of file
|
© Nokia 2006 |