1 /* |
|
2 * Copyright (c) 2004-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: Accessory handler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CVTENGACCHANDLER_H |
|
21 #define CVTENGACCHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <AccPolAccessoryMode.h> |
|
26 #include <accessoryserver.h> |
|
27 #include <accessorymode.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MVtEngAccessoryObserver; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Accessory mode listener for video telephony. |
|
36 * |
|
37 * @lib videoteleng |
|
38 * @since 3.0 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CVtEngAccessoryHandler ) : public CActive |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 ¨* @return instance of CVtEngAccessoryHandler |
|
47 */ |
|
48 static CVtEngAccessoryHandler* NewL( ); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CVtEngAccessoryHandler(); |
|
54 |
|
55 public: // From base classes. |
|
56 |
|
57 /** |
|
58 * Handles accessory mode changes. |
|
59 */ |
|
60 void RunL(); |
|
61 |
|
62 /** |
|
63 * Cancels accessory mode monitoring. |
|
64 */ |
|
65 void DoCancel(); |
|
66 |
|
67 /** |
|
68 * Handles exceptions in RunL. |
|
69 * @param aError error code. |
|
70 * @return error code. |
|
71 */ |
|
72 TInt RunError( TInt aError ); |
|
73 |
|
74 public: // New functions |
|
75 |
|
76 /** |
|
77 * Sets a new listener interested in accessory changes. |
|
78 * @param aObserver call back interface for notifications. |
|
79 */ |
|
80 void RegisterObserverL( MVtEngAccessoryObserver* aObserver ); |
|
81 |
|
82 /** |
|
83 * Unregisters a listener. |
|
84 * NOTE, do not call this from NotifyObserversL! |
|
85 * @param aObserver call back interface for notifications. |
|
86 */ |
|
87 void RemoveObserver( MVtEngAccessoryObserver* aObserver ); |
|
88 |
|
89 /** |
|
90 * Returns current accessory mode. |
|
91 * @param aAccessoryMode accessory mode in return |
|
92 * @return Symbian error code |
|
93 */ |
|
94 TInt AccessoryMode( TAccPolAccessoryMode& aAccessoryMode ) const; |
|
95 |
|
96 private: // New functions. |
|
97 |
|
98 /** |
|
99 * Removes all observers |
|
100 */ |
|
101 void RemoveAllObservers(); |
|
102 |
|
103 /** |
|
104 * Sets object active and renews subscription. |
|
105 */ |
|
106 void StartListening(); |
|
107 |
|
108 /** |
|
109 * Notifies all registered listeners. |
|
110 */ |
|
111 void NotifyObserversL(); |
|
112 |
|
113 private: // Constructors. |
|
114 |
|
115 /** |
|
116 * C++ default constructor. |
|
117 */ |
|
118 CVtEngAccessoryHandler(); |
|
119 |
|
120 /** |
|
121 * By default Symbian 2nd phase constructor is private. |
|
122 */ |
|
123 void ConstructL( ); |
|
124 |
|
125 private: // Data |
|
126 // Current accessory mode. |
|
127 TAccPolAccessoryMode iCurrentAccessoryMode; |
|
128 |
|
129 // Owned array of accessory mode observers. |
|
130 RPointerArray< MVtEngAccessoryObserver > iAccessoryObservers; |
|
131 |
|
132 // Owned accessory server session. |
|
133 RAccessoryServer iAccessoryServer; |
|
134 |
|
135 // Owned accessory mode subsession. |
|
136 RAccessoryMode iAccessoryMode; |
|
137 |
|
138 // Accessory mode structure. |
|
139 TAccPolAccessoryMode iMode; |
|
140 |
|
141 }; |
|
142 |
|
143 #endif // CVTENGACCHANDLER_H |
|
144 // End of File |
|