Class
ValentChannel
unstable since: 1.0
Description [src]
class Valent.Channel : Valent.Object
{
/* No available fields */
}
A base class for device connections.
ValentChannel
is a base class for the primary communication channel in
Valent. It is effectively an abstraction layer around a GIOStream
.
Packet Exchange
The core of the KDE Connect protocol is built on the exchange of JSON
packets, similar to JSON-RPC. Packets can be queued concurrently from
different threads with valent_channel_write_packet()
and read
sequentially with valent_channel_read_packet()
.
Packets may contain payload information, allowing devices to negotiate
auxiliary connections. Incoming connections can be accepted by passing the
packet to valent_channel_download()
, or opened by passing the packet
to valent_channel_upload()
.
Implementation Notes
Implementations should override Valent.ChannelClass.download
and
Valent.ChannelClass.upload
to support accepting and opening auxiliary
connections, respectively. To know when to store persistent data related to
the connection, override Valent.ChannelClass.store_data
.
Available since: 1.0
Instance methods
valent_channel_close_finish
Finish an operation started by valent_channel_close_async()
.
unstable since: 1.0
valent_channel_download_async
Open an auxiliary connection, usually to download data.
unstable since: 1.0
valent_channel_download_finish
Finish an operation started with valent_channel_download_async()
.
unstable since: 1.0
valent_channel_read_packet_finish
Finish an operation started by valent_channel_read_packet()
.
unstable since: 1.0
valent_channel_upload_async
Accept an auxiliary connection, usually to upload data.
unstable since: 1.0
valent_channel_upload_finish
Finish an operation started with valent_channel_upload_async()
.
unstable since: 1.0
valent_channel_write_packet_finish
Finish an operation started by valent_channel_write_packet()
.
unstable since: 1.0
Methods inherited from ValentObject (9)
valent_object_chain_cancellable
Chain a cancellable to the object’s cancellable.
unstable since: 1.0
valent_object_destroy
Destroy the object.
unstable since: 1.0
valent_object_dup_iri
Get a copy of the IRI for the object.
unstable since: 1.0
valent_object_in_destruction
Get whether the object is destroyed or in destruction.
unstable since: 1.0
valent_object_lock
Acquire a lock on object
.
unstable since: 1.0
valent_object_notify
Emit GObject::notify
on object
, on the main thread.
unstable since: 1.0
valent_object_notify_by_pspec
Emit GObject::notify
on object
, on the main thread.
unstable since: 1.0
valent_object_ref_cancellable
Get a GCancellable
for the object.
unstable since: 1.0
valent_object_unlock
Release a lock on object
.
unstable since: 1.0
Properties
Properties inherited from ValentObject (2)
Valent.Object:cancellable
The object GCancellable
.
unstable since: 1.0
Valent.Object:iri
The object IRI.
unstable since: 1.0
Signals
Signals inherited from ValentObject (1)
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
Class structure
struct ValentChannelClass {
ValentObjectClass parent_class;
GIOStream* (* download) (
ValentChannel* channel,
JsonNode* packet,
GCancellable* cancellable,
GError** error
);
void (* download_async) (
ValentChannel* channel,
JsonNode* packet,
GCancellable* cancellable,
GAsyncReadyCallback callback,
gpointer user_data
);
GIOStream* (* download_finish) (
ValentChannel* channel,
GAsyncResult* result,
GError** error
);
GIOStream* (* upload) (
ValentChannel* channel,
JsonNode* packet,
GCancellable* cancellable,
GError** error
);
void (* upload_async) (
ValentChannel* channel,
JsonNode* packet,
GCancellable* cancellable,
GAsyncReadyCallback callback,
gpointer user_data
);
GIOStream* (* upload_finish) (
ValentChannel* channel,
GAsyncResult* result,
GError** error
);
void (* store_data) (
ValentChannel* channel,
ValentContext* context
);
}
No description available.
Class members
parent_class: ValentObjectClass
No description available.
download: GIOStream* (* download) ( ValentChannel* channel, JsonNode* packet, GCancellable* cancellable, GError** error )
No description available.
download_async: void (* download_async) ( ValentChannel* channel, JsonNode* packet, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )
No description available.
download_finish: GIOStream* (* download_finish) ( ValentChannel* channel, GAsyncResult* result, GError** error )
No description available.
upload: GIOStream* (* upload) ( ValentChannel* channel, JsonNode* packet, GCancellable* cancellable, GError** error )
No description available.
upload_async: void (* upload_async) ( ValentChannel* channel, JsonNode* packet, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )
No description available.
upload_finish: GIOStream* (* upload_finish) ( ValentChannel* channel, GAsyncResult* result, GError** error )
No description available.
store_data: void (* store_data) ( ValentChannel* channel, ValentContext* context )
No description available.
Virtual methods
Valent.ChannelClass.download
Open an auxiliary connection, usually to download data.
unstable since: 1.0
Valent.ChannelClass.download_async
Open an auxiliary connection, usually to download data.
unstable since: 1.0
Valent.ChannelClass.download_finish
Finish an operation started with valent_channel_download_async()
.
unstable since: 1.0
Valent.ChannelClass.upload
Accept an auxiliary connection, usually to upload data.
unstable since: 1.0
Valent.ChannelClass.upload_async
Accept an auxiliary connection, usually to upload data.
unstable since: 1.0
Valent.ChannelClass.upload_finish
Finish an operation started with valent_channel_upload_async()
.
unstable since: 1.0