|
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: Subsession handles are stored here for later handling |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CACCSRVNOTIFICATIONQUEUE_H |
|
21 #define CACCSRVNOTIFICATIONQUEUE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 #include <AccPolGenericID.h> |
|
26 #include <AccPolGenericIDArray.h> |
|
27 #include <AccPolAccessoryMode.h> |
|
28 #include <AsyCmdTypes.h> |
|
29 #include <AccessoryTypes.h> |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // MACROS |
|
34 |
|
35 // DATA TYPES |
|
36 enum TMsgID |
|
37 { |
|
38 EConnectAccessory, //ConnaecAccessory |
|
39 ENewAccessoryConnected, //NotifyNewAccessoryConnected |
|
40 EAccessoryConnectionStatusChanged, //NotifyAccessoryConnectionStatusChanged |
|
41 EAccessoryConnectionStatusAsyncChanged, //GetAccessoryConnectionStatusAsync |
|
42 EAccessoryModeChanged, //NotifyAccessoryModeChanged |
|
43 EAccessoryModeAsyncChanged, //GetAccessoryModeAsync |
|
44 EAccessoryDisconnected, //NotifyAccessoryDisconnected |
|
45 EAccessoryValueChangedTInt, //NotifyAccessoryValueChangedTInt |
|
46 EAccessoryValueChangedTBool, //NotifyAccessoryValueChangedTBool |
|
47 EAccessoryValueChangedObject, //NotifyAccessoryValueChangedObject |
|
48 EBluetoothAudioLinkOpenReq, //NotifyBluetoothAudioLinkOpenReq |
|
49 EBluetoothAudioLinkCloseReq, //NotifyBluetoothAudioLinkCloseReq |
|
50 EAccessoryAudioLinkOpened, //NotifyAccessoryAudioLinkOpened |
|
51 EAccessoryAudioLinkClosed, //NotifyAccessoryAudioLinkClosed |
|
52 EAccessoryAudioLinkOpen, //AccessoryAudioLinkOpen |
|
53 EAccessoryAudioLinkClose, //AccessoryAudioLinkClose |
|
54 EBluetoothAudioLinkOpenResp, //BluetoothAudioLinkOpenResp |
|
55 EBluetoothAudioLinkCloseResp, //BluetoothAudioLinkCloseResp |
|
56 ENotifyProcessCommand, //NotifyProcessCommand |
|
57 ESetValue, //SetValueL |
|
58 EGetValue, //GetValueL |
|
59 EUnknown //Initialisation value for error tracking |
|
60 }; |
|
61 |
|
62 // FUNCTION PROTOTYPES |
|
63 |
|
64 // FORWARD DECLARATIONS |
|
65 class MQueueObserver; |
|
66 |
|
67 // CLASS DECLARATION |
|
68 |
|
69 /** |
|
70 * Queue class for observers to register and complete messages |
|
71 * |
|
72 * @lib AccServer.lib |
|
73 * @since S60 3.1 |
|
74 */ |
|
75 NONSHARABLE_CLASS( CAccSrvNotificationQueue ) : public CBase |
|
76 { |
|
77 public: // Constructors and destructor |
|
78 |
|
79 /** |
|
80 * Two-phased constructor. |
|
81 */ |
|
82 static CAccSrvNotificationQueue* NewL(); |
|
83 |
|
84 /** |
|
85 * Destructor. |
|
86 */ |
|
87 virtual ~CAccSrvNotificationQueue(); |
|
88 |
|
89 public: // New functions |
|
90 |
|
91 /** |
|
92 * Register a observer to the queue. |
|
93 * @since S60 3.1 |
|
94 * @param aMsgID Message to which the observer is registered to. |
|
95 * @param aCallback Handle to observer. |
|
96 * @return void |
|
97 */ |
|
98 void RegisterControlMessage( TMsgID aMsgID, |
|
99 MQueueObserver* aCallback ); |
|
100 |
|
101 /** |
|
102 * Cancels registeration to the queue. |
|
103 * @since S60 3.1 |
|
104 * @param aMsgID Message to which the observer registereation is cancelled. |
|
105 * @param aCallback Handle to observer. |
|
106 * @return void |
|
107 */ |
|
108 void CancelControlMessage( TMsgID aMsgID, |
|
109 MQueueObserver* aCallback ); |
|
110 |
|
111 /** |
|
112 * Completes the message(s) from the queue. Call-back will be called |
|
113 * for all registered observers for message given as a parameter. |
|
114 * @since S60 3.1 |
|
115 * @param aMsgID Message to complete. |
|
116 * @param aErrorCode Error code for call-back. |
|
117 * @param aUniqueID Generic IDs Unique ID for call-back. |
|
118 * @return void |
|
119 */ |
|
120 void CompleteControlMessageL( TMsgID aMsgID, |
|
121 TInt aErrorCode, |
|
122 TInt aUniqueID ); |
|
123 |
|
124 /** |
|
125 * Completes the message(s) from the queue. Call-back will be called |
|
126 * for all registered observers for message given as a parameter. |
|
127 * @since S60 3.1 |
|
128 * @param aMsgID Message to complete. |
|
129 * @param aCmdResponse Response value from ASY for call-back. |
|
130 * @param aErrorCode Error code for call-back. |
|
131 * @param aTrId Transaction ID for call-back. |
|
132 * @return void |
|
133 */ |
|
134 void CompleteValueMessageL( TMsgID aMsgID, |
|
135 TAccValueTypeTBool aCmdResponse, |
|
136 TInt aErrorCode, |
|
137 TInt aTrId ); |
|
138 |
|
139 /** |
|
140 * Completes the message(s) from the queue. Call-back will be called |
|
141 * for all registered observers for message given as a parameter. |
|
142 * @since S60 3.1 |
|
143 * @param aMsgID Message to complete. |
|
144 * @param aCmdResponse Response value from ASY for call-back. |
|
145 * @param aErrorCode Error code for call-back. |
|
146 * @param aTrId Transaction ID for call-back. |
|
147 * @return void |
|
148 */ |
|
149 void CompleteValueMessageL( TMsgID aMsgID, |
|
150 TAccValueTypeTInt aCmdResponse, |
|
151 TInt aErrorCode, |
|
152 TInt aTrId ); |
|
153 |
|
154 /** |
|
155 * Completes the message(s) from the queue. Call-back will be called |
|
156 * for all registered observers for message given as a parameter. |
|
157 * @since S60 3.1 |
|
158 * @param aMsgID Message to complete. |
|
159 * @param aCmdResponse Response value from ASY for call-back. |
|
160 * @param aErrorCode Error code for call-back. |
|
161 * @param aTrId Transaction ID for call-back. |
|
162 * @return void |
|
163 */ |
|
164 void CompleteValueMessageL( TMsgID aMsgID, |
|
165 TDesC8& aCmdResponse, |
|
166 TInt aErrorCode, |
|
167 TInt aTrId ); |
|
168 |
|
169 /** |
|
170 * Completes the message(s) from the queue. Call-back will be called |
|
171 * for all registered observers for message given as a parameter. |
|
172 * @since S60 3.1 |
|
173 * @param aMsgID Message to complete. |
|
174 * @param aCmdn ASY command for call-back. |
|
175 * @param aTrId Transaction ID for call-back. |
|
176 * @param aASYCommandParamRecord ASY command parameters for call-back. |
|
177 * @param aPtrBuf Pointer to CBufFlat buffer where CAccPolObjectCon object |
|
178 * is externalized to. |
|
179 * @return void |
|
180 */ |
|
181 void CompleteASYCmdL( TMsgID aMsgID, |
|
182 TProcessCmdId aCmdn, |
|
183 TInt aTrId, |
|
184 TASYCommandParamRecord& aASYCommandParamRecord, |
|
185 TPtr8* aPtrBuf=NULL ); |
|
186 |
|
187 /** |
|
188 * Completes the message(s) from the queue. Call-back will be called |
|
189 * for all registered observers for message given as a parameter. |
|
190 * @param aMsgID Message to complete. |
|
191 * @param aTrId Transaction ID for call-back. |
|
192 * @param aPtrBuf Response value from ASY for call-back. |
|
193 * Pointer to CBufFlat buffer where CAccPolObjectCon object |
|
194 * is externalized to. |
|
195 * @param aErrorCode Error code for call-back. |
|
196 * @return void |
|
197 */ |
|
198 void CompleteValueMessageL( TMsgID aMsgID, |
|
199 TInt aTrId, |
|
200 TPtr8* aPtrBuf, |
|
201 TInt aErrorCode ); |
|
202 |
|
203 |
|
204 /** |
|
205 * Gets the number of waiting control messages. |
|
206 * @since S60 3.2 |
|
207 * @param aMsgID Message to check. |
|
208 * @return The number of waiting messages |
|
209 */ |
|
210 TInt ControlMessagesWaiting( TMsgID aMsgID ); |
|
211 |
|
212 public: // Functions from base classes |
|
213 |
|
214 protected: // New functions |
|
215 |
|
216 protected: // Functions from base classes |
|
217 |
|
218 private: |
|
219 |
|
220 /** |
|
221 * C++ default constructor. |
|
222 */ |
|
223 CAccSrvNotificationQueue(); |
|
224 |
|
225 /** |
|
226 * By default Symbian 2nd phase constructor is private. |
|
227 */ |
|
228 void ConstructL(); |
|
229 |
|
230 /** |
|
231 * Return reference to correct member array. |
|
232 */ |
|
233 RArray<MQueueObserver*>* ControlMessageArray( TMsgID aMsgID ); |
|
234 |
|
235 public: // Data |
|
236 |
|
237 protected: // Data |
|
238 |
|
239 private: // Data |
|
240 |
|
241 // Outstanding subsessions for "ConnectAccessory" request |
|
242 RArray<MQueueObserver *> iConnectAccessory; //not owned |
|
243 |
|
244 // Outstanding subsessions for "NewAccessoryConnected" notification |
|
245 RArray<MQueueObserver *> iNewAccessoryConnectedArray; //not owned |
|
246 |
|
247 // Outstanding subsessions for "AccessoryDisconnected" notification |
|
248 RArray<MQueueObserver *> iAccessoryDisconnectedArray; //not owned |
|
249 |
|
250 // Outstanding subsessions for "AccessoryModeChanged" notification |
|
251 RArray<MQueueObserver *> iAccessoryModeChangedArray; //not owned |
|
252 |
|
253 // Outstanding subsessions for "GetAccessoryModeAsync" |
|
254 RArray<MQueueObserver *> iGetAccessoryModeAsyncArray; //not owned |
|
255 |
|
256 // Outstanding subsessions for "AccessoryConnectionStatusChanged" notification |
|
257 RArray<MQueueObserver *> iAccessoryConnectionStatusChangedArray; //not owned |
|
258 |
|
259 // Outstanding subsessions for "GetAccessoryConnectionStatusAsync" |
|
260 RArray<MQueueObserver *> iGetAccessoryConnectionStatusAsyncArray; //not owned |
|
261 |
|
262 // Outstanding subsessions for "AccessoryAudioLinkOpen" requests |
|
263 RArray<MQueueObserver *> iAccessoryAudioLinkOpenArray; //not owned |
|
264 |
|
265 // Outstanding subsessions for "NotifyAccessoryAudioLinkOpened" notification |
|
266 RArray<MQueueObserver *> iAccessoryAudioLinkOpenedArray; //not owned |
|
267 |
|
268 // Outstanding subsessions for "AccessoryAudioLinkClosed" notification |
|
269 RArray<MQueueObserver *> iAccessoryAudioLinkClosedArray; //not owned |
|
270 |
|
271 // Outstanding subsessions for "AccessoryAudioLinkClose" request |
|
272 RArray<MQueueObserver *> iAccessoryAudioLinkCloseArray; //not owned |
|
273 |
|
274 // Outstanding subsessions for "BluetoothAudioLinkOpenReq" notification |
|
275 RArray<MQueueObserver *> iBluetoothAudioLinkOpenReqArray; //not owned |
|
276 |
|
277 // Outstanding subsessions for "BluetoothAudioLinkCloseReq" notification |
|
278 RArray<MQueueObserver *> iBluetoothAudioLinkCloseReqArray; //not owned |
|
279 |
|
280 // Outstanding subsessions for "BluetoothAudioLinkOpenResp" notification |
|
281 RArray<MQueueObserver *> iBluetoothAudioLinkOpenRespArray; //not owned |
|
282 |
|
283 // Outstanding subsessions for "BluetoothAudioLinkCloseResp" notification |
|
284 RArray<MQueueObserver *> iBluetoothAudioLinkCloseRespArray; //not owned |
|
285 |
|
286 // Outstanding subsessions for "NotifyProcessCommand" request |
|
287 RArray<MQueueObserver *> iNotifyProcessCommandArray; //not owned |
|
288 |
|
289 // Outstanding subsessions for "AccessoryValueChangedTBool" notification |
|
290 RArray<MQueueObserver *> iNotifyAccessoryValueChangedTBoolArray; //not owned |
|
291 |
|
292 // Outstanding subsessions for "AccessoryValueChangedTInt" notification |
|
293 RArray<MQueueObserver *> iNotifyAccessoryValueChangedTIntArray; //not owned |
|
294 |
|
295 // Outstanding subsessions for "AccessoryValueChangedObject" notification |
|
296 RArray<MQueueObserver *> iNotifyAccessoryValueChangedObjectArray; //not owned |
|
297 |
|
298 // Outstanding subsessions for SetValueL request |
|
299 RArray<MQueueObserver *> iSetValueArray; //not owned |
|
300 |
|
301 // Outstanding subsessions for GetValueL request |
|
302 RArray<MQueueObserver *> iGetValueArray; //not owned |
|
303 |
|
304 public: // Friend classes |
|
305 |
|
306 protected: // Friend classes |
|
307 |
|
308 private: // Friend classes |
|
309 |
|
310 }; |
|
311 |
|
312 #endif // CACCSRVNOTIFICATIONQUEUE_H |
|
313 |
|
314 // End of File |