1 /* |
1 /* |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 #include <usb/usblogger.h> |
19 #include "activewaitforecomevent.h" |
19 #include "activewaitforecomevent.h" |
20 #include <usb/usblogger.h> |
|
21 #include "utils.h" |
20 #include "utils.h" |
22 |
21 #include "OstTraceDefinitions.h" |
23 |
22 #ifdef OST_TRACE_COMPILER_IN_USE |
24 #ifdef __FLOG_ACTIVE |
23 #include "activewaitforecomeventTraces.h" |
25 _LIT8(KLogComponent, "fdf "); |
|
26 #endif |
24 #endif |
27 |
|
28 #ifdef _DEBUG |
25 #ifdef _DEBUG |
29 _LIT( KFdfEcomEventAOPanicCategory, "FdfEcomEventAO" ); |
26 _LIT( KFdfEcomEventAOPanicCategory, "FdfEcomEventAO" ); |
30 #endif |
27 #endif |
31 |
28 |
32 CActiveWaitForEComEvent::CActiveWaitForEComEvent(MEComEventObserver& aObserver) |
29 CActiveWaitForEComEvent::CActiveWaitForEComEvent(MEComEventObserver& aObserver) |
33 : CActive(CActive::EPriorityStandard), |
30 : CActive(CActive::EPriorityStandard), |
34 iObserver(aObserver) |
31 iObserver(aObserver) |
35 { |
32 { |
36 LOG_FUNC |
33 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_CONS_ENTRY ); |
37 |
34 |
38 CActiveScheduler::Add(this); |
35 CActiveScheduler::Add(this); |
|
36 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_CONS_EXIT ); |
39 } |
37 } |
40 |
38 |
41 CActiveWaitForEComEvent::~CActiveWaitForEComEvent() |
39 CActiveWaitForEComEvent::~CActiveWaitForEComEvent() |
42 { |
40 { |
43 LOG_FUNC |
41 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_DES_ENTRY ); |
44 Cancel(); |
42 |
|
43 Cancel(); |
45 iEComSession.Close(); |
44 iEComSession.Close(); |
46 REComSession::FinalClose(); |
45 REComSession::FinalClose(); |
|
46 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_DES_EXIT ); |
47 } |
47 } |
48 |
48 |
49 CActiveWaitForEComEvent* CActiveWaitForEComEvent::NewL(MEComEventObserver& aObserver) |
49 CActiveWaitForEComEvent* CActiveWaitForEComEvent::NewL(MEComEventObserver& aObserver) |
50 { |
50 { |
51 CActiveWaitForEComEvent* self = new(ELeave) CActiveWaitForEComEvent(aObserver); |
51 CActiveWaitForEComEvent* self = new(ELeave) CActiveWaitForEComEvent(aObserver); |
61 iEComSession = REComSession::OpenL(); |
61 iEComSession = REComSession::OpenL(); |
62 } |
62 } |
63 |
63 |
64 void CActiveWaitForEComEvent::Wait() |
64 void CActiveWaitForEComEvent::Wait() |
65 { |
65 { |
66 LOG_FUNC |
66 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_WAIT_ENTRY ); |
|
67 |
67 iEComSession.NotifyOnChange(iStatus); |
68 iEComSession.NotifyOnChange(iStatus); |
68 SetActive(); |
69 SetActive(); |
|
70 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_WAIT_EXIT ); |
69 } |
71 } |
70 |
72 |
71 void CActiveWaitForEComEvent::RunL() |
73 void CActiveWaitForEComEvent::RunL() |
72 { |
74 { |
73 LOG_LINE |
75 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_RUNL_ENTRY ); |
74 LOG_FUNC |
76 |
75 iObserver.EComEventReceived(); |
77 iObserver.EComEventReceived(); |
76 Wait(); |
78 Wait(); |
|
79 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_RUNL_EXIT ); |
77 } |
80 } |
78 |
81 |
79 void CActiveWaitForEComEvent::DoCancel() |
82 void CActiveWaitForEComEvent::DoCancel() |
80 { |
83 { |
81 LOG_FUNC |
84 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_DOCANCEL_ENTRY ); |
|
85 |
82 iEComSession.CancelNotifyOnChange(iStatus); |
86 iEComSession.CancelNotifyOnChange(iStatus); |
|
87 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_DOCANCEL_EXIT ); |
83 } |
88 } |
84 |
89 |
85 TInt CActiveWaitForEComEvent::RunError(TInt aError) |
90 TInt CActiveWaitForEComEvent::RunError(TInt aError) |
86 { |
91 { |
87 LOG_LINE |
92 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_RUNERROR_ENTRY ); |
88 LOG_FUNC |
93 OstTrace1( TRACE_FATAL, CACTIVEWAITFORECOMEVENT_RUNERROR, "ECOM change notification error = %d ", aError ); |
89 LOGTEXT2(_L8("ECOM change notification error = %d "), aError); |
94 |
90 __ASSERT_DEBUG(EFalse, _USB_PANIC(KFdfEcomEventAOPanicCategory, aError)); |
95 __ASSERT_DEBUG(EFalse,User::Panic(KFdfEcomEventAOPanicCategory, aError)); |
|
96 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_RUNERROR_EXIT ); |
91 return KErrNone; |
97 return KErrNone; |
92 } |
98 } |