If we can't find service info, add devices
based only on their name
347222
function isRecognisedBluetoothDevice(name) {
    if (!name) return false;
    var devs = recognisedBluetoothDevices();
    for (var i=0;i<devs.length;i++)
      if (name.substr(0, devs[i].length) == devs[i])
        return true;
    return false;
  }
498959
def resolve_service_id(self, service_name=None, service_type=None):
        """"""
        services = [s._info for s in self.api.services.list()]

        service_name = service_name.lower()
        for s in services:
            name = s['name'].lower()
            if service_type and service_name:
                if (service_name == name and service_type == s['type']):
                    return s['id']
            elif service_name and service_name == name:
                return s['id']
            elif service_type and service_type == s['type']:
                return s['id']
        return None
850564
def by_name(name):
    
    devices = discover(all_households=True)
    for device in (devices or []):
        if device.player_name == name:
            return device
    return None
932231
def _add_device_to_device_group(self, device):
        '''
        '''

        device_name = get_device_info(device).name
        dg = pollster(self._get_device_group)(device)
        dg.devices_s.devices.create(name=device_name, partition=self.partition)
        pollster(self._check_device_exists_in_device_group)(device_name)
335593
def get_device_names(self):
        """"""
        dev_names = {}
        for device in self.get_device_ids():
            dev_names[device] = self.get_device_name(device)
        return dev_names
296345
def trusted_devices(self):
        
        request = self.session.get(
            '%s/listDevices' % self._setup_endpoint,
            params=self.params
        )
        return request.json().get('devices')
152765
def _update_details(self,data):
        ''''''
        # DeviceName, IconID, HouseID, DeviceID always present
        self.device_id = data['DeviceID']
        self.device_name = data['DeviceName']
        self.properties = data
293700
def get_dead_hosting_devices_info(self):
        
        res = []
        for hd_id in self.hosting_devices_backlog:
            hd = self.hosting_devices_backlog[hd_id]['hd']
            if hd['hd_state'] == cc.HD_DEAD:
                res.append(hd['id'])
        return res
369341
def _undedicate_device(self, userid, vaddr):
        """"""
        action = 'undedicate'
        rd = ('changevm %(uid)s %(act)s %(va)s' %
              {'uid': userid, 'act': action,
               'va': vaddr})
        action = "undedicate device from userid '%s'" % userid
        with zvmutils.log_and_reraise_smt_request_failed(action):
            self._request(rd)
344683
function addDevices(deviceArr) {
      deviceArr.forEach(function(el, i) {
        self.devices.push({
          name: deviceArr[i]['name'],
          deviceId: deviceArr[i]['id']
        });
      });
    }
965868
def add_device():
    
    req = request.get_json()
    success = False
    if 'device_id' in req and 'host' in req:
        success = add(req['device_id'], req['host'], req.get('adbkey', ''), req.get('adb_server_ip', ''), req.get('adb_server_port', 5037))
    return jsonify(success=success)
25271
def add_device_callback(self, devices, callback):
        """"""
        if not devices:
            return False

        if not isinstance(devices, (tuple, list)):
            devices = [devices]

        for device in devices:
            # Device may be a device_id
            device_id = device

            # If they gave us an actual device, get that devices ID
            if isinstance(device, AbodeDevice):
                device_id = device.device_id

            # Validate the device is valid
            if not self._abode.get_device(device_id):
                raise AbodeException((ERROR.EVENT_DEVICE_INVALID))

            _LOGGER.debug(
                "Subscribing to updated for device_id: %s", device_id)

            self._device_callbacks[device_id].append((callback))

        return True
493903
def set_device_name(self, new_name):
        

        device_name = self.get_characteristic_handle_from_uuid(UUID_DEVICE_NAME)
        if device_name is None:
            logger.warn('Failed to find handle for device name')
            return False
        
        if len(new_name) > MAX_DEVICE_NAME_LEN:
            logger.error('Device name exceeds maximum length ({} > {})'.format(len(new_name), MAX_DEVICE_NAME_LEN))
            return False

        if self.dongle._write_attribute(self.conn_handle, device_name, new_name.encode('ascii')):
            self.name = new_name
            return True

        return False
661393
function(devices)
		{
			for (var i in devices)
			{
				var device = devices[i]
				if (device.name == params.name)
				{
					console.log('Found bonded device: ' + device.name)
					params.onFound(device)
					return // bonded device found
				}
			}
			params.onNotFound()
		}
1310376
def get_by_name(self, name): # pylint: disable=invalid-name,redefined-builtin
        
        rs, _ = self.list(filter=field('name').eq(name), limit=1)
        if len(rs) is 0:
            raise CDRouterError('no such device')
        return rs[0]
1244244
def list_devices(self):
        """"""
        if self.plm.devices:
            for addr in self.plm.devices:
                device = self.plm.devices[addr]
                if device.address.is_x10:
                    _LOGGING.info('Device: %s %s', device.address.human,
                                  device.description)
                else:
                    _LOGGING.info('Device: %s cat: 0x%02x subcat: 0x%02x '
                                  'desc: %s, model: %s',
                                  device.address.human, device.cat,
                                  device.subcat, device.description,
                                  device.model)
        else:
            _LOGGING.info('No devices found')
            if not self.plm.transport:
                _LOGGING.info('IM connection has not been made.')
                _LOGGING.info('Use `connect [device]` to open the connection')
1348409
def add_device(self, name, protocol, model=None, **parameters):
        
        device = Device(self.lib.tdAddDevice(), lib=self.lib)
        try:
            device.name = name
            device.protocol = protocol
            if model:
                device.model = model
            for key, value in parameters.items():
                device.set_parameter(key, value)

            # Return correct type
            return DeviceFactory(device.id, lib=self.lib)
        except Exception:
            import sys
            exc_info = sys.exc_info()
            try:
                device.remove()
            except:
                pass

            if "with_traceback" in dir(Exception):
                raise exc_info[0].with_traceback(exc_info[1], exc_info[2])
            else:
                exec("raise exc_info[0], exc_info[1], exc_info[2]")