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 CUsbIdPinObserver::ConstructL() |
40 void CUsbIdPinObserver::ConstructL() |
41 { |
41 { |
42 LOG_FUNC |
42 LOG_FUNC |
43 |
43 |
44 User::LeaveIfError(iIdPin.Attach(KUidUsbManCategory, |
44 LEAVEIFERROR(iIdPin.Attach(KUidUsbManCategory, |
45 KUsbOtgIdPinPresentProperty)); |
45 KUsbOtgIdPinPresentProperty)); |
46 |
46 |
47 } |
47 } |
48 |
48 |
49 // --------------------------------------------------------------------------- |
49 // --------------------------------------------------------------------------- |
90 TInt err = iIdPin.Get(val); |
90 TInt err = iIdPin.Get(val); |
91 |
91 |
92 if (KErrNone != err) |
92 if (KErrNone != err) |
93 { |
93 { |
94 LOG("CanNotGetIdPinProperty" ); |
94 LOG("CanNotGetIdPinProperty" ); |
95 Panic( ECanNotGetIdPinProperty); |
95 PANIC( ECanNotGetIdPinProperty); |
96 } |
96 } |
97 |
97 |
98 return (EFalse == val ? EIdPinOff : EIdPinOn); |
98 return (EFalse == val ? EIdPinOff : EIdPinOn); |
99 } |
99 } |
100 |
100 |
108 |
108 |
109 // check if the same observer already exist in a list |
109 // check if the same observer already exist in a list |
110 if (KErrNotFound != iObservers.Find(&aObserver)) |
110 if (KErrNotFound != iObservers.Find(&aObserver)) |
111 { |
111 { |
112 LOG("Observer already exists" ); |
112 LOG("Observer already exists" ); |
113 Panic( EObserverAlreadyExists); |
113 PANIC( EObserverAlreadyExists); |
114 return; |
114 return; |
115 } |
115 } |
116 iObservers.AppendL(&aObserver); |
116 iObservers.AppendL(&aObserver); |
117 |
117 |
118 if (KFirst == iObservers.Count()) // first item |
118 if (KFirst == iObservers.Count()) // first item |
133 |
133 |
134 TInt i(iObservers.Find(&aObserver)); |
134 TInt i(iObservers.Find(&aObserver)); |
135 if (KErrNotFound == i) |
135 if (KErrNotFound == i) |
136 { |
136 { |
137 LOG("Observer not found"); |
137 LOG("Observer not found"); |
138 Panic( ECanNotFindIdPinObserver); |
138 PANIC( ECanNotFindIdPinObserver); |
139 return; |
139 return; |
140 } |
140 } |
141 |
141 |
142 iObservers.Remove(i); |
142 iObservers.Remove(i); |
143 |
143 |
186 { |
186 { |
187 iObservers[i]->IdPinOnL(); |
187 iObservers[i]->IdPinOnL(); |
188 } |
188 } |
189 break; |
189 break; |
190 } |
190 } |
191 ; |
|
192 |
191 |
193 case EIdPinOff: |
192 case EIdPinOff: |
194 { |
193 { |
195 LOG("IdPin OFF"); |
194 LOG("IdPin OFF"); |
196 |
195 |
198 { |
197 { |
199 iObservers[i]->IdPinOffL(); |
198 iObservers[i]->IdPinOffL(); |
200 } |
199 } |
201 break; |
200 break; |
202 } |
201 } |
203 ; |
|
204 |
202 |
205 default: |
203 default: |
206 { |
204 { |
207 LOG("WrongIdPinState"); |
205 LOG("WrongIdPinState"); |
208 Panic( EWrongIdPinState); |
206 PANIC( EWrongIdPinState); |
209 } |
207 } |
210 } |
208 } |
211 |
209 |
212 } |
210 } |
213 |
211 |