equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008 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". |
39 // |
39 // |
40 void CUsbBusActivityObserver::ConstructL() |
40 void CUsbBusActivityObserver::ConstructL() |
41 { |
41 { |
42 LOG_FUNC |
42 LOG_FUNC |
43 |
43 |
44 User::LeaveIfError(iBusActivity.Attach(KUidUsbManCategory, |
44 LEAVEIFERROR(iBusActivity.Attach(KUidUsbManCategory, |
45 KUsbOtgConnectionIdleProperty)); |
45 KUsbOtgConnectionIdleProperty)); |
46 |
46 |
47 } |
47 } |
48 |
48 |
49 // --------------------------------------------------------------------------- |
49 // --------------------------------------------------------------------------- |
90 TInt err = iBusActivity.Get(val); |
90 TInt err = iBusActivity.Get(val); |
91 |
91 |
92 if (KErrNone != err) |
92 if (KErrNone != err) |
93 { |
93 { |
94 LOG("ECanNotGetBusActivityProperty" ); |
94 LOG("ECanNotGetBusActivityProperty" ); |
95 Panic( ECanNotGetBusActivityProperty); |
95 PANIC( ECanNotGetBusActivityProperty); |
96 } |
96 } |
97 |
97 |
98 return (0 == val ? EBusActive : EBusIdle); |
98 return (0 == val ? EBusActive : EBusIdle); |
99 |
99 |
100 } |
100 } |
109 |
109 |
110 // check if the same observer already exist in a list |
110 // check if the same observer already exist in a list |
111 if (KErrNotFound != iObservers.Find(&aObserver)) |
111 if (KErrNotFound != iObservers.Find(&aObserver)) |
112 { |
112 { |
113 LOG( "Observer already exists" ); |
113 LOG( "Observer already exists" ); |
114 Panic( EObserverAlreadyExists); |
114 PANIC( EObserverAlreadyExists); |
115 return; |
115 return; |
116 } |
116 } |
117 iObservers.AppendL(&aObserver); |
117 iObservers.AppendL(&aObserver); |
118 |
118 |
119 if (KFirst == iObservers.Count()) // first item |
119 if (KFirst == iObservers.Count()) // first item |
134 |
134 |
135 TInt i(iObservers.Find(&aObserver)); |
135 TInt i(iObservers.Find(&aObserver)); |
136 if (KErrNotFound == i) |
136 if (KErrNotFound == i) |
137 { |
137 { |
138 LOG( "Observer not found" ); |
138 LOG( "Observer not found" ); |
139 Panic( ECanNotFindBusActivityObserver); |
139 PANIC( ECanNotFindBusActivityObserver); |
140 return; |
140 return; |
141 } |
141 } |
142 |
142 |
143 iObservers.Remove(i); |
143 iObservers.Remove(i); |
144 |
144 |
200 } |
200 } |
201 |
201 |
202 default: |
202 default: |
203 { |
203 { |
204 LOG("WrongBusState" ); |
204 LOG("WrongBusState" ); |
205 Panic( EWrongBusState); |
205 PANIC( EWrongBusState); |
206 } |
206 } |
207 } |
207 } |
208 |
208 |
209 } |
209 } |
210 |
210 |