|
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 "TCmdSetSourceActivity.h" |
|
22 #include "CTcMCEContext.h" |
|
23 |
|
24 #include <MceMediaSource.h> |
|
25 |
|
26 void TCmdSetSourceActivity::ExecuteL() |
|
27 { |
|
28 // ---------- Setup -------------------------------------------------------- |
|
29 |
|
30 // Get source |
|
31 CMceMediaSource* source = reinterpret_cast<CMceMediaSource*> |
|
32 (GetObjectForIdL(KSourceId, ETrue)); |
|
33 |
|
34 TBool enable = ExtractBooleanL( KParamActivity, ETrue ); |
|
35 |
|
36 // ---------- Execution ---------------------------------------------------- |
|
37 |
|
38 if ( enable ) |
|
39 { |
|
40 if ( !source->IsEnabled() ) |
|
41 { |
|
42 source->EnableL(); |
|
43 } |
|
44 } |
|
45 else |
|
46 { |
|
47 if ( source->IsEnabled() ) |
|
48 { |
|
49 source->DisableL(); |
|
50 } |
|
51 } |
|
52 |
|
53 |
|
54 // ---------- Response creation -------------------------------------------- |
|
55 |
|
56 AddIdResponseL( KSourceId, *source ); |
|
57 AddBooleanResponseL( KResponseActivity, source->IsEnabled() ); |
|
58 |
|
59 |
|
60 } |
|
61 |
|
62 TBool TCmdSetSourceActivity::Match( const TTcIdentifier& aId ) |
|
63 { |
|
64 return TTcMceCommandBase::Match( aId, _L8("SetSourceActivity") ); |
|
65 } |
|
66 |
|
67 TTcCommandBase* TCmdSetSourceActivity::CreateL( MTcTestContext& aContext ) |
|
68 { |
|
69 return new( ELeave ) TCmdSetSourceActivity( aContext ); |
|
70 } |