當前位置: 首頁>>代碼示例>>Python>>正文


Python dbus.exceptions方法代碼示例

本文整理匯總了Python中dbus.exceptions方法的典型用法代碼示例。如果您正苦於以下問題:Python dbus.exceptions方法的具體用法?Python dbus.exceptions怎麽用?Python dbus.exceptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dbus的用法示例。


在下文中一共展示了dbus.exceptions方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Set

# 需要導入模塊: import dbus [as 別名]
# 或者: from dbus import exceptions [as 別名]
def Set(self, interface_name, property_name, value, *args, **kwargs):
        """Standard D-Bus API for setting a property value"""

        try:
            iface_props = self.props[interface_name]
        except KeyError:
            raise dbus.exceptions.DBusException(
                'no such interface ' + interface_name,
                name=self.interface + '.UnknownInterface')

        if property_name not in iface_props:
            raise dbus.exceptions.DBusException(
                'no such property ' + property_name,
                name=self.interface + '.UnknownProperty')

        iface_props[property_name] = value 
開發者ID:ukBaz,項目名稱:python-bluezero,代碼行數:18,代碼來源:advertisement.py

示例2: GetAll

# 需要導入模塊: import dbus [as 別名]
# 或者: from dbus import exceptions [as 別名]
def GetAll(self, interface_name):
        """Return the service properties.

        This method is registered with the D-Bus at
        ``org.freedesktop.DBus.Properties``

        :param interface: interface to get the properties of.

        The interface must be ``org.bluez.GattService1`` otherwise an
        exception is raised.
        """
        if interface_name != constants.GATT_SERVICE_IFACE:
            raise InvalidArgsException()

        try:
            return self.props[interface_name]
        except KeyError:
            raise dbus.exceptions.DBusException(
                'no such interface ' + interface_name,
                name=interface_name + '.UnknownInterface') 
開發者ID:ukBaz,項目名稱:python-bluezero,代碼行數:22,代碼來源:localGATT.py

示例3: Set

# 需要導入模塊: import dbus [as 別名]
# 或者: from dbus import exceptions [as 別名]
def Set(self, interface_name, property_name, value, *args, **kwargs):
        """Standard D-Bus API for setting a property value"""

        try:
            iface_props = self.props[interface_name]
        except KeyError:
            raise dbus.exceptions.DBusException(
                'no such interface ' + interface_name,
                name=self.interface + '.UnknownInterface')

        if property_name not in iface_props:
            raise dbus.exceptions.DBusException(
                'no such property ' + property_name,
                name=self.interface + '.UnknownProperty')

        iface_props[property_name] = value

        self.PropertiesChanged(interface_name,
                               dbus.Dictionary({property_name: value},
                                               signature='sv'),
                               dbus.Array([], signature='s')) 
開發者ID:ukBaz,項目名稱:python-bluezero,代碼行數:23,代碼來源:localGATT.py

示例4: Get

# 需要導入模塊: import dbus [as 別名]
# 或者: from dbus import exceptions [as 別名]
def Get(self, interface_name, property_name):
        """DBus API for getting a property value.

        This method is registered with the D-Bus at
        ``org.freedesktop.DBus.Properties``

        :param interface_name: interface to get the properties of.
        :param property_name: request this property
        """

        if interface_name != constants.GATT_CHRC_IFACE:
            raise InvalidArgsException()

        try:
            return self.GetAll(interface_name)[property_name]
        except KeyError:
            raise dbus.exceptions.DBusException(
                'no such property ' + property_name,
                name=interface_name + '.UnknownProperty') 
開發者ID:ukBaz,項目名稱:python-bluezero,代碼行數:21,代碼來源:localGATT.py

示例5: Get

# 需要導入模塊: import dbus [as 別名]
# 或者: from dbus import exceptions [as 別名]
def Get(self, interface_name, property_name):
        """DBus API for getting a property value"""

        if interface_name != constants.LE_ADVERTISEMENT_IFACE:
            raise InvalidArgsException()

        try:
            return self.GetAll(interface_name)[property_name]
        except KeyError:
            raise dbus.exceptions.DBusException(
                'no such property ' + property_name,
                name=interface_name + '.UnknownProperty') 
開發者ID:ukBaz,項目名稱:python-bluezero,代碼行數:14,代碼來源:advertisement.py


注:本文中的dbus.exceptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。