|
1 /* |
|
2 * Copyright (c) 2002 - 2008 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: Class which is resposible for handling communication with |
|
15 * Bt settings API |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "BtSettings.h" |
|
21 |
|
22 CBtSettings::CBtSettings() |
|
23 { |
|
24 // No implementation required |
|
25 } |
|
26 |
|
27 CBtSettings::~CBtSettings() |
|
28 { |
|
29 delete iSettings; |
|
30 if( iWaiter->IsStarted() ) |
|
31 { |
|
32 iWaiter->AsyncStop(); |
|
33 } |
|
34 delete iWaiter; |
|
35 } |
|
36 |
|
37 CBtSettings* CBtSettings::NewLC() |
|
38 { |
|
39 CBtSettings* self = new ( ELeave ) CBtSettings(); |
|
40 CleanupStack::PushL(self); |
|
41 self->ConstructL(); |
|
42 return self; |
|
43 } |
|
44 |
|
45 CBtSettings* CBtSettings::NewL() |
|
46 { |
|
47 CBtSettings* self = CBtSettings::NewLC(); |
|
48 CleanupStack::Pop(); // self; |
|
49 return self; |
|
50 } |
|
51 |
|
52 void CBtSettings::ConstructL() |
|
53 { |
|
54 iWaiter = new ( ELeave ) CActiveSchedulerWait(); |
|
55 iSettings = CBTEngSettings::NewL( this ); |
|
56 iError = KErrNone; |
|
57 } |
|
58 |
|
59 void CBtSettings::PowerStateChanged( TBTPowerStateValue /*aState*/ ) |
|
60 { |
|
61 if( iWaiter->IsStarted() ) |
|
62 { |
|
63 iWaiter->AsyncStop(); |
|
64 } |
|
65 } |
|
66 |
|
67 void CBtSettings::VisibilityModeChanged( TBTVisibilityMode /*aState*/ ) |
|
68 { |
|
69 if( iWaiter->IsStarted() ) |
|
70 { |
|
71 iWaiter->AsyncStop(); |
|
72 } |
|
73 } |
|
74 |
|
75 TInt CBtSettings::GetPowerState( TBTPowerStateValue& aState ) |
|
76 { |
|
77 iError = iSettings->GetPowerState( aState ); |
|
78 return iError; |
|
79 } |
|
80 |
|
81 TInt CBtSettings::SetPowerState( TBTPowerStateValue aState ) |
|
82 { |
|
83 TBTPowerStateValue state; |
|
84 |
|
85 iError = iSettings->GetPowerState( state ); |
|
86 if( iError ) |
|
87 { |
|
88 return iError; |
|
89 } |
|
90 else if( state != aState ) |
|
91 { |
|
92 if( state == EBTPowerOff ) |
|
93 { |
|
94 iError = iSettings->SetPowerState( EBTPowerOn ); |
|
95 } |
|
96 else |
|
97 { |
|
98 iError = iSettings->SetPowerState( EBTPowerOff ); |
|
99 } |
|
100 |
|
101 if( iError ) |
|
102 { |
|
103 return iError; |
|
104 } |
|
105 else |
|
106 { |
|
107 if ( !iWaiter->IsStarted() ) |
|
108 { |
|
109 iWaiter->Start(); |
|
110 } |
|
111 } |
|
112 } |
|
113 return iError; |
|
114 } |
|
115 |
|
116 TInt CBtSettings::GetVisibilityMode( TBTVisibilityMode& aMode ) |
|
117 { |
|
118 return KErrNone; |
|
119 } |
|
120 |
|
121 TInt SetVisibilityMode( TBTVisibilityMode aMode, TInt aTime ) |
|
122 { |
|
123 return KErrNone; |
|
124 } |
|
125 |
|
126 TInt GetLocalName( TDes& aName ) |
|
127 { |
|
128 return KErrNone; |
|
129 } |
|
130 |
|
131 TInt SetLocalName( const TDes& aName ) |
|
132 { |
|
133 return KErrNone; |
|
134 } |
|
135 |
|
136 // End of file |