Add devices from config.
510202
def _add_devices_from_config(args):
    
    config = _parse_config(args.config)
    for device in config['devices']:
        if args.default:
            if device == "default":
                raise ValueError('devicename "default" in config is not allowed if default param is set')
            if config['devices'][device]['host'] == args.default:
                raise ValueError('host set in default param must not be defined in config')
        add(device, config['devices'][device]['host'], config['devices'][device].get('adbkey', ''),
            config['devices'][device].get('adb_server_ip', ''), config['devices'][device].get('adb_server_port', 5037))
460521
def model_setup(self):
        
        for device in self.devman.devices:
            if self.__dict__[device].n:
                try:
                    self.__dict__[device].setup()
                except Exception as e:
                    raise e
905151
def add_machine(self, machine):
        """"""
        self._logger.debug('Adding machine {} to driver'.format(machine.id))
        machine._driver = self
        machine._reset()
        if machine.id is not None:
            # TODO warning when STM already registered
            Driver._stms_by_id[machine.id] = machine
            self._add_event(event_id=None, args=[], kwargs={}, stm=machine)
932488
def _add_saved_device_info(self, **kwarg):
        """"""
        addr = kwarg.get('address')
        _LOGGER.debug('Found saved device with address %s', addr)
        self._saved_devices[addr] = kwarg
800493
async def update_from_devices(self):
        """"""
        res = await self.get_json(URL_DEVICES.format(self._url))
        if res:
            self.devices.update_devices(res)
            return True
        return False
1246112
def device_added(self, device):
        """"""
        if not self._mounter.is_handleable(device):
            return
        if self._has_actions('device_added'):
            # wait for partitions etc to be reported to udiskie, otherwise we
            # can't discover the actions
            GLib.timeout_add(500, self._device_added, device)
        else:
            self._device_added(device)
848743
def setup(self):
        
        self.devices = self.system.devman.devices
        self.ndevice = len(self.devices)

        self.gcalls = [''] * self.ndevice
        self.fcalls = [''] * self.ndevice
        self.gycalls = [''] * self.ndevice
        self.fxcalls = [''] * self.ndevice
        self.jac0s = [''] * self.ndevice

        self.build_vec()
        self.build_strings()
        self._compile_newton()
        self._compile_fdpf()
        self._compile_pfload()
        self._compile_pfgen()
        self._compile_seriesflow()
        self._compile_int()
        self._compile_int_f()
        self._compile_int_g()
        self._compile_bus_injection()
1186293
def AddAdapter(self, device_name, system_name):
    '''
    '''
    path = '/org/bluez/' + device_name
    adapter_properties = {
        'UUIDs': dbus.Array([
            '00001000-0000-1000-8000-00805f9b34fb',
            '00001001-0000-1000-8000-00805f9b34fb',
            '0000112d-0000-1000-8000-00805f9b34fb',
            '00001112-0000-1000-8000-00805f9b34fb',
            '0000111f-0000-1000-8000-00805f9b34fb',
            '0000111e-0000-1000-8000-00805f9b34fb',
            '0000110c-0000-1000-8000-00805f9b34fb',
            '0000110e-0000-1000-8000-00805f9b34fb',
            '0000110a-0000-1000-8000-00805f9b34fb',
            '0000110b-0000-1000-8000-00805f9b34fb',
        ], variant_level=1),
        'Discoverable': dbus.Boolean(False, variant_level=1),
        'Discovering': dbus.Boolean(False, variant_level=1),
        'Pairable': dbus.Boolean(True, variant_level=1),
        'Powered': dbus.Boolean(True, variant_level=1),
        'Address': dbus.String('00:01:02:03:04:05', variant_level=1),
        'Alias': dbus.String(system_name, variant_level=1),
        'Name': dbus.String(system_name, variant_level=1),
        # Reference:
        # http://bluetooth-pentest.narod.ru/software/
        # bluetooth_class_of_device-service_generator.html
        'Class': dbus.UInt32(268, variant_level=1),  # Computer, Laptop
    }

    self.AddObject(path,
                   ADAPTER_IFACE,
                   # Properties
                   adapter_properties,
                   # Methods
                   [
                       ('GetProperties', '', 'a{sv}', 'ret = self.GetAll("org.bluez.Adapter")'),
                       ('SetProperty', 'sv', '', 'self.Set("org.bluez.Adapter", args[0], args[1]); '
                                                 'self.EmitSignal("org.bluez.Adapter", "PropertyChanged",'
                                                 ' "sv", [args[0], args[1]])'),
                   ])

    manager = mockobject.objects['/']
    manager.props[MANAGER_IFACE]['Adapters'] \
        = [dbus.ObjectPath(path, variant_level=1)]
    manager.EmitSignal(OBJECT_MANAGER_IFACE, 'InterfacesAdded',
                       'oa{sa{sv}}', [
                           dbus.ObjectPath(path, variant_level=1),
                           {ADAPTER_IFACE: adapter_properties},
                       ])

    manager.EmitSignal(MANAGER_IFACE, 'AdapterAdded',
                       'o', [dbus.ObjectPath(path, variant_level=1)])
    manager.EmitSignal(MANAGER_IFACE, 'DefaultAdapterChanged',
                       'o', [dbus.ObjectPath(path, variant_level=1)])
    manager.EmitSignal(MANAGER_IFACE, 'PropertyChanged', 'sv', [
        "Adapters",
        dbus.Array([dbus.ObjectPath(path, variant_level=1), ], variant_level=1),
    ])

    return path
568402
public function setupAsNewDevice(){

        $guidId = Uuid::uuid4()->toString();
        $phoneId = Uuid::uuid4()->toString();
        $rankToken = Uuid::uuid4()->toString();
        $googleAdId = Uuid::uuid4()->toString();

        $this->setGuid($guidId);
        $this->setUuid($guidId);
        $this->setPhoneId($phoneId);
        $this->setRankToken($rankToken);
        $this->setGoogleAdId($googleAdId);

    }
1201849
def associate_hosting_device_with_config_agent(
            self, client, config_agent_id, body):
        """"""
        return client.post((ConfigAgentHandlingHostingDevice.resource_path +
                            CFG_AGENT_HOSTING_DEVICES) % config_agent_id,
                           body=body)
176320
public function addDevice($device)
    {
        if (!isset($this->devices)) {
            $this->devices = [];
        }

        $this->devices[] = $device;

        return $this;
    }
283618
def _configure_services(self, configs):
        """"""
        for service, config in six.iteritems(configs):
            self.d.configure(service, config)
509383
def prepare_network(self):
        """"""
        hydpy.pub.selections = selectiontools.Selections()
        hydpy.pub.selections += hydpy.pub.networkmanager.load_files()
        self.update_devices(hydpy.pub.selections.complete)
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
74449
def setup_config(command, filename, section, vars):
    """"""
    conf = appconfig('config:' + filename)
    load_environment(conf.global_conf, conf.local_conf)
1138406
def add_physical_item(self, instance, item):
        
        (name, dev_type) = self.device_typename(item)
        self.topology['devices'][name] = {}
        self.topology['devices'][name]['hv_id'] = self.hv_id
        self.topology['devices'][name]['node_id'] = self.nid
        self.topology['devices'][name]['from'] = dev_type['from']
        self.topology['devices'][name]['type'] = dev_type['type']
        self.topology['devices'][name]['desc'] = dev_type['desc']

        if 'ext_conf' in dev_type:
            self.topology['devices'][name]['ext_conf'] = dev_type['ext_conf']

        for s_item in sorted(self.old_top[instance][item]):
            if self.old_top[instance][item][s_item] is not None:
                self.topology['devices'][name][s_item] = \
                    self.old_top[instance][item][s_item]

        if instance != 'GNS3-DATA' and \
                self.topology['devices'][name]['type'] == 'Router':
            if 'model' not in self.topology['devices'][name]:
                self.topology['devices'][name]['model'] = \
                    self.topology['conf'][self.hv_id]['model']
            else:
                self.topology['devices'][name]['model'] = MODEL_TRANSFORM[
                    self.topology['devices'][name]['model']]
        elif dev_type['type'] == 'VirtualBoxVM':
            self.topology['devices'][name]['vbox_id'] = self.vbox_id
            self.vbox_id += 1
        elif dev_type['type'] == 'QemuVM':
            self.topology['devices'][name]['qemu_id'] = self.qemu_id
            self.qemu_id += 1

        if instance != 'GNS3-DATA' \
            and 'hx' not in self.topology['devices'][name] \
                and 'hy' not in self.topology['devices'][name]:
            self.topology['devices'][name]['hx'] = dev_type['label_x']
            self.topology['devices'][name]['hy'] = -25.0
        self.nid += 1
1157394
def init_device(self):
        """"""
        Device.init_device(self)

        # Add anything here that has to be done before the device is set to
        # its ON state.

        self._set_master_state('on')
        self._devProxy = DeviceProxy(self.get_name())