1 /* |
1 /* |
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006 - 2010 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". |
77 LOGTEXT2(_L8("CUsbLcdActive::RunL() error = %d"),iStatus.Int()); |
77 LOGTEXT2(_L8("CUsbLcdActive::RunL() error = %d"),iStatus.Int()); |
78 } |
78 } |
79 else |
79 else |
80 { |
80 { |
81 |
81 |
82 TInt ret = RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, value); |
82 TInt ret = iProperty.Get( value ); |
83 LOGTEXT2(_L8("CUsbLcdActive::RunL() Personality = %d"), value); |
83 LOGTEXT3(_L8("Personality: %d, ret: %d"), value, ret); |
84 iProperty.Subscribe(iStatus); |
84 iProperty.Subscribe(iStatus); |
85 SetActive(); |
85 SetActive(); |
86 if (ret == KErrNone) |
86 if (ret == KErrNone) |
87 { |
87 { |
88 switch (value) |
88 HandleUsbPersonalityChange( value ); |
89 { |
89 } |
90 case KUsbPersonalityIdPCSuite: |
|
91 case KUsbPersonalityIdPCSuiteMTP: |
|
92 NotifyLcd(ETrue); |
|
93 LOGTEXT(_L8("CUsbLcdActive::RunL() in PC Suite mode")); |
|
94 break; |
|
95 |
|
96 default: |
|
97 NotifyLcd(EFalse); |
|
98 LOGTEXT(_L8("CUsbLcdActive::RunL() mode is not PC Suite")); |
|
99 break; |
|
100 } |
|
101 } |
|
102 } |
90 } |
103 } |
91 } |
104 |
92 |
105 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
106 // From class CActive |
94 // From class CActive |
143 void CUsbLcdActive::Start() |
131 void CUsbLcdActive::Start() |
144 { |
132 { |
145 LOG_FUNC |
133 LOG_FUNC |
146 iProperty.Subscribe(iStatus); |
134 iProperty.Subscribe(iStatus); |
147 SetActive(); |
135 SetActive(); |
|
136 // Check the starting state |
|
137 TInt usbPersonalityId( KUsbWatcherSelectedPersonalityNone ); |
|
138 TInt ret = iProperty.Get( usbPersonalityId ); |
|
139 if ( ( ret == KErrNone ) && |
|
140 ( usbPersonalityId != KUsbWatcherSelectedPersonalityNone ) ) |
|
141 { |
|
142 HandleUsbPersonalityChange( usbPersonalityId ); |
|
143 } |
148 } |
144 } |
149 |
145 |
|
146 |
150 // --------------------------------------------------------------------------- |
147 // --------------------------------------------------------------------------- |
151 // This function notifying LoCoD framewark about active USB personality |
148 // This function handles the USB active personality change, and notify LoCoD |
152 // If Personality == 113 (PC Suite), then ETrue; in all other cases is EFalse |
149 // framework whether PC Suite is active |
153 // --------------------------------------------------------------------------- |
150 // --------------------------------------------------------------------------- |
154 // |
151 // |
155 void CUsbLcdActive::NotifyLcd(TBool aUsbStatus) |
152 void CUsbLcdActive::HandleUsbPersonalityChange( TInt aNewPersonalityId ) |
156 { |
153 { |
157 LOG_FUNC |
154 LOG_FUNC |
158 iObserver.NotifyBearerStatus(ELocodBearerUSB, aUsbStatus); |
155 LOGTEXT2( _L8( "aNewPersonalityId: %d"), aNewPersonalityId ); |
|
156 TBool isPcSuiteActive( EFalse ); |
|
157 if ( ( aNewPersonalityId == KUsbPersonalityIdPCSuite ) || |
|
158 ( aNewPersonalityId == KUsbPersonalityIdPCSuiteMTP ) ) |
|
159 { |
|
160 isPcSuiteActive = ETrue; |
|
161 } |
|
162 iObserver.NotifyBearerStatus( ELocodBearerUSB, isPcSuiteActive ); |
159 } |
163 } |
160 |
164 |
161 //End of file |
165 //End of file |