#include "flutter/shell/platform/linux/public/flutter_linux/fl_event_channel.h"
#include <gmodule.h>
#include "flutter/shell/platform/linux/fl_method_codec_private.h"
Go to the source code of this file.
Classes | |
struct | _FlEventChannel |
struct | _FlEventChannelResponseHandle |
Functions | |
static FlMethodErrorResponse * | handle_method_call (FlEventChannel *self, const gchar *name, FlValue *args) |
static void | message_cb (FlBinaryMessenger *messenger, const gchar *channel, GBytes *message, FlBinaryMessengerResponseHandle *response_handle, gpointer user_data) |
static void | remove_handlers (FlEventChannel *self) |
static void | channel_closed_cb (gpointer user_data) |
static void | fl_event_channel_dispose (GObject *object) |
static void | fl_event_channel_class_init (FlEventChannelClass *klass) |
static void | fl_event_channel_init (FlEventChannel *self) |
G_MODULE_EXPORT FlEventChannel * | fl_event_channel_new (FlBinaryMessenger *messenger, const gchar *name, FlMethodCodec *codec) |
G_MODULE_EXPORT void | fl_event_channel_set_stream_handlers (FlEventChannel *self, FlEventChannelHandler listen_handler, FlEventChannelHandler cancel_handler, gpointer user_data, GDestroyNotify destroy_notify) |
G_MODULE_EXPORT gboolean | fl_event_channel_send (FlEventChannel *self, FlValue *event, GCancellable *cancellable, GError **error) |
G_MODULE_EXPORT gboolean | fl_event_channel_send_error (FlEventChannel *self, const gchar *code, const gchar *message, FlValue *details, GCancellable *cancellable, GError **error) |
G_MODULE_EXPORT gboolean | fl_event_channel_send_end_of_stream (FlEventChannel *self, GCancellable *cancellable, GError **error) |
Variables | |
static constexpr char | kListenMethod [] = "listen" |
static constexpr char | kCancelMethod [] = "cancel" |
static constexpr char | kEventRequestError [] = "error" |
|
static |
Definition at line 130 of file fl_event_channel.cc.
References remove_handlers(), TRUE, and user_data.
Referenced by fl_event_channel_new().
|
static |
Definition at line 153 of file fl_event_channel.cc.
References fl_event_channel_dispose().
|
static |
Definition at line 136 of file fl_event_channel.cc.
References fl_binary_messenger_set_message_handler_on_channel(), and remove_handlers().
Referenced by fl_event_channel_class_init().
|
static |
Definition at line 157 of file fl_event_channel.cc.
G_MODULE_EXPORT FlEventChannel* fl_event_channel_new | ( | FlBinaryMessenger * | messenger, |
const gchar * | name, | ||
FlMethodCodec * | codec | ||
) |
Definition at line 159 of file fl_event_channel.cc.
References channel_closed_cb(), fl_binary_messenger_set_message_handler_on_channel(), and message_cb().
Referenced by TEST().
G_MODULE_EXPORT gboolean fl_event_channel_send | ( | FlEventChannel * | channel, |
FlValue * | event, | ||
GCancellable * | cancellable, | ||
GError ** | error | ||
) |
fl_event_channel_send: @channel: an #FlEventChannel. @event: event to send, must match what the #FlMethodCodec supports. @cancellable: (allow-none): a #GCancellable or NULL. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.
Sends an event on the channel. Events should only be sent once the channel is being listened to.
Returns: TRUE if successful.
Definition at line 196 of file fl_event_channel.cc.
References error, event, fl_binary_messenger_send_on_channel(), fl_method_codec_encode_success_envelope(), and TRUE.
Referenced by send_events_listen_cb().
G_MODULE_EXPORT gboolean fl_event_channel_send_end_of_stream | ( | FlEventChannel * | self, |
GCancellable * | cancellable, | ||
GError ** | error | ||
) |
Definition at line 237 of file fl_event_channel.cc.
References fl_binary_messenger_send_on_channel(), and TRUE.
G_MODULE_EXPORT gboolean fl_event_channel_send_error | ( | FlEventChannel * | self, |
const gchar * | code, | ||
const gchar * | message, | ||
FlValue * | details, | ||
GCancellable * | cancellable, | ||
GError ** | error | ||
) |
Definition at line 215 of file fl_event_channel.cc.
References error, fl_binary_messenger_send_on_channel(), fl_method_codec_encode_error_envelope(), and TRUE.
G_MODULE_EXPORT void fl_event_channel_set_stream_handlers | ( | FlEventChannel * | channel, |
FlEventChannelHandler | listen_handler, | ||
FlEventChannelHandler | cancel_handler, | ||
gpointer | user_data, | ||
GDestroyNotify | destroy_notify | ||
) |
fl_event_channel_set_stream_handlers: @channel: an #FlEventChannel. @listen_handler: (allow-none): function to call when the Dart side of the channel starts listening to the stream. @cancel_handler: (allow-none): function to call when the Dart side of the channel cancels their subscription to the stream. @user_data: (closure): user data to pass to @listen_handler and @cancel_handler. @destroy_notify: (allow-none): a function which gets called to free @user_data, or NULL.
Sets the functions called when the Dart side requests the stream to start and finish.
The handlers are removed if the channel is closed or is replaced by another handler, set @destroy_notify if you want to detect this.
Definition at line 181 of file fl_event_channel.cc.
References remove_handlers(), and user_data.
Referenced by TEST().
|
static |
Definition at line 46 of file fl_event_channel.cc.
References args, fl_method_error_response_new(), kCancelMethod, kEventRequestError, and kListenMethod.
Referenced by message_cb().
|
static |
Definition at line 69 of file fl_event_channel.cc.
References args, error, fl_binary_messenger_send_response(), fl_method_codec_decode_method_call(), fl_method_codec_encode_error_envelope(), fl_method_codec_encode_success_envelope(), fl_method_error_response_get_code(), fl_method_error_response_get_details(), fl_method_error_response_get_message(), handle_method_call(), and user_data.
Referenced by fl_event_channel_new().
|
static |
Definition at line 119 of file fl_event_channel.cc.
Referenced by channel_closed_cb(), fl_event_channel_dispose(), and fl_event_channel_set_stream_handlers().
|
staticconstexpr |
Definition at line 12 of file fl_event_channel.cc.
Referenced by handle_method_call().
|
staticconstexpr |
Definition at line 13 of file fl_event_channel.cc.
Referenced by handle_method_call().
|
staticconstexpr |
Definition at line 11 of file fl_event_channel.cc.
Referenced by handle_method_call().