133 // --------------------------------------------------------------------------- |
133 // --------------------------------------------------------------------------- |
134 // CFotaUpdate::CFotaUpdate() |
134 // CFotaUpdate::CFotaUpdate() |
135 // --------------------------------------------------------------------------- |
135 // --------------------------------------------------------------------------- |
136 // |
136 // |
137 CFotaUpdate::CFotaUpdate() : CActive(EPriorityNormal) |
137 CFotaUpdate::CFotaUpdate() : CActive(EPriorityNormal) |
138 ,iScheduledUpdate(NULL),iHandleUpdateAcceptLater(EFalse) |
138 ,iScheduledUpdate(NULL),iHandleUpdateAcceptLater(EFalse),iCentrep(NULL) |
139 { |
139 { |
140 CActiveScheduler::Add( this ); |
140 CActiveScheduler::Add( this ); |
141 iNotifParams.iNoteType = ESyncMLFwUpdUnknown; |
141 iNotifParams.iNoteType = ESyncMLFwUpdUnknown; |
142 iNotifParams.iIntParam = 0; |
142 iNotifParams.iIntParam = 0; |
143 iChargeToMonitor = 0; |
143 iChargeToMonitor = 0; |
863 FLOG(_L("CFotaUpdate::LaunchNotifierL() <<")); |
868 FLOG(_L("CFotaUpdate::LaunchNotifierL() <<")); |
864 } |
869 } |
865 |
870 |
866 |
871 |
867 // --------------------------------------------------------------------------- |
872 // --------------------------------------------------------------------------- |
|
873 // CFotaUpdate::LaunchNotifierL |
|
874 // Shows the postpone information note when postpone limit feature is enabled. |
|
875 // --------------------------------------------------------------------------- |
|
876 void CFotaUpdate::LaunchNotifierL( const TSyncMLFwUpdNoteTypes aNotetype |
|
877 ,const TInt aIntUserPostpone,const TInt aIntMaxPostpone,TIntervalType aIntervalType,const TInt aInterval) |
|
878 { |
|
879 FLOG(_L("CFotaUpdate::LaunchNotifierL() >> prof.Id: %d aIntUserPostpone: %d aIntMaxPostpone %d") |
|
880 ,iUpdateState.iProfileId,aIntUserPostpone,aIntMaxPostpone); |
|
881 if (!IsActive()) |
|
882 { |
|
883 TSyncMLFwUpdNotifParams params; |
|
884 |
|
885 // Parameters to display the information note is displayed |
|
886 params.iNoteType = aNotetype; |
|
887 params.iFotaUserPostponeCount = aIntUserPostpone; |
|
888 params.iFotaMaxPostponeCount = aIntMaxPostpone; |
|
889 params.iIntervalType = aIntervalType; |
|
890 params.iInterval = aInterval; |
|
891 |
|
892 /* |
|
893 if(iReminderString.Length() > 0) |
|
894 params.iSelectedReminder.Copy(iReminderString); |
|
895 |
|
896 TBuf<5> aTime; |
|
897 aTime.Zero(); |
|
898 |
|
899 for(TInt i = 0; i<iReminderString.Length();i++) |
|
900 { |
|
901 TChar ch = iReminderString[i]; |
|
902 if ( ch.IsDigit()) //separates digits from the string |
|
903 { |
|
904 aTime.Append(ch); |
|
905 } |
|
906 else |
|
907 { |
|
908 break; |
|
909 } |
|
910 } |
|
911 |
|
912 TInt val =1 ; |
|
913 TLex lex(aTime); |
|
914 TInt err = lex.Val(val); */ |
|
915 |
|
916 TSyncMLFwUpdNotifParamsPckg pckg(params); |
|
917 iNotifParams.iNoteType = params.iNoteType; |
|
918 iNotifParams.iIntParam = params.iIntParam; |
|
919 iDummyResponsePckg = TSyncMLFwUpdNotifRetValPckg(); |
|
920 User::LeaveIfError( iNotifier.Connect() ); |
|
921 iNotifier.StartNotifierAndGetResponse( iStatus,KSyncMLFwUpdNotifierUid |
|
922 , pckg, iDummyResponsePckg ); |
|
923 SetActive(); |
|
924 } |
|
925 FLOG(_L("CFotaUpdate::LaunchNotifierL() <<")); |
|
926 } |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 // --------------------------------------------------------------------------- |
868 // CFotaUpdate::UpdateL |
932 // CFotaUpdate::UpdateL |
869 // Updates the fw: Creates input files for update agent and boots device to |
933 // Updates the fw: Creates input files for update agent and boots device to |
870 // update mode. |
934 // update mode. |
871 // --------------------------------------------------------------------------- |
935 // --------------------------------------------------------------------------- |
872 void CFotaUpdate::UpdateL() |
936 void CFotaUpdate::UpdateL() |
946 CRepository* centrep2 = NULL; |
1010 CRepository* centrep2 = NULL; |
947 TRAP( err, centrep2 = CRepository::NewL( KCRUidFotaServer ) ) |
1011 TRAP( err, centrep2 = CRepository::NewL( KCRUidFotaServer ) ) |
948 if (err==KErrNone ) |
1012 if (err==KErrNone ) |
949 { |
1013 { |
950 centrep2->Set( KFotaUpdateState, EFotaPendingGenAlert ); |
1014 centrep2->Set( KFotaUpdateState, EFotaPendingGenAlert ); |
951 } |
1015 if(iFOTAUICustomization) |
952 delete centrep2; |
1016 centrep2->Set( KFOTAUserPostponeCount, 0 ); |
953 |
1017 } |
|
1018 delete centrep2; |
|
1019 |
954 // Boot to update mode |
1020 // Boot to update mode |
955 LaunchNotifierL( ESyncMLFwUpdRebootNote, KErrNone); |
1021 LaunchNotifierL( ESyncMLFwUpdRebootNote, KErrNone); |
956 |
1022 |
957 FLOG(_L(" waiting 2 sec to keep 'restarting' visible")); |
1023 FLOG(_L(" waiting 2 sec to keep 'restarting' visible")); |
958 User::After(TTimeIntervalMicroSeconds32(2000000)); |
1024 User::After(TTimeIntervalMicroSeconds32(2000000)); |
1192 //new code |
1260 //new code |
1193 |
1261 |
1194 |
1262 |
1195 FLOG(_L("CFotaUpdate::StartUpdateL(TDownloadIPCParams aParams) << \ |
1263 FLOG(_L("CFotaUpdate::StartUpdateL(TDownloadIPCParams aParams) << \ |
1196 pkig:%d"),aParams.iPkgId); |
1264 pkig:%d"),aParams.iPkgId); |
|
1265 } |
|
1266 |
|
1267 |
|
1268 void CFotaUpdate::DisplayInstallationNoteTypeL() |
|
1269 { |
|
1270 FLOG(_L("CFotaUpdate::DisplayInstallationNoteTypeL: >>")); |
|
1271 |
|
1272 //CRepository* centrep = NULL; |
|
1273 TInt err = KErrNone; |
|
1274 TInt CustomNotes = 0; |
|
1275 if(iCentrep == NULL) |
|
1276 { |
|
1277 TRAP(err, iCentrep = CRepository::NewL(TUid::Uid(KFotaServerUid))); |
|
1278 if(err) |
|
1279 { |
|
1280 FLOG(_L("DisplayInstallationNoteTypeL: reading from cenrep failed, returning ENormal")); |
|
1281 LaunchNotifierL( ESyncMLFwUpdStartQuery, iUpdateState.iProfileId ); |
|
1282 return; |
|
1283 } |
|
1284 } |
|
1285 |
|
1286 err= iCentrep->Get( KFOTAUINotesCustomization, CustomNotes); |
|
1287 if (err) |
|
1288 CustomNotes = 0; |
|
1289 iFOTAUICustomization = CustomNotes; |
|
1290 |
|
1291 if(iFOTAUICustomization) |
|
1292 { |
|
1293 //TRAP(err, centrep = CRepository::NewL( TUid::Uid(KFotaServerUid))); |
|
1294 //if(err) |
|
1295 // { |
|
1296 // FLOG(_L("DetermineNoteType: reading from cenrep failed, returning ETrue")); |
|
1297 // return ETrue; |
|
1298 // } |
|
1299 |
|
1300 TInt fotaUserPostpone = 0,fotaMaxPostpone = 3; |
|
1301 if(iCentrep) |
|
1302 { |
|
1303 iCentrep->Get( KFOTAUserPostponeCount , fotaUserPostpone ); |
|
1304 iCentrep->Get( KFOTAMaxPostponeCount , fotaMaxPostpone ); |
|
1305 } |
|
1306 iFOTAUserPostponeCount = fotaUserPostpone; |
|
1307 iFOTAMaxPostponeCount = fotaMaxPostpone; |
|
1308 |
|
1309 if(iFOTAUserPostponeCount < iFOTAMaxPostponeCount) |
|
1310 { |
|
1311 FLOG(_L("DisplayInstallationNoteTypeL: returning EPostponeLimit")); |
|
1312 LaunchNotifierL( ESyncMLFwUpdPostponeLimitQuery, iUpdateState.iProfileId ); |
|
1313 //return EPostponeLimit; |
|
1314 } |
|
1315 else |
|
1316 { |
|
1317 FLOG(_L("DisplayInstallationNoteTypeL: returning EForceStart")); |
|
1318 LaunchNotifierL( ESyncMLFwUpdForceQuery, iUpdateState.iProfileId ); |
|
1319 //return EForceStart; |
|
1320 } |
|
1321 } |
|
1322 else |
|
1323 { |
|
1324 FLOG(_L("DisplayInstallationNoteTypeL: returning ENormal")); |
|
1325 LaunchNotifierL( ESyncMLFwUpdStartQuery, iUpdateState.iProfileId ); |
|
1326 //return ENormal; |
|
1327 } |
|
1328 |
1197 } |
1329 } |
1198 |
1330 |
1199 |
1331 |
1200 |
1332 |
1201 // --------------------------------------------------------------------------- |
1333 // --------------------------------------------------------------------------- |
1478 // --------------------------------------------------------------------------- |
1610 // --------------------------------------------------------------------------- |
1479 // |
1611 // |
1480 void CFotaUpdate::ShowReminderDialogL() |
1612 void CFotaUpdate::ShowReminderDialogL() |
1481 { |
1613 { |
1482 // Push default content to navigation pane and change title |
1614 // Push default content to navigation pane and change title |
|
1615 if(iFOTAUICustomization) |
|
1616 { |
|
1617 //if(iFOTAUICustomization) |
|
1618 // { |
|
1619 if(iCentrep) |
|
1620 { |
|
1621 // When User has pressed Later, Postpone limit has to be Incremented |
|
1622 iFOTAUserPostponeCount = iFOTAUserPostponeCount + 1; |
|
1623 iCentrep->Set( KFOTAUserPostponeCount , iFOTAUserPostponeCount ); |
|
1624 } |
|
1625 // } |
|
1626 |
|
1627 |
|
1628 if(iFOTAUserPostponeCount > iFOTAMaxPostponeCount) |
|
1629 { |
|
1630 // When User presses the end key during a Force Update Query or a Update Warning note, Force Update Query should be shown again. |
|
1631 TIntervalType tIntervalType; |
|
1632 TInt tInterval; |
|
1633 tIntervalType = (TIntervalType)EEndKeyReminder; |
|
1634 tInterval = 1; |
|
1635 CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval ); |
|
1636 iFotaServer->FinalizeUpdateL(); |
|
1637 return; |
|
1638 } |
|
1639 } |
1483 CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); |
1640 CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); |
1484 CAknNavigationControlContainer* naviPane = NULL; |
1641 CAknNavigationControlContainer* naviPane = NULL; |
1485 HBufC* originalTitle; |
1642 HBufC* originalTitle; |
1486 CAknTitlePane* titlePane = NULL; |
1643 CAknTitlePane* titlePane = NULL; |
1487 originalTitle = HBufC::NewLC( 50 ); //KNsmlMaxTitleSize |
1644 originalTitle = HBufC::NewLC( 50 ); //KNsmlMaxTitleSize |
1591 if ( aRet && aRadioSelectionIndex== 0 ) |
1748 if ( aRet && aRadioSelectionIndex== 0 ) |
1592 { |
1749 { |
1593 FLOG(_L("Creating reminder: for 1st option")); |
1750 FLOG(_L("Creating reminder: for 1st option")); |
1594 tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex]; |
1751 tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex]; |
1595 tInterval = iInterval[aRadioSelectionIndex]; |
1752 tInterval = iInterval[aRadioSelectionIndex]; |
|
1753 if(iFOTAUICustomization) |
|
1754 LaunchNotifierL( ESyncMLFwUpdPostponeNote , iFOTAUserPostponeCount, iFOTAMaxPostponeCount, tIntervalType,tInterval); |
1596 en=FindScheduleL( ETrue ); |
1755 en=FindScheduleL( ETrue ); |
1597 CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval ); |
1756 CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval ); |
1598 iFotaServer->FinalizeUpdateL(); |
1757 iFotaServer->FinalizeUpdateL(); |
1599 } |
1758 } |
1600 else if(aRet && aRadioSelectionIndex == 1 ) |
1759 else if(aRet && aRadioSelectionIndex == 1 ) |
1601 { |
1760 { |
1602 FLOG(_L("Creating reminder: 4 hours")); |
1761 FLOG(_L("Creating reminder: 4 hours")); |
1603 tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex]; |
1762 tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex]; |
1604 tInterval = iInterval[aRadioSelectionIndex]; |
1763 tInterval = iInterval[aRadioSelectionIndex]; |
|
1764 if(iFOTAUICustomization) |
|
1765 LaunchNotifierL( ESyncMLFwUpdPostponeNote , iFOTAUserPostponeCount, iFOTAMaxPostponeCount, tIntervalType,tInterval); |
1605 en=FindScheduleL( ETrue ); |
1766 en=FindScheduleL( ETrue ); |
1606 CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval ); |
1767 CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval ); |
1607 iFotaServer->FinalizeUpdateL(); |
1768 iFotaServer->FinalizeUpdateL(); |
1608 } |
1769 } |
1609 else if(aRet && aRadioSelectionIndex == 2 ) |
1770 else if(aRet && aRadioSelectionIndex == 2 ) |
1610 { |
1771 { |
1611 FLOG(_L("Creating reminder: for 2nd option")); |
1772 FLOG(_L("Creating reminder: for 2nd option")); |
1612 tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex]; |
1773 tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex]; |
1613 tInterval = iInterval[aRadioSelectionIndex]; |
1774 tInterval = iInterval[aRadioSelectionIndex]; |
|
1775 if(iFOTAUICustomization) |
|
1776 LaunchNotifierL( ESyncMLFwUpdPostponeNote , iFOTAUserPostponeCount, iFOTAMaxPostponeCount, tIntervalType,tInterval); |
1614 en=FindScheduleL( ETrue ); |
1777 en=FindScheduleL( ETrue ); |
1615 CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval ); |
1778 CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval ); |
1616 iFotaServer->FinalizeUpdateL(); |
1779 iFotaServer->FinalizeUpdateL(); |
1617 } |
1780 } |
1618 else if(aRet && aRadioSelectionIndex == 3 ) |
1781 else if(aRet && aRadioSelectionIndex == 3 ) |
1619 { |
1782 { |
1620 FLOG(_L("Creating reminder: for 3rd option")); |
1783 FLOG(_L("Creating reminder: for 3rd option")); |
1621 tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex]; |
1784 tIntervalType = (TIntervalType)iIntervalType[aRadioSelectionIndex]; |
1622 tInterval = iInterval[aRadioSelectionIndex]; |
1785 tInterval = iInterval[aRadioSelectionIndex]; |
|
1786 if(iFOTAUICustomization) |
|
1787 LaunchNotifierL( ESyncMLFwUpdPostponeNote , iFOTAUserPostponeCount, iFOTAMaxPostponeCount, tIntervalType,tInterval); |
1623 en=FindScheduleL( ETrue ); |
1788 en=FindScheduleL( ETrue ); |
1624 CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval ); |
1789 CreateScheduleL ( iUpdateState.iPkgId, tIntervalType ,tInterval ); |
1625 iFotaServer->FinalizeUpdateL(); |
1790 iFotaServer->FinalizeUpdateL(); |
1626 } |
1791 } |
1627 else if (!aRet || aRadioSelectionIndex == 4) |
1792 else if (!aRet || aRadioSelectionIndex == 4) |
1629 FLOG(_L("Deleting reminder, btn press %d"),aRet); |
1794 FLOG(_L("Deleting reminder, btn press %d"),aRet); |
1630 TScheduleEntryInfo2 en=FindScheduleL( ETrue ); |
1795 TScheduleEntryInfo2 en=FindScheduleL( ETrue ); |
1631 |
1796 |
1632 if ( !aRet ) // cancel pressed |
1797 if ( !aRet ) // cancel pressed |
1633 { |
1798 { |
1634 LaunchNotifierL( ESyncMLFwUpdStartQuery, iUpdateState.iProfileId ); |
1799 if(iFOTAUICustomization) |
1635 } |
1800 { |
|
1801 if(iCentrep) |
|
1802 { |
|
1803 // When User has pressed Later and then does a cancel for the warning query, Postpone limit has to be decremented |
|
1804 iFOTAUserPostponeCount = iFOTAUserPostponeCount - 1; |
|
1805 iCentrep->Set( KFOTAUserPostponeCount , iFOTAUserPostponeCount ); |
|
1806 } |
|
1807 } |
|
1808 DisplayInstallationNoteTypeL(); |
|
1809 } |
1636 else // ok pressed |
1810 else // ok pressed |
1637 { |
1811 { |
1638 LaunchNotifierL( ESyncMLFwUpdNoReminder , KErrNone ); |
1812 LaunchNotifierL( ESyncMLFwUpdNoReminder , KErrNone ); |
1639 //iFotaServer->FinalizeUpdateL(); |
1813 //iFotaServer->FinalizeUpdateL(); |
1640 } |
1814 } |
1723 // CFotaUpdate::CreateScheduleL |
1897 // CFotaUpdate::CreateScheduleL |
1724 // Creates fotaupdate schedule (named [102072c4]) |
1898 // Creates fotaupdate schedule (named [102072c4]) |
1725 // --------------------------------------------------------------------------- |
1899 // --------------------------------------------------------------------------- |
1726 // |
1900 // |
1727 TInt CFotaUpdate::CreateScheduleL ( const TInt aPackageId |
1901 TInt CFotaUpdate::CreateScheduleL ( const TInt aPackageId |
1728 ,const TIntervalType aIntervalType |
1902 ,TIntervalType aIntervalType |
1729 ,const TInt aInterval) |
1903 ,const TInt aInterval) |
1730 { |
1904 { |
1731 FLOG(_L("CFotaUpdate::CreateScheduleL ()") ); |
1905 FLOG(_L("CFotaUpdate::CreateScheduleL ()") ); |
1732 const TInt KRepeatForever = 0; |
1906 const TInt KRepeatForever = 0; |
1733 const TInt KTaskPriority = 1; |
1907 const TInt KTaskPriority = 1; |
1734 _LIT(KFotaScheduleExe, "Z:\\sys\\bin\\fotaschedulehandler.exe"); |
1908 _LIT(KFotaScheduleExe, "Z:\\sys\\bin\\fotaschedulehandler.exe"); |