| // 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.device; |
| using fuchsia.net; |
| using fuchsia.buildinfo; |
| |
| type TargetIp = struct { |
| ip fuchsia.net.IpAddress; |
| scope_id uint32; |
| }; |
| |
| type TargetIpPort = struct { |
| ip fuchsia.net.IpAddress; |
| scope_id uint32; |
| port uint16; |
| }; |
| |
| // TODO(awdavies): Add serial number. |
| type TargetAddrInfo = strict union { |
| 1: ip TargetIp; |
| 2: ip_port TargetIpPort; |
| }; |
| |
| // TODO(awdavies): Add more target states once they're more well defined. |
| type TargetState = strict enum { |
| UNKNOWN = 1; |
| DISCONNECTED = 2; |
| PRODUCT = 3; |
| FASTBOOT = 4; |
| ZEDBOOT = 5; |
| }; |
| |
| // TODO(awdavies): Add more target types. Hardware? Product state? |
| type TargetType = strict enum { |
| UNKNOWN = 1; |
| }; |
| |
| /// Current known state of the remote control |
| type RemoteControlState = strict enum { |
| UP = 1; |
| DOWN = 2; |
| UNKNOWN = 3; |
| }; |
| |
| type Target = table { |
| 1: nodename string:fuchsia.device.DEVICE_NAME_MAX; |
| 2: addresses vector<TargetAddrInfo>:256; |
| 3: age_ms uint64; |
| 4: rcs_state RemoteControlState; |
| 5: target_type TargetType; |
| 6: target_state TargetState; |
| // Contains the string used for the product in `fx set`, for example |
| // `fx set core.x64` would make this value "core". |
| 7: product_config string:fuchsia.buildinfo.MAX_STRING_LENGTH; |
| // Contains the string used for the board in `fx set`, for example |
| // `fx set core.x64` would make this value "x64". |
| 8: board_config string:fuchsia.buildinfo.MAX_STRING_LENGTH; |
| 9: serial_number string:256; |
| /// ssh_address is the preferred address to use to connect to the |
| /// device over SSH, and will include a port number if a custom SSH |
| /// port number has been set. |
| 10: ssh_address TargetAddrInfo; |
| }; |
| |
| type TargetRebootError = strict enum { |
| UNKNOWN = 1; |
| /// Cannot reboot from fastboot to recovery. |
| FASTBOOT_TO_RECOVERY = 2; |
| /// There was an Overnet communication issue with the target. |
| TARGET_COMMUNICATION = 3; |
| /// There was a Fastboot protocol communication issue with the |
| /// target. |
| FASTBOOT_COMMUNICATION = 4; |
| }; |
| |
| type TargetRebootState = strict enum { |
| PRODUCT = 1; |
| BOOTLOADER = 2; |
| RECOVERY = 3; |
| }; |
| |
| @discoverable |
| protocol TargetControl { |
| Reboot(struct { |
| state TargetRebootState; |
| }) -> (struct {}) error TargetRebootError; |
| }; |