コード例 #1
0
 def adapter(self):
     """The address of the adapter the device belongs to."""
     adapter_obj = dbus_tools.get_dbus_obj(self._adapter)
     adapter_props = dbus_tools.get_dbus_iface(dbus.PROPERTIES_IFACE,
                                               adapter_obj)
     return dbus_tools.get(adapter_props,  constants.ADAPTER_INTERFACE,
                           'Address')
コード例 #2
0
    def test_get_property_default(self):
        self.dbusmock_bluez.AddAdapter('hci0', 'My-Test-Device')

        path_obj = dbus_tools.get_dbus_obj('/org/bluez/hci0')
        result = dbus_tools.get(path_obj, 'org.bluez.Adapter1', 'address',
                                'xx')
        self.assertEqual('xx', result)
コード例 #3
0
 def name(self):
     """Return the remote device name."""
     return dbus_tools.get(
         self.remote_device_props, constants.DEVICE_INTERFACE,
         'Name', None)
コード例 #4
0
    def test_get_property_exception(self):
        self.dbusmock_bluez.AddAdapter('hci0', 'My-Test-Device')

        path_obj = dbus_tools.get_dbus_obj('/org/bluez/hci0')
        with self.assertRaises(dbus.exceptions.DBusException):
            result = dbus_tools.get(path_obj, 'org.bluez.AdapterXX', 'Address')
コード例 #5
0
    def test_get_property(self):
        self.dbusmock_bluez.AddAdapter('hci0', 'My-Test-Device')

        path_obj = dbus_tools.get_dbus_obj('/org/bluez/hci0')
        result = dbus_tools.get(path_obj, 'org.bluez.Adapter1', 'Address')
        self.assertEqual('00:01:02:03:04:05', result)