(state, interface=None)
Sets an interfaces power state.

  Args:
    state: bool, True is on, False is off.
    interface: the CWInterface to operate on.

  Returns:
    bool: whether setting the state was successful.
Sets an interfaces power state.
Sets an interfaces power state .
def SetInterfacePower(state, interface=None):
  """Sets an interfaces power state.

  Args:
    state: bool, True is on, False is off.
    interface: the CWInterface to operate on.

  Returns:
    bool: whether setting the state was successful.
  """
  if not interface:
    interface = GetDefaultInterface()
    if not interface:
      return False

  if bool(interface.powerOn()) != state:
    _, error = interface.setPower_error_(state, None)
    if error:
      logging.debug('Failed to set interface power. Error: %s', error)
      return False
    if state:
      while interface.interfaceState() == 0:
        # After powering on the interface, it takes a while before it's ready.
        logging.debug('Waiting for interface to wake up')
        time.sleep(5)
      return True
def SetInterfacePower ( state , interface = None ) : if not interface : interface = GetDefaultInterface ( ) if not interface : return False if bool ( interface . powerOn ( ) ) != state : _ , error = interface . setPower_error_ ( state , None ) if error : logging . debug ( 'Failed to set interface power. Error: %s' , error ) return False if state : while interface . interfaceState ( ) == 0 : # After powering on the interface, it takes a while before it's ready. logging . debug ( 'Waiting for interface to wake up' ) time . sleep ( 5 ) return True