author | hgs |
Mon, 23 Aug 2010 14:17:50 +0300 | |
changeset 44 | 0a3ad94fc71c |
parent 39 | ac7857bd5fdb |
child 57 | 21be958eb3ce |
permissions | -rw-r--r-- |
24 | 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 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
18 |
// System includes |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
19 |
#include <ncp_feature_settings.hrh> |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
20 |
|
24 | 21 |
// User includes |
22 |
#include "cradioaccessoryobserver.h" |
|
23 |
#include "mradioheadseteventobserver.h" |
|
24 |
#include "cradioenginelogger.h" |
|
25 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
26 |
#ifdef ASW_CORE_AUDIO_PLATFORM_VERSION // Nokia specific adaptation |
39 | 27 |
//#include <accpolpropgenericid.h> |
28 |
#include <AccPolGenericIdDefinitions.h> |
|
35 | 29 |
|
30 |
#ifndef __WINS__ |
|
39 | 31 |
// See accpolpropgenericid.h definitions KPCNokiaAV == 0x20000, |
32 |
// Forced to use hard coded value here to avoid including from epoc32/include/internal |
|
33 |
const TUint KPhysicalConnectionBitmask = 0x20000 | KPCWired; |
|
35 | 34 |
|
35 |
#else |
|
39 | 36 |
// See accpolpropgenericid.h definitions KPCNokiaAV == 0x20000, |
37 |
// Forced to use hard coded value here to avoid including from epoc32/include/internal |
|
38 |
const TUint KPhysicalConnectionBitmask = 0x20000 | KPCWired; |
|
35 | 39 |
|
40 |
#endif // __WINS__ |
|
41 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
42 |
#else |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
43 |
const TUint KPhysicalConnectionBitmask = KPCWired; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
44 |
#endif // ASW_CORE_AUDIO_PLATFORM_VERSION |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
45 |
|
24 | 46 |
// --------------------------------------------------------------------------- |
47 |
// |
|
48 |
// --------------------------------------------------------------------------- |
|
49 |
// |
|
50 |
CRadioAccessoryObserver::CRadioAccessoryObserver() |
|
51 |
: CActive( CActive::EPriorityStandard ) |
|
52 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
53 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 54 |
} |
55 |
||
56 |
||
57 |
// --------------------------------------------------------------------------- |
|
58 |
// |
|
59 |
// --------------------------------------------------------------------------- |
|
60 |
// |
|
61 |
void CRadioAccessoryObserver::ConstructL() |
|
62 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
63 |
LEVEL2( LOG_METHOD_AUTO ); |
24 | 64 |
User::LeaveIfError( iAccessoryServer.Connect() ); |
65 |
||
66 |
// Creates a new sub-session within an existing session. |
|
67 |
User::LeaveIfError( iAccessoryConn.CreateSubSession( iAccessoryServer ) ); |
|
68 |
User::LeaveIfError( iAccessoryConn.GetAccessoryConnectionStatus( iAccPolGenIdArr ) ); |
|
69 |
||
70 |
TInt nroChangedAccessories( 0 ); |
|
71 |
UpdateCurrentAccessoriesL( nroChangedAccessories ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
72 |
LOG_FORMAT( "Found %d wired/BT accessories ( %d accessories in total ).", |
24 | 73 |
nroChangedAccessories, iAccPolGenIdArr.Count() ); |
74 |
CActiveScheduler::Add( this ); |
|
75 |
// Accessory is always listened |
|
76 |
iAccessoryConn.NotifyAccessoryConnectionStatusChanged( iStatus, iAccPolGenIdArr ); |
|
77 |
SetActive(); |
|
78 |
} |
|
79 |
||
80 |
// --------------------------------------------------------------------------- |
|
81 |
// |
|
82 |
// --------------------------------------------------------------------------- |
|
83 |
// |
|
84 |
CRadioAccessoryObserver* CRadioAccessoryObserver::NewL() |
|
85 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
86 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 87 |
CRadioAccessoryObserver* self = new( ELeave ) CRadioAccessoryObserver; |
88 |
CleanupStack::PushL( self ); |
|
89 |
self->ConstructL(); |
|
90 |
CleanupStack::Pop( self ); |
|
91 |
return self; |
|
92 |
} |
|
93 |
||
94 |
// --------------------------------------------------------------------------- |
|
95 |
// |
|
96 |
// --------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
CRadioAccessoryObserver::~CRadioAccessoryObserver() |
|
99 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
100 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 101 |
Cancel(); |
102 |
iAccessoryConn.CloseSubSession(); |
|
103 |
iAccessoryServer.Close(); |
|
104 |
iSavedAccessories.Close(); |
|
105 |
} |
|
106 |
||
107 |
// --------------------------------------------------------------------------- |
|
108 |
// |
|
109 |
// --------------------------------------------------------------------------- |
|
110 |
// |
|
111 |
TBool CRadioAccessoryObserver::FindAccessoryL( TBool aAcceptOnlyHeadset, TAccAudioOutPutType& aOutputType ) const |
|
112 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
113 |
LEVEL2( LOG_METHOD_AUTO ); |
24 | 114 |
#ifdef __WINS__ |
115 |
TBool accessoryFound = ETrue; |
|
116 |
aAcceptOnlyHeadset = ETrue; |
|
117 |
aOutputType = EAccAudioOutPutTypePrivate; |
|
118 |
#else |
|
119 |
TBool accessoryFound = EFalse; |
|
120 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
121 |
LOG_FORMAT( "Connected accessories count = %d", iAccPolGenIdArr.Count()); |
38 | 122 |
for ( TInt i = 0; i < iAccPolGenIdArr.Count() && !accessoryFound; ++i ) |
24 | 123 |
{ |
124 |
TAccPolGenericID accPolGenId = iAccPolGenIdArr.GetGenericIDL( i ); |
|
125 |
||
126 |
//Check if physical connection is of acceptable type |
|
127 |
TUint32 physicalConnectionCaps = accPolGenId.PhysicalConnectionCaps(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
128 |
if ( physicalConnectionCaps & KPhysicalConnectionBitmask || physicalConnectionCaps & KPCBluetooth ) |
24 | 129 |
{ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
130 |
LOG_FORMAT( "is wired or BT ( physicalConnectionCaps = %d )", physicalConnectionCaps ); |
24 | 131 |
|
132 |
if ( !aAcceptOnlyHeadset ) |
|
133 |
{ |
|
134 |
accessoryFound = ETrue; |
|
135 |
} |
|
136 |
//Get device type ( check if is HeadSet ) |
|
137 |
TUint32 deviceType = accPolGenId.DeviceTypeCaps(); |
|
138 |
if ( deviceType & KDTHeadset ) |
|
139 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
140 |
LOG_FORMAT( "is HeadSet( deviceType = %d )", deviceType ); |
24 | 141 |
if ( !IsLineoutConnectedL( accPolGenId ) ) |
142 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
143 |
LOG( "Is a normal headSet" ); |
24 | 144 |
accessoryFound = ETrue; |
145 |
} |
|
146 |
} |
|
147 |
else if ( deviceType & KDTLoopset ) |
|
148 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
149 |
LOG_FORMAT( "is Loopset( deviceType = %d )", deviceType ); |
24 | 150 |
accessoryFound = ETrue; |
151 |
} |
|
152 |
else |
|
153 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
154 |
LOG_FORMAT( "is NOT HeadSet or Loopset( deviceType = %d )", deviceType ); |
24 | 155 |
} |
156 |
||
157 |
if ( accessoryFound ) |
|
158 |
{ |
|
159 |
// get the public/private status |
|
160 |
TAccPolNameRecord nameRecord; |
|
161 |
nameRecord.SetNameL( KAccAudioOutputType ); |
|
162 |
||
163 |
TAccValueTypeTInt audioOutputTypeValue; |
|
164 |
iAccessoryConn.GetValueL( accPolGenId, nameRecord, audioOutputTypeValue ); |
|
165 |
||
166 |
aOutputType = static_cast<TAccAudioOutPutType>( audioOutputTypeValue.iValue ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
167 |
LOG_FORMAT( "AudioOutputType = %d", aOutputType ); |
24 | 168 |
} |
169 |
} |
|
170 |
else |
|
171 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
172 |
LOG_FORMAT( "is NOT wired or BT ( physicalConnectionCaps = %d )", physicalConnectionCaps ); |
24 | 173 |
} |
174 |
} |
|
175 |
#endif |
|
176 |
return accessoryFound; |
|
177 |
} |
|
178 |
||
179 |
// --------------------------------------------------------------------------- |
|
180 |
// |
|
181 |
// --------------------------------------------------------------------------- |
|
182 |
// |
|
183 |
TBool CRadioAccessoryObserver::IsHeadsetConnectedL() const |
|
184 |
{ |
|
185 |
TAccAudioOutPutType audioOutputType( EAccAudioOutPutTypePrivate ); |
|
186 |
return FindAccessoryL( ETrue , audioOutputType ); |
|
187 |
} |
|
188 |
||
189 |
// --------------------------------------------------------------------------- |
|
190 |
// |
|
191 |
// --------------------------------------------------------------------------- |
|
192 |
// |
|
193 |
TBool CRadioAccessoryObserver::IsLineoutConnectedL( TAccPolGenericID& aAccPolGenId ) const |
|
194 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
195 |
LEVEL2( LOG_METHOD_AUTO ); |
24 | 196 |
TBool isLineOut( EFalse ); |
197 |
||
198 |
CAccPolSubblockNameArray* nameArray = CAccPolSubblockNameArray::NewL(); |
|
199 |
CleanupStack::PushL( nameArray ); |
|
200 |
iAccessoryConn.GetSubblockNameArrayL( aAccPolGenId, *nameArray ); |
|
201 |
||
202 |
TBool isAudioOutValue = nameArray->HasName( KAccAudioOut ); |
|
203 |
CleanupStack::PopAndDestroy( nameArray ); |
|
204 |
if ( isAudioOutValue ) |
|
205 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
206 |
LOG_FORMAT( "isAudioOutValue = ( %d )", isAudioOutValue ); |
24 | 207 |
|
208 |
TAccPolNameRecord nameRecord; |
|
209 |
nameRecord.SetNameL( KAccAudioOut ); |
|
210 |
||
211 |
//Check if connected accessory is LineOut |
|
212 |
TAccValueTypeTInt audioOutValue; |
|
213 |
iAccessoryConn.GetValueL( aAccPolGenId, nameRecord, audioOutValue ); |
|
214 |
||
215 |
LOG( "CRadioAccessoryObserver::IsLineoutConnectedL - GetValueL() - OK" ); |
|
216 |
if ( TAccAudioOutLineout == audioOutValue.iValue ) |
|
217 |
{ |
|
218 |
//is lineout |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
219 |
LOG_FORMAT( "Accessory is LineOut( audioOutValue = %d )", audioOutValue.iValue ); |
24 | 220 |
isLineOut = ETrue; |
221 |
} |
|
222 |
} |
|
223 |
return isLineOut; |
|
224 |
} |
|
225 |
||
226 |
// --------------------------------------------------------------------------- |
|
227 |
// |
|
228 |
// --------------------------------------------------------------------------- |
|
229 |
// |
|
230 |
void CRadioAccessoryObserver::UpdateCurrentAccessoriesL( TInt& aNroChangedAccessories ) |
|
231 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
232 |
LEVEL2( LOG_METHOD_AUTO ); |
24 | 233 |
// first check, the removed accessories. |
234 |
TInt removedAccessories = CountRemovedAccessoriesL(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
235 |
LOG_FORMAT( "- %d accessories removed.", removedAccessories ); |
24 | 236 |
aNroChangedAccessories += removedAccessories; |
237 |
TInt addedAccessories = CountAddedAccessoriesL(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
238 |
LOG_FORMAT( "- %d accessories added.", addedAccessories ); |
24 | 239 |
aNroChangedAccessories += addedAccessories; |
240 |
||
241 |
iSavedAccessories.Reset(); |
|
242 |
||
38 | 243 |
for ( TInt i = 0; i < iAccPolGenIdArr.Count(); ++i ) |
24 | 244 |
{ |
245 |
iSavedAccessories.AppendL( iAccPolGenIdArr.GetGenericIDL( i ) ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
246 |
LOG_FORMAT( "- accessory in slot %d: %d", |
24 | 247 |
i, iAccPolGenIdArr.GetGenericIDL( i ).UniqueID() ); |
248 |
} |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
249 |
LOG_FORMAT( "- %d accessories in total.", iSavedAccessories.Count() ); |
24 | 250 |
} |
251 |
||
252 |
// --------------------------------------------------------------------------- |
|
253 |
// |
|
254 |
// --------------------------------------------------------------------------- |
|
255 |
// |
|
256 |
TInt CRadioAccessoryObserver::CountRemovedAccessoriesL() const |
|
257 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
258 |
LEVEL2( LOG_METHOD_AUTO ); |
24 | 259 |
TInt removedAccessories( 0 ); |
260 |
||
38 | 261 |
for ( TInt i = 0; i < iSavedAccessories.Count(); ++i ) |
24 | 262 |
{ |
263 |
TAccPolGenericID savedAcc = iSavedAccessories[i]; |
|
264 |
||
265 |
TUint32 physicalConnectionCaps = savedAcc.PhysicalConnectionCaps(); |
|
266 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
267 |
if ( physicalConnectionCaps & KPhysicalConnectionBitmask || physicalConnectionCaps & KPCBluetooth ) |
24 | 268 |
{ |
269 |
TBool found( EFalse ); |
|
270 |
||
271 |
for ( TInt j = 0; j < iAccPolGenIdArr.Count() && !found; j++ ) |
|
272 |
{ |
|
273 |
TAccPolGenericID freshAcc = iAccPolGenIdArr.GetGenericIDL( j ); |
|
274 |
if ( freshAcc.UniqueID() == savedAcc.UniqueID() ) |
|
275 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
276 |
LOG_FORMAT( "- Accessory with id = %d found.", savedAcc.UniqueID() ); |
24 | 277 |
found = ETrue; |
278 |
} |
|
279 |
} |
|
280 |
if ( !found ) |
|
281 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
282 |
LOG_FORMAT( "- Accessory with id = %d removed.", savedAcc.UniqueID() ); |
24 | 283 |
removedAccessories++; |
284 |
} |
|
285 |
} |
|
286 |
} |
|
287 |
return removedAccessories; |
|
288 |
} |
|
289 |
||
290 |
// --------------------------------------------------------------------------- |
|
291 |
// |
|
292 |
// --------------------------------------------------------------------------- |
|
293 |
// |
|
294 |
TInt CRadioAccessoryObserver::CountAddedAccessoriesL() const |
|
295 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
296 |
LEVEL2( LOG_METHOD_AUTO ); |
24 | 297 |
TInt addedAccessories( 0 ); |
298 |
||
38 | 299 |
for ( TInt i = 0; i < iAccPolGenIdArr.Count(); ++i ) |
24 | 300 |
{ |
301 |
TAccPolGenericID freshAcc = iAccPolGenIdArr.GetGenericIDL( i ); |
|
302 |
||
303 |
TUint32 physicalConnectionCaps = freshAcc.PhysicalConnectionCaps(); |
|
304 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
305 |
if ( physicalConnectionCaps & KPhysicalConnectionBitmask || physicalConnectionCaps & KPCBluetooth ) |
24 | 306 |
{ |
307 |
TBool found( EFalse ); |
|
308 |
||
309 |
for ( TInt j = 0; j < iSavedAccessories.Count() && !found; j++ ) |
|
310 |
{ |
|
311 |
TAccPolGenericID savedAcc = iSavedAccessories[j]; |
|
312 |
if ( savedAcc.UniqueID() == freshAcc.UniqueID() ) |
|
313 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
314 |
LOG_FORMAT( "- Accessory with id = %d found.", freshAcc.UniqueID() ); |
24 | 315 |
found = ETrue; |
316 |
} |
|
317 |
} |
|
318 |
if ( !found ) |
|
319 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
320 |
LOG_FORMAT( "- Accessory with id = %d added.", freshAcc.UniqueID() ); |
24 | 321 |
addedAccessories++; |
322 |
} |
|
323 |
} |
|
324 |
} |
|
325 |
return addedAccessories; |
|
326 |
} |
|
327 |
||
328 |
// --------------------------------------------------------------------------- |
|
329 |
// |
|
330 |
// --------------------------------------------------------------------------- |
|
331 |
// |
|
332 |
void CRadioAccessoryObserver::SetObserver( MRadioHeadsetEventObserver* aObserver ) |
|
333 |
{ |
|
334 |
iObserver = aObserver; |
|
335 |
} |
|
336 |
||
337 |
// --------------------------------------------------------------------------- |
|
338 |
// From class CActive |
|
339 |
// |
|
340 |
// --------------------------------------------------------------------------- |
|
341 |
// |
|
342 |
void CRadioAccessoryObserver::RunL() |
|
343 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
344 |
LEVEL2( LOG_METHOD_AUTO ); |
24 | 345 |
TRequestStatus status = iStatus; |
346 |
iAccessoryConn.NotifyAccessoryConnectionStatusChanged( iStatus, iAccPolGenIdArr ); |
|
347 |
||
348 |
SetActive(); |
|
349 |
||
350 |
TInt nroChangedAccessories( 0 ); |
|
351 |
UpdateCurrentAccessoriesL( nroChangedAccessories ); |
|
352 |
||
353 |
if ( status == KErrNone && nroChangedAccessories != 0 ) |
|
354 |
{ |
|
355 |
TAccAudioOutPutType audioOutputType( EAccAudioOutPutTypePrivate ); |
|
356 |
||
357 |
if ( FindAccessoryL( EFalse, audioOutputType ) ) |
|
358 |
{ |
|
359 |
// Accessory mode may change when combined connection status changes |
|
360 |
// or when audio routing status changes. |
|
361 |
if ( audioOutputType == EAccAudioOutPutTypePrivate ) |
|
362 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
363 |
LOG( "Headset connected" ); |
24 | 364 |
iObserver->HeadsetConnectedCallbackL(); |
365 |
} |
|
366 |
else |
|
367 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
368 |
LOG( "Public wired or BT accessory connected." ); |
24 | 369 |
iObserver->HeadsetDisconnectedCallbackL(); |
370 |
} |
|
371 |
} |
|
372 |
else |
|
373 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
374 |
LOG( "No wired or BT accessories available" ); |
24 | 375 |
iObserver->HeadsetDisconnectedCallbackL(); |
376 |
} |
|
377 |
} |
|
378 |
} |
|
379 |
||
380 |
||
381 |
// --------------------------------------------------------------------------- |
|
382 |
// From class CActive |
|
383 |
// |
|
384 |
// --------------------------------------------------------------------------- |
|
385 |
// |
|
386 |
void CRadioAccessoryObserver::DoCancel() |
|
387 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
388 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 389 |
iAccessoryConn.CancelNotifyAccessoryConnectionStatusChanged(); |
390 |
} |