当前位置: 首页>>代码示例>>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;未经允许,请勿转载。