blob: bcb12370c33f2594cc02d430373e43d043b508d8 [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.
library fidl.test.spaceship;
using zx;
// Having a service should not break C bindings.
service Galaxy {
astrometrics_listener client_end:AstrometricsListener;
ship1 client_end:SpaceShip;
ship2 client_end:UssEnterprise;
};
// StarData is 16 bytes, all inline.
type StarData = struct {
data array<uint8, 16>;
};
// PlanetData is 4 bytes, all inline.
type PlanetData = struct {
data array<uint8, 4>;
};
@for_deprecated_c_bindings
protocol AstrometricsListener {
OnNova();
};
type Alert = strict enum {
GREEN = 1;
YELLOW = 2;
RED = 3;
};
type Shields = strict bits : uint8 {
PORT = 1;
STARBOARD = 2;
FORE = 4;
AFT = 8;
};
@for_deprecated_c_bindings
type FuelLevel = struct {
reaction_mass uint32;
};
type ZxTypes = struct {
a zx.status;
b zx.time;
c zx.duration;
d zx.koid;
e zx.vaddr;
f zx.paddr;
g zx.paddr32;
h zx.off;
};
const MaxStarsAdjustHeading uint32 = 64;
const MaxStarsScanForLifeforms uint32 = 64;
@for_deprecated_c_bindings
protocol SpaceShip {
AdjustHeading(struct {
stars vector<uint32>:MaxStarsAdjustHeading;
}) -> (struct {
result int8;
});
ScanForLifeforms() -> (struct {
lifesigns vector<uint32>:MaxStarsScanForLifeforms;
});
SetAstrometricsListener(resource struct {
listener client_end:AstrometricsListener;
});
SetDefenseCondition(struct {
alert Alert;
});
GetFuelRemaining(resource struct {
cancel zx.handle:<EVENTPAIR, optional>;
}) -> (struct {
status zx.status;
level box<FuelLevel>;
});
AddFuelTank(struct {
level box<FuelLevel>;
}) -> (struct {
consumed uint32;
});
ScanForTensorLifeforms() -> (struct {
lifesigns array<array<array<uint32, 3>, 5>, 8>;
});
ActivateShields(struct {
shields Shields;
});
};
// Captain Kirk can do many things, possibly all at once.
type CaptainKirkWhereabouts = table {
1: is_exploring_new_worlds bool;
2: is_exploring_new_civilizations bool;
3: is_boldly_going_where_no_man_has_gone_before bool;
};
/// The USS Enterprise is far from simple.
protocol UssEnterprise {
WhereIsCaptainKirk() -> (struct {
whereabouts CaptainKirkWhereabouts;
});
};