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