本文整理匯總了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')