|
1 /* |
|
2 * |
|
3 * Copyright (c) <2010> Comarch S.A. and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of the License "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Original Contributors: |
|
11 * Comarch S.A. - original contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "hspsettings.h" |
|
20 #include "hspcommand.h" |
|
21 #include "debug.h" |
|
22 |
|
23 CHsHSPSettings* CHsHSPSettings::InstanceL() |
|
24 { |
|
25 CHsHSPSettings* self = NULL; |
|
26 |
|
27 TAny* tlsPtr = Dll::Tls(); |
|
28 if ( !tlsPtr ) |
|
29 { |
|
30 self = new ( ELeave ) CHsHSPSettings; |
|
31 CleanupStack::PushL( self ); |
|
32 self->ConstructL(); |
|
33 User::LeaveIfError( Dll::SetTls( self ) ); |
|
34 CleanupStack::Pop( self ); |
|
35 } |
|
36 else |
|
37 { |
|
38 self = static_cast <CHsHSPSettings*> ( tlsPtr ); |
|
39 ++self->iReferenceCounter; |
|
40 } |
|
41 |
|
42 return self; |
|
43 } |
|
44 |
|
45 void CHsHSPSettings::Release() |
|
46 { |
|
47 TAny* tlsPtr = Dll::Tls(); |
|
48 __ASSERT_DEBUG( tlsPtr, User::Panic( _L( "HSP Settings error" ), |
|
49 KErrNotFound ) ); |
|
50 |
|
51 CHsHSPSettings* self = static_cast <CHsHSPSettings*> ( tlsPtr ); |
|
52 if ( --self->iReferenceCounter == 0 ) |
|
53 { |
|
54 Dll::FreeTls(); |
|
55 delete self; |
|
56 } |
|
57 } |
|
58 |
|
59 CHsHSPSettings::CHsHSPSettings() : |
|
60 iReferenceCounter( 1 ) |
|
61 { |
|
62 |
|
63 } |
|
64 |
|
65 CHsHSPSettings::~CHsHSPSettings() |
|
66 { |
|
67 } |
|
68 |
|
69 void CHsHSPSettings::ConstructL() |
|
70 { |
|
71 |
|
72 } |
|
73 |
|
74 void CHsHSPSettings::SetSpeakerVolumeLevel( const TInt aLevel ) |
|
75 { |
|
76 iSpeakerVolumeLevel = aLevel; |
|
77 } |
|
78 |
|
79 void CHsHSPSettings::SetMicGainLevel( const TInt aLevel ) |
|
80 { |
|
81 iMicGainLevel = aLevel; |
|
82 } |
|
83 |
|
84 void CHsHSPSettings::UpdateCallStatus( const TBool aIsCallOngoing ) |
|
85 { |
|
86 iCallOngoing = aIsCallOngoing; |
|
87 } |
|
88 |
|
89 TBool CHsHSPSettings::CallOngoing() const |
|
90 { |
|
91 return iCallOngoing; |
|
92 } |
|
93 |