def AddAdapter(self, device_name, system_name):
    '''Convenience method to add a Bluetooth adapter

    You have to specify a device name which must be a valid part of an object
    path, e. g. "hci0", and an arbitrary system name (pretty hostname).

    Returns the new object path.
    '''
    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
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 ) , 'Class' : dbus . UInt32 ( 268 , variant_level = 1 ) , } self . AddObject ( path , ADAPTER_IFACE , adapter_properties , [ ( '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
Convenience method to add a Bluetooth adapter

    You have to specify a device name which must be a valid part of an object
    path, e. g. "hci0", and an arbitrary system name (pretty hostname).

    Returns the new object path.