17 |
17 |
18 |
18 |
19 #include "wrtharvesterpsnotifier.h" |
19 #include "wrtharvesterpsnotifier.h" |
20 #include "wrtharvester.h" |
20 #include "wrtharvester.h" |
21 #include <UikonInternalPSKeys.h>//For MMC Observing |
21 #include <UikonInternalPSKeys.h>//For MMC Observing |
22 |
22 #include <usbmsshared.h>//For USB monitor |
|
23 |
23 // ============================ MEMBER FUNCTIONS ============================= |
24 // ============================ MEMBER FUNCTIONS ============================= |
24 |
25 |
25 // --------------------------------------------------------------------------- |
26 // --------------------------------------------------------------------------- |
26 // Creates an instance of CCHPluginNotifier implementation |
27 // Creates an instance of CCHPluginNotifier implementation |
27 // --------------------------------------------------------------------------- |
28 // --------------------------------------------------------------------------- |
83 // Attach the key |
84 // Attach the key |
84 if( iKey == EWidgetMMCAltered ) |
85 if( iKey == EWidgetMMCAltered ) |
85 { |
86 { |
86 User::LeaveIfError( iProperty.Attach( KPSUidUikon,KUikMMCInserted )); |
87 User::LeaveIfError( iProperty.Attach( KPSUidUikon,KUikMMCInserted )); |
87 } |
88 } |
|
89 else if( iKey == EWidgetMassStorageMode ) |
|
90 { |
|
91 User::LeaveIfError( iProperty.Attach( KUsbMsDriveState_Category,EUsbMsDriveState_DriveStatus )); |
|
92 } |
88 else |
93 else |
89 { |
94 { |
90 User::LeaveIfError( iProperty.Attach( KPropertyCat, iKey)); |
95 User::LeaveIfError( iProperty.Attach( KPropertyCat, iKey)); |
91 } |
96 } |
92 |
97 |
121 iProperty.Subscribe( iStatus ); |
126 iProperty.Subscribe( iStatus ); |
122 SetActive(); |
127 SetActive(); |
123 |
128 |
124 TInt value( 0 ); |
129 TInt value( 0 ); |
125 TInt r (KErrNone); |
130 TInt r (KErrNone); |
126 if( iKey != EWidgetMMCAltered ) |
131 TUsbMsDrivesStatus allDrivesStatus; |
|
132 if( iKey != EWidgetMMCAltered && iKey != EWidgetMassStorageMode ) |
127 { |
133 { |
128 iProperty.Get( KPropertyCat, iKey, value ); |
134 iProperty.Get( KPropertyCat, iKey, value ); |
129 } |
135 } |
|
136 else if( iKey == EWidgetMMCAltered ) |
|
137 { |
|
138 r = iProperty.Get( KPSUidUikon, KUikMMCInserted , value ); |
|
139 } |
130 else |
140 else |
131 { |
141 { |
132 iProperty.Get( KPSUidUikon, KUikMMCInserted , value ); |
142 r = iProperty.Get( allDrivesStatus ); |
133 } |
143 } |
134 |
|
135 if( r == KErrNone ) |
144 if( r == KErrNone ) |
136 { |
145 { |
137 if( iKey == EWidgetUIState && value == 1 ) |
146 if( iKey == EWidgetUIState && value == 1 ) |
138 { |
147 { |
139 iHarvester->TryLaunchNextWidgetL(); |
148 iHarvester->TryLaunchNextOperationL(); |
|
149 } |
|
150 else if(iKey == EWidgetUIState && value == 2) |
|
151 { |
|
152 iHarvester->ClearAllOperations(); |
|
153 SetValue(1); |
140 } |
154 } |
141 else if( iKey == EWidgetRegAltered && value == 1 ) |
155 else if( iKey == EWidgetRegAltered && value == 1 ) |
142 { |
156 { |
143 iHarvester->UpdateL(); |
157 iHarvester->UpdateL(); |
144 } |
158 } |
145 else if( iKey ==EWidgetMMCAltered ) |
159 else if( iKey == EWidgetMMCAltered ) |
146 { |
160 { |
147 iHarvester->UpdateL(); |
161 iHarvester->UpdateL(); |
|
162 } |
|
163 else if( iKey == EWidgetMassStorageMode ) |
|
164 { |
|
165 TInt count = allDrivesStatus.Length()/2; |
|
166 for ( TInt i = 0; i < count; i++ ) |
|
167 { |
|
168 TInt driveNumber = allDrivesStatus[2*i]; |
|
169 TInt driveStatus = allDrivesStatus[2*i+1]; |
|
170 switch( driveStatus ) |
|
171 { |
|
172 case EUsbMsDriveState_Connected: |
|
173 case EUsbMsDriveState_Disconnected: |
|
174 { |
|
175 iHarvester->UpdateL(); |
|
176 } |
|
177 break; |
|
178 default: |
|
179 break; |
|
180 } |
|
181 } |
148 } |
182 } |
149 } |
183 } |
150 } |
184 } |
151 |
185 |
152 // --------------------------------------------------------------------------- |
186 // --------------------------------------------------------------------------- |