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