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. If pairing involves exchanging a key, override Valent.ChannelClass.get_verification_key. To know when to store persistent data related to the connection, override Valent.ChannelClass.store_data.

Available since: 1.0

Hierarchy

hierarchy this ValentChannel ancestor_0 ValentObject ancestor_0--this ancestor_1 GObject ancestor_1--ancestor_0

Ancestors

Instance methods

valent_channel_close

Close the channel.

valent_channel_close_async

Close the channel asynchronously.

unstable since: 1.0

valent_channel_close_finish

Finish an operation started by valent_channel_close_async().

unstable since: 1.0

valent_channel_download

Open an auxiliary connection, usually to download data.

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_get_identity

Get the local identity packet.

unstable since: 1.0

valent_channel_get_peer_identity

Get the peer identity packet.

unstable since: 1.0

valent_channel_get_verification_key

Get a verification key for the connection.

unstable since: 1.0

valent_channel_read_packet

Read the next KDE Connect packet from channel.

unstable since: 1.0

valent_channel_read_packet_finish

Finish an operation started by valent_channel_read_packet().

unstable since: 1.0

valent_channel_ref_base_stream

Get the base GIOStream.

unstable since: 1.0

valent_channel_store_data

Store channel metadata.

unstable since: 1.0

valent_channel_upload

Accept an auxiliary connection, usually to upload data.

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

Send a packet over the channel.

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 (8)
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_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

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Valent.Channel:base-stream

The base GIOStream for the channel.

unstable since: 1.0

Valent.Channel:identity

The local identity packet.

unstable since: 1.0

Valent.Channel:peer-identity

The peer identity packet.

unstable since: 1.0

Properties inherited from ValentObject (1)
Valent.Object:cancellable

The object GCancellable.

unstable since: 1.0

Signals

Signals inherited from ValentObject (1)
ValentObject::destroy

Emitted when the object is being destroyed.

unstable since: 1.0

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;
  const char* (* get_verification_key) (
    ValentChannel* channel
  );
  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
  );
  
}

The virtual function table for ValentChannel.

Class members
parent_class: ValentObjectClass
No description available.
get_verification_key: const char* (* get_verification_key) ( ValentChannel* channel )
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.get_verification_key

Get a verification key for the connection.

unstable since: 1.0

Valent.ChannelClass.store_data

Store channel metadata.

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