| // 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.ffx; |
| using zx; |
| using fuchsia.io; |
| |
| type DaemonError = strict enum { |
| TARGET_CACHE_ERROR = 1; |
| TARGET_STATE_ERROR = 2; |
| RCS_CONNECTION_ERROR = 3; |
| /// A generic timeout error. |
| TIMEOUT = 4; |
| |
| /// When querying for a target, the cache was empty. |
| TARGET_CACHE_EMPTY = 5; |
| /// When querying for a target (specified or not), there were |
| /// too many matches to be clear on which target was the intent |
| /// of the query. |
| TARGET_AMBIGUOUS = 6; |
| /// When querying for a target, no matches were found. |
| TARGET_NOT_FOUND = 7; |
| /// When attempting to connect to RCS on a Fastboot device. |
| TARGET_IN_FASTBOOT = 8; |
| /// Fastboot device expected. |
| NON_FASTBOOT_DEVICE = 9; |
| /// When attempting to use a protocol that is not supported on the daemon. |
| PROTOCOL_NOT_FOUND = 10; |
| /// An error was encountered when attempting to open a protocol stream. |
| PROTOCOL_OPEN_ERROR = 11; |
| /// An error encountered when the daemon's protocol register is in a bad |
| /// state internally. This is primarily caused by trying to open a protocol |
| /// while the daaemon is actively shutting down, and should be extremely |
| /// rare. |
| BAD_PROTOCOL_REGISTER_STATE = 12; |
| /// When attempting to connect to RCS on a Fastboot device. |
| TARGET_IN_ZEDBOOT = 13; |
| }; |
| |
| @discoverable |
| protocol Daemon { |
| /// Requests for the Daemon to exit. Receives 'true' to indicate the request |
| /// was received and the Daemon will then shut down shortly thereafter. |
| Quit() -> (struct { |
| success bool; |
| }); |
| |
| // Retrieves version information about this daemon instance. |
| GetVersionInfo() -> (struct { |
| info VersionInfo; |
| }); |
| |
| /// Connects to a daemon protocol. |
| /// |
| /// Takes a protocol name under which the channel will be connected (the |
| /// caller is intended to know the type of the channel a priori). |
| /// |
| /// Developers are not intended to use this directly. Instead this should |
| /// be invoked automatically through the FFX plugin/protocol framework. |
| /// |
| /// Again for emphasis: if you are a developer and you are invoking this |
| /// function directly, you should reconsider your actions. |
| ConnectToProtocol(resource struct { |
| name fuchsia.io.Name; |
| server_end zx.handle:CHANNEL; |
| }) -> (struct {}) error DaemonError; |
| }; |