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