|
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 "TCmdGetSourceStatus.h" |
|
22 #include "CTcMCEContext.h" |
|
23 #include <MceMediaStream.h> |
|
24 #include <MceAudioStream.h> |
|
25 #include <MceVideoStream.h> |
|
26 |
|
27 #include <MceMediaSource.h> |
|
28 #include <MceCameraSource.h> |
|
29 #include <MceFileSource.h> |
|
30 #include <MceMicSource.h> |
|
31 #include <MceRtpSource.h> |
|
32 |
|
33 void TCmdGetSourceStatus::ExecuteL() |
|
34 { |
|
35 // ---------- Setup -------------------------------------------------------- |
|
36 |
|
37 // Get stream |
|
38 CMceMediaStream* mediaStream = reinterpret_cast<CMceMediaStream*> |
|
39 (GetObjectForIdL(KStreamId, ETrue)); |
|
40 |
|
41 CMceMediaStream* stream = NULL; |
|
42 |
|
43 if ( mediaStream->Type() == KMceAudio ) |
|
44 { |
|
45 stream = dynamic_cast<CMceAudioStream*>(mediaStream); |
|
46 } |
|
47 else if( mediaStream->Type() == KMceVideo ) |
|
48 { |
|
49 stream = dynamic_cast<CMceVideoStream*>(mediaStream); |
|
50 } |
|
51 else |
|
52 { |
|
53 User::Leave( KErrNotSupported ); |
|
54 } |
|
55 |
|
56 |
|
57 // ---------- Execution ---------------------------------------------------- |
|
58 AddIdResponseL( KStreamId, *mediaStream ); |
|
59 |
|
60 // Get source |
|
61 const CMceMediaSource* source = stream->Source(); |
|
62 |
|
63 TBool sourceState = EFalse; |
|
64 |
|
65 if( source->Type() == KMceCameraSource) |
|
66 { |
|
67 sourceState = source->IsEnabled(); |
|
68 AddBooleanResponseL( KValueSourceCamera, sourceState); |
|
69 } |
|
70 else if( source->Type() == KMceFileSource) |
|
71 { |
|
72 sourceState = source->IsEnabled(); |
|
73 AddBooleanResponseL( KValueSourceFile, sourceState); |
|
74 } |
|
75 else if( source->Type() == KMceMicSource) |
|
76 { |
|
77 sourceState = source->IsEnabled(); |
|
78 AddBooleanResponseL( KValueSourceMic,sourceState); |
|
79 } |
|
80 else if( source->Type() == KMceRTPSource) |
|
81 { |
|
82 sourceState = source->IsEnabled(); |
|
83 AddBooleanResponseL( KValueSourceRTP,sourceState); |
|
84 } |
|
85 else |
|
86 { |
|
87 |
|
88 AddBooleanResponseL( KValueSourceUnknown,sourceState); |
|
89 } |
|
90 |
|
91 |
|
92 // ---------- Response creation -------------------------------------------- |
|
93 |
|
94 AddIdResponseL( KStreamId, *stream ); |
|
95 // Sink added to response during execution |
|
96 |
|
97 } |
|
98 |
|
99 TBool TCmdGetSourceStatus::Match( const TTcIdentifier& aId ) |
|
100 { |
|
101 return TTcMceCommandBase::Match( aId, _L8("GetSourceStatus") ); |
|
102 } |
|
103 |
|
104 TTcCommandBase* TCmdGetSourceStatus::CreateL( MTcTestContext& aContext ) |
|
105 { |
|
106 return new( ELeave ) TCmdGetSourceStatus( aContext ); |
|
107 } |