multimediacommsengine/tsrc/testdriver/siptester/src/TCmdUpdateRefresh.cpp
changeset 0 1bce908db942
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/multimediacommsengine/tsrc/testdriver/siptester/src/TCmdUpdateRefresh.cpp	Tue Feb 02 01:04:58 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation
+*
+*/
+
+#include <sipclienttransaction.h>
+#include <sipmessageelements.h>
+#include <siprefresh.h>
+#include <sipregistrationbinding.h>
+#include <sipsubscribedialogassoc.h>
+
+#include "TCmdUpdateRefresh.h"
+#include "SIPConstants.h"
+
+/**
+ * INPUT:
+ *   Headers:		Content-Type*, Content-Encoding*, Expires*
+ *   Parameters:	Content*
+ *   IDs:			RefreshId*, RegistrationId*, SubscribeDialogId*
+ *
+ * OUTPUT:
+ *   Parameters:	-
+ *   IDs:			TransactionId
+ */
+void TCmdUpdateRefresh::ExecuteL()
+	{
+	// -- Setup ---------------------------------------------------------------
+
+	// Get SIP objects from registry
+	CSIPRefresh* refresh = GetRefreshL( EFalse );
+	CSIPRegistrationBinding* registration = GetRegistrationL( EFalse );
+	CSIPSubscribeDialogAssoc* dialogAssoc = GetSubscribeDialogAssocL( EFalse );
+
+	// Get the refresh object from a registration or from a dialog association
+	// if it's  not defined as such.
+	if( !refresh )
+		{
+		if( registration )
+			{
+			refresh = const_cast< CSIPRefresh* >( registration->SIPRefresh() );
+			}
+		else if( dialogAssoc )
+			{
+			refresh = const_cast< CSIPRefresh* >( dialogAssoc->SIPRefresh() );
+			}
+		else
+			{
+			User::Leave( KTcErrMandatoryIdNotFound );
+			}
+		}
+
+	// Extract both headers (that are still left) and content.
+	CSIPMessageElements* elements = ExtractHeadersAndContentLC();
+
+	// -- Execution -----------------------------------------------------------
+
+	// Start refresh update
+	CSIPClientTransaction* transaction = refresh->UpdateL( elements );
+	CleanupStack::Pop( elements );
+
+	// -- Response creation ---------------------------------------------------
+
+	AddIdResponseL( KTransactionId, transaction );
+	}
+
+TBool TCmdUpdateRefresh::Match( const TTcIdentifier& aId )
+	{
+	return TTcSIPCommandBase::Match( aId, _L8("UpdateRefresh") );
+	}
+
+TTcCommandBase* TCmdUpdateRefresh::CreateL( MTcTestContext& aContext )
+	{
+	return new( ELeave ) TCmdUpdateRefresh( aContext );
+	}
+