|
1 /* |
|
2 * Copyright (c) 2005 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 * Main functionality of CHeadsetStatus |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "HeadsetStatus.h" |
|
23 #include "CHeadsetStatusContainer.h" |
|
24 #include <e32std.h> |
|
25 |
|
26 // UNNANMED NAMESPACE FOR LOCAL DEFINITIONS |
|
27 namespace |
|
28 { |
|
29 // CONSTANTS |
|
30 _LIT( KPanicCat, "HeadsetStatus" ); |
|
31 |
|
32 // DATA TYPES |
|
33 enum TPanicCode |
|
34 { |
|
35 EInvalidObserver |
|
36 }; |
|
37 } |
|
38 |
|
39 // ========================= MEMBER FUNCTIONS ================================ |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // C++ constructor. |
|
43 // --------------------------------------------------------------------------- |
|
44 CHeadsetStatus::CHeadsetStatus( ) |
|
45 { |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // CHeadsetStatus::NewL |
|
50 // --------------------------------------------------------------------------- |
|
51 EXPORT_C CHeadsetStatus* CHeadsetStatus::NewL( ) |
|
52 { |
|
53 CHeadsetStatus* self = new ( ELeave ) CHeadsetStatus(); |
|
54 |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop( self ); |
|
58 |
|
59 return self; |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CHeadsetStatus::ConstructL |
|
64 // |
|
65 // Symbian OS two-phased constructor. |
|
66 // --------------------------------------------------------------------------- |
|
67 void CHeadsetStatus::ConstructL() |
|
68 { |
|
69 iContainer = CHeadsetStatusContainer::NewL(); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // C++ destructor |
|
74 // --------------------------------------------------------------------------- |
|
75 EXPORT_C CHeadsetStatus::~CHeadsetStatus() |
|
76 { |
|
77 delete iContainer; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CHeadsetStatus::HeadsetConnectedL |
|
82 // |
|
83 // Method to query the headsets connectivity status. Returns error code |
|
84 // (or KErrNone when query succeeded) and sets the query result into the |
|
85 // boolean in which the parameter aState is referring. |
|
86 // --------------------------------------------------------------------------- |
|
87 EXPORT_C TInt CHeadsetStatus::HeadsetConnectedL( TBool& aState ) |
|
88 { |
|
89 return iContainer->QueryHeadsetStatus( aState ); |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // CHeadsetStatus::SetObserver |
|
94 // --------------------------------------------------------------------------- |
|
95 EXPORT_C void CHeadsetStatus::SetObserver( MHeadsetStatusObserver* aObserver ) |
|
96 { |
|
97 __ASSERT_ALWAYS( aObserver, User::Panic( KPanicCat, EInvalidObserver ) ); |
|
98 |
|
99 iContainer->SetObserver( aObserver ); |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CHeadsetStatus::StartObserving |
|
104 // --------------------------------------------------------------------------- |
|
105 EXPORT_C void CHeadsetStatus::StartObserving() |
|
106 { |
|
107 iContainer->StartObserving(); |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // CHeadsetStatus::StopObserving |
|
112 // --------------------------------------------------------------------------- |
|
113 EXPORT_C void CHeadsetStatus::StopObserving() |
|
114 { |
|
115 iContainer->StopObserving(); |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // CHeadsetStatus::StopObserving |
|
120 // --------------------------------------------------------------------------- |
|
121 EXPORT_C TBool CHeadsetStatus::IsObserving() const |
|
122 { |
|
123 return iContainer->IsObserving(); |
|
124 } |
|
125 |
|
126 // End of File |