(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

    Raises:
      device_errors.CommandFailedError: If method of disabling charging cannot
        be determined.
Enables or disables charging on the device.
Enables or disables charging on the device .
def _HardwareSetCharging(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

    Raises:
      device_errors.CommandFailedError: If method of disabling charging cannot
        be determined.
    """
    self._DiscoverDeviceProfile()
    if not self._cache['profile']['enable_command']:
      raise device_errors.CommandFailedError(
          'Unable to find charging commands.')

    command = (self._cache['profile']['enable_command'] if enabled
               else self._cache['profile']['disable_command'])

    def verify_charging():
      return self.GetCharging() == enabled

    self._device.RunShellCommand(
        command, check_return=True, as_root=True, large_output=True)
    timeout_retry.WaitFor(verify_charging, wait_period=1)
def _HardwareSetCharging ( self , enabled , timeout = None , retries = None ) : self . _DiscoverDeviceProfile ( ) if not self . _cache [ 'profile' ] [ 'enable_command' ] : raise device_errors . CommandFailedError ( 'Unable to find charging commands.' ) command = ( self . _cache [ 'profile' ] [ 'enable_command' ] if enabled else self . _cache [ 'profile' ] [ 'disable_command' ] ) def verify_charging ( ) : return self . GetCharging ( ) == enabled self . _device . RunShellCommand ( command , check_return = True , as_root = True , large_output = True ) timeout_retry . WaitFor ( verify_charging , wait_period = 1 )