blob: 5c00c05beba755178eff8e69e79f3db0e3a3dea9 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen_dart.
// @dart = 2.12
library fidl_fidl_test_service_async;
import 'dart:async' as $async;
import 'dart:core' hide Set;
import 'dart:developer';
import 'dart:typed_data';
import 'package:fidl/fidl.dart' as $fidl;
import 'package:meta/meta.dart';
import 'package:zircon/zircon.dart' as $zircon;
// ignore_for_file: always_specify_types
// ignore_for_file: avoid_positional_boolean_parameters
// ignore_for_file: avoid_returning_null
// ignore_for_file: cascade_invocations
// ignore_for_file: constant_identifier_names
// ignore_for_file: one_member_abstracts
// ignore_for_file: prefer_constructors_over_static_methods
// ignore_for_file: prefer_single_quotes
// ignore_for_file: public_member_api_docs
// ignore_for_file: unused_import
// ignore_for_file: unused_local_variable
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: library_prefixes
// ignore_for_file: prefer_typing_uninitialized_variables
// ignore_for_file: avoid_js_rounded_ints
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: prefer_generic_function_type_aliases
// ignore_for_file: prefer_equal_for_default_values
// ignore_for_file: avoid_catches_without_on_clauses
// ignore_for_file: unused_shown_name
// ignore_for_file: unnecessary_lambdas
// ignore_for_file: comment_references
// ignore_for_file: avoid_unused_constructor_parameters
// ignore_for_file: prefer_interpolation_to_compose_strings
// ignore: unused_element, avoid_private_typedef_functions
typedef _VoidCallback = void Function();
// methodOnFirst: ()
const int _kFirstProtocol_MethodOnFirst_Ordinal = 0x5b76bb4db7c2bba4;
const $fidl.MethodType _kFirstProtocol_MethodOnFirst_Type = $fidl.MethodType(
request: [],
response: [],
name: r"FirstProtocol.MethodOnFirst",
requestInlineSize: 0,
responseInlineSize: 0,
);
abstract class FirstProtocol {
$fidl.ServiceData? get $serviceData => FirstProtocolData();
$async.Future<void> methodOnFirst();
}
// TODO: Remove ServiceData for non-service
class FirstProtocolData implements $fidl.ServiceData<FirstProtocol> {
const FirstProtocolData();
@override
String getName() {
return "";
}
@override
$fidl.AsyncBinding getBinding() {
return FirstProtocolBinding();
}
}
class FirstProtocolProxy extends $fidl.AsyncProxy<FirstProtocol>
implements FirstProtocol {
FirstProtocolProxy()
: super($fidl.AsyncProxyController<FirstProtocol>(
$interfaceName: r'FirstProtocol')) {
ctrl.onResponse = _handleResponse;
}
@override
Null get $serviceData => null;
void _handleEvent($fidl.Message $message) {
switch ($message.ordinal) {
default:
ctrl.proxyError(
$fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
ctrl.close();
break;
}
}
void _handleResponse($fidl.Message $message) {
final int $txid = $message.txid;
if ($txid == 0) {
_handleEvent($message);
return;
}
final $async.Completer? $completer = ctrl.getCompleter($txid);
if ($completer == null) {
$message.closeHandles();
return;
}
switch ($message.ordinal) {
default:
ctrl.proxyError(
$fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
ctrl.close();
break;
}
}
@override
$async.Future<void> methodOnFirst() async {
if (!ctrl.isBound) {
return $async.Future.error(
$fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'),
StackTrace.current);
}
final $fidl.Encoder $encoder = $fidl.Encoder();
$encoder.encodeMessageHeader(_kFirstProtocol_MethodOnFirst_Ordinal, 0);
return $async.Future.sync(() {
ctrl.sendMessage($encoder.message);
});
}
}
class FirstProtocolBinding extends $fidl.AsyncBinding<FirstProtocol> {
FirstProtocolBinding() : super(r"FirstProtocol");
@override
void handleMessage($fidl.Message $message, $fidl.MessageSink $respond) {
switch ($message.ordinal) {
case _kFirstProtocol_MethodOnFirst_Ordinal:
final String _name = _kFirstProtocol_MethodOnFirst_Type.name;
try {
Timeline.startSync(_name);
final List<$fidl.MemberType> $types =
_kFirstProtocol_MethodOnFirst_Type.request!;
// ignore: prefer_const_declarations
final _impl = impl!;
final $async.Future<void> $future = $fidl
.decodeMessageWithCallback<$async.Future<void>>($message,
_kFirstProtocol_MethodOnFirst_Type.decodeRequestInlineSize(),
($fidl.Decoder decoder) {
return _impl.methodOnFirst();
});
} catch (_e) {
close();
print('Exception handling method call $_name: $_e');
rethrow;
} finally {
Timeline.finishSync();
}
break;
default:
throw $fidl.FidlError(
r'Unexpected message name for FirstProtocolBinding');
}
}
}
// methodOnSecond: ()
const int _kSecondProtocol_MethodOnSecond_Ordinal = 0x54ea6448c1555a29;
const $fidl.MethodType _kSecondProtocol_MethodOnSecond_Type = $fidl.MethodType(
request: [],
response: [],
name: r"SecondProtocol.MethodOnSecond",
requestInlineSize: 0,
responseInlineSize: 0,
);
abstract class SecondProtocol {
$fidl.ServiceData? get $serviceData => SecondProtocolData();
$async.Future<void> methodOnSecond();
}
// TODO: Remove ServiceData for non-service
class SecondProtocolData implements $fidl.ServiceData<SecondProtocol> {
const SecondProtocolData();
@override
String getName() {
return "";
}
@override
$fidl.AsyncBinding getBinding() {
return SecondProtocolBinding();
}
}
class SecondProtocolProxy extends $fidl.AsyncProxy<SecondProtocol>
implements SecondProtocol {
SecondProtocolProxy()
: super($fidl.AsyncProxyController<SecondProtocol>(
$interfaceName: r'SecondProtocol')) {
ctrl.onResponse = _handleResponse;
}
@override
Null get $serviceData => null;
void _handleEvent($fidl.Message $message) {
switch ($message.ordinal) {
default:
ctrl.proxyError(
$fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
ctrl.close();
break;
}
}
void _handleResponse($fidl.Message $message) {
final int $txid = $message.txid;
if ($txid == 0) {
_handleEvent($message);
return;
}
final $async.Completer? $completer = ctrl.getCompleter($txid);
if ($completer == null) {
$message.closeHandles();
return;
}
switch ($message.ordinal) {
default:
ctrl.proxyError(
$fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
ctrl.close();
break;
}
}
@override
$async.Future<void> methodOnSecond() async {
if (!ctrl.isBound) {
return $async.Future.error(
$fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'),
StackTrace.current);
}
final $fidl.Encoder $encoder = $fidl.Encoder();
$encoder.encodeMessageHeader(_kSecondProtocol_MethodOnSecond_Ordinal, 0);
return $async.Future.sync(() {
ctrl.sendMessage($encoder.message);
});
}
}
class SecondProtocolBinding extends $fidl.AsyncBinding<SecondProtocol> {
SecondProtocolBinding() : super(r"SecondProtocol");
@override
void handleMessage($fidl.Message $message, $fidl.MessageSink $respond) {
switch ($message.ordinal) {
case _kSecondProtocol_MethodOnSecond_Ordinal:
final String _name = _kSecondProtocol_MethodOnSecond_Type.name;
try {
Timeline.startSync(_name);
final List<$fidl.MemberType> $types =
_kSecondProtocol_MethodOnSecond_Type.request!;
// ignore: prefer_const_declarations
final _impl = impl!;
final $async.Future<void> $future = $fidl
.decodeMessageWithCallback<$async.Future<void>>(
$message,
_kSecondProtocol_MethodOnSecond_Type
.decodeRequestInlineSize(), ($fidl.Decoder decoder) {
return _impl.methodOnSecond();
});
} catch (_e) {
close();
print('Exception handling method call $_name: $_e');
rethrow;
} finally {
Timeline.finishSync();
}
break;
default:
throw $fidl.FidlError(
r'Unexpected message name for SecondProtocolBinding');
}
}
}