blob: e4bd0e2e37eeff16a8d821aa375c417fb9f922ed [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// WARNING: This file is machine generated by fidlgen.
library fidl_test_name;
import 'dart:async';
import 'dart:developer';
import 'dart:typed_data';
import 'package:fidl/fidl.dart' as $fidl;
import 'package:meta/meta.dart';
import 'package:zircon/zircon.dart';
// These imports improve deduplication by making uses of {fidl.dart},
// {fidl_async.dart} and {fidl.dart, fidl_async.dart} generate equivalent
// packages. In AOT, the dead code will be removed by tree shaking.
// ignore: unused_import
import 'fidl_async.dart' as $strongly_connect_async;
// 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
abstract class SwitchingOrdinals {
static const String $serviceName = null;
void ordinalFive();
void onlyGeneratedOrdinal();
}
// ordinalFive: ()
const int _kSwitchingOrdinals_OrdinalFive_Ordinal = 2005164903;
const $fidl.MethodType _kSwitchingOrdinals_OrdinalFive_Type =
const $fidl.MethodType(
request: null,
response: null,
name: r"SwitchingOrdinals.OrdinalFive",
);
// onlyGeneratedOrdinal: ()
const int _kSwitchingOrdinals_OnlyGeneratedOrdinal_Ordinal = 667506719;
const $fidl.MethodType _kSwitchingOrdinals_OnlyGeneratedOrdinal_Type =
const $fidl.MethodType(
request: null,
response: null,
name: r"SwitchingOrdinals.OnlyGeneratedOrdinal",
);
// eventOrdinalFifteen: -> ()
const int _kSwitchingOrdinals_EventOrdinalFifteen_Ordinal = 1467258273;
const $fidl.MethodType _kSwitchingOrdinals_EventOrdinalFifteen_Type =
const $fidl.MethodType(
request: null,
response: null,
name: r"SwitchingOrdinals.EventOrdinalFifteen",
);
// eventOnlyGeneratedOrdinal: -> ()
const int _kSwitchingOrdinals_EventOnlyGeneratedOrdinal_Ordinal = 2146190926;
const $fidl.MethodType _kSwitchingOrdinals_EventOnlyGeneratedOrdinal_Type =
const $fidl.MethodType(
request: null,
response: null,
name: r"SwitchingOrdinals.EventOnlyGeneratedOrdinal",
);
typedef void SwitchingOrdinalsEventOrdinalFifteenCallback();
typedef void SwitchingOrdinalsEventOnlyGeneratedOrdinalCallback();
class SwitchingOrdinalsProxy extends $fidl.Proxy<SwitchingOrdinals>
implements SwitchingOrdinals {
SwitchingOrdinalsProxy()
: super(new $fidl.ProxyController<SwitchingOrdinals>(
$serviceName: null, $interfaceName: r'SwitchingOrdinals')) {
ctrl.onResponse = _handleResponse;
}
void _handleEvent($fidl.Message $message) {
final $fidl.Decoder $decoder = new $fidl.Decoder($message);
switch ($message.ordinal) {
case _kSwitchingOrdinals_EventOrdinalFifteen_Ordinal:
final String _name = _kSwitchingOrdinals_EventOrdinalFifteen_Type.name;
try {
Timeline.startSync(_name);
final Function $callback = eventOrdinalFifteen;
if ($callback == null) {
$message.closeHandles();
return;
}
final List<$fidl.MemberType> $types =
_kSwitchingOrdinals_EventOrdinalFifteen_Type.response;
$decoder.claimMemory(16);
$callback();
// ignore: avoid_catches_without_on_clauses
} catch (_e) {
ctrl.proxyError('Exception handling event $_name: $_e');
ctrl.close();
rethrow;
} finally {
Timeline.finishSync();
}
break;
case _kSwitchingOrdinals_EventOnlyGeneratedOrdinal_Ordinal:
final String _name =
_kSwitchingOrdinals_EventOnlyGeneratedOrdinal_Type.name;
try {
Timeline.startSync(_name);
final Function $callback = eventOnlyGeneratedOrdinal;
if ($callback == null) {
$message.closeHandles();
return;
}
final List<$fidl.MemberType> $types =
_kSwitchingOrdinals_EventOnlyGeneratedOrdinal_Type.response;
$decoder.claimMemory(16);
$callback();
// ignore: avoid_catches_without_on_clauses
} catch (_e) {
ctrl.proxyError('Exception handling event $_name: $_e');
ctrl.close();
rethrow;
} finally {
Timeline.finishSync();
}
break;
default:
ctrl.proxyError('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 Function $callback = ctrl.getCallback($txid);
if ($callback == null) {
$message.closeHandles();
return;
}
final $fidl.Decoder $decoder = new $fidl.Decoder($message);
switch ($message.ordinal) {
default:
ctrl.proxyError('Unexpected message ordinal: ${$message.ordinal}');
ctrl.close();
break;
}
}
@override
void ordinalFive() {
if (!ctrl.isBound) {
ctrl.proxyError('The proxy is closed.');
return;
}
final $fidl.Encoder $encoder = new $fidl.Encoder();
$encoder.encodeMessageHeader(_kSwitchingOrdinals_OrdinalFive_Ordinal, 0);
ctrl.sendMessage($encoder.message);
}
@override
void onlyGeneratedOrdinal() {
if (!ctrl.isBound) {
ctrl.proxyError('The proxy is closed.');
return;
}
final $fidl.Encoder $encoder = new $fidl.Encoder();
$encoder.encodeMessageHeader(
_kSwitchingOrdinals_OnlyGeneratedOrdinal_Ordinal, 0);
ctrl.sendMessage($encoder.message);
}
SwitchingOrdinalsEventOrdinalFifteenCallback eventOrdinalFifteen;
SwitchingOrdinalsEventOnlyGeneratedOrdinalCallback eventOnlyGeneratedOrdinal;
}
class SwitchingOrdinalsEvents {
$fidl.Binding<SwitchingOrdinals> _binding;
void eventOrdinalFifteen() {
final $fidl.Encoder $encoder = new $fidl.Encoder();
$encoder.encodeMessageHeader(
_kSwitchingOrdinals_EventOrdinalFifteen_Ordinal, 0);
_binding.sendMessage($encoder.message);
}
void eventOnlyGeneratedOrdinal() {
final $fidl.Encoder $encoder = new $fidl.Encoder();
$encoder.encodeMessageHeader(
_kSwitchingOrdinals_EventOnlyGeneratedOrdinal_Ordinal, 0);
_binding.sendMessage($encoder.message);
}
}
class SwitchingOrdinalsBinding extends $fidl.Binding<SwitchingOrdinals> {
SwitchingOrdinalsBinding() {
events._binding = this;
}
final SwitchingOrdinalsEvents events = new SwitchingOrdinalsEvents();
@override
void handleMessage($fidl.Message $message, $fidl.MessageSink $respond) {
final $fidl.Decoder $decoder = new $fidl.Decoder($message);
switch ($message.ordinal) {
case _kSwitchingOrdinals_OrdinalFive_Ordinal:
final String _name = _kSwitchingOrdinals_OrdinalFive_Type.name;
try {
Timeline.startSync(_name);
final List<$fidl.MemberType> $types =
_kSwitchingOrdinals_OrdinalFive_Type.request;
$decoder.claimMemory(16);
impl.ordinalFive();
// ignore: avoid_catches_without_on_clauses
} catch (_e) {
close();
print('Exception handling method call $_name: $_e');
rethrow;
} finally {
Timeline.finishSync();
}
break;
case _kSwitchingOrdinals_OnlyGeneratedOrdinal_Ordinal:
final String _name = _kSwitchingOrdinals_OnlyGeneratedOrdinal_Type.name;
try {
Timeline.startSync(_name);
final List<$fidl.MemberType> $types =
_kSwitchingOrdinals_OnlyGeneratedOrdinal_Type.request;
$decoder.claimMemory(16);
impl.onlyGeneratedOrdinal();
// ignore: avoid_catches_without_on_clauses
} catch (_e) {
close();
print('Exception handling method call $_name: $_e');
rethrow;
} finally {
Timeline.finishSync();
}
break;
default:
throw new $fidl.FidlError(
'Unexpected message name for SwitchingOrdinalsBinding');
}
}
}