|
1 /* |
|
2 * Copyright (c) 2006-2007 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: CCCHRequestStorage declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CCHREQUESTSTORAGE_H |
|
20 #define C_CCHREQUESTSTORAGE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "cchclientserverinternal.h" |
|
27 |
|
28 // CONSTANTS |
|
29 // None |
|
30 |
|
31 // MACROS |
|
32 // None |
|
33 |
|
34 // FUNCTION PROTOTYPES |
|
35 // None |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CCCHServerBase; |
|
39 class CCCHSubsession; |
|
40 |
|
41 // DATA TYPES |
|
42 /** |
|
43 * Storage entry structure. |
|
44 */ |
|
45 class TCCHStorageEntry |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * Request type |
|
50 */ |
|
51 TCCHCommands iRequest; |
|
52 /** |
|
53 * IPC message |
|
54 */ |
|
55 RMessage2* iMessage; |
|
56 /** |
|
57 * Pointer to subsession. Not own |
|
58 */ |
|
59 const CCCHSubsession* iSubsession; |
|
60 }; |
|
61 |
|
62 // CLASS DECLARATION |
|
63 |
|
64 /** |
|
65 * CCCHRequestStorage declaration |
|
66 * Storage for asynchronous requests. |
|
67 * @lib cchserver.exe |
|
68 * @since S60 3.2 |
|
69 */ |
|
70 NONSHARABLE_CLASS( CCCHRequestStorage ) : public CBase |
|
71 { |
|
72 public: // Constructors and destructor |
|
73 |
|
74 /** |
|
75 * Two-phased constructor. |
|
76 */ |
|
77 static CCCHRequestStorage* NewL( CCCHServerBase& aServer ); |
|
78 |
|
79 /** |
|
80 * Two-phased constructor. |
|
81 */ |
|
82 static CCCHRequestStorage* NewLC( CCCHServerBase& aServer ); |
|
83 |
|
84 /** |
|
85 * Destructor. |
|
86 */ |
|
87 virtual ~CCCHRequestStorage(); |
|
88 |
|
89 public: // New functions |
|
90 |
|
91 /** |
|
92 * Add new request into storage. |
|
93 * @since S60 3.2 |
|
94 * @param aRequest IPC of request. |
|
95 * @param aMessage Message object of request. |
|
96 * @param aSubsession Pointer to subsession of request. |
|
97 */ |
|
98 void AddRequestL( TCCHCommands aRequest, |
|
99 const RMessage2& aMessage, |
|
100 const CCCHSubsession* aSubsession ); |
|
101 |
|
102 /** |
|
103 * Complete and remove request from storage. |
|
104 * @since S60 3.2 |
|
105 * @param aRequest IPC of request. |
|
106 * @param aSubSession Pointer to subsession of request. |
|
107 * @param aError Request is completed with this value. |
|
108 * @return KErrNone if successfull, KErrNotFound if request is not found. |
|
109 */ |
|
110 TInt CompleteRequest( TCCHCommands aRequest, |
|
111 const CCCHSubsession* aSubsession, |
|
112 TInt aError ); |
|
113 |
|
114 /** |
|
115 * Complete and remove request from storage. Also writes |
|
116 * TAny back to the client |
|
117 * @since S60 3.2 |
|
118 * @param aRequest IPC of request. |
|
119 * @param aSubSession Pointer to subsession of request. |
|
120 * @param aParams TAny parameter, which returns back to the client |
|
121 * @param aError Request is completed with this value. |
|
122 * @return KErrNone if successfull, KErrNotFound if request is not found. |
|
123 */ |
|
124 TInt CompleteRequestL( TCCHCommands aRequest, |
|
125 const CCCHSubsession* aSubsession, |
|
126 TAny* aParams, |
|
127 TInt aError ); |
|
128 |
|
129 /** |
|
130 * Remove all requests by session pointer from storage. |
|
131 * @since S60 3.2 |
|
132 * @param aSubSession Subsession pointer. |
|
133 * @return KErrNone if successfull, KErrNotFound if no requests are found. |
|
134 */ |
|
135 TInt RemoveRequestsBySession( const CCCHSubsession* aSubsession ); |
|
136 |
|
137 /** |
|
138 * Add session to request storage. |
|
139 * @since S60 3.2 |
|
140 * @param aSubSession Subsession pointer. |
|
141 */ |
|
142 void AddSession( CCCHSubsession* aSubsession ); |
|
143 |
|
144 /** |
|
145 * Remove session from request storage. |
|
146 * @since S60 3.2 |
|
147 * @param aSubSession Subsession pointer. |
|
148 * @return KErrNone if successfull, KErrNotFound if no requests are found. |
|
149 */ |
|
150 TInt RemoveSession( const CCCHSubsession* aSubsession ); |
|
151 |
|
152 /** |
|
153 * Notify client about subservice state change |
|
154 * @since S60 3.2 |
|
155 * @param aNewState Service's new information, which writes |
|
156 * back to the client |
|
157 */ |
|
158 void NotifyServiceStatesChange( TServiceStatus aNewStatus ); |
|
159 |
|
160 /** |
|
161 * Starts to scan available network |
|
162 * @since S60 3.2 |
|
163 */ |
|
164 void ScanNetworks(); |
|
165 |
|
166 /** |
|
167 * Cancels scanning request. |
|
168 * @since S60 3.2 |
|
169 */ |
|
170 void ScanNetworksCancel(); |
|
171 |
|
172 private: |
|
173 |
|
174 /** |
|
175 * C++ default constructor. |
|
176 */ |
|
177 CCCHRequestStorage( CCCHServerBase& aServer ); |
|
178 |
|
179 /** |
|
180 * Delete request from storage |
|
181 * @since S60 3.2 |
|
182 * @param aIndex Index of request in storage. |
|
183 */ |
|
184 void DeleteRequest( TInt aIndex ); |
|
185 |
|
186 private: // data |
|
187 |
|
188 /** |
|
189 * Server handle |
|
190 */ |
|
191 CCCHServerBase& iServer; |
|
192 |
|
193 /** |
|
194 * Array of requests. |
|
195 */ |
|
196 RArray<TCCHStorageEntry> iRequests; |
|
197 |
|
198 /** |
|
199 * Array of subsessions. |
|
200 */ |
|
201 RArray<CCCHSubsession*> iSubsessions; |
|
202 |
|
203 }; |
|
204 |
|
205 #endif // C_CCHREQUESTSTORAGE_H |
|
206 |
|
207 // End of file |