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. If `error` is not %NULL, `*error` must be initialized (typically
20  * %NULL, but an error from a previous call using GLib error handling is
21  * explicitly valid).
22  *
23  * Encodes a method call.
24  *
25  * Returns: (transfer full): a binary encoding of this method call or %NULL if
26  * not able to encode.
27  */
28 GBytes* fl_method_codec_encode_method_call(FlMethodCodec* codec,
29  const gchar* name,
30  FlValue* args,
31  GError** error);
32 
33 /**
34  * fl_method_codec_decode_method_call:
35  * @codec: an #FlMethodCodec.
36  * @message: message to decode.
37  * @name: (transfer full): location to write method name or %NULL if not
38  * required.
39  * @args: (transfer full): location to write method arguments, or %NULL if not
40  * required.
41  * @error: (allow-none): #GError location to store the error occurring, or
42  * %NULL. If `error` is not %NULL, `*error` must be initialized (typically
43  * %NULL, but an error from a previous call using GLib error handling is
44  * explicitly valid).
45  *
46  * Decodes a method call.
47  *
48  * Returns: %TRUE if successfully decoded.
49  */
50 gboolean fl_method_codec_decode_method_call(FlMethodCodec* codec,
51  GBytes* message,
52  gchar** name,
53  FlValue** args,
54  GError** error);
55 
56 /**
57  * fl_method_codec_encode_success_envelope:
58  * @codec: an #FlMethodCodec.
59  * @result: (allow-none): method result, or %NULL.
60  * @error: (allow-none): #GError location to store the error occurring, or
61  * %NULL. If `error` is not %NULL, `*error` must be initialized (typically
62  * %NULL, but an error from a previous call using GLib error handling is
63  * explicitly valid).
64  *
65  * Encodes a successful response to a method call.
66  *
67  * Returns: (transfer full): a binary encoding of this response or %NULL if not
68  * able to encode.
69  */
70 GBytes* fl_method_codec_encode_success_envelope(FlMethodCodec* codec,
71  FlValue* result,
72  GError** error);
73 
74 /**
75  * fl_method_codec_encode_error_envelope:
76  * @codec: an #FlMethodCodec.
77  * @code: an error code.
78  * @message: (allow-none): an error message or %NULL.
79  * @details: (allow-none): error details, or %NULL.
80  * @error: (allow-none): #GError location to store the error occurring, or
81  * %NULL. If `error` is not %NULL, `*error` must be initialized (typically
82  * %NULL, but an error from a previous call using GLib error handling is
83  * explicitly valid).
84  *
85  * Encodes an error response to a method call.
86  *
87  * Returns: (transfer full): a binary encoding of this response or %NULL if not
88  * able to encode.
89  */
90 GBytes* fl_method_codec_encode_error_envelope(FlMethodCodec* codec,
91  const gchar* code,
92  const gchar* message,
93  FlValue* details,
94  GError** error);
95 
96 /**
97  * fl_method_codec_encode_response:
98  * @codec: an #FlMethodCodec.
99  * @response: response to encode.
100  * @error: (allow-none): #GError location to store the error occurring, or
101  * %NULL. If `error` is not %NULL, `*error` must be initialized (typically
102  * %NULL, but an error from a previous call using GLib error handling is
103  * explicitly valid).
104  *
105  * Encodes a response to a method call.
106  *
107  * Returns: a new #FlMethodResponse or %NULL on error.
108  */
109 GBytes* fl_method_codec_encode_response(FlMethodCodec* codec,
110  FlMethodResponse* response,
111  GError** error);
112 
113 /**
114  * fl_method_codec_decode_response:
115  * @codec: an #FlMethodCodec.
116  * @message: message to decode.
117  * @error: (allow-none): #GError location to store the error occurring, or
118  * %NULL. If `error` is not %NULL, `*error` must be initialized (typically
119  * %NULL, but an error from a previous call using GLib error handling is
120  * explicitly valid).
121  *
122  * Decodes a response to a method call.
123  *
124  * Returns: a new #FlMethodResponse or %NULL on error.
125  */
126 FlMethodResponse* fl_method_codec_decode_response(FlMethodCodec* codec,
127  GBytes* message,
128  GError** error);
129 
130 G_END_DECLS
131 
132 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_PRIVATE_H_
const char * message
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
GBytes * fl_method_codec_encode_response(FlMethodCodec *self, FlMethodResponse *response, 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)
GBytes * fl_method_codec_encode_success_envelope(FlMethodCodec *codec, FlValue *result, GError **error)
gboolean fl_method_codec_decode_method_call(FlMethodCodec *codec, GBytes *message, gchar **name, FlValue **args, GError **error)
GBytes * fl_method_codec_encode_method_call(FlMethodCodec *codec, const gchar *name, FlValue *args, GError **error)
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42