本文整理汇总了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
示例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')
示例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'))
示例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')
示例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')