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. If `error` is not %NULL, `*error` must be initialized (typically
56  * %NULL, but an error from a previous call using GLib error handling is
57  * explicitly valid).
58  *
59  * Responds to a method call.
60  *
61  * Returns: %TRUE on success.
62  */
63 gboolean fl_method_call_respond(FlMethodCall* method_call,
64  FlMethodResponse* response,
65  GError** error);
66 
67 /**
68  * fl_method_call_respond_success:
69  * @method_call: an #FlMethodCall.
70  * @result: (allow-none): value to respond with, must match what the
71  * #FlMethodCodec supports.
72  * @error: (allow-none): #GError location to store the error occurring, or %NULL
73  * to ignore. If `error` is not %NULL, `*error` must be initialized (typically
74  * %NULL, but an error from a previous call using GLib error handling is
75  * explicitly valid).
76  *
77  * Convenience method that responds to method call with
78  * #FlMethodSuccessResponse.
79  *
80  * Returns: %TRUE on success.
81  */
82 gboolean fl_method_call_respond_success(FlMethodCall* method_call,
83  FlValue* result,
84  GError** error);
85 
86 /**
87  * fl_method_call_respond_error:
88  * @method_call: an #FlMethodCall.
89  * @code: error code.
90  * @message: (allow-none): error message.
91  * @details: (allow-none): details for the error.
92  * @error: (allow-none): #GError location to store the error occurring, or %NULL
93  * to ignore. If `error` is not %NULL, `*error` must be initialized (typically
94  * %NULL, but an error from a previous call using GLib error handling is
95  * explicitly valid).
96  *
97  * Convenience method that responds to method call with #FlMethodErrorResponse.
98  *
99  * Returns: %TRUE on success.
100  */
101 gboolean fl_method_call_respond_error(FlMethodCall* method_call,
102  const gchar* code,
103  const gchar* message,
104  FlValue* details,
105  GError** error);
106 
107 /**
108  * fl_method_call_respond_not_implemented:
109  * @method_call: an #FlMethodCall.
110  * @error: (allow-none): #GError location to store the error occurring, or %NULL
111  * to ignore. If `error` is not %NULL, `*error` must be initialized (typically
112  * %NULL, but an error from a previous call using GLib error handling is
113  * explicitly valid).
114  *
115  * Convenience method that responds to method call with
116  * #FlMethodNotImplementedResponse.
117  *
118  * Returns: %TRUE on success.
119  */
121  GError** error);
122 
123 G_END_DECLS
124 
125 #endif // FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_METHOD_CALL_H_
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlAccessibilityChannel, fl_accessibility_channel, FL, ACCESSIBILITY_CHANNEL, GObject)
const char * message
G_MODULE_EXPORT gboolean fl_method_call_respond_error(FlMethodCall *self, const gchar *code, const gchar *message, FlValue *details, GError **error)
G_MODULE_EXPORT gboolean fl_method_call_respond_not_implemented(FlMethodCall *self, GError **error)
G_BEGIN_DECLS G_MODULE_EXPORT const gchar * fl_method_call_get_name(FlMethodCall *method_call)
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)
FlValue * fl_method_call_get_args(FlMethodCall *method_call)
G_BEGIN_DECLS G_MODULE_EXPORT FlMethodCall * method_call
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42