forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fl_method_codec_private.h
106 lines (96 loc) · 3.77 KB
/
fl_method_codec_private.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_PRIVATE_H_
#define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_PRIVATE_H_
#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_codec.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_method_response.h"
G_BEGIN_DECLS
/**
* fl_method_codec_encode_method_call:
* @codec: an #FlMethodCodec.
* @name: method name.
* @args: (allow-none): method arguments, or %NULL.
* @error: (allow-none): #GError location to store the error occurring, or
* %NULL.
*
* Encodes a method call.
*
* Returns: (transfer full): a binary encoding of this method call or %NULL if
* not able to encode.
*/
GBytes* fl_method_codec_encode_method_call(FlMethodCodec* codec,
const gchar* name,
FlValue* args,
GError** error);
/**
* fl_method_codec_decode_method_call:
* @codec: an #FlMethodCodec.
* @message: message to decode.
* @name: (transfer full): location to write method name or %NULL if not
* required.
* @args: (transfer full): location to write method arguments, or %NULL if not
* required.
* @error: (allow-none): #GError location to store the error occurring, or
* %NULL.
*
* Decodes a method call.
*
* Returns: %TRUE if successfully decoded.
*/
gboolean fl_method_codec_decode_method_call(FlMethodCodec* codec,
GBytes* message,
gchar** name,
FlValue** args,
GError** error);
/**
* fl_method_codec_encode_success_envelope:
* @codec: an #FlMethodCodec.
* @result: (allow-none): method result, or %NULL.
* @error: (allow-none): #GError location to store the error occurring, or
* %NULL.
*
* Encodes a successful response to a method call.
*
* Returns: (transfer full): a binary encoding of this response or %NULL if not
* able to encode.
*/
GBytes* fl_method_codec_encode_success_envelope(FlMethodCodec* codec,
FlValue* result,
GError** error);
/**
* fl_method_codec_encode_error_envelope:
* @codec: an #FlMethodCodec.
* @code: an error code.
* @message: (allow-none): an error message or %NULL.
* @details: (allow-none): error details, or %NULL.
* @error: (allow-none): #GError location to store the error occurring, or
* %NULL.
*
* Encodes an error response to a method call.
*
* Returns: (transfer full): a binary encoding of this response or %NULL if not
* able to encode.
*/
GBytes* fl_method_codec_encode_error_envelope(FlMethodCodec* codec,
const gchar* code,
const gchar* message,
FlValue* details,
GError** error);
/**
* fl_method_codec_decode_response:
* @codec: an #FlMethodCodec.
* @message: message to decode.
* @error: (allow-none): #GError location to store the error occurring, or
* %NULL.
*
* Decodes a response to a method call. If the call resulted in an error then
* @error_code is set, otherwise it is %NULL.
*
* Returns: a new #FlMethodResponse or %NULL on error.
*/
FlMethodResponse* fl_method_codec_decode_response(FlMethodCodec* codec,
GBytes* message,
GError** error);
G_END_DECLS
#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_PRIVATE_H_