def call_blocking(self, bus_name, object_path, dbus_interface, method, signature, args, timeout=-1.0, utf8_strings=False, byte_arrays=False): """Call the given method, synchronously. :Since: 0.81.0 """ if object_path == LOCAL_PATH: raise DBusException('Methods may not be called on the reserved ' 'path %s' % LOCAL_PATH) if dbus_interface == LOCAL_IFACE: raise DBusException('Methods may not be called on the reserved ' 'interface %s' % LOCAL_IFACE) # no need to validate other args - MethodCallMessage ctor will do get_args_opts = {'utf8_strings': utf8_strings, 'byte_arrays': byte_arrays} message = MethodCallMessage(destination=bus_name, path=object_path, interface=dbus_interface, method=method) # Add the arguments to the function try: message.append(signature=signature, *args) except Exception, e: logging.basicConfig() _logger.error('Unable to set arguments %r according to ' 'signature %r: %s: %s', args, signature, e.__class__, e) raise
def call_async(self, bus_name, object_path, dbus_interface, method, signature, args, reply_handler, error_handler, timeout=-1.0, utf8_strings=False, byte_arrays=False, require_main_loop=True): """Call the given method, asynchronously. If the reply_handler is None, successful replies will be ignored. If the error_handler is None, failures will be ignored. If both are None, the implementation may request that no reply is sent. :Returns: The dbus.lowlevel.PendingCall. :Since: 0.81.0 """ if object_path == LOCAL_PATH: raise DBusException('Methods may not be called on the reserved ' 'path %s' % LOCAL_PATH) if dbus_interface == LOCAL_IFACE: raise DBusException('Methods may not be called on the reserved ' 'interface %s' % LOCAL_IFACE) # no need to validate other args - MethodCallMessage ctor will do get_args_opts = {'utf8_strings': utf8_strings, 'byte_arrays': byte_arrays} message = MethodCallMessage(destination=bus_name, path=object_path, interface=dbus_interface, method=method) # Add the arguments to the function try: message.append(signature=signature, *args) except Exception, e: logging.basicConfig() _logger.error('Unable to set arguments %r according to ' 'signature %r: %s: %s', args, signature, e.__class__, e) raise