Function
Valentpacket_init
unstable since: 1.0
Declaration [src]
void
valent_packet_init (
JsonBuilder** builder,
const char* type
)
Description [src]
Initialize a JsonBuilder
and KDE Connect packet.
Creates a new JsonBuilder
and initializes a packet for type
,
leaving the builder in the body
object. Call valent_packet_end()
to finish the packet and get the result.
g_autoptr (JsonBuilder) builder = NULL;
g_autoptr (JsonNode) packet = NULL;
valent_packet_init (&builder, "kdeconnect.ping");
json_builder_set_member_name (builder, "message");
json_builder_add_string_value (builder, "Ping!");
packet = valent_packet_end (&builder);
Available since: 1.0
This function is not directly available to language bindings.
Parameters
builder
-
Type:
JsonBuilder
A location to initialize a
JsonBuilder
.The data is owned by the caller of the function. type
-
Type:
const char*
A KDE Connect packet type.
The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string.