當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。