| Flutter Linux Embedder |

Classes | Macros | Enumerations | Functions | Variables
fl_binary_messenger.h File Reference
`#include "fl_value.h"`
`#include <gio/gio.h>`
`#include <glib-object.h>`
`#include <gmodule.h>`

Go to the source code of this file.

## Classes
struct | _FlBinaryMessengerInterface
struct | _FlBinaryMessengerResponseHandleClass

## Macros
#define | FL_BINARY_MESSENGER_ERROR fl_binary_messenger_codec_error_quark()

## Enumerations
enum | FlBinaryMessengerError { FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED }

## Functions
GQuark | fl_binary_messenger_codec_error_quark (void) G_GNUC_CONST
G_MODULE_EXPORT | G_DECLARE_INTERFACE (FlBinaryMessenger, fl_binary_messenger, FL, BINARY_MESSENGER, GObject) G_MODULE_EXPORT G_DECLARE_DERIVABLE_TYPE(FlBinaryMessengerResponseHandle
void | fl_binary_messenger_set_message_handler_on_channel (FlBinaryMessenger *messenger, const gchar *channel, FlBinaryMessengerMessageHandler handler, gpointer user_data, GDestroyNotify destroy_notify)
gboolean | fl_binary_messenger_send_response (FlBinaryMessenger *messenger, FlBinaryMessengerResponseHandle *response_handle, GBytes *response, GError **error)
void | fl_binary_messenger_send_on_channel (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
GBytes * | fl_binary_messenger_send_on_channel_finish (FlBinaryMessenger *messenger, GAsyncResult *result, GError **error)
void | fl_binary_messenger_resize_channel (FlBinaryMessenger *messenger, const gchar *channel, int64_t new_size)
void | fl_binary_messenger_set_allow_channel_overflow (FlBinaryMessenger *messenger, const gchar *channel, bool allowed)

## Variables
G_MODULE_EXPORT GObject typedef void(* | FlBinaryMessengerMessageHandler )(FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)
G_MODULE_EXPORT | fl_binary_messenger_response_handle
G_MODULE_EXPORT | FL
G_MODULE_EXPORT | BINARY_MESSENGER_RESPONSE_HANDLE

## Macro Definition Documentation

## ◆ FL_BINARY_MESSENGER_ERROR

#define FL_BINARY_MESSENGER_ERROR fl_binary_messenger_codec_error_quark()

FlBinaryMessengerError: @FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED: unable to send response, this message has already been responded to.

Errors for #FlBinaryMessenger objects to set on failures.

Definition at line 27 of file fl_binary_messenger.h.

## Enumeration Type Documentation

## ◆ FlBinaryMessengerError

enum FlBinaryMessengerError

Enumerator
FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED |

Definition at line 29 of file fl_binary_messenger.h.

29 {
30 FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED,
31 } FlBinaryMessengerError;

## Function Documentation

## ◆ fl_binary_messenger_codec_error_quark()

GQuark fl_binary_messenger_codec_error_quark | ( | void |  | ) |

## ◆ fl_binary_messenger_resize_channel()

void fl_binary_messenger_resize_channel | ( | FlBinaryMessenger * | messenger,
|  | const gchar * | channel,
|  | int64_t | new_size
| ) |  |

fl_binary_messenger_resize_channel: @binary_messenger: an #FlBinaryMessenger. @channel: channel to be resize. @new_size: the new size for the channel buffer.

Sends a message to the control channel asking to resize a channel buffer.

Definition at line 475 of file fl_binary_messenger.cc.

477 {
478 g_return_if_fail(FL_IS_BINARY_MESSENGER(self));
479
480 return FL_BINARY_MESSENGER_GET_IFACE(self)->resize_channel(self, channel,
481 new_size);
482 }

Referenced by TEST().

## ◆ fl_binary_messenger_send_on_channel()

void fl_binary_messenger_send_on_channel | ( | FlBinaryMessenger * | messenger,
|  | const gchar * | channel,
|  | GBytes * | message,
|  | GCancellable * | cancellable,
|  | GAsyncReadyCallback | callback,
|  | gpointer | user_data
| ) |  |

fl_binary_messenger_send_on_channel: @binary_messenger: an #FlBinaryMessenger. @channel: channel to send to. @message: (allow-none): message buffer to send or NULL for an empty message. @cancellable: (allow-none): a #GCancellable or NULL. @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied. @user_data: (closure): user data to pass to @callback.

Asynchronously sends a platform message.

Definition at line 451 of file fl_binary_messenger.cc.

457 {
458 g_return_if_fail(FL_IS_BINARY_MESSENGER(self));
459 g_return_if_fail(channel != nullptr);
460
461 FL_BINARY_MESSENGER_GET_IFACE(self)->send_on_channel(
462 self, channel, message, cancellable, callback, user_data);
463 }

References callback, and user_data.

Referenced by fl_basic_message_channel_send(), fl_event_channel_send(), fl_event_channel_send_end_of_stream(), fl_event_channel_send_error(), fl_method_channel_invoke_method(), resize_channel(), set_allow_channel_overflow(), set_app_lifecycle_state(), and TEST().

## ◆ fl_binary_messenger_send_on_channel_finish()

GBytes* fl_binary_messenger_send_on_channel_finish | ( | FlBinaryMessenger * | messenger,
|  | GAsyncResult * | result,
|  | GError ** | error
| ) |  |

fl_binary_messenger_send_on_channel_finish: @messenger: an #FlBinaryMessenger.

Returns
  : a #GAsyncResult. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.

Completes request started with fl_binary_messenger_send_on_channel().

Returns: (transfer full): message response on success or NULL on error.

Definition at line 465 of file fl_binary_messenger.cc.

468 {
469 g_return_val_if_fail(FL_IS_BINARY_MESSENGER(self), FALSE);
470
471 return FL_BINARY_MESSENGER_GET_IFACE(self)->send_on_channel_finish(
472 self, result, error);
473 }

References error, and result.

Referenced by echo_response_cb(), failure_response_cb(), fake_response_cb(), finish_method(), fl_basic_message_channel_send_finish(), fl_method_channel_invoke_method_finish(), and nullptr_response_cb().

## ◆ fl_binary_messenger_send_response()

gboolean fl_binary_messenger_send_response | ( | FlBinaryMessenger * | messenger,
|  | FlBinaryMessengerResponseHandle * | response_handle,
|  | GBytes * | response,
|  | GError ** | error
| ) |  |

fl_binary_messenger_send_response: @binary_messenger: an #FlBinaryMessenger. @response_handle: handle that was provided in a FlBinaryMessengerMessageHandler. @response: (allow-none): response to send or NULL for an empty response. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.

Responds to a platform message. This function is thread-safe.

Returns: TRUE on success.

Definition at line 438 of file fl_binary_messenger.cc.

442 {
443 g_return_val_if_fail(FL_IS_BINARY_MESSENGER(self), FALSE);
444 g_return_val_if_fail(FL_IS_BINARY_MESSENGER_RESPONSE_HANDLE(response_handle),
445 FALSE);
446
447 return FL_BINARY_MESSENGER_GET_IFACE(self)->send_response(
448 self, response_handle, response, error);
449 }

References error.

Referenced by cancel_exception_response_cb(), fake_message_cb(), fl_basic_message_channel_respond(), fl_method_channel_respond(), listen_exception_response_cb(), message_cb(), method_call_error_response_cb(), method_call_not_implemented_response_cb(), method_call_success_response_cb(), response_cb(), response_from_thread_main(), send_events_events_cb(), and TEST().

## ◆ fl_binary_messenger_set_allow_channel_overflow()

void fl_binary_messenger_set_allow_channel_overflow | ( | FlBinaryMessenger * | messenger,
|  | const gchar * | channel,
|  | bool | allowed
| ) |  |

fl_binary_messenger_set_allow_channel_overflow: @messenger: an #FlBinaryMessenger. @channel: channel to be allowed to overflow silently. @allowed: when true the channel is expected to overflow and warning messages will not be shown.

Sends a message to the control channel asking to allow or disallow a channel to overflow silently.

Definition at line 484 of file fl_binary_messenger.cc.

487 {
488 g_return_if_fail(FL_IS_BINARY_MESSENGER(self));
489
490 return FL_BINARY_MESSENGER_GET_IFACE(self)->set_allow_channel_overflow(
491 self, channel, allowed);
492 }

Referenced by TEST().

## ◆ fl_binary_messenger_set_message_handler_on_channel()

void fl_binary_messenger_set_message_handler_on_channel | ( | FlBinaryMessenger * | messenger,
|  | const gchar * | channel,
|  | FlBinaryMessengerMessageHandler | handler,
|  | gpointer | user_data,
|  | GDestroyNotify | destroy_notify
| ) |  |

FlBinaryMessenger:

#FlBinaryMessenger is an object that allows sending and receiving of platform messages with an #FlEngine. FlBinaryMessengerResponseHandle:

#FlBinaryMessengerResponseHandle is an object used to send responses with. fl_binary_messenger_set_platform_message_handler: @binary_messenger: an #FlBinaryMessenger. @channel: channel to listen on. @handler: (allow-none): function to call when a message is received on this channel or NULL to disable a handler @user_data: (closure): user data to pass to @handler. @destroy_notify: (allow-none): a function which gets called to free @user_data, or NULL.

Sets the function called when a platform message is received on the given channel. See FlBinaryMessengerMessageHandler for details on how to respond to messages.

The handler is removed if the channel is closed or is replaced by another handler, set @destroy_notify if you want to detect this.

Definition at line 424 of file fl_binary_messenger.cc.

429 {
430 g_return_if_fail(FL_IS_BINARY_MESSENGER(self));
431 g_return_if_fail(channel != nullptr);
432
433 FL_BINARY_MESSENGER_GET_IFACE(self)->set_message_handler_on_channel(
434 self, channel, handler, user_data, destroy_notify);
435 }

References user_data.

Referenced by fl_basic_message_channel_dispose(), fl_basic_message_channel_new(), fl_event_channel_dispose(), fl_event_channel_new(), fl_method_channel_new(), and TEST().

## ◆ G_DECLARE_INTERFACE()

G_MODULE_EXPORT G_DECLARE_INTERFACE | ( | FlBinaryMessenger | ,
|  | fl_binary_messenger | ,
|  | FL | ,
|  | BINARY_MESSENGER | ,
|  | GObject |
| ) |  |

## Variable Documentation

## ◆ BINARY_MESSENGER_RESPONSE_HANDLE

G_MODULE_EXPORT BINARY_MESSENGER_RESPONSE_HANDLE

Definition at line 46 of file fl_binary_messenger.h.

## ◆ FL

G_MODULE_EXPORT FL

Definition at line 45 of file fl_binary_messenger.h.

## ◆ fl_binary_messenger_response_handle

G_MODULE_EXPORT fl_binary_messenger_response_handle

Definition at line 44 of file fl_binary_messenger.h.

## ◆ FlBinaryMessengerMessageHandler

G_MODULE_EXPORT GObject typedef void(* FlBinaryMessengerMessageHandler) (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data)

FlBinaryMessengerMessageHandler: @messenger: an #FlBinaryMessenger. @channel: channel message received on. @message: message content received from Dart. @response_handle: a handle to respond to the message with. @user_data: (closure): data provided when registering this handler.

Function called when platform messages are received. Call fl_binary_messenger_send_response() to respond to this message. If the response is not occurring in this callback take a reference to @response_handle and release that once it has been responded to. Failing to respond before the last reference to @response_handle is dropped is a programming error.

Definition at line 64 of file fl_binary_messenger.h.

Referenced by G_DECLARE_FINAL_TYPE().

user_data
FlKeyEvent uint64_t FlKeyResponderAsyncCallback gpointer user_data
Definition: fl_key_channel_responder.cc:121
FlBinaryMessengerError
FlBinaryMessengerError
Definition: fl_binary_messenger.h:29
result
GAsyncResult * result
Definition: fl_text_input_plugin.cc:106
FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED
@ FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED
Definition: fl_binary_messenger.h:30
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
callback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Definition: fl_key_channel_responder.cc:120