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