|
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 the License "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 |
|
20 |
|
21 |
|
22 #ifndef CIPTVSERVICEMSGHANDLER_H |
|
23 #define CIPTVSERVICEMSGHANDLER_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <e32base.h> |
|
27 #include "CIptvServiceManager.h" |
|
28 #include "MIptvServiceManagerObserver.h" |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // DATA TYPES |
|
35 |
|
36 // FUNCTION PROTOTYPES |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class CIptvServer; |
|
40 class CIptvEventGenerator; |
|
41 class CIptvSmEvent; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * Handles IPC messages from the client process. Uses CIptvServiceManager. |
|
47 * This class is instantiated when client uses service management methods from |
|
48 * CIptvServiceManagementClient class. Owned by CIptvServerSession. |
|
49 */ |
|
50 class CIptvServiceMsgHandler : public CBase, public MIptvServiceManagerObserver |
|
51 { |
|
52 |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 * |
|
58 * @param aServer IPTV Server, needed for accessing EPG and Service Manager. |
|
59 */ |
|
60 static CIptvServiceMsgHandler* NewL(CIptvServer& aServer); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 virtual ~CIptvServiceMsgHandler(); |
|
66 |
|
67 /** |
|
68 * Handles messages from the client. |
|
69 * |
|
70 * @param aMessage A message to handle. |
|
71 */ |
|
72 void HandleServiceManagerMsgL(const RMessage2& aMessage); |
|
73 |
|
74 private: |
|
75 |
|
76 /** |
|
77 * Handles EIptvEngineServerGetServicesSizeReq message. |
|
78 * |
|
79 * @param aMessage IPC message where the response is written. |
|
80 */ |
|
81 void HandleGetServicesSizeReqL(const RMessage2& aMessage); |
|
82 |
|
83 /** |
|
84 * Called by HandleGetServicesSizeReqL(). |
|
85 * |
|
86 * @param aMessage IPC message where the response is written. |
|
87 */ |
|
88 void GetServicesSizeReqL(const RMessage2& aMessage); |
|
89 |
|
90 /** |
|
91 * Handles EIptvEngineServerGetServicesDataReq message. |
|
92 * |
|
93 * @param aMessage IPC message where the response is written. |
|
94 */ |
|
95 void HandleGetServicesDataReqL(const RMessage2& aMessage); |
|
96 |
|
97 /** |
|
98 * Called by HandleGetServicesDataReqL(). |
|
99 * |
|
100 * @param aMessage IPC message where the response is written. |
|
101 */ |
|
102 void GetServicesDataReqL(const RMessage2& aMessage); |
|
103 |
|
104 /** |
|
105 * Constructs and sends size response to GetServicesUsingIdSizeReq message. |
|
106 * |
|
107 * @param aMessage IPC message where the response is written. |
|
108 */ |
|
109 void HandleGetServicesUsingIdSizeReqL(const RMessage2& aMessage); |
|
110 |
|
111 /** |
|
112 * Constructs and sends size response to GetServicesUsingIdDataReq message. |
|
113 * |
|
114 * @param aMessage IPC message where the response is written. |
|
115 */ |
|
116 void HandleGetServicesUsingIdDataReqL(const RMessage2& aMessage); |
|
117 |
|
118 /** |
|
119 * Handles EIptvEngineSmAddServiceReq message. |
|
120 * |
|
121 * @param aMessage Message from client-server framework |
|
122 */ |
|
123 void HandleAddServiceReqL(const RMessage2& aMessage); |
|
124 |
|
125 /** |
|
126 * Handles EIptvEngineSmDeleteServiceReq message. |
|
127 * |
|
128 * @param aMessage Message from client-server framework |
|
129 */ |
|
130 void HandleDeleteServiceReqL(const RMessage2& aMessage); |
|
131 |
|
132 /** |
|
133 * Handles EIptvEngineSmUpdateServiceReq message. |
|
134 * |
|
135 * @param aMessage Message from client-server framework |
|
136 */ |
|
137 void HandleUpdateServiceReqL(const RMessage2& aMessage); |
|
138 |
|
139 /** |
|
140 * Handles EIptvEngineSmGetServiceSizeUsingProviderId message. |
|
141 * |
|
142 * @param aMessage Message from client-server framework |
|
143 */ |
|
144 void HandleGetServiceSizeUsingProviderIdL(const RMessage2& aMessage); |
|
145 |
|
146 /** |
|
147 * Handles EIptvEngineSmGetServiceDataUsingProviderId message. |
|
148 * |
|
149 * @param aMessage Message from client-server framework |
|
150 */ |
|
151 void HandleGetServiceDataUsingProviderIdL(const RMessage2& aMessage); |
|
152 |
|
153 /** |
|
154 * Creates HBufC* and copies data from client address space |
|
155 * into it. |
|
156 * |
|
157 * @param aMessage Message from client-server framework |
|
158 * @return Pointer to data. |
|
159 */ |
|
160 HBufC8* GetDataFromClientAddrSpaceLC(const RMessage2& aMessage); |
|
161 |
|
162 /** |
|
163 * Used for EIptvEngineSmGetServicesReq and EIptvEngineSmGetServicesUsingIdReq. |
|
164 * Builds size (= iServicesSizeRespIpcMsg) and data (= iServicesDataRespIpcMsg) |
|
165 * messages from iServicesArray. |
|
166 * iServicesSizeRespIpcMsg message contains iServicesDataRespIpcMsg length. |
|
167 */ |
|
168 void BuildServiceIpcMsgRespsL(); |
|
169 |
|
170 /** |
|
171 * Updates last update time to Service db LastUpdate column. |
|
172 * @param aServiceId The service id. |
|
173 * @param aLastUpdate The last update time. |
|
174 */ |
|
175 void SetEpgLastUpdateTimeL( TUint32 aServiceId, TTime& aLastUpdate ); |
|
176 |
|
177 /** |
|
178 * Completes the request with status information. |
|
179 * |
|
180 * @param aMessage |
|
181 * @param aError Error code from Service Manager |
|
182 * @param aGlobalError If operation leaved this contains the reason code. |
|
183 */ |
|
184 void SendStatusRespL( const RMessage2& aMessage, |
|
185 MIptvServiceManagementClientObserver::TRespStatus aError, |
|
186 TInt aGlobalError ); |
|
187 |
|
188 /** |
|
189 * Deletes service group with all belog feeeds. |
|
190 * |
|
191 * @param aGroupId a group id of service(s) to be deleted |
|
192 * @return error code. |
|
193 */ |
|
194 TInt DeleteGroupL( const TUint32 aGroupId ); |
|
195 |
|
196 /** |
|
197 * Handles EIptvEngineSmDeleteServiceReq message. |
|
198 * |
|
199 * @param aServiceId a service id of service to be deleted |
|
200 * @param aServiceType a type of service to be deleted |
|
201 * @return error code. |
|
202 */ |
|
203 TInt DeleteServiceL( const TUint32 aServiceId, |
|
204 const CIptvService::TServiceType aServiceType ); |
|
205 |
|
206 public: |
|
207 |
|
208 /** |
|
209 * From MIptvServiceManagerObserver |
|
210 */ |
|
211 void HandleSmEvent(CIptvSmEvent& aEvent); |
|
212 |
|
213 /** |
|
214 * Actual implementation for HandleSmEvent. |
|
215 */ |
|
216 void HandleSmEventL(CIptvSmEvent& aEvent); |
|
217 |
|
218 private: |
|
219 |
|
220 /** |
|
221 * C++ default constructor. |
|
222 */ |
|
223 CIptvServiceMsgHandler(CIptvServer& aServer); |
|
224 |
|
225 /** |
|
226 * Symbian 2nd phase constructor. |
|
227 */ |
|
228 void ConstructL(); |
|
229 |
|
230 private: // Data |
|
231 |
|
232 /** |
|
233 * Owner of this object |
|
234 */ |
|
235 CIptvServer& iServer; |
|
236 |
|
237 /** |
|
238 * Used to store services data resp IPC msg |
|
239 */ |
|
240 HBufC8* iServicesDataRespIpcMsg; |
|
241 |
|
242 /** |
|
243 * Used to store services size resp IPC msg |
|
244 */ |
|
245 HBufC8* iServicesSizeRespIpcMsg; |
|
246 |
|
247 /** |
|
248 * Stores CIptvServices object |
|
249 */ |
|
250 CIptvServices* iServices; |
|
251 |
|
252 /** |
|
253 * Generates events, CIptvEventListener catches them in client process. |
|
254 */ |
|
255 CIptvEventGenerator* iEventGenerator; |
|
256 |
|
257 }; |
|
258 |
|
259 #endif // CIPTVSERVICEMSGHANDLER_H |
|
260 |
|
261 // End of File |