1// Copyright 2018 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5library fidl.test.spaceship; 6 7using zx; 8 9// StarData is 16 bytes, all inline. 10struct StarData { 11 array<uint8>:16 data; 12}; 13 14// PlanetData is 4 bytes, all inline. 15struct PlanetData { 16 array<uint8>:4 data; 17}; 18 19// AstrologicalData is 20 bytes long, i.e. tag of 4 bytes + max(4, 16). 20union AstrologicalData { 21 StarData star; 22 PlanetData planet; 23}; 24 25[Layout = "Simple"] 26interface AstrometricsListener { 27 1: OnNova(); 28}; 29 30enum Alert { 31 GREEN = 1; 32 YELLOW = 2; 33 RED = 3; 34}; 35 36struct FuelLevel { 37 uint32 reaction_mass; 38}; 39 40struct ZxTypes { 41 zx.status a; 42 zx.time b; 43 zx.duration c; 44 zx.koid d; 45 zx.vaddr e; 46 zx.paddr f; 47 zx.paddr32 g; 48 zx.off h; 49}; 50 51const uint32 MaxStarsAdjustHeading = 64; 52const uint32 MaxStarsScanForLifeforms = 64; 53 54[Layout = "Simple"] 55interface SpaceShip { 56 1: AdjustHeading(vector<uint32>:MaxStarsAdjustHeading stars) -> (int8 result); 57 2: ScanForLifeforms() -> (vector<uint32>:MaxStarsScanForLifeforms lifesigns); 58 3: SetAstrometricsListener(AstrometricsListener listener); 59 4: SetDefenseCondition(Alert alert); 60 5: GetFuelRemaining(handle<eventpair>? cancel) -> (zx.status status, FuelLevel? level); 61 6: AddFuelTank(FuelLevel? level) -> (uint32 consumed); 62 7: ScanForTensorLifeforms() -> (array<array<array<uint32>:3>:5>:8 lifesigns); 63 8: ReportAstrologicalData(AstrologicalData data) -> (zx.status status); 64}; 65