equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-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". |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include "cusbhostwatcher.h" |
19 #include "cusbhostwatcher.h" |
|
20 #include <usb/usblogger.h> |
20 #include "cusbhost.h" |
21 #include "cusbhost.h" |
21 |
22 |
22 #include "OstTraceDefinitions.h" |
23 |
23 #ifdef OST_TRACE_COMPILER_IN_USE |
24 #ifdef __FLOG_ACTIVE |
24 #include "cusbhostwatcherTraces.h" |
25 _LIT8(KLogComponent, "hoststatewatcher"); |
25 #endif |
26 #endif |
26 |
|
27 |
|
28 |
27 |
29 /* |
28 /* |
30 * Base class for USB Host watchers |
29 * Base class for USB Host watchers |
31 */ |
30 */ |
32 CActiveUsbHostWatcher::CActiveUsbHostWatcher(RUsbHostStack& aUsbHostStack, |
31 CActiveUsbHostWatcher::CActiveUsbHostWatcher(RUsbHostStack& aUsbHostStack, |
35 CActive(CActive::EPriorityStandard), |
34 CActive(CActive::EPriorityStandard), |
36 iUsbHostStack(aUsbHostStack), |
35 iUsbHostStack(aUsbHostStack), |
37 iOwner(aOwner), |
36 iOwner(aOwner), |
38 iWatcherId(aWatcherId) |
37 iWatcherId(aWatcherId) |
39 { |
38 { |
40 OstTraceFunctionEntry0( CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_CONS_ENTRY ); |
39 LOG_FUNC |
41 CActiveScheduler::Add(this); |
40 CActiveScheduler::Add(this); |
42 OstTraceFunctionExit0( CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_CONS_EXIT ); |
|
43 } |
41 } |
44 |
42 |
45 CActiveUsbHostWatcher::~CActiveUsbHostWatcher() |
43 CActiveUsbHostWatcher::~CActiveUsbHostWatcher() |
46 { |
44 { |
47 OstTraceFunctionEntry0( CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_DES_ENTRY ); |
45 LOG_FUNC |
48 Cancel(); |
46 Cancel(); |
49 OstTraceFunctionExit0( CACTIVEUSBHOSTWATCHER_CACTIVEUSBHOSTWATCHER_DES_EXIT ); |
|
50 } |
47 } |
51 |
48 |
52 void CActiveUsbHostWatcher::RunL() |
49 void CActiveUsbHostWatcher::RunL() |
53 { |
50 { |
54 OstTraceFunctionEntry0( CACTIVEUSBHOSTWATCHER_RUNL_ENTRY ); |
51 LOG_FUNC |
55 |
52 |
56 ASSERT(iStatus.Int() == KErrNone); |
53 ASSERT(iStatus.Int() == KErrNone); |
57 iOwner.NotifyHostEvent(iWatcherId); |
54 iOwner.NotifyHostEvent(iWatcherId); |
58 Post(); |
55 Post(); |
59 OstTraceFunctionExit0( CACTIVEUSBHOSTWATCHER_RUNL_EXIT ); |
|
60 } |
56 } |
61 |
57 |
62 |
58 |
63 |
59 |
64 /* |
60 /* |
82 aOwner, |
78 aOwner, |
83 KHostEventMonitor) |
79 KHostEventMonitor) |
84 , iHostEventInfo(aHostEventInfo) |
80 , iHostEventInfo(aHostEventInfo) |
85 |
81 |
86 { |
82 { |
87 OstTraceFunctionEntry0( CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_CONS_ENTRY ); |
83 LOG_FUNC |
88 OstTraceFunctionExit0( CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_CONS_EXIT ); |
|
89 } |
84 } |
90 |
85 |
91 CActiveUsbHostEventWatcher::~CActiveUsbHostEventWatcher() |
86 CActiveUsbHostEventWatcher::~CActiveUsbHostEventWatcher() |
92 { |
87 { |
93 OstTraceFunctionEntry0( CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_DES_ENTRY ); |
88 LOG_FUNC |
94 Cancel(); |
89 Cancel(); |
95 OstTraceFunctionExit0( CACTIVEUSBHOSTEVENTWATCHER_CACTIVEUSBHOSTEVENTWATCHER_DES_EXIT ); |
|
96 } |
90 } |
97 |
91 |
98 void CActiveUsbHostEventWatcher::Post() |
92 void CActiveUsbHostEventWatcher::Post() |
99 { |
93 { |
100 OstTraceFunctionEntry0( CACTIVEUSBHOSTEVENTWATCHER_POST_ENTRY ); |
94 LOG_FUNC |
101 |
95 |
102 iUsbHostStack.NotifyDeviceEvent(iStatus, iHostEventInfo); |
96 iUsbHostStack.NotifyDeviceEvent(iStatus, iHostEventInfo); |
103 SetActive(); |
97 SetActive(); |
104 OstTraceFunctionExit0( CACTIVEUSBHOSTEVENTWATCHER_POST_EXIT ); |
|
105 } |
98 } |
106 |
99 |
107 void CActiveUsbHostEventWatcher::DoCancel() |
100 void CActiveUsbHostEventWatcher::DoCancel() |
108 { |
101 { |
109 OstTraceFunctionEntry0( CACTIVEUSBHOSTEVENTWATCHER_DOCANCEL_ENTRY ); |
102 LOG_FUNC |
110 |
103 |
111 iUsbHostStack.NotifyDeviceEventCancel(); |
104 iUsbHostStack.NotifyDeviceEventCancel(); |
112 OstTraceFunctionExit0( CACTIVEUSBHOSTEVENTWATCHER_DOCANCEL_EXIT ); |
|
113 } |
105 } |
114 |
106 |
115 |
107 |
116 /* |
108 /* |
117 * Monitors device monitor events |
109 * Monitors device monitor events |
126 return self; |
118 return self; |
127 } |
119 } |
128 |
120 |
129 CActiveUsbHostMessageWatcher::~CActiveUsbHostMessageWatcher() |
121 CActiveUsbHostMessageWatcher::~CActiveUsbHostMessageWatcher() |
130 { |
122 { |
131 OstTraceFunctionEntry0( CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_DES_ENTRY ); |
123 LOG_FUNC |
|
124 |
132 Cancel(); |
125 Cancel(); |
133 OstTraceFunctionExit0( CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_DES_EXIT ); |
|
134 } |
126 } |
135 |
127 |
136 CActiveUsbHostMessageWatcher::CActiveUsbHostMessageWatcher( |
128 CActiveUsbHostMessageWatcher::CActiveUsbHostMessageWatcher( |
137 RUsbHostStack& aUsbHostStack, |
129 RUsbHostStack& aUsbHostStack, |
138 MUsbHostObserver& aOwner, |
130 MUsbHostObserver& aOwner, |
140 :CActiveUsbHostWatcher(aUsbHostStack, |
132 :CActiveUsbHostWatcher(aUsbHostStack, |
141 aOwner, |
133 aOwner, |
142 KHostMessageMonitor) |
134 KHostMessageMonitor) |
143 , iHostMessage(aHostMessage) |
135 , iHostMessage(aHostMessage) |
144 { |
136 { |
145 OstTraceFunctionEntry0( CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_CONS_ENTRY ); |
137 LOG_FUNC |
146 OstTraceFunctionExit0( CACTIVEUSBHOSTMESSAGEWATCHER_CACTIVEUSBHOSTMESSAGEWATCHER_CONS_EXIT ); |
|
147 } |
138 } |
148 |
139 |
149 void CActiveUsbHostMessageWatcher::Post() |
140 void CActiveUsbHostMessageWatcher::Post() |
150 { |
141 { |
151 OstTraceFunctionEntry0( CACTIVEUSBHOSTMESSAGEWATCHER_POST_ENTRY ); |
142 LOG_FUNC |
152 |
143 |
153 iUsbHostStack.NotifyDevmonEvent(iStatus, iHostMessage); |
144 iUsbHostStack.NotifyDevmonEvent(iStatus, iHostMessage); |
154 SetActive(); |
145 SetActive(); |
155 OstTraceFunctionExit0( CACTIVEUSBHOSTMESSAGEWATCHER_POST_EXIT ); |
|
156 } |
146 } |
157 |
147 |
158 |
148 |
159 void CActiveUsbHostMessageWatcher::DoCancel() |
149 void CActiveUsbHostMessageWatcher::DoCancel() |
160 { |
150 { |
161 OstTraceFunctionEntry0( CACTIVEUSBHOSTMESSAGEWATCHER_DOCANCEL_ENTRY ); |
151 LOG_FUNC |
162 |
152 |
163 iUsbHostStack.NotifyDevmonEventCancel(); |
153 iUsbHostStack.NotifyDevmonEventCancel(); |
164 OstTraceFunctionExit0( CACTIVEUSBHOSTMESSAGEWATCHER_DOCANCEL_EXIT ); |
|
165 } |
154 } |
166 |
155 |