|
1 /* |
|
2 * Copyright (c) 2006 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: Controller |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "mccaudiorouter.h" |
|
23 #include "mmccinterfacedef.h" |
|
24 #include "mccsubcontrollerlogs.h" |
|
25 #include <AudioOutput.h> |
|
26 |
|
27 // EXTERNAL DATA STRUCTURES |
|
28 |
|
29 // EXTERNAL FUNCTION PROTOTYPES |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // MACROS |
|
34 |
|
35 // LOCAL CONSTANTS AND MACROS |
|
36 |
|
37 // MODULE DATA STRUCTURES |
|
38 |
|
39 // LOCAL FUNCTION PROTOTYPES |
|
40 |
|
41 // FORWARD DECLARATIONS |
|
42 |
|
43 // ============================= LOCAL FUNCTIONS =============================== |
|
44 |
|
45 |
|
46 // ============================ MEMBER FUNCTIONS =============================== |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CMccAudioRouter::NewL |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CMccAudioRouter* CMccAudioRouter::NewL( CMMFDevSound& aDevSound ) |
|
53 { |
|
54 CMccAudioRouter* self = new ( ELeave ) CMccAudioRouter; |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL( aDevSound ); |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CMccAudioRouter::~CMccAudioRouter |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CMccAudioRouter::~CMccAudioRouter() |
|
66 { |
|
67 delete iAudioRouter; |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CMccAudioRouter::SetAudioRouteL |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 void CMccAudioRouter::SetAudioRouteL( |
|
75 TUint32 aRoutingDestination ) |
|
76 { |
|
77 __SUBCONTROLLER_INT1( "CMccAudioRouter::SetAudioRouteL, route to:", |
|
78 aRoutingDestination ); |
|
79 |
|
80 __ASSERT_ALWAYS( iRoutingSupported, User::Leave( KErrNotSupported ) ); |
|
81 |
|
82 // Mcc audio route constants imitate enumerations defined in audiooutput.h |
|
83 CAudioOutput::TAudioOutputPreference output = CAudioOutput::ENoPreference; |
|
84 switch ( aRoutingDestination ) |
|
85 { |
|
86 case KMccAudioToPrivate: |
|
87 { |
|
88 output = CAudioOutput::EPrivate; |
|
89 break; |
|
90 } |
|
91 case KMccAudioToPublic: |
|
92 { |
|
93 output = CAudioOutput::EPublic; |
|
94 break; |
|
95 } |
|
96 default: |
|
97 { |
|
98 User::Leave( KErrArgument ); |
|
99 break; |
|
100 } |
|
101 } |
|
102 |
|
103 iAudioRouter->SetAudioOutputL( output ); |
|
104 |
|
105 __SUBCONTROLLER( "CMccAudioRouter::SetAudioRouteL, exit" ); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CMccAudioRouter::GetAudioRouteL |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 void CMccAudioRouter::GetAudioRouteL( |
|
113 TUint32& aRoutingDestination ) |
|
114 { |
|
115 __SUBCONTROLLER( "CMccAudioRouter::GetAudioRouteL"); |
|
116 |
|
117 __ASSERT_ALWAYS( iRoutingSupported, User::Leave( KErrNotSupported ) ); |
|
118 |
|
119 // Mcc audio route constants imitate enumerations defined in audiooutput.h |
|
120 aRoutingDestination = (TUint32)iAudioRouter->AudioOutput(); |
|
121 |
|
122 __SUBCONTROLLER( "CMccAudioRouter::GetAudioRouteL, exit"); |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CMccAudioRouter::ConstructL |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 void CMccAudioRouter::ConstructL( CMMFDevSound& aDevSound ) |
|
130 { |
|
131 TRAPD( err, iAudioRouter = CAudioOutput::NewL( aDevSound ) ); |
|
132 iRoutingSupported = ( !err && iAudioRouter ); |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CMccAudioRouter::CMccAudioRouter |
|
137 // C++ default constructor can NOT contain any code, that |
|
138 // might leave. |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 CMccAudioRouter::CMccAudioRouter() |
|
142 { |
|
143 } |
|
144 |