module OBus_connection:sig
..end
type
t
val compare : t -> t -> int
Pervasives.compare
. It allows this module to be used
as argument to the functors Set.Make
and Map.Make
.
Otherwise you should use OBus_bus
or immediatly call
OBus_bus.register_connection
after the creation.
val of_addresses : ?switch:Lwt_switch.t ->
?shared:bool -> OBus_address.t list -> t Lwt.t
of_addresses ?switch ?shared addresses
try to get a working
D-Bus connection from a list of addresses. The server must be
accessible from at least one of these addresses.
If shared
is true and a connection to the same server is
already open, then it is used instead of transport
. This is
the default behaviour.
val loopback : unit -> t
val close : t -> unit Lwt.t
All thread waiting for a reply will fail with the exception
OBus_connection.Connection_closed
.
Notes:
val active : t -> bool React.signal
exception Connection_closed
exception Connection_lost
exception Transport_error of exn
val name : t -> OBus_name.bus
""
.val transport : t -> OBus_transport.t
transport connection
get the transport associated with a
connectionval can_send_basic_type : t -> OBus_value.T.basic -> bool
val can_send_single_type : t -> OBus_value.T.single -> bool
val can_send_sequence_type : t -> OBus_value.T.sequence -> bool
can_send_*_type connection typ
returns whether values of the
given type can be sent through the given connection.val send_message : t -> OBus_message.t -> unit Lwt.t
send_message connection message
send a message without
expecting a reply.val send_message_with_reply : t -> OBus_message.t -> OBus_message.t Lwt.t
send_message_with_reply connection message
Send a message and
return a thread which wait for the reply (which is a method
return or an error)val send_message_keep_serial : t -> OBus_message.t -> unit Lwt.t
OBus_connection.send_message
but do not generate a serial for the
message.
Warning: this is for implementing a D-Bus daemon only, not for
casual use.
val send_message_keep_serial_with_reply : t -> OBus_message.t -> OBus_message.t Lwt.t
OBus_connection.send_message_with_reply
but do not generate a serial
for the message.
Warning: this is for implementing a D-Bus daemon only, not for
casual use.
val method_call : connection:t ->
?destination:OBus_name.bus ->
path:OBus_path.t ->
?interface:OBus_name.interface ->
member:OBus_name.member ->
i_args:'a OBus_value.C.sequence ->
o_args:'b OBus_value.C.sequence -> 'a -> 'b Lwt.t
val method_call_with_message : connection:t ->
?destination:OBus_name.bus ->
path:OBus_path.t ->
?interface:OBus_name.interface ->
member:OBus_name.member ->
i_args:'a OBus_value.C.sequence ->
o_args:'b OBus_value.C.sequence -> 'a -> (OBus_message.t * 'b) Lwt.t
OBus_connection.method_call
, but also returns the reply message so
you can extract informations from it.val method_call_no_reply : connection:t ->
?destination:OBus_name.bus ->
path:OBus_path.t ->
?interface:OBus_name.interface ->
member:OBus_name.member ->
i_args:'a OBus_value.C.sequence -> 'a -> unit Lwt.t
OBus_connection.method_call
but do not expect a reply
For incoming messages they are called before dispatching, for
outgoing ones, they are called just before being sent.
typefilter =
OBus_message.t -> OBus_message.t option
Some msg
where msg
is the message given to the filter
modified or not, which means that the message is replaced by
this oneNone
which means that the message will be dropped, i.e. not
dispatched or not sentval incoming_filters : t -> filter Lwt_sequence.t
val outgoing_filters : t -> filter Lwt_sequence.t
type 'a
key
val new_key : unit -> 'a key
new_key ()
generates a new key.val get : t -> 'a key -> 'a option
get connection key
returns the data associated to key
in
connection, if any.val set : t -> 'a key -> 'a option -> unit
set connection key value
attach value
to connection
under
the key key
. set connection key None
will remove any
occurence of key
from connection
.OBus_info.debug
is set then a
message is printed on stderr
val set_on_disconnect : t -> (exn -> unit Lwt.t) -> unit
Notes:
OBus_connection.close
val of_transport : ?switch:Lwt_switch.t ->
?guid:OBus_address.guid -> ?up:bool -> OBus_transport.t -> t
guid
is
provided the connection will be shared.
up
tell whether the connection is initially up or down,
default is true
.
of_transport
, newly created connection are always up.
When a connection is down, messages will not be dispatched
val state : t -> [ `Down | `Up ] React.signal
val set_up : t -> unit
val set_down : t -> unit