The CCU / Homegear asks for devices known to our XML-RPC server. We respond to that request using this method.
333040
def listDevices(self, interface_id):
        """"""
        LOG.debug("RPCFunctions.listDevices: interface_id = %s, _devices_raw = %s" % (
            interface_id, str(self._devices_raw)))
        remote = interface_id.split('-')[-1]
        if remote not in self._devices_raw:
            self._devices_raw[remote] = []
        if self.systemcallback:
            self.systemcallback('listDevices', interface_id)
        return self._devices_raw[remote]
246560
def RPC(self, url, opname, obj, replytype=None, **kw):
        '''
        '''
        self.Send(url, opname, obj, **kw)
        return self.Receive(replytype, **kw)
1039686
def start_device(name, frontend, backend):
    
    device = getattr(devices, name)
    device(frontend, backend)
233367
def _check_devices_active_licensed(self):
        '''
        '''

        if len(self._get_devices_by_activation_state('active')) != \
                len(self.devices):
            msg = "One or more devices not in 'Active' and licensed state."
            raise UnexpectedDeviceGroupState(msg)
236139
def get_device(self, device_id, refresh=False):
        """"""
        if self._devices is None:
            self.get_devices()
            refresh = False

        device = self._devices.get(device_id)

        if device and refresh:
            device.refresh()

        return device
402108
def devices(self):
		""""""

		response = self._call(
			mc_calls.DeviceManagementInfo
		)
		registered_devices = response.body.get('data', {}).get('items', [])

		return registered_devices
1327086
def do_IHaveRequest(self, apdu):
        """"""
        if _debug: WhoHasIHaveServices._debug("do_IHaveRequest %r", apdu)

        # check for required parameters
        if apdu.deviceIdentifier is None:
            raise MissingRequiredParameter("deviceIdentifier required")
        if apdu.objectIdentifier is None:
            raise MissingRequiredParameter("objectIdentifier required")
        if apdu.objectName is None:
            raise MissingRequiredParameter("objectName required")
618699
def _mds_rpc_post(self, device_id, _wrap_with_consumer=True, async_id=None, **params):
        """"""
        self.ensure_notifications_thread()
        api = self._get_api(mds.DeviceRequestsApi)
        async_id = async_id or utils.new_async_id()
        device_request = mds.DeviceRequest(**params)
        api.create_async_request(
            device_id,
            async_id=async_id,
            body=device_request,
        )
        return AsyncConsumer(async_id, self._db) if _wrap_with_consumer else async_id
85523
def _send_rpc(self, device_info, control_info, address, rpc_id, payload, poll_interval, timeout):
        """"""

        write_address, write_data = control_info.format_rpc(address, rpc_id, payload)
        self._jlink.memory_write32(write_address, write_data)

        self._trigger_rpc(device_info)

        start = monotonic()
        now = start

        poll_address, poll_mask = control_info.poll_info()

        while (now - start) < timeout:
            time.sleep(poll_interval)
            value, = self._jlink.memory_read8(poll_address, 1)

            if value & poll_mask:
                break

            now = monotonic()

        if (now - start) >= timeout:
            raise HardwareError("Timeout waiting for RPC response", timeout=timeout, poll_interval=poll_interval)

        read_address, read_length = control_info.response_info()
        read_data = self._read_memory(read_address, read_length, join=True)

        return control_info.format_response(read_data)
548604
public static DeviceType getDevice(final Request request) {
		if (request instanceof ServletRequest) {
			return getDevice(((ServletRequest) request).getBackingRequest());
		}
		return DeviceType.NORMAL;
	}
368987
def devices
      url = "me/player/devices"
      response = RSpotify.resolve_auth_request(@id, url)

      return response if RSpotify.raw_response
      response['devices'].map { |i| Device.new i }
    end
1210001
protected boolean requestRequiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) {
        val accessTokenRequest = isAccessTokenRequest(request, response);
        if (!accessTokenRequest) {
            val extractor = extractAccessTokenGrantRequest(request);
            if (extractor.isPresent()) {
                val ext = extractor.get();
                return ext.requestMustBeAuthenticated();
            }
        } else {
            val extractor = extractAccessTokenGrantRequest(request);
            if (extractor.isPresent()) {
                val ext = extractor.get();
                return ext.getResponseType() != OAuth20ResponseTypes.DEVICE_CODE;
            }
        }
        return false;
    }
129487
def hosting_devices_unassigned_from_cfg_agent(self, context, payload):
        """"""
        try:
            if payload['hosting_device_ids']:
                #TODO(hareeshp): implement unassignment of hosting devices
                pass
        except KeyError as e:
            LOG.error("Invalid payload format for received RPC message "
                      "`hosting_devices_unassigned_from_cfg_agent`. Error "
                      "is %(error)s. Payload is %(payload)s",
                      {'error': e, 'payload': payload})
560774
async def SetMachineBlockDevices(self, machine_block_devices):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='DiskManager',
                   request='SetMachineBlockDevices',
                   version=2,
                   params=_params)
        _params['machine-block-devices'] = machine_block_devices
        reply = await self.rpc(msg)
        return reply
1312893
async def get_devices(self):
        """"""
        data = await self.api("devices")
        if self.connected and self.authenticated:
            self._devices = data
        else:
            self._devices = self._devices
        _LOGGER.debug(self._devices)
973550
protected boolean isDeviceTokenRequest(final HttpServletRequest request, final HttpServletResponse response) {
        val requestPath = request.getRequestURI();
        val pattern = String.format("(%s)", OAuth20Constants.DEVICE_AUTHZ_URL);
        return doesUriMatchPattern(requestPath, pattern);
    }
1307254
def device_filter(self):
        
        if isinstance(self._device_filter, str):
            return self._decode_query(self._device_filter)
        return self._device_filter