Compute and return the device state.

        :returns: Device state.
426214
def state(self):
        
        # Check if device is disconnected.
        if not self.available:
            return STATE_UNKNOWN
        # Check if device is off.
        if not self.screen_on:
            return STATE_OFF
        # Check if screen saver is on.
        if not self.awake:
            return STATE_IDLE
        # Check if the launcher is active.
        if self.launcher or self.settings:
            return STATE_STANDBY
        # Check for a wake lock (device is playing).
        if self.wake_lock:
            return STATE_PLAYING
        # Otherwise, device is paused.
        return STATE_PAUSED
435980
def update_state(self):
        
        response = self.api_interface.get_device_state(self, id_override=self.parent_id(),
                                                       type_override=self.parent_object_type())
        self._update_state_from_response(response)
1293553
def deployed_devices(self):
        
        if self._deployed_devices is None:
            self._deployed_devices = DeployedDevices(self)
        return self._deployed_devices
852507
def state(self):
        
        return Emitter(weakref.proxy(self.lib), self.lib.jit_new_state())
1328111
def get_wifi_state(self):
        
        log.debug("getting wifi state...")
        cmd, url = DEVICE_URLS["get_wifi_state"]
        return self._exec(cmd, url)
383495
def get_state(self, force_update=False):
        
        if force_update or self._state is None:
            return int(self.basicevent.GetBinaryState()['BinaryState'])
        return self._state
565024
def read(self):
        
        ret = None

        try:
            ret = self._device.read_data(1)

        except (usb.core.USBError, FtdiError) as err:
            raise CommError('Error reading from device: {0}'.format(str(err)), err)

        return ret
1173139
def compute_state(self):
        
        data = {}
        data['directory'] = self._dir.path
        data['files'] = list(self._dir.files())
        data['subdirs'] = list(self._dir.subdirs())
        data['index'] = self.index()
        return data
945142
def status(self, additional=[]):
        
        self.manager.refresh_client()
        fields = ['batteryLevel', 'deviceDisplayName', 'deviceStatus', 'name']
        fields += additional
        properties = {}
        for field in fields:
            properties[field] = self.content.get(field)
        return properties
958125
def is_cpu(self):
        
        return self._device.get_info(cl.device_info.TYPE) == cl.device_type.CPU
842624
def update_state(self):
        
        response = self.api_interface.get_device_state(self, id_override=self.parent.object_id(),
                                                       type_override=self.parent.object_type())
        self._update_state_from_response(response)
472570
def hardware_status(self):
        
        result = self.make_request(
            NodeCommandFailed,
            resource='appliance_status')
        return HardwareStatus(result.get('hardware_statuses', []))
1156918
def get_bluetooth_state(self):
        
        log.debug("getting bluetooth state...")
        cmd, url = DEVICE_URLS["get_bluetooth_state"]
        return self._exec(cmd, url)
133679
def _get_state():
    '''
    
    '''
    try:
        return pyconnman.ConnManager().get_property('State')
    except KeyError:
        return 'offline'
    except dbus.DBusException as exc:
        raise salt.exceptions.CommandExecutionError('Connman daemon error: {0}'.format(exc))
446485
def _get_state(self, **kwargs):
        '''
        

        '''

        return self.describe(fields=dict(state=True), **kwargs)["state"]
1023996
def IsDevice(self):
    
    if self._stat_object is None:
      self._stat_object = self._GetStat()
    if self._stat_object is not None:
      self.entry_type = self._stat_object.type
    return self.entry_type == definitions.FILE_ENTRY_TYPE_DEVICE
164598
def get(self, device_id: int) -> Optional[Device]:
        """"""
        return self._devices.get(device_id)