|
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 "TCmdGetFCMessage.h" |
|
22 #include "CTcMCEContext.h" |
|
23 #include "CTcMCEReceived.h" |
|
24 #include <MCESession.h> |
|
25 |
|
26 |
|
27 void TCmdGetFCMessage::ExecuteL() |
|
28 { |
|
29 |
|
30 // -- Setup --------- |
|
31 |
|
32 // Get an item off the receive queue (waits until timeout if none is present) |
|
33 |
|
34 TInt timeout = ExtractIntegerL( KParamTimeout, KDefaultReceiveTimeout, |
|
35 EFalse ); |
|
36 CTcMCEReceived& item = iContext.ReceivedFCItemL( timeout ); |
|
37 |
|
38 if ( !item.Session() ) |
|
39 { |
|
40 User::Leave(KErrNotFound); // If first item doesn't contain a session |
|
41 } |
|
42 |
|
43 CMceSession* expectedSession = reinterpret_cast<CMceSession*> |
|
44 (GetObjectForIdL(KSessionId, ETrue)); |
|
45 |
|
46 if(item.Session() != expectedSession) |
|
47 { |
|
48 // If the first item's containing session is not the expected |
|
49 User::Leave(KErrNotFound); |
|
50 } |
|
51 |
|
52 // -- Execution ------ |
|
53 |
|
54 // -- Response creation ---------------------------------------------------- |
|
55 |
|
56 // Add Session |
|
57 AddIdResponseL( KSessionId, *(item.Session()) ); |
|
58 |
|
59 // Add FCMessage |
|
60 if (item.FCMessage()) |
|
61 { |
|
62 if (item.FCMessage()->Length() > 0) |
|
63 { |
|
64 AddTextResponseL(KResponseFCMessage, *(item.FCMessage())); |
|
65 } |
|
66 } |
|
67 |
|
68 // Add Error |
|
69 if ( item.Error() != KErrNone ) |
|
70 { |
|
71 AddIntegerResponseL( KResponseError, item.Error() ); |
|
72 } |
|
73 |
|
74 } |
|
75 |
|
76 TBool TCmdGetFCMessage::Match( const TTcIdentifier& aId ) |
|
77 { |
|
78 return TTcMceCommandBase::Match( aId, _L8("GetFCMessage") ); |
|
79 } |
|
80 |
|
81 TTcCommandBase* TCmdGetFCMessage::CreateL( MTcTestContext& aContext ) |
|
82 { |
|
83 return new( ELeave ) TCmdGetFCMessage( aContext ); |
|
84 } |