|
1 /* |
|
2 * Copyright (c) 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: class handles event notification to subscribers. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CPOSLMDBMANEVENTHANDLER_H |
|
21 #define CPOSLMDBMANEVENTHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 #include <EPos_TPosLmDatabaseEvent.h> |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 /** |
|
31 * This class handles event notification to subscribers. |
|
32 */ |
|
33 class CPosLmDbManEventHandler : public CBase |
|
34 { |
|
35 |
|
36 public: // Constructor & Destructor |
|
37 |
|
38 /** |
|
39 * Two-phased constructor. |
|
40 */ |
|
41 static CPosLmDbManEventHandler* NewL(); |
|
42 |
|
43 /** |
|
44 * Destructor. |
|
45 */ |
|
46 ~CPosLmDbManEventHandler(); |
|
47 |
|
48 public: // New functions |
|
49 |
|
50 /** |
|
51 * Returns the database URI from last event to client. |
|
52 * |
|
53 * @param aMessage A message. |
|
54 */ |
|
55 void ServerUriFromLastEvent( |
|
56 /* IN */ const RMessagePtr2& aMessage |
|
57 ); |
|
58 |
|
59 /** |
|
60 * If there is at least one event waiting in the event queue, this |
|
61 * message will be completed directly. Otherwise the message will be |
|
62 * put on hold until an event arrives. |
|
63 * |
|
64 * @param aMessage A message. |
|
65 */ |
|
66 void HandleRequestForEventL( |
|
67 /* IN */ const RMessagePtr2& aMessage |
|
68 ); |
|
69 |
|
70 /** |
|
71 * Called when a landmark operation has generated an event. |
|
72 * If there is a message waiting for an event it will be completed |
|
73 * directly. Otherwise this event will be put in the event queue. |
|
74 * |
|
75 * @param aEvent An event. |
|
76 * @param aUri A database URI. |
|
77 */ |
|
78 void HandleIncomingEventL( |
|
79 /* IN */ TPosLmDatabaseEvent aEvent, |
|
80 /* IN */ const TDesC& aUri |
|
81 ); |
|
82 |
|
83 /** |
|
84 * Completes an outstanding event if it exists. |
|
85 * |
|
86 * @param aError The error code to complete with. |
|
87 */ |
|
88 void CompleteAnyOutStandingRequest( |
|
89 /* IN */ TInt aError |
|
90 ); |
|
91 |
|
92 private: |
|
93 |
|
94 /** |
|
95 * C++ default constructor. |
|
96 */ |
|
97 CPosLmDbManEventHandler(); |
|
98 |
|
99 /** |
|
100 * By default Symbian 2nd phase constructor is private. |
|
101 * |
|
102 */ |
|
103 void ConstructL(); |
|
104 |
|
105 void WriteEventAndComplete( |
|
106 /* IN */ const RMessagePtr2& aMessage |
|
107 ); |
|
108 |
|
109 void AddToEventQueueL( |
|
110 /* IN */ TPosLmDatabaseEvent aEvent, |
|
111 /* IN */ const TDesC& aUri |
|
112 ); |
|
113 |
|
114 // By default, prohibit copy constructor |
|
115 CPosLmDbManEventHandler( const CPosLmDbManEventHandler& ); |
|
116 // Prohibit assigment operator |
|
117 CPosLmDbManEventHandler& operator= ( const CPosLmDbManEventHandler& ); |
|
118 |
|
119 private: // Data |
|
120 |
|
121 RArray<TPosLmDatabaseEvent> iEventQueue; |
|
122 RMessagePtr2 iHoldingMessage; |
|
123 CDesCArrayFlat* iUriArray; |
|
124 HBufC* iLastUri; |
|
125 |
|
126 }; |
|
127 |
|
128 #endif // CPOSLMEVENTHANDLER_H |
|
129 |
|
130 // End of File |