5#include "flutter/shell/platform/linux/public/flutter_linux/fl_json_method_codec.h"
9#include "flutter/shell/platform/linux/public/flutter_linux/fl_json_message_codec.h"
22 fl_method_codec_get_type())
24static
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);
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);
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");
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));
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
static GBytes * fl_json_method_codec_encode_success_envelope(FlMethodCodec *codec, FlValue *result, GError **error)
static GBytes * fl_json_method_codec_encode_method_call(FlMethodCodec *codec, const gchar *name, FlValue *args, GError **error)
G_MODULE_EXPORT FlJsonMethodCodec * fl_json_method_codec_new()
static GBytes * fl_json_method_codec_encode_error_envelope(FlMethodCodec *codec, const gchar *code, const gchar *error_message, FlValue *details, GError **error)
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)
static constexpr char kArgsKey[]
static void fl_json_method_codec_class_init(FlJsonMethodCodecClass *klass)
static FlMethodResponse * fl_json_method_codec_decode_response(FlMethodCodec *codec, GBytes *message, GError **error)
static constexpr char kMethodKey[]
G_DEFINE_TYPE(FlJsonMethodCodec, fl_json_method_codec, fl_method_codec_get_type()) static void fl_json_method_codec_dispose(GObject *object)
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
@ FL_MESSAGE_CODEC_ERROR_FAILED
#define FL_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlMethodErrorResponse * fl_method_error_response_new(const gchar *code, const gchar *message, FlValue *details)
G_MODULE_EXPORT FlMethodSuccessResponse * fl_method_success_response_new(FlValue *result)
const uint8_t uint32_t uint32_t GError ** error
G_MODULE_EXPORT FlValue * fl_value_new_map()
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_lookup_string(FlValue *self, const gchar *key)
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_null()
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
G_MODULE_EXPORT FlValue * fl_value_new_list()
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
typedefG_BEGIN_DECLS struct _FlValue FlValue
DEF_SWITCHES_START aot vmservice shared library name
FlMethodCodec parent_instance
FlJsonMessageCodec * codec