|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <telephonyaudiorouting.h> |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CTelephonyAudioRouting* CTelephonyAudioRouting::NewL( |
|
32 MTelephonyAudioRoutingObserver& aObserver) |
|
33 { |
|
34 CTelephonyAudioRouting* self = |
|
35 new (ELeave) CTelephonyAudioRouting( aObserver ); |
|
36 CleanupStack::PushL( self ); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(); |
|
39 return self; |
|
40 } |
|
41 |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CTelephonyAudioRouting::~CTelephonyAudioRouting() |
|
48 { |
|
49 iAvailableOutputs.Reset(); |
|
50 } |
|
51 |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 const TArray<CTelephonyAudioRouting::TAudioOutput>& |
|
58 CTelephonyAudioRouting::AvailableOutputs() |
|
59 { |
|
60 return iAvailableOutputs.Array(); |
|
61 } |
|
62 |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 CTelephonyAudioRouting::TAudioOutput CTelephonyAudioRouting::Output() |
|
69 { |
|
70 return iCurrentOutput; |
|
71 } |
|
72 |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CTelephonyAudioRouting::SetOutputL( TAudioOutput aOutput ) |
|
79 { |
|
80 __ASSERT_ALWAYS( aOutput != ENone, User::Leave( KErrArgument ) ); |
|
81 |
|
82 if ( iForceFailWithCode != KErrNone ) |
|
83 { |
|
84 TInt leaveValue = iForceFailWithCode; |
|
85 iForceFailWithCode = KErrNone; |
|
86 User::Leave( leaveValue ); |
|
87 } |
|
88 |
|
89 iCurrentOutput = aOutput; |
|
90 } |
|
91 |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 CTelephonyAudioRouting::TAudioOutput CTelephonyAudioRouting::PreviousOutput() |
|
98 { |
|
99 return iPreviousOutput; |
|
100 } |
|
101 |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 TInt CTelephonyAudioRouting::SetShowNote( TBool aMode ) |
|
108 { |
|
109 iShowNoteMode = aMode; |
|
110 return KErrNone; |
|
111 } |
|
112 |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 TInt CTelephonyAudioRouting::GetShowNote( TBool& aMode ) |
|
119 { |
|
120 aMode = iShowNoteMode; |
|
121 return KErrNone; |
|
122 } |
|
123 |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 CTelephonyAudioRouting::CTelephonyAudioRouting( |
|
130 MTelephonyAudioRoutingObserver& aObserver ) |
|
131 : iObserver( aObserver ) |
|
132 { |
|
133 iForceFailWithCode = KErrNone; |
|
134 iCurrentOutput = EHandset; |
|
135 } |
|
136 |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 void CTelephonyAudioRouting::ConstructL() |
|
143 { |
|
144 |
|
145 } |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |