69 case EUsbFdfSrvEnableDriverLoading: |
70 case EUsbFdfSrvEnableDriverLoading: |
70 EnableDriverLoading(aMessage); |
71 EnableDriverLoading(aMessage); |
71 // This is a sync API- check that the message has been completed. |
72 // This is a sync API- check that the message has been completed. |
72 // (NB We don't check the converse for async APIs because the message |
73 // (NB We don't check the converse for async APIs because the message |
73 // may have been panicked synchronously.) |
74 // may have been panicked synchronously.) |
74 ASSERT_DEBUG(aMessage.Handle() == 0); |
75 if(!(aMessage.Handle() == 0)) |
|
76 { |
|
77 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP1, |
|
78 "Empty aMessage.Handle" ); |
|
79 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
80 } |
75 break; |
81 break; |
76 |
82 |
77 case EUsbFdfSrvDisableDriverLoading: |
83 case EUsbFdfSrvDisableDriverLoading: |
78 DisableDriverLoading(aMessage); |
84 DisableDriverLoading(aMessage); |
79 ASSERT_DEBUG(aMessage.Handle() == 0); |
85 if(!(aMessage.Handle() == 0)) |
|
86 { |
|
87 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP2, |
|
88 "Empty aMessage.Handle" ); |
|
89 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
90 } |
80 break; |
91 break; |
81 |
92 |
82 case EUsbFdfSrvNotifyDeviceEvent: |
93 case EUsbFdfSrvNotifyDeviceEvent: |
83 NotifyDeviceEvent(aMessage); |
94 NotifyDeviceEvent(aMessage); |
84 break; |
95 break; |
85 |
96 |
86 case EUsbFdfSrvNotifyDeviceEventCancel: |
97 case EUsbFdfSrvNotifyDeviceEventCancel: |
87 NotifyDeviceEventCancel(aMessage); |
98 NotifyDeviceEventCancel(aMessage); |
88 ASSERT_DEBUG(aMessage.Handle() == 0); |
99 if(!(aMessage.Handle() == 0)) |
|
100 { |
|
101 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP3, |
|
102 "Empty aMessage.Handle" ); |
|
103 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
104 } |
89 break; |
105 break; |
90 |
106 |
91 case EUsbFdfSrvNotifyDevmonEvent: |
107 case EUsbFdfSrvNotifyDevmonEvent: |
92 NotifyDevmonEvent(aMessage); |
108 NotifyDevmonEvent(aMessage); |
93 break; |
109 break; |
94 |
110 |
95 case EUsbFdfSrvNotifyDevmonEventCancel: |
111 case EUsbFdfSrvNotifyDevmonEventCancel: |
96 NotifyDevmonEventCancel(aMessage); |
112 NotifyDevmonEventCancel(aMessage); |
97 ASSERT_DEBUG(aMessage.Handle() == 0); |
113 if(!(aMessage.Handle() == 0)) |
|
114 { |
|
115 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP4, |
|
116 "Empty aMessage.Handle" ); |
|
117 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
118 } |
98 break; |
119 break; |
99 |
120 |
100 case EUsbFdfSrvGetSingleSupportedLanguageOrNumberOfSupportedLanguages: |
121 case EUsbFdfSrvGetSingleSupportedLanguageOrNumberOfSupportedLanguages: |
101 GetSingleSupportedLanguageOrNumberOfSupportedLanguages(aMessage); |
122 GetSingleSupportedLanguageOrNumberOfSupportedLanguages(aMessage); |
102 ASSERT_DEBUG(aMessage.Handle() == 0); |
123 if(!(aMessage.Handle() == 0)) |
|
124 { |
|
125 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP5, |
|
126 "Empty aMessage.Handle" ); |
|
127 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
128 } |
103 break; |
129 break; |
104 |
130 |
105 case EUsbFdfSrvGetSupportedLanguages: |
131 case EUsbFdfSrvGetSupportedLanguages: |
106 GetSupportedLanguages(aMessage); |
132 GetSupportedLanguages(aMessage); |
107 ASSERT_DEBUG(aMessage.Handle() == 0); |
133 if(!(aMessage.Handle() == 0)) |
|
134 { |
|
135 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP6, |
|
136 "Empty aMessage.Handle" ); |
|
137 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
138 } |
108 break; |
139 break; |
109 |
140 |
110 case EUsbFdfSrvGetManufacturerStringDescriptor: |
141 case EUsbFdfSrvGetManufacturerStringDescriptor: |
111 GetManufacturerStringDescriptor(aMessage); |
142 GetManufacturerStringDescriptor(aMessage); |
112 ASSERT_DEBUG(aMessage.Handle() == 0); |
143 if(!(aMessage.Handle() == 0)) |
|
144 { |
|
145 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP7, |
|
146 "Empty aMessage.Handle" ); |
|
147 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
148 } |
113 break; |
149 break; |
114 |
150 |
115 case EUsbFdfSrvGetProductStringDescriptor: |
151 case EUsbFdfSrvGetProductStringDescriptor: |
116 GetProductStringDescriptor(aMessage); |
152 GetProductStringDescriptor(aMessage); |
117 ASSERT_DEBUG(aMessage.Handle() == 0); |
153 if(!(aMessage.Handle() == 0)) |
|
154 { |
|
155 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP8, |
|
156 "Empty aMessage.Handle" ); |
|
157 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
158 } |
118 break; |
159 break; |
119 |
160 |
120 case EUsbFdfSrvGetOtgDescriptor: |
161 case EUsbFdfSrvGetOtgDescriptor: |
121 GetOtgDeviceDescriptor(aMessage); |
162 GetOtgDeviceDescriptor(aMessage); |
122 ASSERT_DEBUG(aMessage.Handle() == 0); |
163 if(!(aMessage.Handle() == 0)) |
|
164 { |
|
165 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP9, |
|
166 "Empty aMessage.Handle" ); |
|
167 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
168 } |
123 break; |
169 break; |
124 |
170 |
125 // Heap failure testing APIs. |
171 // Heap failure testing APIs. |
126 case EUsbFdfSrvDbgFailNext: |
172 case EUsbFdfSrvDbgFailNext: |
127 #ifdef _DEBUG |
173 #ifdef _DEBUG |
128 { |
174 { |
129 LOGTEXT2(_L8("\tfail next (simulating failure after %d allocation(s))"), aMessage.Int0()); |
175 OstTrace1( TRACE_NORMAL, CFDFSESSION_SERVICEL_DUP10, |
|
176 "fail next (simulating failure after %d allocation(s))", |
|
177 aMessage.Int0() ); |
130 if ( aMessage.Int0() == 0 ) |
178 if ( aMessage.Int0() == 0 ) |
131 { |
179 { |
132 __UHEAP_RESET; |
180 __UHEAP_RESET; |
133 } |
181 } |
134 else |
182 else |
135 { |
183 { |
136 __UHEAP_FAILNEXT(aMessage.Int0()); |
184 __UHEAP_FAILNEXT(aMessage.Int0()); |
137 } |
185 } |
138 } |
186 } |
139 #endif // _DEBUG |
187 #endif |
140 CompleteClient(aMessage, KErrNone); |
188 CompleteClient(aMessage, KErrNone); |
141 break; |
189 break; |
142 |
190 |
143 case EUsbFdfSrvDbgAlloc: |
191 case EUsbFdfSrvDbgAlloc: |
144 { |
192 { |
145 TInt err = KErrNone; |
193 TInt err = KErrNone; |
146 #ifdef _DEBUG |
194 #ifdef _DEBUG |
147 LOGTEXT(_L8("\tallocate on the heap")); |
195 OstTrace0( TRACE_NORMAL, CFDFSESSION_SERVICEL_DUP11, "allocate on the heap" ); |
148 TInt* x = NULL; |
196 TInt* x = NULL; |
149 TRAP(err, x = new(ELeave) TInt); |
197 TRAP(err, x = new(ELeave) TInt); |
150 delete x; |
198 delete x; |
151 |
199 #endif |
152 #endif // _DEBUG |
|
153 CompleteClient(aMessage, err); |
200 CompleteClient(aMessage, err); |
154 } |
201 } |
155 break; |
202 break; |
156 |
203 |
157 default: |
204 default: |
158 PANIC_MSG(aMessage, KUsbFdfServerName, EBadIpc); |
205 OstTrace0( TRACE_FATAL, CFDFSESSION_SERVICEL_DUP12, |
159 break; |
206 "Invalid message function" ); |
160 } |
207 aMessage.Panic(KUsbFdfServerName,EBadIpc); |
|
208 |
|
209 break; |
|
210 } |
|
211 OstTraceFunctionExit0( CFDFSESSION_SERVICEL_EXIT ); |
161 } |
212 } |
162 |
213 |
163 void CFdfSession::CompleteClient(const RMessage2& aMessage, TInt aError) |
214 void CFdfSession::CompleteClient(const RMessage2& aMessage, TInt aError) |
164 { |
215 { |
165 LOGTEXT2(_L8("\tcompleting client message with %d"), aError); |
216 OstTrace1( TRACE_NORMAL, CFDFSESSION_COMPLETECLIENT, "completing client message with %d", aError ); |
166 aMessage.Complete(aError); |
217 aMessage.Complete(aError); |
167 } |
218 } |
168 |
219 |
169 void CFdfSession::EnableDriverLoading(const RMessage2& aMessage) |
220 void CFdfSession::EnableDriverLoading(const RMessage2& aMessage) |
170 { |
221 { |
171 LOG_FUNC |
222 OstTraceFunctionEntry0( CFDFSESSION_ENABLEDRIVERLOADING_ENTRY ); |
172 |
223 |
173 iFdf.EnableDriverLoading(); |
224 iFdf.EnableDriverLoading(); |
174 |
225 |
175 CompleteClient(aMessage, KErrNone); |
226 CompleteClient(aMessage, KErrNone); |
|
227 OstTraceFunctionExit0( CFDFSESSION_ENABLEDRIVERLOADING_EXIT ); |
176 } |
228 } |
177 |
229 |
178 void CFdfSession::DisableDriverLoading(const RMessage2& aMessage) |
230 void CFdfSession::DisableDriverLoading(const RMessage2& aMessage) |
179 { |
231 { |
180 LOG_FUNC |
232 OstTraceFunctionEntry0( CFDFSESSION_DISABLEDRIVERLOADING_ENTRY ); |
181 |
233 |
182 iFdf.DisableDriverLoading(); |
234 iFdf.DisableDriverLoading(); |
183 |
235 |
184 CompleteClient(aMessage, KErrNone); |
236 CompleteClient(aMessage, KErrNone); |
|
237 OstTraceFunctionExit0( CFDFSESSION_DISABLEDRIVERLOADING_EXIT ); |
185 } |
238 } |
186 |
239 |
187 TBool CFdfSession::NotifyDeviceEventOutstanding() const |
240 TBool CFdfSession::NotifyDeviceEventOutstanding() const |
188 { |
241 { |
189 const TBool ret = ( iNotifyDeviceEventMsg.Handle() != 0 ); |
242 const TBool ret = ( iNotifyDeviceEventMsg.Handle() != 0 ); |
190 LOGTEXT2(_L("CFdfSession::NotifyDeviceEventOutstanding returning %d"), ret); |
243 OstTrace1( TRACE_NORMAL, CFDFSESSION_NOTIFYDEVICEEVENTOUTSTANDING, |
|
244 "CFdfSession::NotifyDeviceEventOutstanding returning %d", ret ); |
|
245 |
191 return ret; |
246 return ret; |
192 } |
247 } |
193 |
248 |
194 void CFdfSession::NotifyDeviceEvent(const RMessage2& aMessage) |
249 void CFdfSession::NotifyDeviceEvent(const RMessage2& aMessage) |
195 { |
250 { |
196 LOG_FUNC |
251 OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVICEEVENT_ENTRY ); |
197 |
252 |
198 if ( iNotifyDeviceEventMsg.Handle() ) |
253 if ( iNotifyDeviceEventMsg.Handle() ) |
199 { |
254 { |
200 PANIC_MSG(iNotifyDeviceEventMsg, KUsbFdfServerName, ENotifyDeviceEventAlreadyOutstanding); |
255 OstTrace0( TRACE_FATAL, CFDFSESSION_NOTIFYDEVICEEVENT, |
|
256 "Empty iNotifyDeviceEventMsg" ); |
|
257 iNotifyDeviceEventMsg.Panic( KUsbFdfServerName, |
|
258 ENotifyDeviceEventAlreadyOutstanding); |
201 } |
259 } |
202 else |
260 else |
203 { |
261 { |
204 iNotifyDeviceEventMsg = aMessage; |
262 iNotifyDeviceEventMsg = aMessage; |
205 TDeviceEvent event; |
263 TDeviceEvent event; |
206 if ( iFdf.GetDeviceEvent(event) ) |
264 if ( iFdf.GetDeviceEvent(event) ) |
207 { |
265 { |
208 CompleteDeviceEventNotification(event); |
266 CompleteDeviceEventNotification(event); |
209 } |
267 } |
210 } |
268 } |
|
269 OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVICEEVENT_EXIT ); |
211 } |
270 } |
212 |
271 |
213 void CFdfSession::NotifyDeviceEventCancel(const RMessage2& aMessage) |
272 void CFdfSession::NotifyDeviceEventCancel(const RMessage2& aMessage) |
214 { |
273 { |
215 LOG_FUNC |
274 OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVICEEVENTCANCEL_ENTRY ); |
216 |
275 |
217 if ( iNotifyDeviceEventMsg.Handle() ) |
276 if ( iNotifyDeviceEventMsg.Handle() ) |
218 { |
277 { |
219 CompleteClient(iNotifyDeviceEventMsg, KErrCancel); |
278 CompleteClient(iNotifyDeviceEventMsg, KErrCancel); |
220 } |
279 } |
221 CompleteClient(aMessage, KErrNone); |
280 CompleteClient(aMessage, KErrNone); |
|
281 OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVICEEVENTCANCEL_EXIT ); |
222 } |
282 } |
223 |
283 |
224 void CFdfSession::DeviceEvent(const TDeviceEvent& aEvent) |
284 void CFdfSession::DeviceEvent(const TDeviceEvent& aEvent) |
225 { |
285 { |
226 LOG_FUNC |
286 OstTraceFunctionEntry0( CFDFSESSION_DEVICEEVENT_ENTRY ); |
227 |
287 |
228 // This function should only be called if there is a request outstanding. |
288 // This function should only be called if there is a request outstanding. |
229 ASSERT_DEBUG(iNotifyDeviceEventMsg.Handle()); |
289 if(!iNotifyDeviceEventMsg.Handle()) |
230 |
290 { |
|
291 OstTrace0( TRACE_FATAL, CFDFSESSION_DEVICEEVENT, |
|
292 "iNotifyDeviceEventMsg.Handle" ); |
|
293 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
294 } |
231 CompleteDeviceEventNotification(aEvent); |
295 CompleteDeviceEventNotification(aEvent); |
|
296 OstTraceFunctionExit0( CFDFSESSION_DEVICEEVENT_EXIT ); |
232 } |
297 } |
233 |
298 |
234 void CFdfSession::CompleteDeviceEventNotification(const TDeviceEvent& aEvent) |
299 void CFdfSession::CompleteDeviceEventNotification(const TDeviceEvent& aEvent) |
235 { |
300 { |
236 LOG_FUNC |
301 OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION_ENTRY ); |
|
302 |
237 |
303 |
238 TRAPD(err, CompleteDeviceEventNotificationL(aEvent)); |
304 TRAPD(err, CompleteDeviceEventNotificationL(aEvent)); |
239 if ( err ) |
305 if ( err ) |
240 { |
306 { |
241 PANIC_MSG(iNotifyDeviceEventMsg, KUsbFdfServerName, EBadNotifyDeviceEventData); |
307 OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION, |
242 } |
308 "CompleteDeviceEventNotificationL error" ); |
|
309 iNotifyDeviceEventMsg.Panic( KUsbFdfServerName, |
|
310 EBadNotifyDeviceEventData); |
|
311 } |
|
312 OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATION_EXIT ); |
243 } |
313 } |
244 |
314 |
245 void CFdfSession::CompleteDeviceEventNotificationL(const TDeviceEvent& aEvent) |
315 void CFdfSession::CompleteDeviceEventNotificationL(const TDeviceEvent& aEvent) |
246 { |
316 { |
247 LOG_FUNC |
317 OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL_ENTRY ); |
248 |
318 |
249 // iNotifyDeviceEventMsg has one IPC arg: a TDeviceEventInformation |
319 // iNotifyDeviceEventMsg has one IPC arg: a TDeviceEventInformation |
250 |
320 if(!iNotifyDeviceEventMsg.Handle()) |
251 ASSERT_DEBUG(iNotifyDeviceEventMsg.Handle()); |
321 { |
|
322 OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL, |
|
323 "Empty iNotifyDeviceEventMsg.Handle" ); |
|
324 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
325 } |
252 |
326 |
253 TPckg<TDeviceEventInformation> info(aEvent.iInfo); |
327 TPckg<TDeviceEventInformation> info(aEvent.iInfo); |
254 iNotifyDeviceEventMsg.WriteL(0, info); |
328 iNotifyDeviceEventMsg.WriteL(0, info); |
255 |
329 |
256 CompleteClient(iNotifyDeviceEventMsg, KErrNone); |
330 CompleteClient(iNotifyDeviceEventMsg, KErrNone); |
|
331 OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVICEEVENTNOTIFICATIONL_EXIT ); |
257 } |
332 } |
258 |
333 |
259 TBool CFdfSession::NotifyDevmonEventOutstanding() const |
334 TBool CFdfSession::NotifyDevmonEventOutstanding() const |
260 { |
335 { |
261 const TBool ret = ( iNotifyDevmonEventMsg.Handle() != 0 ); |
336 const TBool ret = ( iNotifyDevmonEventMsg.Handle() != 0 ); |
262 LOGTEXT2(_L("CFdfSession::NotifyDevmonEventOutstanding returning %d"), ret); |
337 OstTrace1( TRACE_NORMAL, CFDFSESSION_NOTIFYDEVMONEVENTOUTSTANDING, |
|
338 "CFdfSession::NotifyDevmonEventOutstanding returning %d", ret ); |
263 return ret; |
339 return ret; |
264 } |
340 } |
265 |
341 |
266 void CFdfSession::NotifyDevmonEvent(const RMessage2& aMessage) |
342 void CFdfSession::NotifyDevmonEvent(const RMessage2& aMessage) |
267 { |
343 { |
268 LOG_FUNC |
344 OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVMONEVENT_ENTRY ); |
269 |
345 |
270 if ( iNotifyDevmonEventMsg.Handle() ) |
346 if ( iNotifyDevmonEventMsg.Handle() ) |
271 { |
347 { |
272 PANIC_MSG(iNotifyDevmonEventMsg, KUsbFdfServerName, ENotifyDevmonEventAlreadyOutstanding); |
348 OstTrace0( TRACE_FATAL, CFDFSESSION_NOTIFYDEVMONEVENT, |
|
349 "iNotifyDevmonEventMsg.Handle should empty" ); |
|
350 iNotifyDevmonEventMsg.Panic( KUsbFdfServerName, |
|
351 ENotifyDevmonEventAlreadyOutstanding); |
|
352 |
273 } |
353 } |
274 else |
354 else |
275 { |
355 { |
276 iNotifyDevmonEventMsg = aMessage; |
356 iNotifyDevmonEventMsg = aMessage; |
277 TInt event; |
357 TInt event; |
278 if ( iFdf.GetDevmonEvent(event) ) |
358 if ( iFdf.GetDevmonEvent(event) ) |
279 { |
359 { |
280 CompleteDevmonEventNotification(event); |
360 CompleteDevmonEventNotification(event); |
281 } |
361 } |
282 } |
362 } |
|
363 OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVMONEVENT_EXIT ); |
283 } |
364 } |
284 |
365 |
285 void CFdfSession::NotifyDevmonEventCancel(const RMessage2& aMessage) |
366 void CFdfSession::NotifyDevmonEventCancel(const RMessage2& aMessage) |
286 { |
367 { |
287 LOG_FUNC |
368 OstTraceFunctionEntry0( CFDFSESSION_NOTIFYDEVMONEVENTCANCEL_ENTRY ); |
|
369 |
288 |
370 |
289 if ( iNotifyDevmonEventMsg.Handle() ) |
371 if ( iNotifyDevmonEventMsg.Handle() ) |
290 { |
372 { |
291 CompleteClient(iNotifyDevmonEventMsg, KErrCancel); |
373 CompleteClient(iNotifyDevmonEventMsg, KErrCancel); |
292 } |
374 } |
293 CompleteClient(aMessage, KErrNone); |
375 CompleteClient(aMessage, KErrNone); |
|
376 OstTraceFunctionExit0( CFDFSESSION_NOTIFYDEVMONEVENTCANCEL_EXIT ); |
294 } |
377 } |
295 |
378 |
296 void CFdfSession::DevmonEvent(TInt aError) |
379 void CFdfSession::DevmonEvent(TInt aError) |
297 { |
380 { |
298 LOG_FUNC |
381 OstTraceFunctionEntry0( CFDFSESSION_DEVMONEVENT_ENTRY ); |
299 |
382 |
300 // This function should only be called if there is a request outstanding. |
383 // This function should only be called if there is a request outstanding. |
301 ASSERT_DEBUG(iNotifyDevmonEventMsg.Handle()); |
384 |
|
385 |
|
386 if(!iNotifyDevmonEventMsg.Handle()) |
|
387 { |
|
388 OstTrace0( TRACE_FATAL, CFDFSESSION_DEVMONEVENT, |
|
389 "Empty iNotifyDevmonEventMsg.Handle()" ); |
|
390 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
391 } |
302 |
392 |
303 CompleteDevmonEventNotification(aError); |
393 CompleteDevmonEventNotification(aError); |
|
394 OstTraceFunctionExit0( CFDFSESSION_DEVMONEVENT_EXIT ); |
304 } |
395 } |
305 |
396 |
306 void CFdfSession::CompleteDevmonEventNotification(TInt aError) |
397 void CFdfSession::CompleteDevmonEventNotification(TInt aError) |
307 { |
398 { |
308 LOG_FUNC |
399 OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION_ENTRY ); |
|
400 |
309 |
401 |
310 TRAPD(err, CompleteDevmonEventNotificationL(aError)); |
402 TRAPD(err, CompleteDevmonEventNotificationL(aError)); |
311 if ( err ) |
403 if ( err ) |
312 { |
404 { |
313 PANIC_MSG(iNotifyDevmonEventMsg, KUsbFdfServerName, EBadNotifyDevmonEventData); |
405 OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION, |
314 } |
406 "Bad Notify Devmon Event Data" ); |
|
407 iNotifyDevmonEventMsg.Panic(KUsbFdfServerName, |
|
408 EBadNotifyDevmonEventData); |
|
409 } |
|
410 OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATION_EXIT ); |
315 } |
411 } |
316 |
412 |
317 void CFdfSession::CompleteDevmonEventNotificationL(TInt aEvent) |
413 void CFdfSession::CompleteDevmonEventNotificationL(TInt aEvent) |
318 { |
414 { |
319 LOG_FUNC |
415 OstTraceFunctionEntry0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL_ENTRY ); |
320 |
416 |
321 // iNotifyDevmonEventMsg has the following IPC args: |
417 // iNotifyDevmonEventMsg has the following IPC args: |
322 // 0- TInt& aError |
418 // 0- TInt& aError |
323 |
419 if(!iNotifyDevmonEventMsg.Handle()) |
324 ASSERT_DEBUG(iNotifyDevmonEventMsg.Handle()); |
420 { |
|
421 OstTrace0( TRACE_FATAL, CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL, |
|
422 "Empty iNotifyDevmonEventMsg.Handle" ); |
|
423 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
424 } |
325 |
425 |
326 TPckg<TInt> event(aEvent); |
426 TPckg<TInt> event(aEvent); |
327 iNotifyDevmonEventMsg.WriteL(0, event); |
427 iNotifyDevmonEventMsg.WriteL(0, event); |
328 |
428 |
329 CompleteClient(iNotifyDevmonEventMsg, KErrNone); |
429 CompleteClient(iNotifyDevmonEventMsg, KErrNone); |
|
430 OstTraceFunctionExit0( CFDFSESSION_COMPLETEDEVMONEVENTNOTIFICATIONL_EXIT ); |
330 } |
431 } |
331 |
432 |
332 void CFdfSession::GetSingleSupportedLanguageOrNumberOfSupportedLanguages(const RMessage2& aMessage) |
433 void CFdfSession::GetSingleSupportedLanguageOrNumberOfSupportedLanguages(const RMessage2& aMessage) |
333 { |
434 { |
334 LOG_FUNC |
435 OstTraceFunctionEntry0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGES_ENTRY ); |
335 |
436 |
336 // To save IPC operations between client and server, we make use of the |
437 // To save IPC operations between client and server, we make use of the |
337 // fact that the majority of devices only support a single language. |
438 // fact that the majority of devices only support a single language. |
338 // The client is expected to have a buffer big enough to hold a single |
439 // The client is expected to have a buffer big enough to hold a single |
339 // TUint. |
440 // TUint. |
340 // If the device supports 0 languages, the buffer is left empty and the |
441 // If the device supports 0 languages, the buffer is left empty and the |
346 // KErrTooBig. The client then allocates a buffer big enough to hold the |
447 // KErrTooBig. The client then allocates a buffer big enough to hold the |
347 // supported languages and uses EUsbFdfSrvGetSupportedLanguages to get |
448 // supported languages and uses EUsbFdfSrvGetSupportedLanguages to get |
348 // them all. |
449 // them all. |
349 TRAPD(err, GetSingleSupportedLanguageOrNumberOfSupportedLanguagesL(aMessage)); |
450 TRAPD(err, GetSingleSupportedLanguageOrNumberOfSupportedLanguagesL(aMessage)); |
350 CompleteClient(aMessage, err); |
451 CompleteClient(aMessage, err); |
|
452 OstTraceFunctionExit0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGES_EXIT ); |
351 } |
453 } |
352 |
454 |
353 void CFdfSession::GetSingleSupportedLanguageOrNumberOfSupportedLanguagesL(const RMessage2& aMessage) |
455 void CFdfSession::GetSingleSupportedLanguageOrNumberOfSupportedLanguagesL(const RMessage2& aMessage) |
354 { |
456 { |
355 LOG_FUNC |
457 OstTraceFunctionEntry0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_ENTRY ); |
356 |
458 |
357 const TUint deviceId = aMessage.Int0(); |
459 const TUint deviceId = aMessage.Int0(); |
358 LOGTEXT2(_L8("\tdeviceId = %d"), deviceId); |
460 OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL, |
|
461 "deviceId = %d", deviceId ); |
359 const RArray<TUint>& langIds = iFdf.GetSupportedLanguagesL(deviceId); |
462 const RArray<TUint>& langIds = iFdf.GetSupportedLanguagesL(deviceId); |
360 const TUint count = langIds.Count(); |
463 const TUint count = langIds.Count(); |
361 LOGTEXT2(_L8("\tcount = %d"), count); |
464 OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP1, |
|
465 "count = %d", count ); |
362 switch ( count ) |
466 switch ( count ) |
363 { |
467 { |
364 case 0: |
468 case 0: |
365 // Nothing to write to the client's address space, complete with |
469 // Nothing to write to the client's address space, complete with |
366 LEAVEL(KErrNotFound); |
470 OstTrace0( TRACE_NORMAL, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP2, |
367 break; |
471 "Nothing to write to the client's address space" ); |
|
472 User::Leave(KErrNotFound); |
|
473 break; |
368 |
474 |
369 case 1: |
475 case 1: |
370 { |
476 { |
371 // Write the single supported language to the client, complete with |
477 // Write the single supported language to the client, complete with |
372 // KErrNone (or error of course, if their buffer isn't big enough). |
478 // KErrNone (or error of course, if their buffer isn't big enough). |
373 TPckg<TUint> buf(langIds[0]); |
479 TPckg<TUint> buf(langIds[0]); |
374 LEAVEIFERRORL(aMessage.Write(1, buf)); |
480 TInt err=aMessage.Write(1, buf); |
|
481 LEAVEIFERRORL(err,OstTrace1( TRACE_ERROR, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP3, |
|
482 "aMessage.Write with err: %d", err );); |
375 } |
483 } |
376 break; |
484 break; |
377 |
485 |
378 default: |
486 default: |
379 { |
487 { |
380 // Write the number of supported languages to the client, complete |
488 // Write the number of supported languages to the client, complete |
381 // with KErrTooBig (or error if their buffer wasn't big enough). NB |
489 // with KErrTooBig (or error if their buffer wasn't big enough). NB |
382 // This is the point at which this mechanism depends on |
490 // This is the point at which this mechanism depends on |
383 // RMessagePtr2::WriteL itself not leaving with KErrTooBig! |
491 // RMessagePtr2::WriteL itself not leaving with KErrTooBig! |
384 TPckg<TUint> buf(count); |
492 TPckg<TUint> buf(count); |
385 LEAVEIFERRORL(aMessage.Write(1, buf)); |
493 TInt error=aMessage.Write(1, buf); |
386 LEAVEL(KErrTooBig); |
494 |
387 } |
495 LEAVEIFERRORL(error, OstTrace1( TRACE_ERROR, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP4, |
388 break; |
496 "aMessage.Write with err: %d", error );); |
389 } |
497 OstTrace0( TRACE_ERROR, CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_DUP5, |
|
498 "message error too big" ); |
|
499 User::Leave(KErrTooBig); |
|
500 } |
|
501 break; |
|
502 } |
|
503 OstTraceFunctionExit0( CFDFSESSION_GETSINGLESUPPORTEDLANGUAGEORNUMBEROFSUPPORTEDLANGUAGESL_EXIT ); |
390 } |
504 } |
391 |
505 |
392 void CFdfSession::GetSupportedLanguages(const RMessage2& aMessage) |
506 void CFdfSession::GetSupportedLanguages(const RMessage2& aMessage) |
393 { |
507 { |
394 LOG_FUNC |
508 OstTraceFunctionEntry0( CFDFSESSION_GETSUPPORTEDLANGUAGES_ENTRY ); |
395 |
509 |
396 TRAPD(err, GetSupportedLanguagesL(aMessage)); |
510 TRAPD(err, GetSupportedLanguagesL(aMessage)); |
397 CompleteClient(aMessage, err); |
511 CompleteClient(aMessage, err); |
|
512 OstTraceFunctionExit0( CFDFSESSION_GETSUPPORTEDLANGUAGES_EXIT ); |
398 } |
513 } |
399 |
514 |
400 void CFdfSession::GetSupportedLanguagesL(const RMessage2& aMessage) |
515 void CFdfSession::GetSupportedLanguagesL(const RMessage2& aMessage) |
401 { |
516 { |
402 LOG_FUNC |
517 OstTraceFunctionEntry0( CFDFSESSION_GETSUPPORTEDLANGUAGESL_ENTRY ); |
403 |
518 |
404 const TUint deviceId = aMessage.Int0(); |
519 const TUint deviceId = aMessage.Int0(); |
405 LOGTEXT2(_L8("\tdeviceId = %d"), deviceId); |
520 OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSUPPORTEDLANGUAGESL, |
|
521 "deviceId = %d", deviceId ); |
406 const RArray<TUint>& langIds = iFdf.GetSupportedLanguagesL(deviceId); |
522 const RArray<TUint>& langIds = iFdf.GetSupportedLanguagesL(deviceId); |
407 |
523 |
408 const TUint count = langIds.Count(); |
524 const TUint count = langIds.Count(); |
409 LOGTEXT2(_L8("\tcount = %d"), count); |
525 OstTrace1( TRACE_NORMAL, CFDFSESSION_GETSUPPORTEDLANGUAGESL_DUP1, |
|
526 "count = %d", count ); |
410 RBuf8 buf; |
527 RBuf8 buf; |
411 buf.CreateL(count * sizeof(TUint)); |
528 buf.CreateL(count * sizeof(TUint)); |
412 CleanupClosePushL(buf); |
529 CleanupClosePushL(buf); |
413 for ( TUint ii = 0 ; ii < count ; ++ii ) |
530 for ( TUint ii = 0 ; ii < count ; ++ii ) |
414 { |
531 { |
415 buf.Append((TUint8*)&(langIds[ii]), sizeof(TUint)); |
532 buf.Append((TUint8*)&(langIds[ii]), sizeof(TUint)); |
416 } |
533 } |
417 |
534 |
418 // Write back to the client. |
535 // Write back to the client. |
419 LEAVEIFERRORL(aMessage.Write(1, buf)); |
536 TInt err=aMessage.Write(1, buf); |
|
537 LEAVEIFERRORL(err,OstTrace1( TRACE_ERROR, CFDFSESSION_GETSUPPORTEDLANGUAGESL_DUP2, |
|
538 "aMessage.Write with error: %d", err );); |
420 CleanupStack::PopAndDestroy(&buf); |
539 CleanupStack::PopAndDestroy(&buf); |
|
540 OstTraceFunctionExit0( CFDFSESSION_GETSUPPORTEDLANGUAGESL_EXIT ); |
421 } |
541 } |
422 |
542 |
423 void CFdfSession::GetManufacturerStringDescriptor(const RMessage2& aMessage) |
543 void CFdfSession::GetManufacturerStringDescriptor(const RMessage2& aMessage) |
424 { |
544 { |
425 LOG_FUNC |
545 OstTraceFunctionEntry0( CFDFSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_ENTRY ); |
|
546 |
426 |
547 |
427 GetStringDescriptor(aMessage, EManufacturer); |
548 GetStringDescriptor(aMessage, EManufacturer); |
|
549 OstTraceFunctionExit0( CFDFSESSION_GETMANUFACTURERSTRINGDESCRIPTOR_EXIT ); |
428 } |
550 } |
429 |
551 |
430 void CFdfSession::GetProductStringDescriptor(const RMessage2& aMessage) |
552 void CFdfSession::GetProductStringDescriptor(const RMessage2& aMessage) |
431 { |
553 { |
432 LOG_FUNC |
554 OstTraceFunctionEntry0( CFDFSESSION_GETPRODUCTSTRINGDESCRIPTOR_ENTRY ); |
|
555 |
433 |
556 |
434 GetStringDescriptor(aMessage, EProduct); |
557 GetStringDescriptor(aMessage, EProduct); |
|
558 OstTraceFunctionExit0( CFDFSESSION_GETPRODUCTSTRINGDESCRIPTOR_EXIT ); |
435 } |
559 } |
436 |
560 |
437 void CFdfSession::GetStringDescriptor(const RMessage2& aMessage, TStringType aStringType) |
561 void CFdfSession::GetStringDescriptor(const RMessage2& aMessage, TStringType aStringType) |
438 { |
562 { |
439 LOG_FUNC |
563 OstTraceFunctionEntry0( CFDFSESSION_GETSTRINGDESCRIPTOR_ENTRY ); |
440 |
564 |
441 TRAPD(err, GetStringDescriptorL(aMessage, aStringType)); |
565 TRAPD(err, GetStringDescriptorL(aMessage, aStringType)); |
442 CompleteClient(aMessage, err); |
566 CompleteClient(aMessage, err); |
|
567 OstTraceFunctionExit0( CFDFSESSION_GETSTRINGDESCRIPTOR_EXIT ); |
443 } |
568 } |
444 |
569 |
445 void CFdfSession::GetStringDescriptorL(const RMessage2& aMessage, TStringType aStringType) |
570 void CFdfSession::GetStringDescriptorL(const RMessage2& aMessage, TStringType aStringType) |
446 { |
571 { |
447 LOG_FUNC |
572 OstTraceFunctionEntry0( CFDFSESSION_GETSTRINGDESCRIPTORL_ENTRY ); |
448 |
573 |
449 ASSERT_DEBUG(aStringType == EManufacturer || aStringType == EProduct); |
574 if(!(aStringType == EManufacturer || aStringType == EProduct)) |
450 |
575 { |
|
576 OstTrace0( TRACE_FATAL, CFDFSESSION_GETSTRINGDESCRIPTORL, |
|
577 "String Type error" ); |
|
578 __ASSERT_DEBUG(EFalse,User::Panic(KPanicCategory,__LINE__)); |
|
579 } |
451 TName string; |
580 TName string; |
452 const TUint deviceId = aMessage.Int0(); |
581 const TUint deviceId = aMessage.Int0(); |
453 const TUint langId = aMessage.Int1(); |
582 const TUint langId = aMessage.Int1(); |
454 if ( aStringType == EManufacturer ) |
583 if ( aStringType == EManufacturer ) |
455 { |
584 { |