Flutter Engine
fl_method_codec.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_codec.h"
#include "flutter/shell/platform/linux/fl_method_codec_private.h"
#include <gmodule.h>

Go to the source code of this file.

Functions

G_MODULE_EXPORT GType fl_method_codec_get_type ()
 
static void fl_method_codec_class_init (FlMethodCodecClass *klass)
 
static void fl_method_codec_init (FlMethodCodec *self)
 
GBytes * fl_method_codec_encode_method_call (FlMethodCodec *self, const gchar *name, FlValue *args, GError **error)
 
gboolean fl_method_codec_decode_method_call (FlMethodCodec *self, GBytes *message, gchar **name, FlValue **args, GError **error)
 
GBytes * fl_method_codec_encode_success_envelope (FlMethodCodec *self, FlValue *result, GError **error)
 
GBytes * fl_method_codec_encode_error_envelope (FlMethodCodec *self, const gchar *code, const gchar *message, FlValue *details, GError **error)
 
FlMethodResponse * fl_method_codec_decode_response (FlMethodCodec *self, GBytes *message, GError **error)
 

Function Documentation

◆ fl_method_codec_class_init()

static void fl_method_codec_class_init ( FlMethodCodecClass *  klass)
static

Definition at line 15 of file fl_method_codec.cc.

15 {}

◆ fl_method_codec_decode_method_call()

gboolean fl_method_codec_decode_method_call ( FlMethodCodec *  self,
GBytes *  message,
gchar **  name,
FlValue **  args,
GError **  error 
)

Definition at line 30 of file fl_method_codec.cc.

Referenced by decode_error_method_call(), decode_method_call(), FlutterEngineSendPlatformMessage(), message_cb(), TEST(), and test_method_codec_decode_method_call().

34  {
35  g_return_val_if_fail(FL_IS_METHOD_CODEC(self), FALSE);
36  g_return_val_if_fail(message != nullptr, FALSE);
37  g_return_val_if_fail(name != nullptr, FALSE);
38  g_return_val_if_fail(args != nullptr, FALSE);
39 
40  return FL_METHOD_CODEC_GET_CLASS(self)->decode_method_call(self, message,
41  name, args, error);
42 }
G_BEGIN_DECLS FlValue * args
FlMethodResponse GError ** error
const char * name
Definition: fuchsia.cc:50

◆ fl_method_codec_decode_response()

FlMethodResponse* fl_method_codec_decode_response ( FlMethodCodec *  self,
GBytes *  message,
GError **  error 
)

Definition at line 65 of file fl_method_codec.cc.

References fl_method_not_implemented_response_new().

Referenced by cancel_exception_response_cb(), decode_error_response(), decode_response_with_error(), decode_response_with_success(), fl_method_channel_invoke_method_finish(), listen_exception_response_cb(), method_call_error_response_cb(), method_call_not_implemented_response_cb(), method_call_success_response_cb(), send_events_events_cb(), TEST(), and test_method_codec_decode_response().

67  {
68  g_return_val_if_fail(FL_IS_METHOD_CODEC(self), nullptr);
69  g_return_val_if_fail(message != nullptr, nullptr);
70 
71  if (g_bytes_get_size(message) == 0) {
72  return FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
73  }
74 
75  return FL_METHOD_CODEC_GET_CLASS(self)->decode_response(self, message, error);
76 }
FlMethodResponse GError ** error
G_MODULE_EXPORT FlMethodNotImplementedResponse * fl_method_not_implemented_response_new()

◆ fl_method_codec_encode_error_envelope()

GBytes* fl_method_codec_encode_error_envelope ( FlMethodCodec *  self,
const gchar *  code,
const gchar *  message,
FlValue details,
GError **  error 
)

Definition at line 53 of file fl_method_codec.cc.

Referenced by encode_error_envelope(), fl_event_channel_send_error(), fl_method_channel_respond(), FlutterEngineSendPlatformMessage(), message_cb(), and TEST().

57  {
58  g_return_val_if_fail(FL_IS_METHOD_CODEC(self), nullptr);
59  g_return_val_if_fail(code != nullptr, nullptr);
60 
61  return FL_METHOD_CODEC_GET_CLASS(self)->encode_error_envelope(
62  self, code, message, details, error);
63 }
FlMethodResponse GError ** error

◆ fl_method_codec_encode_method_call()

GBytes* fl_method_codec_encode_method_call ( FlMethodCodec *  self,
const gchar *  name,
FlValue args,
GError **  error 
)

Definition at line 19 of file fl_method_codec.cc.

Referenced by encode_method_call(), fl_method_channel_invoke_method(), invoke_method(), TEST(), and test_method_codec_encode_method_call().

22  {
23  g_return_val_if_fail(FL_IS_METHOD_CODEC(self), nullptr);
24  g_return_val_if_fail(name != nullptr, nullptr);
25 
26  return FL_METHOD_CODEC_GET_CLASS(self)->encode_method_call(self, name, args,
27  error);
28 }
G_BEGIN_DECLS FlValue * args
FlMethodResponse GError ** error
const char * name
Definition: fuchsia.cc:50

◆ fl_method_codec_encode_success_envelope()

GBytes* fl_method_codec_encode_success_envelope ( FlMethodCodec *  codec,
FlValue result,
GError **  error 
)

fl_method_codec_encode_success_envelope: : an #FlMethodCodec.

Returns
: (allow-none): method result, or NULL. : (allow-none): #GError location to store the error occurring, or NULL.

Encodes a successful response to a method call.

Returns: (transfer full): a binary encoding of this response or NULL if not able to encode.

Definition at line 44 of file fl_method_codec.cc.

Referenced by encode_success_envelope(), fl_event_channel_send(), fl_method_channel_respond(), FlutterEngineSendPlatformMessage(), message_cb(), and TEST().

46  {
47  g_return_val_if_fail(FL_IS_METHOD_CODEC(self), nullptr);
48 
49  return FL_METHOD_CODEC_GET_CLASS(self)->encode_success_envelope(self, result,
50  error);
51 }
FlMethodResponse GError ** error

◆ fl_method_codec_get_type()

G_MODULE_EXPORT GType fl_method_codec_get_type ( )

Referenced by G_DECLARE_FINAL_TYPE().

◆ fl_method_codec_init()

static void fl_method_codec_init ( FlMethodCodec *  self)
static

Definition at line 17 of file fl_method_codec.cc.

17 {}