| telepathy-glib API Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | Properties | ||||
#include <telepathy-glib/telepathy-glib.h> struct TpDBusTubeChannel; struct TpDBusTubeChannelClass; #define TP_DBUS_TUBE_CHANNEL_FEATURE_CORE GHashTable * tp_dbus_tube_channel_get_parameters (TpDBusTubeChannel *self); const gchar * tp_dbus_tube_channel_get_service_name (TpDBusTubeChannel *self); void tp_dbus_tube_channel_offer_async (TpDBusTubeChannel *self,GHashTable *params,GAsyncReadyCallback callback,gpointer user_data); GDBusConnection * tp_dbus_tube_channel_offer_finish (TpDBusTubeChannel *self,GAsyncResult *result,GError **error); void tp_dbus_tube_channel_accept_async (TpDBusTubeChannel *self,GAsyncReadyCallback callback,gpointer user_data); GDBusConnection * tp_dbus_tube_channel_accept_finish (TpDBusTubeChannel *self,GAsyncResult *result,GError **error);
TpDBusTubeChannel provides API for working with D-Bus tube channels, which allow applications to open D-Bus connections to a contact or chat room.
To create a new outgoing D-Bus tube channel, do something like:
GHashTable *request_properties = tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, tp_contact_get_identifier (contact),
TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME, G_TYPE_STRING, "com.example.walrus",
NULL);
TpAccountChannelRequest *req = tp_account_channel_request_new (account,
request_properties, TP_USER_ACTION_TIME_NOT_USER_ACTION);
tp_account_channel_request_create_and_handle_channel_async (req, NULL, callback, NULL);
// ...
static void
callback (
GObject *source,
GAsyncResult *result,
gpointer user_data)
{
TpAccountChannelRequest *req = TP_ACCOUNT_CHANNEL_REQUEST (source);
TpChannel *channel;
GError *error = NULL;
channel = tp_account_channel_request_create_and_handle_channel_finish (req, result, &error);
tp_dbus_tube_channel_offer_async (TP_DBUS_TUBE_CHANNEL (channel), NULL, offer_callback, NULL);
}
You can find a fuller example in the examples/client/dbus-tubes directory.
struct TpDBusTubeChannel;
Data structure representing a TpDBusTubeChannel.
Since 0.18.0
struct TpDBusTubeChannelClass {
};
The class of a TpDBusTubeChannel.
Since 0.18.0
#define TP_DBUS_TUBE_CHANNEL_FEATURE_CORE
Expands to a call to a function that returns a quark representing the core feature of a TpDBusTubeChannel.
One can ask for a feature to be prepared using the
tp_proxy_prepare_async() function, and waiting for it to callback.
Since 0.18.0
GHashTable * tp_dbus_tube_channel_get_parameters (TpDBusTubeChannel *self);
Return the "parameters" property
|
a TpDBusTubeChannel |
Returns : |
the value of "parameters". [transfer none][element-type utf8 GObject.Value] |
Since 0.18.0
const gchar * tp_dbus_tube_channel_get_service_name
(TpDBusTubeChannel *self);
Return the "service-name" property
|
a TpDBusTubeChannel |
Returns : |
the value of "service-name". [transfer none] |
Since 0.18.0
void tp_dbus_tube_channel_offer_async (TpDBusTubeChannel *self,GHashTable *params,GAsyncReadyCallback callback,gpointer user_data);
Offer an outgoing D-Bus tube. When the tube has been offered and accepted
callback will be called. You can then call
tp_dbus_tube_channel_offer_finish() to get the GDBusConnection that will
be used to communicate through the tube.
|
an outgoing TpDBusTubeChannel |
|
parameters of the tube, or NULL. [allow-none][transfer none]
|
|
a callback to call when the tube has been offered |
|
data to pass to callback
|
Since 0.18.0
GDBusConnection * tp_dbus_tube_channel_offer_finish (TpDBusTubeChannel *self,GAsyncResult *result,GError **error);
Finishes offering an outgoing D-Bus tube. The returned GDBusConnection is ready to be used to exchange data through the tube.
|
a TpDBusTubeChannel |
|
a GAsyncResult |
|
a GError to fill |
Returns : |
a reference on a GDBusConnection if the tube
has been successfully offered and opened; NULL otherwise. [transfer full]
|
Since 0.18.0
void tp_dbus_tube_channel_accept_async (TpDBusTubeChannel *self,GAsyncReadyCallback callback,gpointer user_data);
Accept an incoming D-Bus tube. When the tube has been accepted
callback will be called. You can then call
tp_dbus_tube_channel_accept_finish() to get the GDBusConnection that will
be used to communicate through the tube.
|
an incoming TpDBusTubeChannel |
|
a callback to call when the tube has been offered |
|
data to pass to callback
|
Since 0.18.0
GDBusConnection * tp_dbus_tube_channel_accept_finish (TpDBusTubeChannel *self,GAsyncResult *result,GError **error);
Finishes to accept an incoming D-Bus tube. The returned GDBusConnection is ready to be used to exchange data through the tube.
|
a TpDBusTubeChannel |
|
a GAsyncResult |
|
a GError to fill |
Returns : |
a reference on a GDBusConnection if the tube
has been successfully accepted and opened; NULL otherwise. [transfer full]
|
Since 0.18.0
"parameters" property "parameters" GHashTable_gchararray+GValue_* : Read
A string to GValue GHashTable representing the parameters of the tube.
Will be NULL for outgoing tubes until the tube has been offered.
Since 0.18.0
"service-name" property"service-name" gchar* : Read
A string representing the service name that will be used over the tube.
Default value: NULL
Since 0.18.0