| 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
G_MODULE_EXPORT 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_warns_on_channel_overflow (FlBinaryMessenger *messenger, const gchar *channel, bool warns)

## 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 // Part of the public API, so fixing the name is a breaking change.
31 FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED,
32 } FlBinaryMessengerError;
FlBinaryMessengerError
FlBinaryMessengerError
Definition: fl_binary_messenger.h:29
FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED
@ FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED
Definition: fl_binary_messenger.h:31

## Function Documentation

## ◆ fl_binary_messenger_codec_error_quark()

G_MODULE_EXPORT 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 459 of file fl_binary_messenger.cc.

461 {
462 g_return_if_fail(FL_IS_BINARY_MESSENGER(self));
463
464 return FL_BINARY_MESSENGER_GET_IFACE(self)->resize_channel(self, channel,
465 new_size);
466 }

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 435 of file fl_binary_messenger.cc.

441 {
442 g_return_if_fail(FL_IS_BINARY_MESSENGER(self));
443 g_return_if_fail(channel != nullptr);
444
445 FL_BINARY_MESSENGER_GET_IFACE(self)->send_on_channel(
446 self, channel, message, cancellable, callback, user_data);
447 }
message
const char * message
Definition: fl_accessibility_handler.cc:21
user_data
const char FlTextDirection FlAssertiveness gpointer user_data
Definition: fl_accessibility_handler.cc:24

References message, 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(), send_lifecycle_state(), set_warns_on_channel_overflow(), 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. If `error` is not NULL, `*error` must be initialized (typically NULL, but an error from a previous call using GLib error handling is explicitly valid).

Completes request started with fl_binary_messenger_send_on_channel().

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

Definition at line 449 of file fl_binary_messenger.cc.

452 {
453 g_return_val_if_fail(FL_IS_BINARY_MESSENGER(self), FALSE);
454
455 return FL_BINARY_MESSENGER_GET_IFACE(self)->send_on_channel_finish(
456 self, result, error);
457 }
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40

References error.

Referenced by finish_method(), fl_basic_message_channel_send_finish(), fl_method_channel_invoke_method_finish(), and TEST().

## ◆ 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. If `error` is not NULL, `*error` must be initialized (typically NULL, but an error from a previous call using GLib error handling is explicitly valid).

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

Returns: TRUE on success.

Definition at line 422 of file fl_binary_messenger.cc.

426 {
427 g_return_val_if_fail(FL_IS_BINARY_MESSENGER(self), FALSE);
428 g_return_val_if_fail(FL_IS_BINARY_MESSENGER_RESPONSE_HANDLE(response_handle),
429 FALSE);
430
431 return FL_BINARY_MESSENGER_GET_IFACE(self)->send_response(
432 self, response_handle, response, error);
433 }

References error.

Referenced by fl_basic_message_channel_respond(), fl_method_channel_respond(), message_cb(), and 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 408 of file fl_binary_messenger.cc.

413 {
414 g_return_if_fail(FL_IS_BINARY_MESSENGER(self));
415 g_return_if_fail(channel != nullptr);
416
417 FL_BINARY_MESSENGER_GET_IFACE(self)->set_message_handler_on_channel(
418 self, channel, handler, user_data, destroy_notify);
419 }

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().

## ◆ fl_binary_messenger_set_warns_on_channel_overflow()

void fl_binary_messenger_set_warns_on_channel_overflow | ( | FlBinaryMessenger * | messenger,
|  | const gchar * | channel,
|  | bool | warns
| ) |  |

fl_binary_messenger_set_warns_on_channel_overflow: @messenger: an #FlBinaryMessenger. @channel: channel to be allowed to overflow silently. @warns: when false, 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 468 of file fl_binary_messenger.cc.

471 {
472 g_return_if_fail(FL_IS_BINARY_MESSENGER(self));
473
474 return FL_BINARY_MESSENGER_GET_IFACE(self)->set_warns_on_channel_overflow(
475 self, channel, warns);
476 }

Referenced by 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 48 of file fl_binary_messenger.h.

## ◆ FL

G_MODULE_EXPORT FL

Definition at line 47 of file fl_binary_messenger.h.

## ◆ fl_binary_messenger_response_handle

G_MODULE_EXPORT fl_binary_messenger_response_handle

Definition at line 46 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) | ( | 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 66 of file fl_binary_messenger.h.