Tracks differences in the device state.
779486
def check_state(self):
        """"""
        if self.dpad:
            x_state, y_state = self.handle_dpad()
        else:
            x_state, y_state = self.handle_abs()

        # pylint: disable=no-member
        new_state = set((
            x_state,
            y_state,
            ('Key', 0x130, int(self.microbit.button_a.is_pressed())),
            ('Key', 0x131, int(self.microbit.button_b.is_pressed())),
            ('Key', 0x13a, int(self.microbit.pin0.is_touched())),
            ('Key', 0x133, int(self.microbit.pin1.is_touched())),
            ('Key', 0x134, int(self.microbit.pin2.is_touched())),
        ))
        events = new_state - self.state
        self.state = new_state
        return events
415172
def state(self) -> str:
        """"""
        return self._coerce_state_from_string(
            next(
                attr['Value'] for attr in self._device_json.get(
                    'Attributes', [])
                if attr.get('AttributeDisplayName') == 'doorstate'))
744791
def handle_features(self, device_features):
        """"""

        self.device_features = device_features

        if device_features and 'zone' in device_features:
            for zone in device_features['zone']:
                zone_id = zone.get('id')
                if zone_id in self.zones:
                    _LOGGER.debug("handle_features: %s", zone_id)
                    input_list = zone.get('input_list', [])
                    input_list.sort()
                    self.zones[zone_id].source_list = input_list
669941
def on_state_changed(self, state):
        """"""
        if state:
            self.editor.sig_key_pressed.connect(self._on_key_pressed)
        else:
            self.editor.sig_key_pressed.disconnect(self._on_key_pressed)
669974
def report_device_status(self, mode):
        
        if mode == 5:    # Request for terminal status.
            self.write_process_input(ctrl.CSI + "0n")
        elif mode == 6:  # Request for cursor position.
            x = self.cursor.x + 1
            y = self.cursor.y + 1

            # "Origin mode (DECOM) selects line numbering."
            if mo.DECOM in self.mode:
                y -= self.margins.top
            self.write_process_input(ctrl.CSI + "{0};{1}R".format(y, x))
747835
def _prior_running_states(jid):
    '''
    
    '''

    ret = []
    active = __salt__['saltutil.is_running']('state.*')
    for data in active:
        try:
            data_jid = int(data['jid'])
        except ValueError:
            continue
        if data_jid < int(jid):
            ret.append(data)
    return ret
337151
def set_state(self, newState, timer=0):
        """"""
        if _debug: ServerSSM._debug("set_state %r (%s) timer=%r", newState, SSM.transactionLabels[newState], timer)

        # do the regular state change
        SSM.set_state(self, newState, timer)

        # when completed or aborted, remove tracking
        if (newState == COMPLETED) or (newState == ABORTED):
            if _debug: ServerSSM._debug("    - remove from active transactions")
            self.ssmSAP.serverTransactions.remove(self)

            # release the device info
            if self.device_info:
                if _debug: ClientSSM._debug("    - release device information")
                self.ssmSAP.deviceInfoCache.release(self.device_info)
27033
def _check_devices(self):
        ""
        for i in range(1, len(self.poses)):
            pose = self.poses[i]
            if not pose.bDeviceIsConnected:
                continue
            if not pose.bPoseIsValid:
                continue
            if self.show_controllers_only:
                device_class = openvr.VRSystem().getTrackedDeviceClass(i)
                if not device_class == openvr.TrackedDeviceClass_Controller:
                    continue
            model_name = openvr.VRSystem().getStringTrackedDeviceProperty(i, openvr.Prop_RenderModelName_String)
            # Create a new mesh object, if necessary
            if model_name not in self.meshes:
                self.meshes[model_name] = TrackedDeviceMesh(model_name)
1186040
def desc(self):
        """"""
        return '{0} (ID: {1}) - {2} - {3}'.format(
            self.name, self.device_id, self.type, self.status)
995551
def _on_device_update(self, devid):
        """"""
        if isinstance(devid, (tuple, list)):
            devid = devid[0]

        if devid is None:
            _LOGGER.warning("Device update with no device id.")
            return

        _LOGGER.debug("Device update event for device ID: %s", devid)

        device = self._abode.get_device(devid, True)

        if not device:
            _LOGGER.debug("Got device update for unknown device: %s", devid)
            return

        for callback in self._device_callbacks.get(device.device_id, ()):
            _execute_callback(callback, device)
419391
def isTrackedDeviceConnected(self, unDeviceIndex):
        """"""

        fn = self.function_table.isTrackedDeviceConnected
        result = fn(unDeviceIndex)
        return result
1153557
def get_status(self, device_id):
        """"""
        devices = self.get_devices()

        if devices != False:
            for device in devices:
                if device['door'] == device_id:
                    return device['status']

        return False
921688
def has_device_info(self, key):
        """"""
        if _debug: DeviceInfoCache._debug("has_device_info %r", key)

        return key in self.cache
188884
def _check_all_devices_in_sync(self):
        '''
        '''

        if len(self._get_devices_by_failover_status('In Sync')) != \
                len(self.devices):
            msg = "Expected all devices in group to have 'In Sync' status."
            raise UnexpectedDeviceGroupState(msg)
764396
private void stateCheckMark() {
        StackEntry e = stack[stk];
        int x = stateCheckPos(e.getStatePStr(), ((SCStackEntry)e).getStateCheck());
        stateCheckBuff[x / 8] |= (1 << (x % 8));
    }
992906
def _update_activities(self):
        """"""
        self._activities = self._activities_request()
        _LOGGER.debug("Device Activities Response: %s", self._activities)

        if not self._activities:
            self._activities = []
        elif not isinstance(self._activities, (list, tuple)):
            self._activities = [self._activities]

        self._update_events()
575655
def _get_events(self, result):
        """""""
        events = []

        for event_data in result:
            event = Event.factory(event_data)

            if event is not None:
                events.append(event)

                if isinstance(event, DeviceStateChangedEvent):
                    # change device state
                    if self.__devices[event.device_url] is None:
                        raise Exception(
                            "Received device change " +
                            "state for unknown device '" +
                            event.device_url + "'")

                    self.__devices[event.device_url].set_active_states(
                        event.states)

        return events