htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp
branchRCL_3
changeset 12 aefcba28a3e0
parent 11 454d022d514b
child 19 d40e813b23c0
equal deleted inserted replaced
11:454d022d514b 12:aefcba28a3e0
    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
    78 _LIT8( KErrDescrSetSizeTempFile, "Error allocating size for temp file" );
    81 _LIT8( KErrDescrSetSizeTempFile, "Error allocating size for temp file" );
    79 _LIT8( KErrDescrDeleteTempFile, "Error deleting temp file" );
    82 _LIT8( KErrDescrDeleteTempFile, "Error deleting temp file" );
    80 _LIT8( KErrDescrSysUtil, "SysUtil failed" );
    83 _LIT8( KErrDescrSysUtil, "SysUtil failed" );
    81 _LIT8( KErrDescrSetTime, "Setting time failed" );
    84 _LIT8( KErrDescrSetTime, "Setting time failed" );
    82 _LIT8( KErrDescrDateTimeFormat, "Setting date and time formats failed" );
    85 _LIT8( KErrDescrDateTimeFormat, "Setting date and time formats failed" );
    83 _LIT8( KErrDescrScreenSaver, "Setting screen saver state failed" );
       
    84 _LIT8( KErrDescrGetNetworkModes, "Getting network modes failed" );
    86 _LIT8( KErrDescrGetNetworkModes, "Getting network modes failed" );
    85 _LIT8( KErrDescrSetNetworkMode, "Setting network mode failed" );
    87 _LIT8( KErrDescrSetNetworkMode, "Setting network mode failed" );
    86 _LIT8( KErrDescrIrActivation, "IR activation failed" );
    88 _LIT8( KErrDescrIrActivation, "IR activation failed" );
    87 _LIT8( KErrDescrGetBtPower, "Getting BT power state failed" );
    89 _LIT8( KErrDescrGetBtPower, "Getting BT power state failed" );
    88 _LIT8( KErrDescrSetBtPower, "Setting BT power state failed" );
    90 _LIT8( KErrDescrSetBtPower, "Setting BT power state failed" );
    89 _LIT8( KErrDescrBtOnDenied, "Turning BT on not allowed (Offline mode)" );
    91 _LIT8( KErrDescrBtOnDenied, "Turning BT on not allowed (Offline mode)" );
    90 _LIT8( KErrDescrBtOffDenied, "Turning BT off not allowed (active connections)" );
    92 _LIT8( KErrDescrBtOffDenied, "Turning BT off not allowed (active connections)" );
    91 _LIT8( KErrDescrBtSettings, "Bluetooth settings failed" );
    93 _LIT8( KErrDescrBtSettings, "Bluetooth settings failed" );
    92 _LIT8( KErrDescrBtDeletePairings, "Deleting Bluetooth pairing(s) failed" );
    94 _LIT8( KErrDescrBtDeletePairings, "Deleting Bluetooth pairing(s) failed" );
       
    95 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
    93 _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
    94 _LIT8( KErrDescrInvalidTime, "Auto key guard time value too large (max 3600)" );
   101 _LIT8( KErrDescrInvalidTime, "Auto key guard time value too large (max 3600)" );
    95 _LIT8( KErrDescrAutoKeyGuardFailed, "Setting auto key guard time failed" );
   102 _LIT8( KErrDescrAutoKeyGuardFailed, "Setting auto key guard time failed" );
    96 _LIT8( KErrDescrInvalidSSTimeout, "Invalid screen saver timeout value" );
       
    97 _LIT8( KErrDescrSSTimeoutFailed, "Setting screen saver timeout failed" );
       
    98 _LIT8( KErrDescrDrmDbConnect, "DRM DB connect failed." );
   103 _LIT8( KErrDescrDrmDbConnect, "DRM DB connect failed." );
    99 _LIT8( KErrDescrDrmDbDelete,  "DRM DB delete failed." );
   104 _LIT8( KErrDescrDrmDbDelete,  "DRM DB delete failed." );
   100 _LIT8( KErrDescrBatteryLevel, "Getting battery level failed." );
   105 _LIT8( KErrDescrBatteryLevel, "Getting battery level failed." );
   101 _LIT8( KErrDescrChargingStatus, "Getting charging status failed." );
   106 _LIT8( KErrDescrChargingStatus, "Getting charging status failed." );
   102 _LIT8( KErrDescrSignalStrength, "Getting signal strength failed." );
   107 _LIT8( KErrDescrSignalStrength, "Getting signal strength failed." );
   174 
   179 
   175 //------------------------------------------------------------------------------
   180 //------------------------------------------------------------------------------
   176 // Constructor
   181 // Constructor
   177 //------------------------------------------------------------------------------
   182 //------------------------------------------------------------------------------
   178 CHtiSysInfoServicePlugin::CHtiSysInfoServicePlugin():
   183 CHtiSysInfoServicePlugin::CHtiSysInfoServicePlugin():
   179     iMemEater( NULL ), iReply( NULL ), iAllowSSValue( -1 ),
   184     iMemEater( NULL ), iReply( NULL ), iGalleryUpdateSupported( ETrue )
   180     iAllowSSPropertyAttached( EFalse ), iGalleryUpdateSupported( ETrue )
   185     {
   181     {
   186 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
       
   187         iAllowSSValue = -1;
       
   188         iAllowSSPropertyAttached = EFalse;
       
   189 #endif
   182     }
   190     }
   183 
   191 
   184 //------------------------------------------------------------------------------
   192 //------------------------------------------------------------------------------
   185 // Destructor
   193 // Destructor
   186 //------------------------------------------------------------------------------
   194 //------------------------------------------------------------------------------
   197 
   205 
   198     if ( iAllowSSSubscriber )
   206     if ( iAllowSSSubscriber )
   199         {
   207         {
   200         iAllowSSSubscriber->Unsubscribe();
   208         iAllowSSSubscriber->Unsubscribe();
   201         }
   209         }
       
   210 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
   202     iAllowSSProperty.Close();
   211     iAllowSSProperty.Close();
       
   212 #endif 
   203     delete iAllowSSSubscriber;
   213     delete iAllowSSSubscriber;
   204     }
   214     }
   205 
   215 
   206 //------------------------------------------------------------------------------
   216 //------------------------------------------------------------------------------
   207 // Second phase construction
   217 // Second phase construction
   512         // some error, should not be called
   522         // some error, should not be called
   513         iDispatcher->RemoveMemoryObserver( this );
   523         iDispatcher->RemoveMemoryObserver( this );
   514         }
   524         }
   515     }
   525     }
   516 
   526 
       
   527 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
   517 //------------------------------------------------------------------------------
   528 //------------------------------------------------------------------------------
   518 // CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange
   529 // CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange
   519 //------------------------------------------------------------------------------
   530 //------------------------------------------------------------------------------
   520 TInt CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange( TAny* aPtr )
   531 TInt CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange( TAny* aPtr )
   521     {
   532     {
   535                               KScreenSaverAllowScreenSaver, wantedValue );
   546                               KScreenSaverAllowScreenSaver, wantedValue );
   536         }
   547         }
   537     return err;
   548     return err;
   538     }
   549     }
   539 
   550 
   540 
   551 #endif
   541 /*
   552 /*
   542  * Private helper methods
   553  * Private helper methods
   543  */
   554  */
   544 
   555 
   545 //------------------------------------------------------------------------------
   556 //------------------------------------------------------------------------------
  1456 // CHtiSysInfoServicePlugin::HandleScreenSaverCommandL
  1467 // CHtiSysInfoServicePlugin::HandleScreenSaverCommandL
  1457 //------------------------------------------------------------------------------
  1468 //------------------------------------------------------------------------------
  1458 void CHtiSysInfoServicePlugin::HandleScreenSaverCommandL(
  1469 void CHtiSysInfoServicePlugin::HandleScreenSaverCommandL(
  1459                                     const TDesC8& aMessage )
  1470                                     const TDesC8& aMessage )
  1460     {
  1471     {
       
  1472     HTI_LOG_FUNC_IN(
       
  1473             "CHtiSysInfoServicePlugin::HandleScreenSaverCommandL" );
       
  1474 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
  1461     if ( aMessage.Length() != 1 )
  1475     if ( aMessage.Length() != 1 )
  1462         {
  1476         {
  1463         iDispatcher->DispatchOutgoingErrorMessage(
  1477         iDispatcher->DispatchOutgoingErrorMessage(
  1464             KErrArgument,
  1478             KErrArgument,
  1465             KErrDescrArgument,
  1479             KErrDescrArgument,
  1520         iAllowSSSubscriber = NULL;
  1534         iAllowSSSubscriber = NULL;
  1521         }
  1535         }
  1522 
  1536 
  1523     iReply = HBufC8::NewL( 1 );
  1537     iReply = HBufC8::NewL( 1 );
  1524     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" );
  1525     }
  1545     }
  1526 
  1546 
  1527 //------------------------------------------------------------------------------
  1547 //------------------------------------------------------------------------------
  1528 // CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL
  1548 // CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL
  1529 //------------------------------------------------------------------------------
  1549 //------------------------------------------------------------------------------
  1530 void CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL(
  1550 void CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL(
  1531                                     const TDesC8& aMessage )
  1551                                     const TDesC8& aMessage )
  1532     {
  1552     {
  1533     HTI_LOG_FUNC_IN(
  1553     HTI_LOG_FUNC_IN(
  1534             "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
  1554             "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
       
  1555 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
  1535     if ( aMessage.Length() != 2 )
  1556     if ( aMessage.Length() != 2 )
  1536         {
  1557         {
  1537         iDispatcher->DispatchOutgoingErrorMessage(
  1558         iDispatcher->DispatchOutgoingErrorMessage(
  1538             KErrArgument,
  1559             KErrArgument,
  1539             KErrDescrArgument,
  1560             KErrDescrArgument,
  1564         iDispatcher->DispatchOutgoingErrorMessage( err,
  1585         iDispatcher->DispatchOutgoingErrorMessage( err,
  1565             KErrDescrSSTimeoutFailed, KSysInfoServiceUid );
  1586             KErrDescrSSTimeoutFailed, KSysInfoServiceUid );
  1566         }
  1587         }
  1567 
  1588 
  1568     delete persRep;
  1589     delete persRep;
       
  1590 #else
       
  1591     iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
       
  1592             KErrDescrNotSupported, KSysInfoServiceUid);
       
  1593 #endif 
  1569     HTI_LOG_FUNC_OUT(
  1594     HTI_LOG_FUNC_OUT(
  1570         "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
  1595         "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
  1571     }
  1596     }
  1572 
  1597 
  1573 //------------------------------------------------------------------------------
  1598 //------------------------------------------------------------------------------
  2143 // CHtiSysInfoServicePlugin::HandleKeyLockToggleL
  2168 // CHtiSysInfoServicePlugin::HandleKeyLockToggleL
  2144 //------------------------------------------------------------------------------
  2169 //------------------------------------------------------------------------------
  2145 void CHtiSysInfoServicePlugin::HandleKeyLockToggleL( const TDesC8& aMessage )
  2170 void CHtiSysInfoServicePlugin::HandleKeyLockToggleL( const TDesC8& aMessage )
  2146     {
  2171     {
  2147     HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
  2172     HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
  2148 
  2173 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
  2149     if ( aMessage.Length() != 3 )
  2174     if ( aMessage.Length() != 3 )
  2150         {
  2175         {
  2151         iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
  2176         iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
  2152             KErrDescrArgument, KSysInfoServiceUid );
  2177             KErrDescrArgument, KSysInfoServiceUid );
  2153         return;
  2178         return;
  2210                 KErrDescrKeyLock, KSysInfoServiceUid );
  2235                 KErrDescrKeyLock, KSysInfoServiceUid );
  2211             }
  2236             }
  2212         }
  2237         }
  2213 
  2238 
  2214     keyLock.Close();
  2239     keyLock.Close();
  2215 
  2240 #else
       
  2241     iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
       
  2242             KErrDescrNotSupported, KSysInfoServiceUid);
       
  2243 #endif    
  2216     HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
  2244     HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
  2217     }
  2245     }
  2218 
  2246 
  2219 //------------------------------------------------------------------------------
  2247 //------------------------------------------------------------------------------
  2220 // CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL
  2248 // CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL