| // 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.remotecontrol; |
| |
| // This is copied from `fuchsia.sys.types`. |
| // Unfortunately we can't depend on it directly, |
| // because this protocol needs to build on the host. |
| const uint16 MAX_URL_LENGTH = 2083; |
| |
| enum RebootType { |
| // Standard reboot. |
| REBOOT = 1; |
| // Reboots into recovery mode. |
| RECOVERY = 2; |
| // Reboots into the bootloader. |
| BOOTLOADER = 3; |
| }; |
| |
| // TODO(fxb/42833): improve this API by making it async. |
| table RunComponentResponse { |
| // Component's exit code. |
| 1: int64 exit_code; |
| // stdout from the component. |
| // This would be called just 'stdout', except for fxb/42108. |
| 2: string:MAX component_stdout; |
| // stderr from the component. |
| // This would be called just 'stderr', except for fxb/42108. |
| 3: string:MAX component_stderr; |
| }; |
| |
| [Discoverable, FragileBase] |
| protocol RemoteControl { |
| // Starts a component and waits for it finish. |
| RunComponent( |
| // Name of the component to start. |
| string:MAX_URL_LENGTH component_url, |
| // Arguments to pass to the component. |
| vector<string:MAX>:MAX args |
| ) -> (RunComponentResponse response); |
| |
| // Starts a component asynchronously. |
| StartComponent( |
| // Name of the component to start. |
| string:MAX_URL_LENGTH component_url, |
| // Arguments to pass to the component. |
| vector<string:MAX>:MAX args, |
| // stdout from the component. |
| // This would be called just 'stdout', except for fxb/42108. |
| handle<socket> component_stdout, |
| // stderr from the component. |
| // This would be called just 'stderr', except for fxb/42108. |
| handle<socket> component_stderr, |
| request<ComponentController> controller |
| ) -> () error ComponentControlError; |
| |
| // This should be a fire-and-forget, but that seems to do |
| // nothing in Overnet. |
| // TODO(fxb/43011) look into this. |
| // TODO(fxb/43046) Add parameters for other reboot types. |
| RebootDevice(RebootType reboot_type) -> (); |
| }; |