|
1 /* |
|
2 * Copyright (c) 2008-2009 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 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef EVENTMAN_H |
|
24 #define EVENTMAN_H |
|
25 |
|
26 #include <e32base.h> |
|
27 #include "msmm_internal_def.h" |
|
28 |
|
29 class MMsmmSrvProxy; |
|
30 class CDeviceEventHandler; |
|
31 |
|
32 NONSHARABLE_CLASS (CDeviceEventQueue) : public CActive |
|
33 { |
|
34 public: |
|
35 ~CDeviceEventQueue(); |
|
36 static CDeviceEventQueue* NewL(MMsmmSrvProxy& aServer); |
|
37 static CDeviceEventQueue* NewLC(MMsmmSrvProxy& aServer); |
|
38 |
|
39 /** Queue a device event |
|
40 * Intends to be used by CMsmmSession class |
|
41 */ |
|
42 void PushL(const TDeviceEvent& aEvent); |
|
43 |
|
44 /** Finalize events in queue |
|
45 * Intends to be used by CMsmmServer when last session has been closed. |
|
46 * This function will remove all pending events of adding a interface |
|
47 * from the queue. It also cancels adding events that currently is being |
|
48 * handled in CDeviceEventHandler. |
|
49 */ |
|
50 void Finalize(); |
|
51 |
|
52 /** Return count of events in queue |
|
53 */ |
|
54 inline TUint8 Count() const; |
|
55 |
|
56 protected: |
|
57 // Derived from CActive |
|
58 void DoCancel(); |
|
59 void RunL(); |
|
60 TInt RunError(TInt aError); |
|
61 |
|
62 private: |
|
63 CDeviceEventQueue(MMsmmSrvProxy& aServer); |
|
64 void ConstructL(); |
|
65 |
|
66 void AppendAndOptimizeL(const TDeviceEvent& aEvent); |
|
67 void StartL(); |
|
68 |
|
69 void SendEventL(); |
|
70 |
|
71 inline TBool IsEventAvailable() const; |
|
72 TDeviceEvent Pop(); |
|
73 |
|
74 private: |
|
75 MMsmmSrvProxy& iServer; |
|
76 CDeviceEventHandler* iHandler; // Owned |
|
77 RArray<TDeviceEvent> iEventArray; |
|
78 }; |
|
79 |
|
80 #include "eventqueue.inl" |
|
81 |
|
82 #endif /*EVENTMAN_H*/ |