iaupdate/IAD/backgroundchecker/src/iaupdatebginternalfilehandler.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
    13 *
    13 *
    14 * Description:    
    14 * Description:    
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 
       
    19 
       
    20 
    18 #include <bautils.h>
    21 #include <bautils.h>
    19 #include <s32file.h>
    22 #include <s32file.h>
    20 #include <sysversioninfo.h>
    23 #include <sysversioninfo.h>
    21 #include "iaupdatebglogger.h"
    24 #include "iaupdatebglogger.h"
    22 #include "iaupdatebginternalfilehandler.h"
    25 #include "iaupdatebginternalfilehandler.h"
    62 //
    65 //
    63 // -----------------------------------------------------------------------------
    66 // -----------------------------------------------------------------------------
    64 //
    67 //
    65 CIAUpdateBGInternalFileHandler::CIAUpdateBGInternalFileHandler()
    68 CIAUpdateBGInternalFileHandler::CIAUpdateBGInternalFileHandler()
    66     : iLastTimeShowNewFeatureDialog( 0 ), iUserRejectNewFeatureDialog( EFalse ), 
    69     : iLastTimeShowNewFeatureDialog( 0 ), iUserRejectNewFeatureDialog( EFalse ), 
    67       iMode( EFirstTimeMode ), iFwVersion( NULL ), 
    70       iNextRemindTime(0), iIsReminderOn( EFalse ), iMode( EFirstTimeMode ), iFwVersion( NULL ), 
    68       iSNID(0), iRetryTimes(0)
    71       iSNID(0), iRetryTimes(0)
    69     {
    72     {
    70     }
    73     }
    71 
    74 
    72 // -----------------------------------------------------------------------------
    75 // -----------------------------------------------------------------------------
   210 void CIAUpdateBGInternalFileHandler::SetUserRejectNewFeatureDialog( TBool aUserDecision )
   213 void CIAUpdateBGInternalFileHandler::SetUserRejectNewFeatureDialog( TBool aUserDecision )
   211     {
   214     {
   212     iUserRejectNewFeatureDialog = aUserDecision;
   215     iUserRejectNewFeatureDialog = aUserDecision;
   213     }
   216     }
   214 
   217 
       
   218 
       
   219 // -----------------------------------------------------------------------------
       
   220 // CIAUpdateBGInternalFileHandler::ReminderOn
       
   221 //
       
   222 // -----------------------------------------------------------------------------
       
   223 //
       
   224 TBool CIAUpdateBGInternalFileHandler::ReminderOn()
       
   225     {
       
   226     return iIsReminderOn;
       
   227     }
       
   228 
       
   229 
       
   230 // -----------------------------------------------------------------------------
       
   231 // CIAUpdateBGInternalFileHandler::SetReminder
       
   232 //
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 void CIAUpdateBGInternalFileHandler::SetReminder( TBool aOn )
       
   236     {
       
   237     iIsReminderOn = aOn;
       
   238     }
       
   239 
       
   240 
       
   241 // -----------------------------------------------------------------------------
       
   242 // CIAUpdateBGInternalFileHandler::NextRemindTime
       
   243 //
       
   244 // -----------------------------------------------------------------------------
       
   245 //
       
   246 TTime CIAUpdateBGInternalFileHandler::NextRemindTime()
       
   247     {
       
   248     return iNextRemindTime;
       
   249     }
       
   250 
       
   251 
       
   252 // -----------------------------------------------------------------------------
       
   253 // CIAUpdateBGInternalFileHandler::SetNextRemindTime
       
   254 //
       
   255 // -----------------------------------------------------------------------------
       
   256 //
       
   257 void CIAUpdateBGInternalFileHandler::SetNextRemindTime( TTime aNextRemindTime )
       
   258     {
       
   259     iNextRemindTime = aNextRemindTime;
       
   260     }
       
   261 
       
   262 
       
   263 // -----------------------------------------------------------------------------
       
   264 // CIAUpdateBGInternalFileHandler::SetNextRemindTime
       
   265 //
       
   266 // -----------------------------------------------------------------------------
       
   267 //
       
   268 void CIAUpdateBGInternalFileHandler::SetNextRemindTime( TInt64 aNextRemindTime )
       
   269     {
       
   270     iNextRemindTime = aNextRemindTime;
       
   271     }
       
   272 
       
   273 
   215 // -----------------------------------------------------------------------------
   274 // -----------------------------------------------------------------------------
   216 // CIAUpdateBGInternalFileHandler::SetMode
   275 // CIAUpdateBGInternalFileHandler::SetMode
   217 //
   276 //
   218 // -----------------------------------------------------------------------------
   277 // -----------------------------------------------------------------------------
   219 //
   278 //
   220 void CIAUpdateBGInternalFileHandler::SetMode( TIAUpdateBGMode aMode )
   279 void CIAUpdateBGInternalFileHandler::SetMode( TIAUpdateBGMode aMode )
   221     {
   280     {
   222     iMode = aMode;
   281     iMode = aMode;
   223     }
   282     }
   224 
   283 
       
   284 
   225 // -----------------------------------------------------------------------------
   285 // -----------------------------------------------------------------------------
   226 // CIAUpdateBGInternalFileHandler::Mode
   286 // CIAUpdateBGInternalFileHandler::Mode
   227 //
   287 //
   228 // -----------------------------------------------------------------------------
   288 // -----------------------------------------------------------------------------
   229 //
   289 //
   230 TIAUpdateBGMode CIAUpdateBGInternalFileHandler::Mode()
   290 TIAUpdateBGMode CIAUpdateBGInternalFileHandler::Mode()
   231     {
   291     {
   232     return iMode;
   292     return iMode;
   233     }
   293     }
   234 
   294 
       
   295 
   235 // -----------------------------------------------------------------------------
   296 // -----------------------------------------------------------------------------
   236 // CIAUpdateBGInternalFileHandler::FwVersion
   297 // CIAUpdateBGInternalFileHandler::FwVersion
   237 //
   298 //
   238 // -----------------------------------------------------------------------------
   299 // -----------------------------------------------------------------------------
   239 //
   300 //
   240 HBufC* CIAUpdateBGInternalFileHandler::FwVersion()
   301 HBufC* CIAUpdateBGInternalFileHandler::FwVersion()
   241     {
   302     {
   242     return iFwVersion;
   303     return iFwVersion;
   243     }
   304     }
       
   305 
   244 
   306 
   245 // ----------------------------------------------------------
   307 // ----------------------------------------------------------
   246 // CIAUpdateBGInternalFileHandler::SetFwVersionL()
   308 // CIAUpdateBGInternalFileHandler::SetFwVersionL()
   247 // ----------------------------------------------------------
   309 // ----------------------------------------------------------
   248 TInt CIAUpdateBGInternalFileHandler::SetFwVersionL( const TDesC& aFwVersion )
   310 TInt CIAUpdateBGInternalFileHandler::SetFwVersionL( const TDesC& aFwVersion )
   301     {
   363     {
   302     iRetryTimes = aRetry;
   364     iRetryTimes = aRetry;
   303     }
   365     }
   304 
   366 
   305 // -----------------------------------------------------------------------------
   367 // -----------------------------------------------------------------------------
   306 // CIAUpdateBGInternalFileHandler::NrOfIndicatorEntries
       
   307 //
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 TInt CIAUpdateBGInternalFileHandler::NrOfIndicatorEntries()
       
   311     {
       
   312     return iNrOfIndicatiorEntries;
       
   313     }
       
   314 
       
   315 
       
   316 // -----------------------------------------------------------------------------
       
   317 // CIAUpdateBGInternalFileHandler::SetNrOfIndicatorEntries
       
   318 //
       
   319 // -----------------------------------------------------------------------------
       
   320 //
       
   321 void CIAUpdateBGInternalFileHandler::SetNrOfIndicatorEntries( TInt aEntries )
       
   322     {
       
   323     iNrOfIndicatiorEntries = aEntries;
       
   324     }
       
   325 // -----------------------------------------------------------------------------
       
   326 // CIAUpdateBGInternalFileHandler::InternalizeL
   368 // CIAUpdateBGInternalFileHandler::InternalizeL
   327 //
   369 //
   328 // -----------------------------------------------------------------------------
   370 // -----------------------------------------------------------------------------
   329 //
   371 //
   330 void CIAUpdateBGInternalFileHandler::InternalizeL( RReadStream& aStream )
   372 void CIAUpdateBGInternalFileHandler::InternalizeL( RReadStream& aStream )
   338     
   380     
   339     TInt userDecision( aStream.ReadUint8L() );
   381     TInt userDecision( aStream.ReadUint8L() );
   340     // Static casting is safe to do here because enum and TInt are the same.
   382     // Static casting is safe to do here because enum and TInt are the same.
   341     SetUserRejectNewFeatureDialog( static_cast< TBool >( userDecision ) );
   383     SetUserRejectNewFeatureDialog( static_cast< TBool >( userDecision ) );
   342     
   384     
       
   385     TInt64 nextRemindTime( 0 );
       
   386     aStream >> nextRemindTime;
       
   387     SetNextRemindTime( nextRemindTime );
       
   388     
       
   389     TInt remindOn( aStream.ReadUint8L() );
       
   390     // Static casting is safe to do here because enum and TInt are the same.
       
   391     SetReminder( static_cast< TBool >( remindOn ) );
       
   392     
   343     TInt mode( aStream.ReadUint8L() );
   393     TInt mode( aStream.ReadUint8L() );
   344     SetMode( static_cast<TIAUpdateBGMode> (mode) );
   394     SetMode( static_cast<TIAUpdateBGMode> (mode) );
   345     
   395     
   346     //read the length of fw version string
   396     //read the length of fw version string
   347     TInt fwlength ( aStream.ReadUint8L() );
   397     TInt fwlength ( aStream.ReadUint8L() );
   353     TInt snid ( aStream.ReadUint16L() );
   403     TInt snid ( aStream.ReadUint16L() );
   354     SetSoftNotificationID( snid ); 
   404     SetSoftNotificationID( snid ); 
   355     
   405     
   356     TInt retry ( aStream.ReadUint8L() );
   406     TInt retry ( aStream.ReadUint8L() );
   357     SetRetryTimes( retry );
   407     SetRetryTimes( retry );
   358     
       
   359     TInt entries ( aStream.ReadUint8L() );
       
   360     SetNrOfIndicatorEntries( entries );
       
   361     
       
   362     }
   408     }
   363 
   409 
   364 
   410 
   365 // -----------------------------------------------------------------------------
   411 // -----------------------------------------------------------------------------
   366 // CIAUpdateBGInternalFileHandler::ExternalizeL
   412 // CIAUpdateBGInternalFileHandler::ExternalizeL
   375     TInt64 lastshowTime( LastTimeShowNewFeatureDialog().Int64() );
   421     TInt64 lastshowTime( LastTimeShowNewFeatureDialog().Int64() );
   376     aStream << lastshowTime;
   422     aStream << lastshowTime;
   377 
   423 
   378     TInt userDecision ( UserRejectNewFeatureDialog() );
   424     TInt userDecision ( UserRejectNewFeatureDialog() );
   379     aStream.WriteUint8L( userDecision );
   425     aStream.WriteUint8L( userDecision );
       
   426     
       
   427     TInt64 nextRemindTime( NextRemindTime().Int64() ); 
       
   428     aStream << nextRemindTime;
       
   429     
       
   430     TInt remindOn ( ReminderOn() );
       
   431     aStream.WriteUint8L( remindOn );
   380     
   432     
   381     TInt mode( Mode() );
   433     TInt mode( Mode() );
   382     aStream.WriteUint8L( mode );
   434     aStream.WriteUint8L( mode );
   383     
   435     
   384     //write length of fw string
   436     //write length of fw string
   389     TInt snid ( SoftNotificationID() ); 
   441     TInt snid ( SoftNotificationID() ); 
   390     aStream.WriteUint16L( snid );
   442     aStream.WriteUint16L( snid );
   391     
   443     
   392     TInt retry ( RetryTimes() );
   444     TInt retry ( RetryTimes() );
   393     aStream.WriteUint8L( retry ); 
   445     aStream.WriteUint8L( retry ); 
   394     
       
   395     TInt entries ( NrOfIndicatorEntries() );
       
   396     aStream.WriteUint8L( entries ); 
       
   397     
       
   398     }
   446     }
   399 
   447 
   400 //EOF
   448 //EOF