(self, enabled, timeout=None, retries=None)
Enables or disables charging on the device.

    Args:
      enabled: A boolean indicating whether charging should be enabled or
        disabled.
      timeout: timeout in seconds
      retries: number of retries
Enables or disables charging on the device.
Enables or disables charging on the device .
def SetCharging(self, enabled, timeout=None, retries=None):
    """Enables or disables charging on the device.

    Args:
      enabled: A boolean indicating whether charging should be enabled or
        disabled.
      timeout: timeout in seconds
      retries: number of retries
    """
    if self.GetCharging() == enabled:
      logger.warning('Device charging already in expected state: %s', enabled)
      return

    self._DiscoverDeviceProfile()
    if enabled:
      if self._cache['profile']['enable_command']:
        self._HardwareSetCharging(enabled)
      else:
        logger.info('Unable to enable charging via hardware. '
                    'Falling back to software enabling.')
        self.EnableBatteryUpdates()
    else:
      if self._cache['profile']['enable_command']:
        self._ClearPowerData()
        self._HardwareSetCharging(enabled)
      else:
        logger.info('Unable to disable charging via hardware. '
                     'Falling back to software disabling.')
        self.DisableBatteryUpdates()
def SetCharging ( self , enabled , timeout = None , retries = None ) : if self . GetCharging ( ) == enabled : logger . warning ( 'Device charging already in expected state: %s' , enabled ) return self . _DiscoverDeviceProfile ( ) if enabled : if self . _cache [ 'profile' ] [ 'enable_command' ] : self . _HardwareSetCharging ( enabled ) else : logger . info ( 'Unable to enable charging via hardware. ' 'Falling back to software enabling.' ) self . EnableBatteryUpdates ( ) else : if self . _cache [ 'profile' ] [ 'enable_command' ] : self . _ClearPowerData ( ) self . _HardwareSetCharging ( enabled ) else : logger . info ( 'Unable to disable charging via hardware. ' 'Falling back to software disabling.' ) self . DisableBatteryUpdates ( )