Flutter Engine
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_FL_METHOD_CALL_H_
6 #define FLUTTER_SHELL_PLATFORM_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 
14 #include "fl_method_response.h"
15 #include "fl_value.h"
16 
17 G_BEGIN_DECLS
18 
19 G_DECLARE_FINAL_TYPE(FlMethodCall, fl_method_call, FL, METHOD_CALL, GObject)
20 
21 /**
22  * FlMethodCall:
23  *
24  * #FlMethodCall represents and incoming method call as returned by an
25  * #FlMethodChannel.
26  */
27 
28 /**
29  * fl_method_call_get_name:
30  * @method_call: an #FlMethodCall.
31  *
32  * Gets the name of the method call.
33  *
34  * Returns: a method name.
35  */
36 const gchar* fl_method_call_get_name(FlMethodCall* method_call);
37 
38 /**
39  * fl_method_call_get_args:
40  * @method_call: an #FlMethodCall.
41  *
42  * Gets the arguments passed to the method.
43  *
44  * Returns: an #FlValue.
45  */
47 
48 /**
49  * fl_method_call_respond:
50  * @method_call: an #FlMethodCall.
51  * @response: an #FlMethodResponse.
52  * @error: (allow-none): #GError location to store the error occurring, or %NULL
53  * to ignore.
54  *
55  * Responds to a method call.
56  *
57  * Returns: %TRUE on success.
58  */
59 gboolean fl_method_call_respond(FlMethodCall* method_call,
60  FlMethodResponse* response,
61  GError** error);
62 
63 /**
64  * fl_method_call_respond_success:
65  * @method_call: an #FlMethodCall.
66  * @result: (allow-none): value to respond with, must match what the
67  * #FlMethodCodec supports.
68  * @error: (allow-none): #GError location to store the error occurring, or %NULL
69  * to ignore.
70  *
71  * Convenience method that responds to method call with
72  * #FlMethodSuccessResponse.
73  *
74  * Returns: %TRUE on success.
75  */
76 gboolean fl_method_call_respond_success(FlMethodCall* method_call,
77  FlValue* result,
78  GError** error);
79 
80 /**
81  * fl_method_call_respond_error:
82  * @method_call: an #FlMethodCall.
83  * @code: error code.
84  * @message: (allow-none): error message.
85  * @details: (allow-none): details for the error.
86  * @error: (allow-none): #GError location to store the error occurring, or %NULL
87  * to ignore.
88  *
89  * Convenience method that responds to method call with #FlMethodErrorResponse.
90  *
91  * Returns: %TRUE on success.
92  */
93 gboolean fl_method_call_respond_error(FlMethodCall* method_call,
94  const gchar* code,
95  const gchar* message,
96  FlValue* details,
97  GError** error);
98 
99 /**
100  * fl_method_call_respond_not_implemented:
101  * @method_call: an #FlMethodCall.
102  * @error: (allow-none): #GError location to store the error occurring, or %NULL
103  * to ignore.
104  *
105  * Convenience method that responds to method call with
106  * #FlMethodNotImplementedResponse.
107  *
108  * Returns: %TRUE on success.
109  */
111  GError** error);
112 
113 G_END_DECLS
114 
115 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CALL_H_
G_BEGIN_DECLS FlMethodCall * method_call
G_MODULE_EXPORT gboolean fl_method_call_respond_not_implemented(FlMethodCall *self, GError **error)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
gboolean fl_method_call_respond(FlMethodCall *method_call, FlMethodResponse *response, GError **error)
gboolean fl_method_call_respond_success(FlMethodCall *method_call, FlValue *result, GError **error)
G_BEGIN_DECLS const gchar * fl_method_call_get_name(FlMethodCall *method_call)
FlValue * fl_method_call_get_args(FlMethodCall *method_call)
G_MODULE_EXPORT gboolean fl_method_call_respond_error(FlMethodCall *self, const gchar *code, const gchar *message, FlValue *details, GError **error)
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlKeyEventPlugin, fl_key_event_plugin, FL, KEY_EVENT_PLUGIN, GObject)
G_BEGIN_DECLS FL