| // WARNING: This file is machine generated by fidlgen. |
| // @dart = 2.12 |
| |
| // fidl_experiment = no_optional_structs |
| // fidl_experiment = output_index_json |
| // fidl_experiment = simple_empty_response_syntax |
| // fidl_experiment = unknown_interactions |
| // fidl_experiment = unknown_interactions_mandate |
| |
| library 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: directives_ordering |
| // 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_for_file: override_on_non_overriding_member |
| |
| // methodOnFirst: () |
| const int _kFirstProtocol_MethodOnFirst_Ordinal = 0x5828c91b57492931; |
| const $fidl.MethodType _kFirstProtocol_MethodOnFirst_Type = $fidl.MethodType( |
| request: [], |
| response: [], |
| name: r"FirstProtocol.MethodOnFirst", |
| requestInlineSizeV2: 0, |
| responseInlineSizeV2: 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.IncomingMessage $message) { |
| switch ($message.ordinal) { |
| default: |
| $message.closeHandles(); |
| ctrl.proxyError( |
| $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}')); |
| break; |
| } |
| } |
| |
| void _handleResponse($fidl.IncomingMessage $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}')); |
| break; |
| } |
| } |
| |
| @override |
| $async.Future<void> methodOnFirst() { |
| if (!ctrl.isBound) { |
| return $async.Future.error( |
| $fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'), |
| StackTrace.current); |
| } |
| |
| final $fidl.Encoder $encoder = $fidl.Encoder($fidl.kWireFormatDefault); |
| $encoder.encodeMessageHeader( |
| _kFirstProtocol_MethodOnFirst_Ordinal, 0, $fidl.CallStrictness.strict); |
| return $async.Future.sync(() { |
| ctrl.sendMessage($encoder.message); |
| }); |
| } |
| } |
| |
| class FirstProtocolBinding extends $fidl.AsyncBinding<FirstProtocol> { |
| FirstProtocolBinding() : super(r"FirstProtocol"); |
| |
| @override |
| void handleMessage( |
| $fidl.IncomingMessage $message, $fidl.OutgoingMessageSink $respond) { |
| final $wireFormat = $message.parseWireFormat(); |
| switch ($message.ordinal) { |
| case _kFirstProtocol_MethodOnFirst_Ordinal: |
| final String _name = _kFirstProtocol_MethodOnFirst_Type.name; |
| $fidl.performWithExceptionHandling(_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.requestInlineSize( |
| $wireFormat), ($fidl.Decoder $decoder, int $offset) { |
| return _impl.methodOnFirst(); |
| }); |
| }, close); |
| break; |
| default: |
| $message.closeHandles(); |
| throw $fidl.FidlError( |
| r'Unexpected message name for FirstProtocolBinding'); |
| } |
| } |
| } |
| |
| // methodOnSecond: () |
| const int _kSecondProtocol_MethodOnSecond_Ordinal = 0x70b439758de25c44; |
| const $fidl.MethodType _kSecondProtocol_MethodOnSecond_Type = $fidl.MethodType( |
| request: [], |
| response: [], |
| name: r"SecondProtocol.MethodOnSecond", |
| requestInlineSizeV2: 0, |
| responseInlineSizeV2: 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.IncomingMessage $message) { |
| switch ($message.ordinal) { |
| default: |
| $message.closeHandles(); |
| ctrl.proxyError( |
| $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}')); |
| break; |
| } |
| } |
| |
| void _handleResponse($fidl.IncomingMessage $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}')); |
| break; |
| } |
| } |
| |
| @override |
| $async.Future<void> methodOnSecond() { |
| if (!ctrl.isBound) { |
| return $async.Future.error( |
| $fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'), |
| StackTrace.current); |
| } |
| |
| final $fidl.Encoder $encoder = $fidl.Encoder($fidl.kWireFormatDefault); |
| $encoder.encodeMessageHeader(_kSecondProtocol_MethodOnSecond_Ordinal, 0, |
| $fidl.CallStrictness.strict); |
| return $async.Future.sync(() { |
| ctrl.sendMessage($encoder.message); |
| }); |
| } |
| } |
| |
| class SecondProtocolBinding extends $fidl.AsyncBinding<SecondProtocol> { |
| SecondProtocolBinding() : super(r"SecondProtocol"); |
| |
| @override |
| void handleMessage( |
| $fidl.IncomingMessage $message, $fidl.OutgoingMessageSink $respond) { |
| final $wireFormat = $message.parseWireFormat(); |
| switch ($message.ordinal) { |
| case _kSecondProtocol_MethodOnSecond_Ordinal: |
| final String _name = _kSecondProtocol_MethodOnSecond_Type.name; |
| $fidl.performWithExceptionHandling(_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.requestInlineSize( |
| $wireFormat), ($fidl.Decoder $decoder, int $offset) { |
| return _impl.methodOnSecond(); |
| }); |
| }, close); |
| break; |
| default: |
| $message.closeHandles(); |
| throw $fidl.FidlError( |
| r'Unexpected message name for SecondProtocolBinding'); |
| } |
| } |
| } |