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". |
37 // |
37 // |
38 void CUsbOtgStateObserver::ConstructL() |
38 void CUsbOtgStateObserver::ConstructL() |
39 { |
39 { |
40 LOG_FUNC |
40 LOG_FUNC |
41 |
41 |
42 User::LeaveIfError(iOtgState.Attach(KUidUsbManCategory, |
42 LEAVEIFERROR(iOtgState.Attach(KUidUsbManCategory, |
43 KUsbOtgStateProperty)); |
43 KUsbOtgStateProperty)); |
44 |
44 |
45 } |
45 } |
46 |
46 |
47 // --------------------------------------------------------------------------- |
47 // --------------------------------------------------------------------------- |
86 TInt err = iOtgState.Get(val); |
86 TInt err = iOtgState.Get(val); |
87 |
87 |
88 if (KErrNone != err) |
88 if (KErrNone != err) |
89 { |
89 { |
90 LOG("CanNotGetOtgStateProperty" ); |
90 LOG("CanNotGetOtgStateProperty" ); |
91 Panic( ECanNotGetOtgStateProperty); |
91 PANIC( ECanNotGetOtgStateProperty); |
92 } |
92 } |
93 |
93 |
94 return (TUsbOtgState) val; |
94 return (TUsbOtgState) val; |
95 |
95 |
96 } |
96 } |
105 |
105 |
106 // check if the same observer already exist in a list |
106 // check if the same observer already exist in a list |
107 if (KErrNotFound != iObservers.Find(&aObserver)) |
107 if (KErrNotFound != iObservers.Find(&aObserver)) |
108 { |
108 { |
109 LOG( "Observer already exists" ); |
109 LOG( "Observer already exists" ); |
110 Panic( EObserverAlreadyExists); |
110 PANIC( EObserverAlreadyExists); |
111 return; |
111 return; |
112 } |
112 } |
113 iObservers.AppendL(&aObserver); |
113 iObservers.AppendL(&aObserver); |
114 |
114 |
115 if (KFirst == iObservers.Count()) // first item |
115 if (KFirst == iObservers.Count()) // first item |
130 |
130 |
131 TInt i(iObservers.Find(&aObserver)); |
131 TInt i(iObservers.Find(&aObserver)); |
132 if (KErrNotFound == i) |
132 if (KErrNotFound == i) |
133 { |
133 { |
134 LOG("Observer not found"); |
134 LOG("Observer not found"); |
135 Panic( ECanNotFindOtgStateObserver); |
135 PANIC( ECanNotFindOtgStateObserver); |
136 return; |
136 return; |
137 } |
137 } |
138 |
138 |
139 iObservers.Remove(i); |
139 iObservers.Remove(i); |
140 |
140 |
243 break; |
243 break; |
244 } |
244 } |
245 default: |
245 default: |
246 { |
246 { |
247 LOG("WrongOtgState" ); |
247 LOG("WrongOtgState" ); |
248 Panic( EWrongOtgState); |
248 PANIC( EWrongOtgState); |
249 } |
249 } |
250 } |
250 } |
251 |
251 |
252 } |
252 } |
253 |
253 |