1 /* |
1 /* |
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2009 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 |
|
19 #include "activewaitforecomevent.h" |
18 #include <usb/usblogger.h> |
20 #include <usb/usblogger.h> |
19 #include "activewaitforecomevent.h" |
|
20 #include "utils.h" |
21 #include "utils.h" |
21 #include "OstTraceDefinitions.h" |
22 |
22 #ifdef OST_TRACE_COMPILER_IN_USE |
23 |
23 #include "activewaitforecomeventTraces.h" |
24 #ifdef __FLOG_ACTIVE |
|
25 _LIT8(KLogComponent, "fdf "); |
24 #endif |
26 #endif |
|
27 |
25 #ifdef _DEBUG |
28 #ifdef _DEBUG |
26 _LIT( KFdfEcomEventAOPanicCategory, "FdfEcomEventAO" ); |
29 _LIT( KFdfEcomEventAOPanicCategory, "FdfEcomEventAO" ); |
27 #endif |
30 #endif |
28 |
31 |
29 CActiveWaitForEComEvent::CActiveWaitForEComEvent(MEComEventObserver& aObserver) |
32 CActiveWaitForEComEvent::CActiveWaitForEComEvent(MEComEventObserver& aObserver) |
30 : CActive(CActive::EPriorityStandard), |
33 : CActive(CActive::EPriorityStandard), |
31 iObserver(aObserver) |
34 iObserver(aObserver) |
32 { |
35 { |
33 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_CONS_ENTRY ); |
36 LOG_FUNC |
34 |
37 |
35 CActiveScheduler::Add(this); |
38 CActiveScheduler::Add(this); |
36 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_CONS_EXIT ); |
|
37 } |
39 } |
38 |
40 |
39 CActiveWaitForEComEvent::~CActiveWaitForEComEvent() |
41 CActiveWaitForEComEvent::~CActiveWaitForEComEvent() |
40 { |
42 { |
41 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_CACTIVEWAITFORECOMEVENT_DES_ENTRY ); |
43 LOG_FUNC |
42 |
44 Cancel(); |
43 Cancel(); |
|
44 iEComSession.Close(); |
45 iEComSession.Close(); |
45 REComSession::FinalClose(); |
46 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 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_WAIT_ENTRY ); |
66 LOG_FUNC |
67 |
|
68 iEComSession.NotifyOnChange(iStatus); |
67 iEComSession.NotifyOnChange(iStatus); |
69 SetActive(); |
68 SetActive(); |
70 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_WAIT_EXIT ); |
|
71 } |
69 } |
72 |
70 |
73 void CActiveWaitForEComEvent::RunL() |
71 void CActiveWaitForEComEvent::RunL() |
74 { |
72 { |
75 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_RUNL_ENTRY ); |
73 LOG_LINE |
76 |
74 LOG_FUNC |
77 iObserver.EComEventReceived(); |
75 iObserver.EComEventReceived(); |
78 Wait(); |
76 Wait(); |
79 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_RUNL_EXIT ); |
|
80 } |
77 } |
81 |
78 |
82 void CActiveWaitForEComEvent::DoCancel() |
79 void CActiveWaitForEComEvent::DoCancel() |
83 { |
80 { |
84 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_DOCANCEL_ENTRY ); |
81 LOG_FUNC |
85 |
|
86 iEComSession.CancelNotifyOnChange(iStatus); |
82 iEComSession.CancelNotifyOnChange(iStatus); |
87 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_DOCANCEL_EXIT ); |
|
88 } |
83 } |
89 |
84 |
90 TInt CActiveWaitForEComEvent::RunError(TInt aError) |
85 TInt CActiveWaitForEComEvent::RunError(TInt aError) |
91 { |
86 { |
92 OstTraceFunctionEntry0( CACTIVEWAITFORECOMEVENT_RUNERROR_ENTRY ); |
87 LOG_LINE |
93 OstTrace1( TRACE_FATAL, CACTIVEWAITFORECOMEVENT_RUNERROR, "ECOM change notification error = %d ", aError ); |
88 LOG_FUNC |
94 |
89 LOGTEXT2(_L8("ECOM change notification error = %d "), aError); |
95 __ASSERT_DEBUG(EFalse,User::Panic(KFdfEcomEventAOPanicCategory, aError)); |
90 __ASSERT_DEBUG(EFalse, _USB_PANIC(KFdfEcomEventAOPanicCategory, aError)); |
96 OstTraceFunctionExit0( CACTIVEWAITFORECOMEVENT_RUNERROR_EXIT ); |
|
97 return KErrNone; |
91 return KErrNone; |
98 } |
92 } |