resourcemgmt/hwresourcesmgr/server/src/HWRMPowerStatePluginHandler.cpp
changeset 70 653a8b91b95e
parent 0 4e1aa6a622a0
equal deleted inserted replaced
64:61992147389a 70:653a8b91b95e
    91                                            KNoCapability, KHWRMSidOnlyPolicy ) );
    91                                            KNoCapability, KHWRMSidOnlyPolicy ) );
    92     User::LeaveIfError( iBattStatusProp.Attach( KPSUidHWRMPowerState,
    92     User::LeaveIfError( iBattStatusProp.Attach( KPSUidHWRMPowerState,
    93                                                 KHWRMBatteryStatus ) );
    93                                                 KHWRMBatteryStatus ) );
    94     // Charging status
    94     // Charging status
    95     User::LeaveIfError( RProperty::Define( KPSUidHWRMPowerState,
    95     User::LeaveIfError( RProperty::Define( KPSUidHWRMPowerState,
       
    96                                                KHWRMExtendedBatteryStatus, RProperty::EInt,
       
    97                                                KNoCapability, KHWRMSidOnlyPolicy ) );
       
    98     User::LeaveIfError( iExtendedBattStatusProp.Attach( KPSUidHWRMPowerState,
       
    99                                                 KHWRMExtendedBatteryStatus ) );
       
   100     // Charging status
       
   101     User::LeaveIfError( RProperty::Define( KPSUidHWRMPowerState,
    96                                            KHWRMChargingStatus, RProperty::EInt,
   102                                            KHWRMChargingStatus, RProperty::EInt,
    97                                            KNoCapability, KHWRMSidOnlyPolicy ) );
   103                                            KNoCapability, KHWRMSidOnlyPolicy ) );
    98     User::LeaveIfError( iChargingStatusProp.Attach( KPSUidHWRMPowerState,
   104     User::LeaveIfError( iChargingStatusProp.Attach( KPSUidHWRMPowerState,
    99                                                     KHWRMChargingStatus ) );
   105                                                     KHWRMChargingStatus ) );
   100     
   106     User::LeaveIfError( RProperty::Define( KPSUidHWRMPowerState,
       
   107                                                KHWRMExtendedChargingStatus, RProperty::EInt,
       
   108                                                KNoCapability, KHWRMSidOnlyPolicy ) );
       
   109     User::LeaveIfError( iExtendedChargingStatusProp.Attach( KPSUidHWRMPowerState,
       
   110                                                     KHWRMExtendedChargingStatus ) );
       
   111 
   101     // Get plugin instance
   112     // Get plugin instance
   102     iPlugin = CHWRMPowerStatePlugin::NewL( this );
   113     iPlugin = CHWRMPowerStatePlugin::NewL( this );
   103 
   114 
   104     COMPONENT_TRACE1(_L("HWRM Server - CHWRMPowerStatePluginHandler::ConstructL - return") );
   115     COMPONENT_TRACE1(_L("HWRM Server - CHWRMPowerStatePluginHandler::ConstructL - return") );
   105     }
   116     }
   138 
   149 
   139     // close the P&S properties
   150     // close the P&S properties
   140     iBattLevelProp.Close();
   151     iBattLevelProp.Close();
   141     iBattStatusProp.Close();
   152     iBattStatusProp.Close();
   142     iChargingStatusProp.Close();
   153     iChargingStatusProp.Close();
   143 
   154     iExtendedBattStatusProp.Close();
       
   155     iExtendedChargingStatusProp.Close();
       
   156         
   144     COMPONENT_TRACE1(_L("HWRM Server - CHWRMPowerStatePluginHandler::~CHWRMPowerStatePluginHandler - return ") );
   157     COMPONENT_TRACE1(_L("HWRM Server - CHWRMPowerStatePluginHandler::~CHWRMPowerStatePluginHandler - return ") );
   145     }
   158     }
   146 
   159 
   147 // -----------------------------------------------------------------------------
   160 // -----------------------------------------------------------------------------
   148 // CHWRMPowerStatePluginHandler::NotifyStateChange
   161 // CHWRMPowerStatePluginHandler::NotifyStateChange
   161             {
   174             {
   162             COMPONENT_TRACE2(_L("HWRM Server - KHWRMBatteryLevel key value=%d"), aValue );
   175             COMPONENT_TRACE2(_L("HWRM Server - KHWRMBatteryLevel key value=%d"), aValue );
   163             iBattLevelProp.Set( aValue );
   176             iBattLevelProp.Set( aValue );
   164             break;
   177             break;
   165             }
   178             }
   166         case KHWRMBatteryStatus:
   179         case KHWRMExtendedBatteryStatus:
       
   180         case KHWRMBatteryStatus: // Just for the sake of Integration TestCode, shall be removed once legacy things are deprecated completely
   167             {
   181             {
   168             COMPONENT_TRACE2(_L("HWRM Server - KHWRMBatteryStatus key value=%d"), aValue );
   182             COMPONENT_TRACE2(_L("HWRM Server - KHWRMExtendedBatteryStatus key value=%d"), aValue );
   169             iBattStatusProp.Set( aValue );
   183             
   170             break;
   184             if ( aValue == EBatteryStatusNotSupported ||
   171             }
   185             		 aValue == EBatteryStatusDbiAuthFailed )
   172         case KHWRMChargingStatus:
   186                 {
       
   187                 iBattStatusProp.Set( EBatteryStatusUnknown );
       
   188                 }
       
   189             else
       
   190                 {
       
   191                 iBattStatusProp.Set( aValue );
       
   192                 }
       
   193                 
       
   194             iExtendedBattStatusProp.Set( aValue );
       
   195             
       
   196             break;
       
   197             }        
       
   198         case KHWRMExtendedChargingStatus:
       
   199         case KHWRMChargingStatus: // Just for the sake of Integration TestCode, shall be removed once legacy things are deprecated completely
   173             {
   200             {
   174             COMPONENT_TRACE2(_L("HWRM Server - KHWRMChargingStatus key value=%d"), aValue );
   201             COMPONENT_TRACE2(_L("HWRM Server - KHWRMExtendedChargingStatus key value=%d"), aValue );
   175             iChargingStatusProp.Set( aValue );                        
   202                              
       
   203             if ( aValue == EChargingStatusIllegalChargerError ||
       
   204                  aValue == EChargingStatusChargerUnderVoltageError ||
       
   205                  aValue == EChargingStatusChargerOverVoltageError ||
       
   206                  aValue == EChargingStatusTempTooHotError ||
       
   207                  aValue == EChargingStatusTempTooColdError)
       
   208                 {
       
   209                 iChargingStatusProp.Set ( EChargingStatusError );
       
   210                 }
       
   211             else
       
   212                 {
       
   213                 iChargingStatusProp.Set( aValue );
       
   214                 }
       
   215             
   176             if ( iChargerBlockVibra || iChargerBlockVibraFeedback )
   216             if ( iChargerBlockVibra || iChargerBlockVibraFeedback )
   177                 {
   217                 {
   178                 if ( aValue == EChargingStatusCharging ||
   218                 if ( aValue == EChargingStatusCharging ||
   179                      aValue == EChargingStatusNotCharging ||
   219                      aValue == EChargingStatusNotCharging ||
   180                      aValue == EChargingStatusAlmostComplete ||
   220                      aValue == EChargingStatusAlmostComplete ||
   186                 else
   226                 else
   187                     {
   227                     {
   188                     RProperty::Set(KPSUidHWRMPrivate, KHWRMInternalVibraBlocked, EFalse);
   228                     RProperty::Set(KPSUidHWRMPrivate, KHWRMInternalVibraBlocked, EFalse);
   189                     }
   229                     }
   190                 }
   230                 }
       
   231                 
       
   232             iExtendedChargingStatusProp.Set( aValue );
       
   233             
   191             break;
   234             break;
   192             }
   235             }
   193         default:
   236         default:
   194             break;
   237             break;
   195         }
   238         }