1 /* |
|
2 * Copyright (c) 2005-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: Observer of accessory states. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CIRACCESSORYOBSERVER_H |
|
20 #define CIRACCESSORYOBSERVER_H |
|
21 |
|
22 #include <accessoryserver.h> |
|
23 #include <accessorymode.h> |
|
24 #include <accpolaccessorymode.h> |
|
25 |
|
26 class MIRHeadsetEventObserver; |
|
27 |
|
28 /** |
|
29 * Observer of accessory states. |
|
30 * |
|
31 * Instance of this class observes notifications of headset state changes. |
|
32 * In its turn it sends notifications to its observer of those changes. |
|
33 * |
|
34 */ |
|
35 NONSHARABLE_CLASS( CIRAccessoryObserver ): public CActive |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * C++ default constructor. |
|
41 */ |
|
42 CIRAccessoryObserver(); |
|
43 |
|
44 /** |
|
45 * Static constructor. |
|
46 * |
|
47 * @param aAccessoryServer Existing session for The Accessory Server. |
|
48 */ |
|
49 static CIRAccessoryObserver* NewL(); |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 virtual ~CIRAccessoryObserver(); |
|
55 |
|
56 /** |
|
57 * Sets observer. The observer will be notified when headset has been |
|
58 * pressed or headset is connected/disconnected. |
|
59 * |
|
60 * @param aObserver Observer |
|
61 */ |
|
62 void SetObserver(MIRHeadsetEventObserver* aObserver); |
|
63 |
|
64 /** |
|
65 * Returns accessory connection state. |
|
66 * |
|
67 * @return <code>ETrue </code> if accessory is connected, |
|
68 * <code>EFalse</code> otherwise |
|
69 */ |
|
70 TBool IsHeadsetConnected() const; |
|
71 |
|
72 // from base class CActive |
|
73 /** |
|
74 * From CActive |
|
75 * |
|
76 * @see CActive::RunL() |
|
77 */ |
|
78 void RunL(); |
|
79 |
|
80 /** |
|
81 * From CActive |
|
82 * |
|
83 * @see CActive::DoCancel() |
|
84 */ |
|
85 void DoCancel(); |
|
86 |
|
87 protected: |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * By default Symbian 2nd phase constructor is private. |
|
93 * |
|
94 * @param aAccessoryServer Existing session for The Accessory Server. |
|
95 */ |
|
96 void ConstructL(); |
|
97 |
|
98 public: |
|
99 |
|
100 protected: |
|
101 |
|
102 /** |
|
103 * Instance that gets notifications of the headset state changes |
|
104 */ |
|
105 MIRHeadsetEventObserver* iObserver; |
|
106 |
|
107 private: // Data |
|
108 |
|
109 /** |
|
110 * Session for The Accessory Server. |
|
111 */ |
|
112 RAccessoryServer iAccessoryServer; |
|
113 |
|
114 /** |
|
115 * Accessory Mode sub-session |
|
116 */ |
|
117 RAccessoryMode iAccessoryModeSession; |
|
118 |
|
119 |
|
120 /** |
|
121 * Accessory Mode structure, with active audio information. |
|
122 */ |
|
123 TAccPolAccessoryMode iAccPolAccessoryMode; |
|
124 }; |
|
125 |
|
126 #endif // CIRACCESSORYOBSERVER_H |
|
127 |
|
128 |
|