|
1 /* |
|
2 * Copyright (c) 2004-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <pv_2way_symbian_interface.h> |
|
20 #include <pv_audio_output_control_interface.h> |
|
21 #include "mvtprotocolhandler.h" |
|
22 #include "caudioconfighandler.h" |
|
23 |
|
24 #ifdef _DEBUG |
|
25 # define __IF_DEBUG(t) {RDebug::t;} |
|
26 #else |
|
27 # define __IF_DEBUG(t) |
|
28 #endif |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // TAudioConfigHandler::TAudioConfigHandler |
|
32 // Constructor. |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 TAudioConfigHandler::TAudioConfigHandler(MVtProtocolHandler* aProtocolHandler) : iProtocolHandler(aProtocolHandler) |
|
36 { |
|
37 __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler<"))); |
|
38 __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::TAudioConfigHandler>"))); |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // TAudioConfigHandler::AudioOutputControlCommandComplete |
|
43 // Signals completion of the audio output control command. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void TAudioConfigHandler::AudioOutputControlCommandComplete(TPVCommandId aId |
|
47 ,TPVAudioOutputControlCommand aCmd |
|
48 ,TAny *aContextData |
|
49 ,TInt aStatus) |
|
50 { |
|
51 __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::AudioOutputControlCommandComplete<"))); |
|
52 iProtocolHandler->HandleAudioOutputControlCommandComplete(aId, (TVtAudioOutputControlCommand)aCmd, aContextData, aStatus); |
|
53 __IF_DEBUG(Print(_L("VTProto: TAudioConfigHandler::AudioOutputControlCommandComplete>"))); |
|
54 } |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CAudioConfigCommand::CAudioConfigCommand |
|
57 // Constructor. |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 CAudioConfigCommand::CAudioConfigCommand(MPVAudioOutputControl* aAudioCtrl) : iAudioCtrl(aAudioCtrl) |
|
61 { |
|
62 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand<"))); |
|
63 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::CAudioConfigCommand>"))); |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CAudioConfigCommand::SetObserverL |
|
68 // This API allows the user to specify observers for the 324m interface. |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 void CAudioConfigCommand::SetObserverL(MVtProtocolHandler* aHandler) |
|
72 { |
|
73 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL<"))); |
|
74 iAudioConfigHandler = new (ELeave)TAudioConfigHandler(aHandler); |
|
75 iAudioCtrl->SetAudioOutputControlObserver(iAudioConfigHandler); |
|
76 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetObserverL>"))); |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CAudioConfigCommand::SetAudioVolumeL |
|
81 // Method to set the playback volume to the specified value. |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 TInt CAudioConfigCommand::SetAudioVolumeL(TInt aVolume) |
|
85 { |
|
86 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL"))); |
|
87 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::SetAudioVolumeL aVolume %d"), aVolume)); |
|
88 return iAudioCtrl->SetVolumeL(aVolume); |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CAudioConfigCommand::GetMaxAudioVolumeL |
|
93 // Method to get the maximum valid value for the playback volume. |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 TInt CAudioConfigCommand::GetMaxAudioVolumeL(TInt& aMaxVolume) |
|
97 { |
|
98 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL"))); |
|
99 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::GetMaxAudioVolumeL aMaxVolume %d"), aMaxVolume)); |
|
100 return iAudioCtrl->GetMaxVolumeL(aMaxVolume); |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CAudioConfigCommand::~CAudioConfigCommand |
|
105 // Destructor. |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 CAudioConfigCommand::~CAudioConfigCommand() |
|
109 { |
|
110 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand>"))); |
|
111 delete iAudioConfigHandler; |
|
112 __IF_DEBUG(Print(_L("VTProto: CAudioConfigCommand::~CAudioConfigCommand"))); |
|
113 } |
|
114 // End of File |