Flutter Linux Embedder
fl_method_codec_private.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_PRIVATE_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_PRIVATE_H_
7 
10 
11 G_BEGIN_DECLS
12 
13 /**
14  * fl_method_codec_encode_method_call:
15  * @codec: an #FlMethodCodec.
16  * @name: method name.
17  * @args: (allow-none): method arguments, or %NULL.
18  * @error: (allow-none): #GError location to store the error occurring, or
19  * %NULL.
20  *
21  * Encodes a method call.
22  *
23  * Returns: (transfer full): a binary encoding of this method call or %NULL if
24  * not able to encode.
25  */
26 GBytes* fl_method_codec_encode_method_call(FlMethodCodec* codec,
27  const gchar* name,
28  FlValue* args,
29  GError** error);
30 
31 /**
32  * fl_method_codec_decode_method_call:
33  * @codec: an #FlMethodCodec.
34  * @message: message to decode.
35  * @name: (transfer full): location to write method name or %NULL if not
36  * required.
37  * @args: (transfer full): location to write method arguments, or %NULL if not
38  * required.
39  * @error: (allow-none): #GError location to store the error occurring, or
40  * %NULL.
41  *
42  * Decodes a method call.
43  *
44  * Returns: %TRUE if successfully decoded.
45  */
46 gboolean fl_method_codec_decode_method_call(FlMethodCodec* codec,
47  GBytes* message,
48  gchar** name,
49  FlValue** args,
50  GError** error);
51 
52 /**
53  * fl_method_codec_encode_success_envelope:
54  * @codec: an #FlMethodCodec.
55  * @result: (allow-none): method result, or %NULL.
56  * @error: (allow-none): #GError location to store the error occurring, or
57  * %NULL.
58  *
59  * Encodes a successful response to a method call.
60  *
61  * Returns: (transfer full): a binary encoding of this response or %NULL if not
62  * able to encode.
63  */
64 GBytes* fl_method_codec_encode_success_envelope(FlMethodCodec* codec,
65  FlValue* result,
66  GError** error);
67 
68 /**
69  * fl_method_codec_encode_error_envelope:
70  * @codec: an #FlMethodCodec.
71  * @code: an error code.
72  * @message: (allow-none): an error message or %NULL.
73  * @details: (allow-none): error details, or %NULL.
74  * @error: (allow-none): #GError location to store the error occurring, or
75  * %NULL.
76  *
77  * Encodes an error response to a method call.
78  *
79  * Returns: (transfer full): a binary encoding of this response or %NULL if not
80  * able to encode.
81  */
82 GBytes* fl_method_codec_encode_error_envelope(FlMethodCodec* codec,
83  const gchar* code,
84  const gchar* message,
85  FlValue* details,
86  GError** error);
87 
88 /**
89  * fl_method_codec_decode_response:
90  * @codec: an #FlMethodCodec.
91  * @message: message to decode.
92  * @error: (allow-none): #GError location to store the error occurring, or
93  * %NULL.
94  *
95  * Decodes a response to a method call. If the call resulted in an error then
96  * @error_code is set, otherwise it is %NULL.
97  *
98  * Returns: a new #FlMethodResponse or %NULL on error.
99  */
100 FlMethodResponse* fl_method_codec_decode_response(FlMethodCodec* codec,
101  GBytes* message,
102  GError** error);
103 
104 G_END_DECLS
105 
106 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_PRIVATE_H_
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
fl_method_codec_encode_success_envelope
GBytes * fl_method_codec_encode_success_envelope(FlMethodCodec *codec, FlValue *result, GError **error)
Definition: fl_method_codec.cc:41
fl_method_codec_decode_response
FlMethodResponse * fl_method_codec_decode_response(FlMethodCodec *self, GBytes *message, GError **error)
Definition: fl_method_codec.cc:62
fl_method_codec.h
fl_method_response.h
result
GAsyncResult * result
Definition: fl_text_input_plugin.cc:106
fl_method_codec_decode_method_call
gboolean fl_method_codec_decode_method_call(FlMethodCodec *codec, GBytes *message, gchar **name, FlValue **args, GError **error)
Definition: fl_method_codec.cc:27
args
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
Definition: fl_event_channel.h:89
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
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: fl_method_codec.cc:50
fl_method_codec_encode_method_call
GBytes * fl_method_codec_encode_method_call(FlMethodCodec *codec, const gchar *name, FlValue *args, GError **error)
Definition: fl_method_codec.cc:16