195 // P&S property observers |
195 // P&S property observers |
196 CleanupPropertyObservers(); |
196 CleanupPropertyObservers(); |
197 |
197 |
198 iBatteryLevelObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMBatteryLevel,*this); |
198 iBatteryLevelObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMBatteryLevel,*this); |
199 iBatteryStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMBatteryStatus,*this); |
199 iBatteryStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMBatteryStatus,*this); |
|
200 iExtendedBatteryStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMExtendedBatteryStatus,*this); |
200 iChargingStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMChargingStatus,*this); |
201 iChargingStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMChargingStatus,*this); |
|
202 iExtendedChargingStatusObserver = CPsPropertyObserver::NewL(KPSUidHWRMPowerState, KHWRMExtendedChargingStatus,*this); |
201 } |
203 } |
202 |
204 |
203 void CHWRMTestBase::CleanupPropertyObservers() |
205 void CHWRMTestBase::CleanupPropertyObservers() |
204 { |
206 { |
205 delete iBatteryLevelObserver; |
207 delete iBatteryLevelObserver; |
206 iBatteryLevelObserver = NULL; |
208 iBatteryLevelObserver = NULL; |
207 delete iBatteryStatusObserver; |
209 delete iBatteryStatusObserver; |
208 iBatteryLevelObserver = NULL; |
210 iBatteryStatusObserver = NULL; |
|
211 delete iExtendedBatteryStatusObserver; |
|
212 iExtendedBatteryStatusObserver = NULL; |
209 delete iChargingStatusObserver; |
213 delete iChargingStatusObserver; |
210 iBatteryLevelObserver = NULL; |
214 iChargingStatusObserver = NULL; |
|
215 delete iExtendedChargingStatusObserver; |
|
216 iExtendedChargingStatusObserver = NULL; |
211 } |
217 } |
212 |
218 |
213 void CHWRMTestBase::GetCRVibraAttributeL(TUint32 aVibraKey, TInt &aValue) |
219 void CHWRMTestBase::GetCRVibraAttributeL(TUint32 aVibraKey, TInt &aValue) |
214 { |
220 { |
215 CRepository* rep = CRepository::NewLC(KCRUidVibraCtrl); |
221 CRepository* rep = CRepository::NewLC(KCRUidVibraCtrl); |
362 void CHWRMTestBase::ExpectBatteryStatusNotificationL(EPSHWRMBatteryStatus aStatus) |
368 void CHWRMTestBase::ExpectBatteryStatusNotificationL(EPSHWRMBatteryStatus aStatus) |
363 { |
369 { |
364 iExpectedBatteryStatusNotifications.AppendL(aStatus); |
370 iExpectedBatteryStatusNotifications.AppendL(aStatus); |
365 } |
371 } |
366 |
372 |
|
373 void CHWRMTestBase::ExpectExtendedBatteryStatusNotificationL(EPSHWRMBatteryStatus aStatus) |
|
374 { |
|
375 iExpectedExtendedBatteryStatusNotifications.AppendL(aStatus); |
|
376 } |
|
377 |
367 void CHWRMTestBase::ExpectedChargingStatusNotificationsL(EPSHWRMChargingStatus aStatus) |
378 void CHWRMTestBase::ExpectedChargingStatusNotificationsL(EPSHWRMChargingStatus aStatus) |
368 { |
379 { |
369 iExpectedChargingStatusNotifications.AppendL(aStatus); |
380 iExpectedChargingStatusNotifications.AppendL(aStatus); |
370 } |
381 } |
|
382 |
|
383 void CHWRMTestBase::ExpectedExtendedChargingStatusNotificationsL(EPSHWRMChargingStatus aStatus) |
|
384 { |
|
385 iExpectedExtendedChargingStatusNotifications.AppendL(aStatus); |
|
386 } |
371 |
387 |
372 void CHWRMTestBase::ExpectVibraStatusNotificationL(CHWRMVibra::TVibraStatus aStatus) |
388 void CHWRMTestBase::ExpectVibraStatusNotificationL(CHWRMVibra::TVibraStatus aStatus) |
373 { |
389 { |
374 iExpectedVibraStatusNotifications.AppendL(aStatus); |
390 iExpectedVibraStatusNotifications.AppendL(aStatus); |
375 } |
391 } |
739 break; |
755 break; |
740 case KHWRMBatteryStatus: |
756 case KHWRMBatteryStatus: |
741 BatteryStatusChanged(aValue); |
757 BatteryStatusChanged(aValue); |
742 break; |
758 break; |
743 case KHWRMChargingStatus: |
759 case KHWRMChargingStatus: |
744 ChargingStatusChanged(aValue); |
760 ChargingStatusChanged(aValue); |
745 break; |
761 break; |
|
762 case KHWRMExtendedBatteryStatus: |
|
763 ExtendedBatteryStatusChanged(aValue); |
|
764 break; |
|
765 case KHWRMExtendedChargingStatus: |
|
766 ExtendedChargingStatusChanged(aValue); |
|
767 break; |
746 default: |
768 default: |
747 break; |
769 break; |
748 } |
770 } |
749 } |
771 } |
750 |
772 |
784 SetTestFail(); |
806 SetTestFail(); |
785 } |
807 } |
786 CheckForEndOfTransition(); |
808 CheckForEndOfTransition(); |
787 } |
809 } |
788 |
810 |
|
811 void CHWRMTestBase::ExtendedBatteryStatusChanged(TInt aBatteryStatus) |
|
812 { |
|
813 if (iExpectedExtendedBatteryStatusNotifications.Count() > 0) |
|
814 { |
|
815 if (aBatteryStatus != iExpectedExtendedBatteryStatusNotifications[0]) |
|
816 { |
|
817 INFO_PRINTF3(_L("### ERROR: ExtendedBatteryStatusChanged, expected:%d, actual:%d"),iExpectedExtendedBatteryStatusNotifications[0],aBatteryStatus); |
|
818 SetTestFail(); |
|
819 } |
|
820 iExpectedExtendedBatteryStatusNotifications.Remove(0); |
|
821 } |
|
822 else |
|
823 { |
|
824 INFO_PRINTF2(_L("### ERROR: ExtendedBatteryStatusChanged, expected:NONE, actual:%d"),aBatteryStatus); |
|
825 SetTestFail(); |
|
826 } |
|
827 CheckForEndOfTransition(); |
|
828 } |
|
829 |
789 void CHWRMTestBase::ChargingStatusChanged(TInt aChargingStatus) |
830 void CHWRMTestBase::ChargingStatusChanged(TInt aChargingStatus) |
790 { |
831 { |
791 if (iExpectedChargingStatusNotifications.Count() > 0) |
832 if (iExpectedChargingStatusNotifications.Count() > 0) |
792 { |
833 { |
793 if (aChargingStatus != iExpectedChargingStatusNotifications[0]) |
834 if (aChargingStatus != iExpectedChargingStatusNotifications[0]) |
794 { |
835 { |
795 INFO_PRINTF3(_L("### ERROR: BatteryStatusChanged, expected:%d, actual:%d"),iExpectedChargingStatusNotifications[0],aChargingStatus); |
836 INFO_PRINTF3(_L("### ERROR: ChargingStatusChanged, expected:%d, actual:%d"),iExpectedChargingStatusNotifications[0],aChargingStatus); |
796 SetTestFail(); |
837 SetTestFail(); |
797 } |
838 } |
798 iExpectedChargingStatusNotifications.Remove(0); |
839 iExpectedChargingStatusNotifications.Remove(0); |
799 } |
840 } |
800 else |
841 else |
802 INFO_PRINTF2(_L("### ERROR: ChargingStatusChanged, expected:NONE, actual:%d"),aChargingStatus); |
843 INFO_PRINTF2(_L("### ERROR: ChargingStatusChanged, expected:NONE, actual:%d"),aChargingStatus); |
803 SetTestFail(); |
844 SetTestFail(); |
804 } |
845 } |
805 CheckForEndOfTransition(); |
846 CheckForEndOfTransition(); |
806 } |
847 } |
807 |
848 |
|
849 void CHWRMTestBase::ExtendedChargingStatusChanged(TInt aChargingStatus) |
|
850 { |
|
851 if (iExpectedExtendedChargingStatusNotifications.Count() > 0) |
|
852 { |
|
853 if (aChargingStatus != iExpectedExtendedChargingStatusNotifications[0]) |
|
854 { |
|
855 INFO_PRINTF3(_L("### ERROR: ExtendedChargingStatusChanged, expected:%d, actual:%d"),iExpectedExtendedChargingStatusNotifications[0],aChargingStatus); |
|
856 SetTestFail(); |
|
857 } |
|
858 iExpectedExtendedChargingStatusNotifications.Remove(0); |
|
859 } |
|
860 else |
|
861 { |
|
862 INFO_PRINTF2(_L("### ERROR: ExtendedChargingStatusChanged, expected:NONE, actual:%d"),aChargingStatus); |
|
863 SetTestFail(); |
|
864 } |
|
865 CheckForEndOfTransition(); |
|
866 } |
|
867 |
808 void CHWRMTestBase::CheckPluginInsensitivity() |
868 void CHWRMTestBase::CheckPluginInsensitivity() |
809 { |
869 { |
810 TInt value; |
870 TInt value; |
811 iLightIntensityProperty.Get(value); |
871 iLightIntensityProperty.Get(value); |
812 if (value != iLightDefaultIntensity) |
872 if (value != iLightDefaultIntensity) |
889 if( iExpectedVibraStatusNotifications.Count() !=0 |
949 if( iExpectedVibraStatusNotifications.Count() !=0 |
890 || iExpectedVibraModeNotifications.Count() !=0 |
950 || iExpectedVibraModeNotifications.Count() !=0 |
891 || iExpectedLightNotifications.Count() !=0 |
951 || iExpectedLightNotifications.Count() !=0 |
892 || iExpectedBatteryLevelNotifications.Count() !=0 |
952 || iExpectedBatteryLevelNotifications.Count() !=0 |
893 || iExpectedBatteryStatusNotifications.Count() !=0 |
953 || iExpectedBatteryStatusNotifications.Count() !=0 |
|
954 || iExpectedExtendedBatteryStatusNotifications.Count() !=0 |
894 || iExpectedChargingStatusNotifications.Count() !=0 |
955 || iExpectedChargingStatusNotifications.Count() !=0 |
|
956 || iExpectedExtendedChargingStatusNotifications.Count()!=0 |
895 || iExpectedBatteryPowerMeasurementsError.Count() !=0 |
957 || iExpectedBatteryPowerMeasurementsError.Count() !=0 |
896 || iExpectedFmTxStatusNotifications.Count() !=0 |
958 || iExpectedFmTxStatusNotifications.Count() !=0 |
897 || iExpectedFmTxFrequencyNotifications.Count() !=0 |
959 || iExpectedFmTxFrequencyNotifications.Count() !=0 |
898 #ifdef SYMBIAN_HWRM_EXTPOWERINFO |
960 #ifdef SYMBIAN_HWRM_EXTPOWERINFO |
899 || iExpectedBatteryChargingTimeMeasurementsError.Count() !=0 |
961 || iExpectedBatteryChargingTimeMeasurementsError.Count() !=0 |
1132 iExpectedExtLightNotifications.Close(); |
1194 iExpectedExtLightNotifications.Close(); |
1133 iExpectedFmTxStatusNotifications.Close(); |
1195 iExpectedFmTxStatusNotifications.Close(); |
1134 iExpectedFmTxFrequencyNotifications.Close(); |
1196 iExpectedFmTxFrequencyNotifications.Close(); |
1135 iExpectedBatteryLevelNotifications.Close(); |
1197 iExpectedBatteryLevelNotifications.Close(); |
1136 iExpectedBatteryStatusNotifications.Close(); |
1198 iExpectedBatteryStatusNotifications.Close(); |
|
1199 iExpectedExtendedBatteryStatusNotifications.Close(); |
1137 iExpectedChargingStatusNotifications.Close(); |
1200 iExpectedChargingStatusNotifications.Close(); |
|
1201 iExpectedExtendedChargingStatusNotifications.Close(); |
1138 iExpectedVibraFeedbackModeNotifications.Close(); |
1202 iExpectedVibraFeedbackModeNotifications.Close(); |
1139 iExpectedBatteryPowerMeasurementsError.Close(); |
1203 iExpectedBatteryPowerMeasurementsError.Close(); |
1140 #ifdef SYMBIAN_HWRM_EXTPOWERINFO |
1204 #ifdef SYMBIAN_HWRM_EXTPOWERINFO |
1141 iExpectedBatteryChargingTimeMeasurementsError.Close(); |
1205 iExpectedBatteryChargingTimeMeasurementsError.Close(); |
1142 iExpectedBatteryChargingCurrentMeasurementsError.Close(); |
1206 iExpectedBatteryChargingCurrentMeasurementsError.Close(); |
1279 if (iExpectedBatteryStatusNotifications.Count() != 0) |
1343 if (iExpectedBatteryStatusNotifications.Count() != 0) |
1280 { |
1344 { |
1281 SetTestFail(); |
1345 SetTestFail(); |
1282 INFO_PRINTF1(_L("### ERROR Expected Battery Status Notification not received")); |
1346 INFO_PRINTF1(_L("### ERROR Expected Battery Status Notification not received")); |
1283 } |
1347 } |
|
1348 if (iExpectedExtendedBatteryStatusNotifications.Count() != 0) |
|
1349 { |
|
1350 SetTestFail(); |
|
1351 INFO_PRINTF1(_L("### ERROR Expected Extended Battery Status Notification not received")); |
|
1352 } |
1284 if (iExpectedChargingStatusNotifications.Count() != 0) |
1353 if (iExpectedChargingStatusNotifications.Count() != 0) |
1285 { |
1354 { |
1286 SetTestFail(); |
1355 SetTestFail(); |
1287 INFO_PRINTF1(_L("### ERROR Expected Charging Status Notification not received")); |
1356 INFO_PRINTF1(_L("### ERROR Expected Charging Status Notification not received")); |
1288 } |
1357 } |
|
1358 if (iExpectedExtendedChargingStatusNotifications.Count() != 0) |
|
1359 { |
|
1360 SetTestFail(); |
|
1361 INFO_PRINTF1(_L("### ERROR Expected Extended Charging Status Notification not received")); |
|
1362 } |
1289 if (iExpectedBatteryPowerMeasurementsError.Count() != 0) |
1363 if (iExpectedBatteryPowerMeasurementsError.Count() != 0) |
1290 { |
1364 { |
1291 SetTestFail(); |
1365 SetTestFail(); |
1292 INFO_PRINTF1(_L("### ERROR Expected Battery Power Measurements Error not received")); |
1366 INFO_PRINTF1(_L("### ERROR Expected Battery Power Measurements Error not received")); |
1293 } |
1367 } |
1459 case EChargingStatusError: |
1533 case EChargingStatusError: |
1460 { |
1534 { |
1461 INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusError")); |
1535 INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusError")); |
1462 break; |
1536 break; |
1463 } |
1537 } |
|
1538 case EChargingStatusIllegalChargerError: |
|
1539 { |
|
1540 INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusIllegalChargerError")); |
|
1541 break; |
|
1542 } |
|
1543 case EChargingStatusChargerUnderVoltageError: |
|
1544 { |
|
1545 INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusChargerUnderVoltageError")); |
|
1546 break; |
|
1547 } |
|
1548 case EChargingStatusChargerOverVoltageError: |
|
1549 { |
|
1550 INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusChargerOverVoltageError")); |
|
1551 break; |
|
1552 } |
|
1553 case EChargingStatusTempTooHotError: |
|
1554 { |
|
1555 INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusTempTooHotError")); |
|
1556 break; |
|
1557 } |
|
1558 case EChargingStatusTempTooColdError: |
|
1559 { |
|
1560 INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusTempTooColdError")); |
|
1561 break; |
|
1562 } |
1464 case EChargingStatusNotConnected: |
1563 case EChargingStatusNotConnected: |
1465 { |
1564 { |
1466 INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusNotConnected")); |
1565 INFO_PRINTF1(_L("INFO: Battery charging status changed: EChargingStatusNotConnected")); |
1467 break; |
1566 break; |
1468 } |
1567 } |
1495 { |
1594 { |
1496 INFO_PRINTF1(_L("INFO: Battery charging status changed: UNDEFINED!")); |
1595 INFO_PRINTF1(_L("INFO: Battery charging status changed: UNDEFINED!")); |
1497 } |
1596 } |
1498 } |
1597 } |
1499 |
1598 |
1500 if (iExpectedChargingStatusNotifications.Count() > 0) |
1599 if (iExpectedExtendedChargingStatusNotifications.Count() > 0) |
1501 { |
1600 { |
1502 if (aChrgStatus != iExpectedChargingStatusNotifications[0]) |
1601 if (aChrgStatus != iExpectedExtendedChargingStatusNotifications[0]) |
1503 { |
1602 { |
1504 INFO_PRINTF3(_L("### ERROR: ChargingStatusChange, expected:%d, actual:%d"),iExpectedChargingStatusNotifications[0],aChrgStatus); |
1603 INFO_PRINTF3(_L("### ERROR: ChargingStatusChange, expected:%d, actual:%d"),iExpectedExtendedChargingStatusNotifications[0],aChrgStatus); |
1505 SetTestFail(); |
1604 SetTestFail(); |
1506 } |
1605 } |
1507 iExpectedChargingStatusNotifications.Remove(0); |
1606 iExpectedExtendedChargingStatusNotifications.Remove(0); |
1508 } |
1607 } |
1509 else |
1608 else |
1510 { |
1609 { |
1511 INFO_PRINTF2(_L("### ERROR: ChargingStatusChange, expected:NONE, actual:%d"),aChrgStatus); |
1610 INFO_PRINTF2(_L("### ERROR: ChargingStatusChange, expected:NONE, actual:%d"),aChrgStatus); |
1512 SetTestFail(); |
1611 SetTestFail(); |