当前位置: 首页>>代码示例>>Python>>正文


Python dbus.PROPERTIES_IFACE属性代码示例

本文整理汇总了Python中dbus.PROPERTIES_IFACE属性的典型用法代码示例。如果您正苦于以下问题:Python dbus.PROPERTIES_IFACE属性的具体用法?Python dbus.PROPERTIES_IFACE怎么用?Python dbus.PROPERTIES_IFACE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在dbus的用法示例。


在下文中一共展示了dbus.PROPERTIES_IFACE属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def __init__(self, path):
        proxy = dbus.SystemBus().get_object('org.freedesktop.systemd1', path)
        self._unit = dbus.Interface(
            proxy, dbus_interface='org.freedesktop.systemd1.Unit')

        props = self._unit.GetAll(
            'org.freedesktop.systemd1.Unit',
            dbus_interface=dbus.PROPERTIES_IFACE)

        for prop in props:
            prop = str(prop)

            if not hasattr(self.__class__, prop):
                setattr(self.__class__, prop, self._make_property(prop))

        if self.LoadState == 'not-found':
            raise NoSuchUnit(self.Id) 
开发者ID:ideascube,项目名称:ideascube,代码行数:19,代码来源:systemd.py

示例2: __init__

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def __init__(self, adapter_addr, device_addr, profile_uuid):
        """
        Remote GATT Profile Initialisation.

        :param profile_path: dbus path to the profile.
        """
        self.profile_path = dbus_tools.get_profile_path(adapter_addr,
                                                        device_addr,
                                                        profile_uuid)
        self.bus = dbus.SystemBus()
        self.profile_object = self.bus.get_object(
            constants.BLUEZ_SERVICE_NAME,
            self.profile_path)
        self.profile_methods = dbus.Interface(
            self.profile_object,
            constants.GATT_PROFILE_IFACE)
        self.profile_props = dbus.Interface(self.profile_object,
                                            dbus.PROPERTIES_IFACE) 
开发者ID:ukBaz,项目名称:python-bluezero,代码行数:20,代码来源:GATT.py

示例3: get_props

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def get_props(adapter=None,
              device=None,
              service=None,
              characteristic=None,
              descriptor=None):
    """
    Get properties for the specified object
    :param adapter: Adapter Address
    :param device:  Device Address
    :param service:  GATT Service UUID
    :param characteristic: GATT Characteristic UUID
    :param descriptor: GATT Descriptor UUID
    :return: Object of the DBus properties available
    """
    path_obj = get_dbus_path(adapter,
                             device,
                             service,
                             characteristic,
                             descriptor)

    return get_dbus_iface(dbus.PROPERTIES_IFACE, get_dbus_obj(path_obj)) 
开发者ID:ukBaz,项目名称:python-bluezero,代码行数:23,代码来源:dbus_tools.py

示例4: __init__

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def __init__(self, adapter_addr=None):

        self.bus = dbus.SystemBus()

        if adapter_addr is None:
            adapters = adapter.list_adapters()
            if len(adapters) > 0:
                adapter_addr = adapters[0]

        self.advert_mngr_path = dbus_tools.get_dbus_path(adapter=adapter_addr)
        self.advert_mngr_obj = self.bus.get_object(
            constants.BLUEZ_SERVICE_NAME,
            self.advert_mngr_path)
        self.advert_mngr_methods = dbus.Interface(
            self.advert_mngr_obj,
            constants.LE_ADVERTISING_MANAGER_IFACE)
        self.advert_mngr_props = dbus.Interface(self.advert_mngr_obj,
                                                dbus.PROPERTIES_IFACE) 
开发者ID:ukBaz,项目名称:python-bluezero,代码行数:20,代码来源:advertisement.py

示例5: run

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def run(self):
        """
        Starts the main loop that is necessary to receive Bluetooth events from the Bluetooth adapter.

        This call blocks until you call `stop()` to stop the main loop.
        """

        if self._main_loop:
            return

        self._interface_added_signal = self._bus.add_signal_receiver(
            self._interfaces_added,
            dbus_interface='org.freedesktop.DBus.ObjectManager',
            signal_name='InterfacesAdded')

        # TODO: Also listen to 'interfaces removed' events?

        self._properties_changed_signal = self._bus.add_signal_receiver(
            self._properties_changed,
            dbus_interface=dbus.PROPERTIES_IFACE,
            signal_name='PropertiesChanged',
            arg0='org.bluez.Device1',
            path_keyword='path')

        def disconnect_signals():
            for device in self._devices.values():
                device.invalidate()
            self._properties_changed_signal.remove()
            self._interface_added_signal.remove()

        self._main_loop = GObject.MainLoop()
        try:
            self._main_loop.run()
            disconnect_signals()
        except Exception:
            disconnect_signals()
            raise 
开发者ID:getsenic,项目名称:gatt-python,代码行数:39,代码来源:gatt_linux.py

示例6: _make_property

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def _make_property(self, name):
        def get_func(self):
            return dbus_to_python(self._unit.Get(
                'org.freedesktop.systemd1.Unit', name,
                dbus_interface=dbus.PROPERTIES_IFACE))

        return property(get_func) 
开发者ID:ideascube,项目名称:ideascube,代码行数:9,代码来源:systemd.py

示例7: __get_properties

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def __get_properties(self):
        try:
            obj = self._bus.get_object(self._BASE_NAME, self._BASE_PATH)
            properties_interface = dbus.Interface(obj, dbus.PROPERTIES_IFACE)
            return properties_interface.GetAll(self._BASE_NAME)
        except dbus.exceptions.DBusException as error:
            raise ServiceError(error) 
开发者ID:emlid,项目名称:pywificontrol,代码行数:9,代码来源:dbuswpasupplicant.py

示例8: __get_property

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def __get_property(self, property_name):
        try:
            obj = self._bus.get_object(self._BASE_NAME, self._BASE_PATH)
            properties_interface = dbus.Interface(obj, dbus.PROPERTIES_IFACE)
            return properties_interface.Get(self._BASE_NAME, property_name)
        except dbus.exceptions.DBusException as error:
            raise PropertyError(error) 
开发者ID:emlid,项目名称:pywificontrol,代码行数:9,代码来源:dbuswpasupplicant.py

示例9: __set_property

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def __set_property(self, property_name, property_value):
        try:
            obj = self._bus.get_object(self._BASE_NAME, self._BASE_PATH)
            properties_interface = dbus.Interface(obj, dbus.PROPERTIES_IFACE)
            properties_interface.Set(self._BASE_NAME, property_name, property_value)
        except dbus.exceptions.DBusException as error:
            raise PropertyError(error) 
开发者ID:emlid,项目名称:pywificontrol,代码行数:9,代码来源:dbuswpasupplicant.py

示例10: __init__

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def __init__(self, adapter_addr, device_addr):
        """Default initialiser.

        Creates object for the specified remote Bluetooth device.
        This is on the specified adapter specified.

        :param adapter_addr: Address of the local Bluetooth adapter.
        :param device_addr: Address of the remote Bluetooth device.
        """
        self.bus = dbus.SystemBus()
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        self.mainloop = GObject.MainLoop()

        device_path = dbus_tools.get_dbus_path(adapter_addr, device_addr)
        if not device_path:
            raise ValueError("Cannot find a device: " + device_addr +
                             " using adapter: " + adapter_addr)

        self.remote_device_path = device_path
        self.remote_device_obj = self.bus.get_object(
            constants.BLUEZ_SERVICE_NAME,
            self.remote_device_path)
        self.remote_device_methods = dbus.Interface(
            self.remote_device_obj,
            constants.DEVICE_INTERFACE)
        self.remote_device_props = dbus.Interface(self.remote_device_obj,
                                                  dbus.PROPERTIES_IFACE) 
开发者ID:ukBaz,项目名称:python-bluezero,代码行数:29,代码来源:device.py

示例11: __init__

# 需要导入模块: import dbus [as 别名]
# 或者: from dbus import PROPERTIES_IFACE [as 别名]
def __init__(self, device_addr):
        """Default initialiser.

        Creates the interface to the remote Bluetooth device.

        :param device_addr: Address of Bluetooth device player to use.
        """
        self.player_path = _find_player_path(device_addr)
        self.player_object = dbus_tools.get_dbus_obj(self.player_path)
        self.player_methods = dbus_tools.get_dbus_iface(
            constants.MEDIA_PLAYER_IFACE, self.player_object)
        self.player_props = dbus_tools.get_dbus_iface(
            dbus.PROPERTIES_IFACE, self.player_object) 
开发者ID:ukBaz,项目名称:python-bluezero,代码行数:15,代码来源:media_player.py


注:本文中的dbus.PROPERTIES_IFACE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。