|
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: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "MCEConstants.h" |
|
21 #include "TCmdSendRejectRefer.h" |
|
22 #include "CTcMCEContext.h" |
|
23 |
|
24 #include <MceInRefer.h> |
|
25 |
|
26 void TCmdSendRejectRefer::ExecuteL() |
|
27 { |
|
28 // ---------- Setup -------------------------------------------------------- |
|
29 |
|
30 // Get refer |
|
31 CMceInRefer* refer = reinterpret_cast<CMceInRefer*> |
|
32 (GetObjectForIdL(KReferId, ETrue)); |
|
33 |
|
34 // ---------- Execution ---------------------------------------------------- |
|
35 |
|
36 // Get reasonphrase |
|
37 TPtrC8 reason = ExtractTextL(KParamReasonPhrase, EFalse); |
|
38 |
|
39 // Get statuscode |
|
40 TInt status = ExtractIntegerL(KParamStatusCode, 0, EFalse); |
|
41 |
|
42 // Get Headers |
|
43 CDesC8Array* headers = ExtractHeadersL( EFalse ); |
|
44 CleanupStack::PushL(headers); |
|
45 |
|
46 // Reject |
|
47 if( reason == KNullDesC8 && status == 0 && !headers ) |
|
48 { |
|
49 CleanupStack::PopAndDestroy(headers); |
|
50 refer->RejectL(); |
|
51 } |
|
52 else |
|
53 { |
|
54 refer->RespondL( reason, status, headers ); |
|
55 CleanupStack::Pop(headers); |
|
56 } |
|
57 |
|
58 CMceRefer::TState state = refer->State(); |
|
59 |
|
60 // ---------- Response creation -------------------------------------------- |
|
61 |
|
62 AddIdResponseL( KReferId, *refer ); |
|
63 |
|
64 // Add refer state |
|
65 AddIntegerResponseL( KResponseReferState, state ); |
|
66 AddTextualReferStateL( state ); |
|
67 |
|
68 } |
|
69 |
|
70 TBool TCmdSendRejectRefer::Match( const TTcIdentifier& aId ) |
|
71 { |
|
72 return TTcMceCommandBase::Match( aId, _L8("SendRejectRefer") ); |
|
73 } |
|
74 |
|
75 TTcCommandBase* TCmdSendRejectRefer::CreateL( MTcTestContext& aContext ) |
|
76 { |
|
77 return new( ELeave ) TCmdSendRejectRefer( aContext ); |
|
78 } |