|  | // Copyright 2019 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 fuchsia.developer.bridge; | 
|  | using fuchsia.developer.remotecontrol as rc; | 
|  | using fuchsia.device; | 
|  | using zx; | 
|  |  | 
|  | enum DaemonError { | 
|  | TARGET_CACHE_ERROR = 1; | 
|  | TARGET_STATE_ERROR = 2; | 
|  | RCS_CONNECTION_ERROR = 3; | 
|  | /// A generic timeout error. | 
|  | TIMEOUT = 4; | 
|  | }; | 
|  |  | 
|  | [Discoverable] | 
|  | protocol Daemon { | 
|  | /// Crashes the daemon. Primarily used for testing. | 
|  | Crash() -> (); | 
|  |  | 
|  | /// Returns the input. | 
|  | EchoString(string:256 value) -> (string:256 response); | 
|  |  | 
|  | /// Lists targets by nodename. | 
|  | /// TODO(fxbug.dev/52798): Use an iterator instead of a limited vector. | 
|  | ListTargets(string:fuchsia.device.DEVICE_NAME_MAX value) -> (vector<Target>:512 response); | 
|  |  | 
|  | /// Make the daemon exit. | 
|  | Quit() -> (bool success); | 
|  |  | 
|  | /// Gets a remote control proxy for the given target. | 
|  | /// The target param expects an exact match with a target's | 
|  | /// nodename. | 
|  | GetRemoteControl( | 
|  | string:fuchsia.device.DEVICE_NAME_MAX target, | 
|  | request<rc.RemoteControl> remote) -> () error DaemonError; | 
|  |  | 
|  | /// Gets a fastboot proxy for the given target. | 
|  | /// The target param expects an exact match with a target's | 
|  | /// nodename. | 
|  | GetFastboot( | 
|  | string:fuchsia.device.DEVICE_NAME_MAX target, | 
|  | request<Fastboot> fastboot) -> () error FastbootError; | 
|  |  | 
|  | /// Attempts to get the SSH address for a given target. | 
|  | /// | 
|  | /// Waits for: | 
|  | /// 1.) A target of the given nodename to appear (if it hasn't already). | 
|  | /// 2.) For the target to have an SSH-friendly address. | 
|  | /// | 
|  | /// Returns: | 
|  | /// * First address found for the target that satisfies step 2. | 
|  | /// | 
|  | /// Errors: | 
|  | /// * Timeout error if steps 1 and 2 don't happen in time. | 
|  | /// * Cache error if a target has appeared but suddenly disappears before | 
|  | ///   running the function to completion. | 
|  | GetSshAddress(string:fuchsia.device.DEVICE_NAME_MAX target, zx.duration timeout) | 
|  | -> (TargetAddrInfo ip) error DaemonError; | 
|  | }; |