|
Flutter Linux Embedder
|
|
Go to the documentation of this file.
22 fl_method_codec_get_type())
24 static
void fl_json_method_codec_dispose(GObject*
object) {
25 FlJsonMethodCodec*
self = FL_JSON_METHOD_CODEC(
object);
27 g_clear_object(&self->codec);
29 G_OBJECT_CLASS(fl_json_method_codec_parent_class)->dispose(
object);
37 FlJsonMethodCodec*
self = FL_JSON_METHOD_CODEC(codec);
55 FlJsonMethodCodec*
self = FL_JSON_METHOD_CODEC(codec);
58 FL_MESSAGE_CODEC(self->codec), message,
error);
59 if (
value ==
nullptr) {
65 "Expected JSON map in method response, got %d instead",
71 if (method_value ==
nullptr) {
73 "Missing JSON method field in method response");
78 "Expected JSON string for method name, got %d instead",
95 FlJsonMethodCodec*
self = FL_JSON_METHOD_CODEC(codec);
107 FlMethodCodec* codec,
109 const gchar* error_message,
112 FlJsonMethodCodec*
self = FL_JSON_METHOD_CODEC(codec);
128 FlMethodCodec* codec,
131 FlJsonMethodCodec*
self = FL_JSON_METHOD_CODEC(codec);
134 FL_MESSAGE_CODEC(self->codec), message,
error);
135 if (
value ==
nullptr) {
141 "Expected JSON list in method response, got %d instead",
148 return FL_METHOD_RESPONSE(
154 "Error code wrong type");
163 "Error message wrong type");
166 const gchar* message =
176 return FL_METHOD_RESPONSE(
180 "Got response envelope of length %zi, expected 1 (success) or "
188 G_OBJECT_CLASS(klass)->dispose = fl_json_method_codec_dispose;
189 FL_METHOD_CODEC_CLASS(klass)->encode_method_call =
191 FL_METHOD_CODEC_CLASS(klass)->decode_method_call =
193 FL_METHOD_CODEC_CLASS(klass)->encode_success_envelope =
195 FL_METHOD_CODEC_CLASS(klass)->encode_error_envelope =
197 FL_METHOD_CODEC_CLASS(klass)->decode_response =
206 return static_cast<FlJsonMethodCodec*
>(
207 g_object_new(fl_json_method_codec_get_type(),
nullptr));
static FlMethodResponse * fl_json_method_codec_decode_response(FlMethodCodec *codec, GBytes *message, GError **error)
G_MODULE_EXPORT FlJsonMethodCodec * fl_json_method_codec_new()
static constexpr char kMethodKey[]
G_MODULE_EXPORT FlMethodErrorResponse * fl_method_error_response_new(const gchar *code, const gchar *message, FlValue *details)
static void fl_json_method_codec_init(FlJsonMethodCodec *self)
static gboolean fl_json_method_codec_decode_method_call(FlMethodCodec *codec, GBytes *message, gchar **name, FlValue **args, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_list()
typedefG_BEGIN_DECLS struct _FlValue FlValue
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_null()
G_MODULE_EXPORT FlValue * fl_value_lookup_string(FlValue *self, const gchar *key)
const G_MODULE_EXPORT gchar * fl_value_get_string(FlValue *self)
FlJsonMessageCodec * codec
G_MODULE_EXPORT FlMethodSuccessResponse * fl_method_success_response_new(FlValue *result)
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_map()
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
G_DEFINE_TYPE(FlJsonMethodCodec, fl_json_method_codec, fl_method_codec_get_type()) static void fl_json_method_codec_dispose(GObject *object)
static GBytes * fl_json_method_codec_encode_success_envelope(FlMethodCodec *codec, FlValue *result, GError **error)
FlMethodCodec parent_instance
@ FL_MESSAGE_CODEC_ERROR_FAILED
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
static GBytes * fl_json_method_codec_encode_method_call(FlMethodCodec *codec, const gchar *name, FlValue *args, GError **error)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static constexpr char kArgsKey[]
const uint8_t uint32_t uint32_t GError ** error
static GBytes * fl_json_method_codec_encode_error_envelope(FlMethodCodec *codec, const gchar *code, const gchar *error_message, FlValue *details, GError **error)
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
static void fl_json_method_codec_class_init(FlJsonMethodCodecClass *klass)
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
#define FL_MESSAGE_CODEC_ERROR