htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp
changeset 11 4df3a095718c
parent 10 e6e3e87d58b4
child 31 e7a04a6385be
equal deleted inserted replaced
10:e6e3e87d58b4 11:4df3a095718c
    21 #include "HtiLightsController.h"
    21 #include "HtiLightsController.h"
    22 #include "HtiPropertySubscriber.h"
    22 #include "HtiPropertySubscriber.h"
    23 #include <HtiDispatcherInterface.h>
    23 #include <HtiDispatcherInterface.h>
    24 #include <HtiLogging.h>
    24 #include <HtiLogging.h>
    25 
    25 
       
    26 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
    26 #include <aknkeylock.h>
    27 #include <aknkeylock.h>
       
    28 #include <ScreensaverInternalPSKeys.h>
       
    29 #endif
       
    30 
    27 #include <AknSkinsInternalCRKeys.h>
    31 #include <AknSkinsInternalCRKeys.h>
    28 #include <AknsSkinUID.h>
    32 #include <AknsSkinUID.h>
    29 #include <AknsSrvClient.h>
    33 #include <AknsSrvClient.h>
    30 #include <bautils.h>
    34 #include <bautils.h>
    31 #include <btengsettings.h>
    35 #include <btengsettings.h>
    41 #include <hal.h>
    45 #include <hal.h>
    42 #include <ir_sock.h>
    46 #include <ir_sock.h>
    43 #include <mmtsy_names.h>
    47 #include <mmtsy_names.h>
    44 #include <rmmcustomapi.h>
    48 #include <rmmcustomapi.h>
    45 #include <hwrmpowerstatesdkpskeys.h>
    49 #include <hwrmpowerstatesdkpskeys.h>
    46 #include <ScreensaverInternalPSKeys.h>
       
    47 #include <settingsinternalcrkeys.h>
    50 #include <settingsinternalcrkeys.h>
    48 #include <sysutil.h>
    51 #include <sysutil.h>
    49 #include <tz.h>
    52 #include <tz.h>
    50 
    53 
    51 // CONSTANTS
    54 // CONSTANTS
    58 const TInt KMaxBtNameLength = 30;
    61 const TInt KMaxBtNameLength = 30;
    59 const TInt KDateTimeFormatCmdLength = 6;
    62 const TInt KDateTimeFormatCmdLength = 6;
    60 
    63 
    61 _LIT( KTempFilePath, "\\" );
    64 _LIT( KTempFilePath, "\\" );
    62 _LIT( KTempFileName, "HtiTempFile.tmp" );
    65 _LIT( KTempFileName, "HtiTempFile.tmp" );
       
    66 _LIT( KMatchFileName, "HtiTempFile.tmp*" );
    63 _LIT( KDateSeparatorChars, ".:/-" );
    67 _LIT( KDateSeparatorChars, ".:/-" );
    64 _LIT( KTimeSeparatorChars, ".:" );
    68 _LIT( KTimeSeparatorChars, ".:" );
    65 
    69 
    66 _LIT8( KErrDescrArgument, "Invalid argument" );
    70 _LIT8( KErrDescrArgument, "Invalid argument" );
    67 _LIT8( KErrDescrNotSupported, "Command not supported" );
    71 _LIT8( KErrDescrNotSupported, "Command not supported" );
    77 _LIT8( KErrDescrSetSizeTempFile, "Error allocating size for temp file" );
    81 _LIT8( KErrDescrSetSizeTempFile, "Error allocating size for temp file" );
    78 _LIT8( KErrDescrDeleteTempFile, "Error deleting temp file" );
    82 _LIT8( KErrDescrDeleteTempFile, "Error deleting temp file" );
    79 _LIT8( KErrDescrSysUtil, "SysUtil failed" );
    83 _LIT8( KErrDescrSysUtil, "SysUtil failed" );
    80 _LIT8( KErrDescrSetTime, "Setting time failed" );
    84 _LIT8( KErrDescrSetTime, "Setting time failed" );
    81 _LIT8( KErrDescrDateTimeFormat, "Setting date and time formats failed" );
    85 _LIT8( KErrDescrDateTimeFormat, "Setting date and time formats failed" );
    82 _LIT8( KErrDescrScreenSaver, "Setting screen saver state failed" );
       
    83 _LIT8( KErrDescrGetNetworkModes, "Getting network modes failed" );
    86 _LIT8( KErrDescrGetNetworkModes, "Getting network modes failed" );
    84 _LIT8( KErrDescrSetNetworkMode, "Setting network mode failed" );
    87 _LIT8( KErrDescrSetNetworkMode, "Setting network mode failed" );
    85 _LIT8( KErrDescrIrActivation, "IR activation failed" );
    88 _LIT8( KErrDescrIrActivation, "IR activation failed" );
    86 _LIT8( KErrDescrGetBtPower, "Getting BT power state failed" );
    89 _LIT8( KErrDescrGetBtPower, "Getting BT power state failed" );
    87 _LIT8( KErrDescrSetBtPower, "Setting BT power state failed" );
    90 _LIT8( KErrDescrSetBtPower, "Setting BT power state failed" );
    88 _LIT8( KErrDescrBtOnDenied, "Turning BT on not allowed (Offline mode)" );
    91 _LIT8( KErrDescrBtOnDenied, "Turning BT on not allowed (Offline mode)" );
    89 _LIT8( KErrDescrBtOffDenied, "Turning BT off not allowed (active connections)" );
    92 _LIT8( KErrDescrBtOffDenied, "Turning BT off not allowed (active connections)" );
    90 _LIT8( KErrDescrBtSettings, "Bluetooth settings failed" );
    93 _LIT8( KErrDescrBtSettings, "Bluetooth settings failed" );
    91 _LIT8( KErrDescrBtDeletePairings, "Deleting Bluetooth pairing(s) failed" );
    94 _LIT8( KErrDescrBtDeletePairings, "Deleting Bluetooth pairing(s) failed" );
       
    95 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
    92 _LIT8( KErrDescrKeyLock, "Key lock toggle failed" );
    96 _LIT8( KErrDescrKeyLock, "Key lock toggle failed" );
       
    97 _LIT8( KErrDescrScreenSaver, "Setting screen saver state failed" );
       
    98 _LIT8( KErrDescrInvalidSSTimeout, "Invalid screen saver timeout value" );
       
    99 _LIT8( KErrDescrSSTimeoutFailed, "Setting screen saver timeout failed" );
       
   100 #endif
    93 _LIT8( KErrDescrInvalidTime, "Auto key guard time value too large (max 3600)" );
   101 _LIT8( KErrDescrInvalidTime, "Auto key guard time value too large (max 3600)" );
    94 _LIT8( KErrDescrAutoKeyGuardFailed, "Setting auto key guard time failed" );
   102 _LIT8( KErrDescrAutoKeyGuardFailed, "Setting auto key guard time failed" );
    95 _LIT8( KErrDescrInvalidSSTimeout, "Invalid screen saver timeout value" );
       
    96 _LIT8( KErrDescrSSTimeoutFailed, "Setting screen saver timeout failed" );
       
    97 _LIT8( KErrDescrDrmDbConnect, "DRM DB connect failed." );
   103 _LIT8( KErrDescrDrmDbConnect, "DRM DB connect failed." );
    98 _LIT8( KErrDescrDrmDbDelete,  "DRM DB delete failed." );
   104 _LIT8( KErrDescrDrmDbDelete,  "DRM DB delete failed." );
    99 _LIT8( KErrDescrBatteryLevel, "Getting battery level failed." );
   105 _LIT8( KErrDescrBatteryLevel, "Getting battery level failed." );
   100 _LIT8( KErrDescrChargingStatus, "Getting charging status failed." );
   106 _LIT8( KErrDescrChargingStatus, "Getting charging status failed." );
   101 _LIT8( KErrDescrSignalStrength, "Getting signal strength failed." );
   107 _LIT8( KErrDescrSignalStrength, "Getting signal strength failed." );
   173 
   179 
   174 //------------------------------------------------------------------------------
   180 //------------------------------------------------------------------------------
   175 // Constructor
   181 // Constructor
   176 //------------------------------------------------------------------------------
   182 //------------------------------------------------------------------------------
   177 CHtiSysInfoServicePlugin::CHtiSysInfoServicePlugin():
   183 CHtiSysInfoServicePlugin::CHtiSysInfoServicePlugin():
   178     iMemEater( NULL ), iReply( NULL ), iAllowSSValue( -1 ),
   184     iMemEater( NULL ), iReply( NULL ), iGalleryUpdateSupported( ETrue )
   179     iAllowSSPropertyAttached( EFalse ), iGalleryUpdateSupported( ETrue )
   185     {
   180     {
   186 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
       
   187         iAllowSSValue = -1;
       
   188         iAllowSSPropertyAttached = EFalse;
       
   189 #endif
   181     }
   190     }
   182 
   191 
   183 //------------------------------------------------------------------------------
   192 //------------------------------------------------------------------------------
   184 // Destructor
   193 // Destructor
   185 //------------------------------------------------------------------------------
   194 //------------------------------------------------------------------------------
   196 
   205 
   197     if ( iAllowSSSubscriber )
   206     if ( iAllowSSSubscriber )
   198         {
   207         {
   199         iAllowSSSubscriber->Unsubscribe();
   208         iAllowSSSubscriber->Unsubscribe();
   200         }
   209         }
       
   210 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
   201     iAllowSSProperty.Close();
   211     iAllowSSProperty.Close();
       
   212 #endif 
   202     delete iAllowSSSubscriber;
   213     delete iAllowSSSubscriber;
   203     }
   214     }
   204 
   215 
   205 //------------------------------------------------------------------------------
   216 //------------------------------------------------------------------------------
   206 // Second phase construction
   217 // Second phase construction
   511         // some error, should not be called
   522         // some error, should not be called
   512         iDispatcher->RemoveMemoryObserver( this );
   523         iDispatcher->RemoveMemoryObserver( this );
   513         }
   524         }
   514     }
   525     }
   515 
   526 
       
   527 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
   516 //------------------------------------------------------------------------------
   528 //------------------------------------------------------------------------------
   517 // CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange
   529 // CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange
   518 //------------------------------------------------------------------------------
   530 //------------------------------------------------------------------------------
   519 TInt CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange( TAny* aPtr )
   531 TInt CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange( TAny* aPtr )
   520     {
   532     {
   534                               KScreenSaverAllowScreenSaver, wantedValue );
   546                               KScreenSaverAllowScreenSaver, wantedValue );
   535         }
   547         }
   536     return err;
   548     return err;
   537     }
   549     }
   538 
   550 
   539 
   551 #endif
   540 /*
   552 /*
   541  * Private helper methods
   553  * Private helper methods
   542  */
   554  */
   543 
   555 
   544 //------------------------------------------------------------------------------
   556 //------------------------------------------------------------------------------
  1086 //------------------------------------------------------------------------------
  1098 //------------------------------------------------------------------------------
  1087 // CHtiSysInfoServicePlugin::HandleEatDiskSpaceL
  1099 // CHtiSysInfoServicePlugin::HandleEatDiskSpaceL
  1088 //------------------------------------------------------------------------------
  1100 //------------------------------------------------------------------------------
  1089 void CHtiSysInfoServicePlugin::HandleEatDiskSpaceL( const TDesC8& aMessage )
  1101 void CHtiSysInfoServicePlugin::HandleEatDiskSpaceL( const TDesC8& aMessage )
  1090     {
  1102     {
       
  1103     HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
       
  1104     
  1091     if ( aMessage.Length() != 10 )
  1105     if ( aMessage.Length() != 10 )
  1092         {
  1106         {
  1093         iDispatcher->DispatchOutgoingErrorMessage(
  1107         iDispatcher->DispatchOutgoingErrorMessage(
  1094             KErrArgument,
  1108             KErrArgument,
  1095             KErrDescrArgument,
  1109             KErrDescrArgument,
  1096             KSysInfoServiceUid );
  1110             KSysInfoServiceUid );
  1097         return;
  1111         HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
  1098         }
  1112         return;
  1099 
  1113         }
  1100 
  1114 
       
  1115     TFileName commonpath;
       
  1116     commonpath.Append( aMessage[1] );
       
  1117     commonpath.Append( _L( ":" ) );
       
  1118     commonpath.Append( KTempFilePath );
       
  1119     commonpath.Append( KTempFileName );
  1101     TFileName path;
  1120     TFileName path;
  1102     path.Append( aMessage[1] );
  1121         
  1103     path.Append( _L( ":" ) );
       
  1104     path.Append( KTempFilePath );
       
  1105     path.Append( KTempFileName );
       
  1106 
       
  1107     HTI_LOG_TEXT( "Temp file path:" );
       
  1108     HTI_LOG_DES( path );
       
  1109 
       
  1110     // check if previous temp file exists and delete it
       
  1111     if ( BaflUtils::FileExists( iFs, path ) )
       
  1112         {
       
  1113         TInt err = iFileMan->Delete( path );
       
  1114         if ( err )
       
  1115             {
       
  1116             iDispatcher->DispatchOutgoingErrorMessage(
       
  1117                 err,
       
  1118                 KErrDescrDeleteTempFile,
       
  1119                 KSysInfoServiceUid );
       
  1120             return;
       
  1121             }
       
  1122         }
       
  1123 
       
  1124     // get free disk space
  1122     // get free disk space
  1125     TInt drive;
  1123     TInt drive;
  1126     RFs::CharToDrive( TChar( aMessage[1] ), drive );
  1124     RFs::CharToDrive( TChar( aMessage[1] ), drive );
  1127     TVolumeInfo volInfo;
  1125     TVolumeInfo volInfo;
  1128     TInt err = iFs.Volume( volInfo, drive );
  1126     TInt err = iFs.Volume( volInfo, drive );
  1130         {
  1128         {
  1131         iDispatcher->DispatchOutgoingErrorMessage(
  1129         iDispatcher->DispatchOutgoingErrorMessage(
  1132             err,
  1130             err,
  1133             KErrDescrVolInfo,
  1131             KErrDescrVolInfo,
  1134             KSysInfoServiceUid );
  1132             KSysInfoServiceUid );
       
  1133         HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
  1135         return;
  1134         return;
  1136         }
  1135         }
  1137 
  1136 
  1138     // calculate how much we must eat the disk space
  1137     // calculate how much we must eat the disk space
  1139     TInt64 temp1 = aMessage[2] +
  1138     TInt64 temp1 = aMessage[2] +
  1155         {
  1154         {
  1156         iDispatcher->DispatchOutgoingErrorMessage(
  1155         iDispatcher->DispatchOutgoingErrorMessage(
  1157             KErrDiskFull,
  1156             KErrDiskFull,
  1158             KErrDescrNotEnoughSpace,
  1157             KErrDescrNotEnoughSpace,
  1159             KSysInfoServiceUid );
  1158             KSysInfoServiceUid );
       
  1159         HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
  1160         return;
  1160         return;
  1161         }
  1161         }
  1162 
  1162 
  1163     // check if scaceToEat is greater than KMaxTInt
  1163     // check if scaceToEat is greater than KMaxTInt
  1164     //  --> it must be eaten in several chunks
  1164     //  --> it must be eaten in several chunks
  1165     //  --> not yet supported.
  1165     //  --> not yet supported.
  1166     if ( spaceToEat > KMaxTInt )
  1166 
  1167         {
  1167     TInt64 size;
  1168         HTI_LOG_TEXT( "Cannot allocate a file bigger than KMaxTInt" );
  1168     for(TInt i=1;  spaceToEat>0; i++)
  1169 
  1169         {
  1170         iDispatcher->DispatchOutgoingErrorMessage(
  1170         path.Zero();
  1171             KErrOverflow,
  1171         path.Copy(commonpath);
  1172             KErrDescrSetSizeTempFile,
  1172         path.AppendNum(i);
  1173             KSysInfoServiceUid );
  1173         if ( BaflUtils::FileExists( iFs, path ) )
  1174         return;
  1174             {
  1175         }
  1175             continue;
  1176 
  1176             }
  1177     // create a temp file
  1177         
  1178     RFile diskEater;
  1178         if(spaceToEat > KMaxTInt)  
  1179     err = diskEater.Replace( iFs, path, EFileWrite );
  1179             size=KMaxTInt;
  1180     if ( err )
  1180         else
  1181         {
  1181             size=spaceToEat;
  1182         iDispatcher->DispatchOutgoingErrorMessage(
  1182         
  1183             err,
  1183         err = CreatFileToEatDiskSpace(path, size);
  1184             KErrDescrCreateTempFile,
  1184         if(err)
  1185             KSysInfoServiceUid );
  1185             { 
  1186         return;
  1186             HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL CreateFile Fail" );
  1187         }
  1187             return;  
  1188 
  1188             }        
  1189     // set the size for temp file
  1189         
  1190     err = diskEater.SetSize( I64LOW( spaceToEat ) );
  1190         iFs.Volume( volInfo, drive );
  1191     if ( err )
  1191         HTI_LOG_FORMAT( "current free space: %Ld", volInfo.iFree );
  1192         {
  1192         spaceToEat = volInfo.iFree - spaceLeftFree;           
  1193         iDispatcher->DispatchOutgoingErrorMessage(
       
  1194             err,
       
  1195             KErrDescrSetSizeTempFile,
       
  1196             KSysInfoServiceUid );
       
  1197         diskEater.Close();
       
  1198         return;
       
  1199         }
       
  1200     diskEater.Close();
       
  1201 
       
  1202     err = iFs.Volume( volInfo, drive );
       
  1203     if ( err )
       
  1204         {
       
  1205         iDispatcher->DispatchOutgoingErrorMessage(
       
  1206             err,
       
  1207             KErrDescrVolInfo,
       
  1208             KSysInfoServiceUid );
       
  1209         return;
       
  1210         }
  1193         }
  1211 
  1194 
  1212     // all ok, send the remaining disk size back
  1195     // all ok, send the remaining disk size back
  1213     iReply = HBufC8::NewL( 8 );
  1196     iReply = HBufC8::NewL( 8 );
  1214     iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
  1197     iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
       
  1198     HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
       
  1199     }
       
  1200 
       
  1201 TInt CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace( TFileName aPath, TInt64 aSpaceToEat  )
       
  1202     {
       
  1203     HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace" );
       
  1204     
       
  1205     HTI_LOG_FORMAT( "Create file: %S", &aPath );
       
  1206     HTI_LOG_FORMAT( "file size %Ld", aSpaceToEat );
       
  1207     
       
  1208     // create a temp file
       
  1209     RFile diskEater;
       
  1210     TInt err = diskEater.Replace( iFs, aPath, EFileWrite );
       
  1211     if ( err )
       
  1212         {
       
  1213         iDispatcher->DispatchOutgoingErrorMessage(
       
  1214             err,
       
  1215             KErrDescrCreateTempFile,
       
  1216             KSysInfoServiceUid );
       
  1217         HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace Replace error" );
       
  1218         return err;
       
  1219         }
       
  1220     
       
  1221     // set the size for temp file
       
  1222     err = diskEater.SetSize( I64LOW( aSpaceToEat ) );
       
  1223     if ( err )
       
  1224         {
       
  1225         iDispatcher->DispatchOutgoingErrorMessage(
       
  1226             err,
       
  1227             KErrDescrSetSizeTempFile,
       
  1228             KSysInfoServiceUid );
       
  1229         diskEater.Close();
       
  1230         HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace SetSize error" );
       
  1231         return err;
       
  1232         }
       
  1233     diskEater.Close();
       
  1234     HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace" );
       
  1235     return 0;
  1215     }
  1236     }
  1216 
  1237 
  1217 //------------------------------------------------------------------------------
  1238 //------------------------------------------------------------------------------
  1218 // CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL
  1239 // CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL
  1219 //------------------------------------------------------------------------------
  1240 //------------------------------------------------------------------------------
  1220 void CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL( const TDesC8& aMessage )
  1241 void CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL( const TDesC8& aMessage )
  1221     {
  1242     {
       
  1243     HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
  1222     if ( aMessage.Length() != 2 )
  1244     if ( aMessage.Length() != 2 )
  1223         {
  1245         {
  1224         iDispatcher->DispatchOutgoingErrorMessage(
  1246         iDispatcher->DispatchOutgoingErrorMessage(
  1225             KErrArgument,
  1247             KErrArgument,
  1226             KErrDescrArgument,
  1248             KErrDescrArgument,
  1227             KSysInfoServiceUid);
  1249             KSysInfoServiceUid);
       
  1250         HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
  1228         return;
  1251         return;
  1229         }
  1252         }
  1230 
  1253 
  1231     TFileName path;
  1254     TFileName path;
  1232     path.Append( aMessage[1] );
  1255     path.Append( aMessage[1] );
  1233     path.Append( _L( ":" ) );
  1256     path.Append( _L( ":" ) );
  1234     path.Append( KTempFilePath );
  1257     path.Append(KTempFilePath);
  1235     path.Append( KTempFileName );
  1258     path.Append(KMatchFileName);
  1236 
  1259     TInt err = iFileMan->Delete(path);
  1237     HTI_LOG_TEXT( "Temp file path:" );
  1260     if ( err )
  1238     HTI_LOG_DES( path );
  1261         {
  1239 
  1262         iDispatcher->DispatchOutgoingErrorMessage(
  1240     TInt err = KErrNone;
       
  1241     // check that temp file exists
       
  1242     if ( BaflUtils::FileExists( iFs, path ) )
       
  1243         {
       
  1244         // try to delete the temp file
       
  1245         err = iFileMan->Delete( path );
       
  1246         if ( err )
       
  1247             {
       
  1248             iDispatcher->DispatchOutgoingErrorMessage(
       
  1249                 err,
  1263                 err,
  1250                 KErrDescrDeleteTempFile,
  1264                 KErrDescrDeleteTempFile,
  1251                 KSysInfoServiceUid );
  1265                 KSysInfoServiceUid );
  1252 
  1266         HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
  1253             return;
  1267         return;
  1254             }
  1268         } 
  1255         }
  1269     
  1256 
       
  1257     // query the free disk space
  1270     // query the free disk space
  1258     TInt drive;
  1271     TInt drive;
  1259     RFs::CharToDrive( TChar( aMessage[1] ), drive );
  1272     RFs::CharToDrive( TChar( aMessage[1] ), drive );
  1260     TVolumeInfo volInfo;
  1273     TVolumeInfo volInfo;
  1261     err = iFs.Volume( volInfo, drive );
  1274     err = iFs.Volume( volInfo, drive );
  1263         {
  1276         {
  1264         iDispatcher->DispatchOutgoingErrorMessage(
  1277         iDispatcher->DispatchOutgoingErrorMessage(
  1265             err,
  1278             err,
  1266             KErrDescrVolInfo,
  1279             KErrDescrVolInfo,
  1267             KSysInfoServiceUid );
  1280             KSysInfoServiceUid );
  1268 
  1281         HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
  1269         return;
  1282         return;
  1270         }
  1283         }
  1271 
  1284 
  1272     // all ok, send the free disk space back
  1285     // all ok, send the free disk space back
  1273     iReply = HBufC8::NewL( 8 );
  1286     iReply = HBufC8::NewL( 8 );
  1274     iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
  1287     iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
       
  1288 
       
  1289     HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
  1275     }
  1290     }
  1276 
  1291 
  1277 //------------------------------------------------------------------------------
  1292 //------------------------------------------------------------------------------
  1278 // CHtiSysInfoServicePlugin::HandleSetHomeTimeL
  1293 // CHtiSysInfoServicePlugin::HandleSetHomeTimeL
  1279 //------------------------------------------------------------------------------
  1294 //------------------------------------------------------------------------------
  1452 // CHtiSysInfoServicePlugin::HandleScreenSaverCommandL
  1467 // CHtiSysInfoServicePlugin::HandleScreenSaverCommandL
  1453 //------------------------------------------------------------------------------
  1468 //------------------------------------------------------------------------------
  1454 void CHtiSysInfoServicePlugin::HandleScreenSaverCommandL(
  1469 void CHtiSysInfoServicePlugin::HandleScreenSaverCommandL(
  1455                                     const TDesC8& aMessage )
  1470                                     const TDesC8& aMessage )
  1456     {
  1471     {
       
  1472     HTI_LOG_FUNC_IN(
       
  1473             "CHtiSysInfoServicePlugin::HandleScreenSaverCommandL" );
       
  1474 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
  1457     if ( aMessage.Length() != 1 )
  1475     if ( aMessage.Length() != 1 )
  1458         {
  1476         {
  1459         iDispatcher->DispatchOutgoingErrorMessage(
  1477         iDispatcher->DispatchOutgoingErrorMessage(
  1460             KErrArgument,
  1478             KErrArgument,
  1461             KErrDescrArgument,
  1479             KErrDescrArgument,
  1516         iAllowSSSubscriber = NULL;
  1534         iAllowSSSubscriber = NULL;
  1517         }
  1535         }
  1518 
  1536 
  1519     iReply = HBufC8::NewL( 1 );
  1537     iReply = HBufC8::NewL( 1 );
  1520     iReply->Des().Append( 0 );
  1538     iReply->Des().Append( 0 );
       
  1539 #else
       
  1540     iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
       
  1541             KErrDescrNotSupported, KSysInfoServiceUid);
       
  1542 #endif 
       
  1543     HTI_LOG_FUNC_OUT(
       
  1544                 "CHtiSysInfoServicePlugin::HandleScreenSaverCommandL" );
  1521     }
  1545     }
  1522 
  1546 
  1523 //------------------------------------------------------------------------------
  1547 //------------------------------------------------------------------------------
  1524 // CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL
  1548 // CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL
  1525 //------------------------------------------------------------------------------
  1549 //------------------------------------------------------------------------------
  1526 void CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL(
  1550 void CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL(
  1527                                     const TDesC8& aMessage )
  1551                                     const TDesC8& aMessage )
  1528     {
  1552     {
  1529     HTI_LOG_FUNC_IN(
  1553     HTI_LOG_FUNC_IN(
  1530             "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
  1554             "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
       
  1555 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
  1531     if ( aMessage.Length() != 2 )
  1556     if ( aMessage.Length() != 2 )
  1532         {
  1557         {
  1533         iDispatcher->DispatchOutgoingErrorMessage(
  1558         iDispatcher->DispatchOutgoingErrorMessage(
  1534             KErrArgument,
  1559             KErrArgument,
  1535             KErrDescrArgument,
  1560             KErrDescrArgument,
  1560         iDispatcher->DispatchOutgoingErrorMessage( err,
  1585         iDispatcher->DispatchOutgoingErrorMessage( err,
  1561             KErrDescrSSTimeoutFailed, KSysInfoServiceUid );
  1586             KErrDescrSSTimeoutFailed, KSysInfoServiceUid );
  1562         }
  1587         }
  1563 
  1588 
  1564     delete persRep;
  1589     delete persRep;
       
  1590 #else
       
  1591     iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
       
  1592             KErrDescrNotSupported, KSysInfoServiceUid);
       
  1593 #endif 
  1565     HTI_LOG_FUNC_OUT(
  1594     HTI_LOG_FUNC_OUT(
  1566         "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
  1595         "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
  1567     }
  1596     }
  1568 
  1597 
  1569 //------------------------------------------------------------------------------
  1598 //------------------------------------------------------------------------------
  2139 // CHtiSysInfoServicePlugin::HandleKeyLockToggleL
  2168 // CHtiSysInfoServicePlugin::HandleKeyLockToggleL
  2140 //------------------------------------------------------------------------------
  2169 //------------------------------------------------------------------------------
  2141 void CHtiSysInfoServicePlugin::HandleKeyLockToggleL( const TDesC8& aMessage )
  2170 void CHtiSysInfoServicePlugin::HandleKeyLockToggleL( const TDesC8& aMessage )
  2142     {
  2171     {
  2143     HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
  2172     HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
  2144 
  2173 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
  2145     if ( aMessage.Length() != 3 )
  2174     if ( aMessage.Length() != 3 )
  2146         {
  2175         {
  2147         iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
  2176         iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
  2148             KErrDescrArgument, KSysInfoServiceUid );
  2177             KErrDescrArgument, KSysInfoServiceUid );
  2149         return;
  2178         return;
  2206                 KErrDescrKeyLock, KSysInfoServiceUid );
  2235                 KErrDescrKeyLock, KSysInfoServiceUid );
  2207             }
  2236             }
  2208         }
  2237         }
  2209 
  2238 
  2210     keyLock.Close();
  2239     keyLock.Close();
  2211 
  2240 #else
       
  2241     iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
       
  2242             KErrDescrNotSupported, KSysInfoServiceUid);
       
  2243 #endif    
  2212     HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
  2244     HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
  2213     }
  2245     }
  2214 
  2246 
  2215 //------------------------------------------------------------------------------
  2247 //------------------------------------------------------------------------------
  2216 // CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL
  2248 // CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL
  2855 // CHtiSysInfoServicePlugin::CleanUpTempFiles
  2887 // CHtiSysInfoServicePlugin::CleanUpTempFiles
  2856 //------------------------------------------------------------------------------
  2888 //------------------------------------------------------------------------------
  2857 TInt CHtiSysInfoServicePlugin::CleanUpTempFiles()
  2889 TInt CHtiSysInfoServicePlugin::CleanUpTempFiles()
  2858     {
  2890     {
  2859     HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::CleanUpTempFiles" );
  2891     HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::CleanUpTempFiles" );
  2860 
       
  2861     TFindFile finder( iFs );
  2892     TFindFile finder( iFs );
  2862     TFileName path( KTempFilePath );
  2893     CDir* dir = NULL;
  2863     TInt err = finder.FindByPath( KTempFileName, &path );
  2894     TInt err = finder.FindWildByDir(KMatchFileName, KTempFilePath, dir);
  2864 
  2895     TInt safeDeleteCount = 0;
  2865     while ( err == KErrNone )
  2896     while ( err == KErrNone && safeDeleteCount < 20)
  2866         {
  2897         {
  2867         TFileName tempFile = finder.File();
  2898         safeDeleteCount++;
  2868 
  2899         TFileName path;
  2869         HTI_LOG_TEXT( "Found temp file: " );
  2900         path.Copy(finder.File());
  2870         HTI_LOG_DES( tempFile );
  2901         HTI_LOG_FORMAT( "found file: %S", &path );
  2871 
  2902         TInt ret = iFileMan->Delete(path);
  2872         err = iFileMan->Delete( tempFile );
  2903         delete dir;
  2873 
  2904         dir = NULL;
  2874         // return if deleting does not succeed to prevent mad man loop
  2905         if(ret != KErrNone)
  2875         if ( err != KErrNone ) return err;
  2906             {
  2876 
  2907             break;
  2877         // try to find next temp file
  2908             }
  2878         err = finder.FindByPath( KTempFileName, &path );
  2909         err = finder.FindWildByDir(KMatchFileName, KTempFilePath, dir);
  2879         }
  2910         }
  2880 
       
  2881     HTI_LOG_FUNC_OUT("CHtiSysInfoServicePlugin::CleanUpTempFiles");
  2911     HTI_LOG_FUNC_OUT("CHtiSysInfoServicePlugin::CleanUpTempFiles");
  2882     return KErrNone;
  2912     return KErrNone;
  2883     }
  2913     }
  2884 
  2914 
  2885 //------------------------------------------------------------------------------
  2915 //------------------------------------------------------------------------------