Class: DBus::Binding::DBusPendingCall

Inherits:
Object
  • Object
show all
Defined in:
ext/ruby-dbus-pending-call.c,
ext/ruby-dbus-pending-call.c

Overview

A DBusPendingCall is used to retrieve asynchronous replies to method call messages.

See DBusConnection#send_with_reply.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.newself

The new method of this class is not available for invocation.

Returns:

  • (self)


21
22
23
24
25
26
# File 'ext/ruby-dbus-common.c', line 21

VALUE
rdbus_private_method(VALUE klass)
{
  rb_raise(rb_eNoMethodError, "Method is unavailable to non-native methods");
  return Qnil;
}

Instance Method Details

#blocknil

Blocks until the pending call is completed and a reply is available.

The blocking behaviour is the same as that for DBusConnection#send_with_reply_and_block.

Returns:

  • (nil)


96
97
98
99
100
101
# File 'ext/ruby-dbus-pending-call.c', line 96

static VALUE
cDBusPendingCall_block(VALUE self)
{
  dbus_pending_call_block(CALL_GET(self));
  return Qnil;
}

#cancelnil

Cancels the pending call, any reply or error received will be ignored.

Returns:

  • (nil)


47
48
49
50
51
52
# File 'ext/ruby-dbus-pending-call.c', line 47

static VALUE
cDBusPendingCall_cancel(VALUE self)
{
  dbus_pending_call_cancel(CALL_GET(self));
  return Qnil;
}

#get_completedObject

Returns true if the pending call has received a reply.



60
61
62
63
64
65
66
# File 'ext/ruby-dbus-pending-call.c', line 60

static VALUE
cDBusPendingCall_get_completed(VALUE self)
{
  if (dbus_pending_call_get_completed(CALL_GET(self)))
    return Qtrue;
  return Qfalse;
}

#get_replyObject

Returns the reply DBusMessage, or nil if no reply has been received yet.



75
76
77
78
79
80
81
82
83
84
# File 'ext/ruby-dbus-pending-call.c', line 75

static VALUE
cDBusPendingCall_get_reply(VALUE self)
{
  DBusMessage *msg = NULL;

  msg = dbus_pending_call_get_reply(CALL_GET(self));
  if (msg != NULL)
    return MSG_NEW(msg);
  return Qnil;
}