|
1 /* |
|
2 * Copyright (c) 2005-2007 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 of remote volume control. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "basrvrvc.h" |
|
21 #include "basrvacc.h" |
|
22 #include "basrvaccman.h" |
|
23 #include "basrvpluginman.h" |
|
24 #include "btaccPlugin.h" |
|
25 #include "debug.h" |
|
26 |
|
27 // ================= MEMBER FUNCTIONS ======================= |
|
28 |
|
29 CBasrvRvc* CBasrvRvc::New(CBasrvAcc& aAccMan) |
|
30 { |
|
31 CBasrvRvc* self = new CBasrvRvc(aAccMan); |
|
32 return self; |
|
33 } |
|
34 |
|
35 CBasrvRvc::~CBasrvRvc() |
|
36 { |
|
37 CBTAccPlugin* plugin = NULL; |
|
38 plugin = iAcc.AccMan().PluginMan().Plugin(iRvcMaster); |
|
39 if (plugin) |
|
40 plugin->DeActivateRemoteVolumeControl(); |
|
41 TRACE_FUNC |
|
42 } |
|
43 |
|
44 void CBasrvRvc::Update(TInt aConnectedProfiles, TInt aProfileCarryingAudio) |
|
45 { |
|
46 TRACE_FUNC |
|
47 iConnectedProfiles = aConnectedProfiles; |
|
48 iProfileCarryingAudio = aProfileCarryingAudio; |
|
49 DoUpdateRvcMaster(); |
|
50 } |
|
51 |
|
52 CBasrvRvc::CBasrvRvc(CBasrvAcc& aAcc) |
|
53 : iAcc(aAcc) |
|
54 { |
|
55 TRACE_FUNC |
|
56 } |
|
57 |
|
58 void CBasrvRvc::DoUpdateRvcMaster() |
|
59 { |
|
60 TRACE_FUNC |
|
61 TProfiles newMaster = EUnknownProfile; |
|
62 if ((iProfileCarryingAudio == EStereo) && (iConnectedProfiles & ERemConTG)) |
|
63 newMaster = ERemConTG; |
|
64 else if (iProfileCarryingAudio & EAnyMonoAudioProfiles) |
|
65 newMaster = EAnyMonoAudioProfiles; |
|
66 TRACE_INFO((_L(" audio carrier 0x%02x, conns 0x%04x"), iProfileCarryingAudio, iConnectedProfiles)) |
|
67 TRACE_INFO((_L(" [RVC master update] current 0x%02x, new 0x%02x"), iRvcMaster, newMaster)) |
|
68 |
|
69 if (iRvcMaster != newMaster) |
|
70 { |
|
71 CBTAccPlugin* plugin = iAcc.AccMan().PluginMan().Plugin(iRvcMaster); |
|
72 if (plugin) |
|
73 { |
|
74 plugin->DeActivateRemoteVolumeControl(); |
|
75 } |
|
76 plugin = iAcc.AccMan().PluginMan().Plugin(newMaster); |
|
77 if (plugin) |
|
78 { |
|
79 plugin->ActivateRemoteVolumeControl(); |
|
80 TRACE_INFO((_L(" [RVC master update] 0x%02x took the role"), newMaster)) |
|
81 } |
|
82 iRvcMaster = newMaster; |
|
83 } |
|
84 } |
|
85 |
|
86 // End of File |