This method wraps the self.add_device() and self.rename_device()
            methods.
            
            Returns device object.
350308
def add_device_with_name_location_timezone( self,
                                                model,
                                                serial,
                                                name,
                                                location,
                                                timezone):
        
        retval = None
        retval = self.add_location_timezone_to_device(
                    self.rename_device(
                        self.add_device(
                            model,
                            serial),
                        name
                    ),
                    location,
                    timezone
        )
        return retval
1013651
private Device loadDevice() {
        //Initialise object with the content saved in shared pref file.
        SharedPreferences sharedPreferences = getSharedPreferences();
        return new Device()
                .setApiSpaceId(sharedPreferences.getString(KEY_API_SPACE_ID, null))
                .setAppVer(sharedPreferences.getInt(KEY_APP_VER, -1))
                .setInstanceId(sharedPreferences.getString(KEY_INSTANCE_ID, null))
                .setPushToken(sharedPreferences.getString(KEY_PUSH_TOKEN, null))
                .setDeviceId(sharedPreferences.getString(KEY_DEVICE_ID, null));
    }
636364
public ApiResponse<DeviceEnvelope> addDeviceWithHttpInfo(Device device) throws ApiException {
        com.squareup.okhttp.Call call = addDeviceValidateBeforeCall(device, null, null);
        Type localVarReturnType = new TypeToken<DeviceEnvelope>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
449420
def oem_init(self):
        
        if self._oemknown:
            return
        self._oem, self._oemknown = get_oem_handler(self._get_device_id(),
                                                    self)
1125502
def register(self, device, callback):
        
        if not device:
            logger.error("Received an invalid device: %r", device)
            return

        logger.debug("Subscribing to events for %s", device.name)
        self._devices[device.vera_device_id].append(device)
        self._callbacks[device].append(callback)
168119
def add_device_override(self, addr, cat, subcat, firmware=None):
        """"""
        self.plm.devices.add_override(addr, 'cat', cat)
        self.plm.devices.add_override(addr, 'subcat', subcat)
        if firmware:
            self.plm.devices.add_override(addr, 'firmware', firmware)
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)
81691
def refresh_devices(self):
        ''''''
        try:
            response = self.api.get("/api/v2/devices", {'properties':'all'})
            for device_data in response['DeviceList']:
                self.devices.append(Device(device_data, self))
        except APIError as e:
            print("API error: ")
            for key,value in e.data.iteritems:
                print(str(key) + ": " + str(value))
534744
def add_device_information(helper, session):
        
        host_name_data = helper.get_snmp_value(session, helper,
                                               DEVICE_INFORMATION_OIDS['oid_host_name'])

        product_type_data = helper.get_snmp_value(session, helper,
                                                  DEVICE_INFORMATION_OIDS['oid_product_type'])

        service_tag_data = helper.get_snmp_value(session, helper,
                                                 DEVICE_INFORMATION_OIDS['oid_service_tag'])

        helper.add_summary('Name: {} - Typ: {} - Service tag: {}'.format(
            host_name_data, product_type_data, service_tag_data))
47763
function() {
            var parts = [
                this.vendor(),
                this.model()
            ];

            for (var index = parts.length - 1; index >= 0; index--) {
                var part = parts[index];
                if (part == null || part.length == null || part.length <= 0) {
                    parts.splice(index, 1);
                }
            }

            var deviceName = parts.join(" - ");

            return deviceName;
        }
886601
def put(self, deviceId):
        
        device = request.get_json()
        logger.debug("Received /devices/" + deviceId + " - " + str(device))
        self._deviceController.accept(deviceId, device)
        return None, 200
290494
def device_class(self, device_class):
        
        if device_class is not None and len(device_class) > 32:
            raise ValueError("Invalid value for `device_class`, length must be less than or equal to `32`")

        self._device_class = device_class
21370
def add(name, device):
    '''
    

    '''

    cmd = 'mdadm --manage {0} --add {1}'.format(name, device)
    if __salt__['cmd.retcode'](cmd) == 0:
        return True
    return False
669280
def set_device_name(self, newname):
        
        return self.write(request.SetDeviceName(self.seq, *self.prep_str(newname)))
118790
def add_to_group(self, devices):
        """"""
        ids = {d.id for d in self.devices_in_group()}
        ids.update(self._device_ids(devices))
        self._set_group(ids)
275700
def device_initialize(self):
    
    existing_device_initialize(self)
    self.type = 'Other'
    self.id = platform.node()
    self.os_version = platform.version()
    self.locale = locale.getdefaultlocale()[0]
1205456
def add_adapter(self, adapter):
        """"""

        if self._started:
            raise InternalError("New adapters cannot be added after start() is called")

        if isinstance(adapter, DeviceAdapter):
            self._logger.warning("Wrapping legacy device adapter %s in async wrapper", adapter)
            adapter = AsynchronousModernWrapper(adapter, loop=self._loop)

        self.adapters.append(adapter)

        adapter_callback = functools.partial(self.handle_adapter_event,
                                             len(self.adapters) - 1)
        events = ['device_seen', 'broadcast', 'report', 'connection',
                  'disconnection', 'trace', 'progress']

        adapter.register_monitor([None], events, adapter_callback)