Flutter Linux Embedder
fl_method_call.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_PUBLIC_FLUTTER_LINUX_FL_METHOD_CALL_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_METHOD_CALL_H_
7 
8 #if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION)
9 #error "Only <flutter_linux/flutter_linux.h> can be included directly."
10 #endif
11 
12 #include <glib-object.h>
13 #include <gmodule.h>
14 
15 #include "fl_method_response.h"
16 #include "fl_value.h"
17 
18 G_BEGIN_DECLS
19 
20 G_MODULE_EXPORT
21 G_DECLARE_FINAL_TYPE(FlMethodCall, fl_method_call, FL, METHOD_CALL, GObject)
22 
23 /**
24  * FlMethodCall:
25  *
26  * #FlMethodCall represents and incoming method call as returned by an
27  * #FlMethodChannel.
28  */
29 
30 /**
31  * fl_method_call_get_name:
32  * @method_call: an #FlMethodCall.
33  *
34  * Gets the name of the method call.
35  *
36  * Returns: a method name.
37  */
38 const gchar* fl_method_call_get_name(FlMethodCall* method_call);
39 
40 /**
41  * fl_method_call_get_args:
42  * @method_call: an #FlMethodCall.
43  *
44  * Gets the arguments passed to the method.
45  *
46  * Returns: an #FlValue.
47  */
49 
50 /**
51  * fl_method_call_respond:
52  * @method_call: an #FlMethodCall.
53  * @response: an #FlMethodResponse.
54  * @error: (allow-none): #GError location to store the error occurring, or %NULL
55  * to ignore.
56  *
57  * Responds to a method call.
58  *
59  * Returns: %TRUE on success.
60  */
61 gboolean fl_method_call_respond(FlMethodCall* method_call,
62  FlMethodResponse* response,
63  GError** error);
64 
65 /**
66  * fl_method_call_respond_success:
67  * @method_call: an #FlMethodCall.
68  * @result: (allow-none): value to respond with, must match what the
69  * #FlMethodCodec supports.
70  * @error: (allow-none): #GError location to store the error occurring, or %NULL
71  * to ignore.
72  *
73  * Convenience method that responds to method call with
74  * #FlMethodSuccessResponse.
75  *
76  * Returns: %TRUE on success.
77  */
78 gboolean fl_method_call_respond_success(FlMethodCall* method_call,
79  FlValue* result,
80  GError** error);
81 
82 /**
83  * fl_method_call_respond_error:
84  * @method_call: an #FlMethodCall.
85  * @code: error code.
86  * @message: (allow-none): error message.
87  * @details: (allow-none): details for the error.
88  * @error: (allow-none): #GError location to store the error occurring, or %NULL
89  * to ignore.
90  *
91  * Convenience method that responds to method call with #FlMethodErrorResponse.
92  *
93  * Returns: %TRUE on success.
94  */
95 gboolean fl_method_call_respond_error(FlMethodCall* method_call,
96  const gchar* code,
97  const gchar* message,
98  FlValue* details,
99  GError** error);
100 
101 /**
102  * fl_method_call_respond_not_implemented:
103  * @method_call: an #FlMethodCall.
104  * @error: (allow-none): #GError location to store the error occurring, or %NULL
105  * to ignore.
106  *
107  * Convenience method that responds to method call with
108  * #FlMethodNotImplementedResponse.
109  *
110  * Returns: %TRUE on success.
111  */
113  GError** error);
114 
115 G_END_DECLS
116 
117 #endif // FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_METHOD_CALL_H_
fl_method_call_get_name
G_BEGIN_DECLS const G_MODULE_EXPORT gchar * fl_method_call_get_name(FlMethodCall *method_call)
Definition: fl_method_call.cc:67
fl_method_call_get_args
FlValue * fl_method_call_get_args(FlMethodCall *method_call)
Definition: fl_method_call.cc:72
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
fl_method_call_respond_not_implemented
G_MODULE_EXPORT gboolean fl_method_call_respond_not_implemented(FlMethodCall *self, GError **error)
Definition: fl_method_call.cc:125
method_call
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
Definition: fl_method_channel.h:120
fl_method_call_respond_success
gboolean fl_method_call_respond_success(FlMethodCall *method_call, FlValue *result, GError **error)
Definition: fl_method_call.cc:100
G_DECLARE_FINAL_TYPE
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlAccessibleTextField, fl_accessible_text_field, FL, ACCESSIBLE_TEXT_FIELD, FlAccessibleNode)
FL
FL
Definition: fl_binary_messenger.cc:27
fl_method_response.h
fl_method_call_respond
gboolean fl_method_call_respond(FlMethodCall *method_call, FlMethodResponse *response, GError **error)
Definition: fl_method_call.cc:77
result
GAsyncResult * result
Definition: fl_text_input_plugin.cc:106
fl_value.h
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
fl_method_call_respond_error
G_MODULE_EXPORT gboolean fl_method_call_respond_error(FlMethodCall *self, const gchar *code, const gchar *message, FlValue *details, GError **error)
Definition: fl_method_call.cc:111