pub struct EmulatorControllerClient<T> { /* private fields */ }Expand description
An EmulatorController service lets you control the emulator. Note that this is currently an experimental feature, and that the service definition might change without notice. Use at your own risk!
We use the following rough conventions:
streamXXX –> streams values XXX (usually for emulator lifetime). Values are updated as soon as they become available. getXXX –> gets a single value XXX setXXX –> sets a single value XXX, does not returning state, these usually have an observable lasting side effect. sendXXX –> send a single event XXX, possibly returning state information. android usually responds to these events.
Implementations§
Source§impl<T> EmulatorControllerClient<T>where
T: GrpcService<Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
impl<T> EmulatorControllerClient<T>where
T: GrpcService<Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
pub fn new(inner: T) -> Self
pub fn with_origin(inner: T, origin: Uri) -> Self
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> EmulatorControllerClient<InterceptedService<T, F>>where
F: Interceptor,
T::ResponseBody: Default,
T: Service<Request<Body>, Response = Response<<T as GrpcService<Body>>::ResponseBody>>,
<T as Service<Request<Body>>>::Error: Into<StdError> + Send + Sync,
Sourcepub fn send_compressed(self, encoding: CompressionEncoding) -> Self
pub fn send_compressed(self, encoding: CompressionEncoding) -> Self
Compress requests with the given encoding.
This requires the server to support it otherwise it might respond with an error.
Sourcepub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
Enable decompressing responses.
Sourcepub fn max_decoding_message_size(self, limit: usize) -> Self
pub fn max_decoding_message_size(self, limit: usize) -> Self
Limits the maximum size of a decoded message.
Default: 4MB
Sourcepub fn max_encoding_message_size(self, limit: usize) -> Self
pub fn max_encoding_message_size(self, limit: usize) -> Self
Limits the maximum size of an encoded message.
Default: usize::MAX
Sourcepub async fn stream_sensor(
&mut self,
request: impl IntoRequest<SensorValue>,
) -> Result<Response<Streaming<SensorValue>>, Status>
pub async fn stream_sensor( &mut self, request: impl IntoRequest<SensorValue>, ) -> Result<Response<Streaming<SensorValue>>, Status>
set/get/stream the sensor data
pub async fn get_sensor( &mut self, request: impl IntoRequest<SensorValue>, ) -> Result<Response<SensorValue>, Status>
pub async fn set_sensor( &mut self, request: impl IntoRequest<SensorValue>, ) -> Result<Response<()>, Status>
Sourcepub async fn set_physical_model(
&mut self,
request: impl IntoRequest<PhysicalModelValue>,
) -> Result<Response<()>, Status>
pub async fn set_physical_model( &mut self, request: impl IntoRequest<PhysicalModelValue>, ) -> Result<Response<()>, Status>
set/get/stream the physical model, this is likely the one you are looking for when you wish to modify the device state.
pub async fn get_physical_model( &mut self, request: impl IntoRequest<PhysicalModelValue>, ) -> Result<Response<PhysicalModelValue>, Status>
pub async fn stream_physical_model( &mut self, request: impl IntoRequest<PhysicalModelValue>, ) -> Result<Response<Streaming<PhysicalModelValue>>, Status>
Sourcepub async fn set_clipboard(
&mut self,
request: impl IntoRequest<ClipData>,
) -> Result<Response<()>, Status>
pub async fn set_clipboard( &mut self, request: impl IntoRequest<ClipData>, ) -> Result<Response<()>, Status>
Atomically set/get the current primary clipboard data. Note that a call to setClipboard will result in an immediate event for those who made a call to streamClipboard and are on a different channel than the one used to set the clipboard.
pub async fn get_clipboard( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<ClipData>, Status>
Sourcepub async fn stream_clipboard(
&mut self,
request: impl IntoRequest<()>,
) -> Result<Response<Streaming<ClipData>>, Status>
pub async fn stream_clipboard( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<Streaming<ClipData>>, Status>
Streams the current data on the clipboard. This will immediately produce a result with the current state of the clipboard after which the stream will block and wait until a new clip event is available from the guest. Calling the setClipboard method above will not result in generating a clip event. It is possible to lose clipboard events if the clipboard updates very rapidly.
Sourcepub async fn set_battery(
&mut self,
request: impl IntoRequest<BatteryState>,
) -> Result<Response<()>, Status>
pub async fn set_battery( &mut self, request: impl IntoRequest<BatteryState>, ) -> Result<Response<()>, Status>
Set/get the battery to the given state.
pub async fn get_battery( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<BatteryState>, Status>
Sourcepub async fn set_gps(
&mut self,
request: impl IntoRequest<GpsState>,
) -> Result<Response<()>, Status>
pub async fn set_gps( &mut self, request: impl IntoRequest<GpsState>, ) -> Result<Response<()>, Status>
Set the state of the gps. Note: Setting the gps position will not be reflected in the user interface. Keep in mind that android usually only samples the gps at 1 hz.
Sourcepub async fn get_gps(
&mut self,
request: impl IntoRequest<()>,
) -> Result<Response<GpsState>, Status>
pub async fn get_gps( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<GpsState>, Status>
Gets the latest gps state as delivered by the setGps call, or location ui if active.
Note: this is not necessarily the actual gps coordinate visible at the time, due to gps sample frequency (usually 1hz).
Sourcepub async fn send_fingerprint(
&mut self,
request: impl IntoRequest<Fingerprint>,
) -> Result<Response<()>, Status>
pub async fn send_fingerprint( &mut self, request: impl IntoRequest<Fingerprint>, ) -> Result<Response<()>, Status>
Simulate a touch event on the finger print sensor.
Sourcepub async fn send_key(
&mut self,
request: impl IntoRequest<KeyboardEvent>,
) -> Result<Response<()>, Status>
pub async fn send_key( &mut self, request: impl IntoRequest<KeyboardEvent>, ) -> Result<Response<()>, Status>
Send a keyboard event. Translating the event.
Sourcepub async fn send_touch(
&mut self,
request: impl IntoRequest<TouchEvent>,
) -> Result<Response<()>, Status>
pub async fn send_touch( &mut self, request: impl IntoRequest<TouchEvent>, ) -> Result<Response<()>, Status>
Send touch/mouse events. Note that mouse events can be simulated by touch events.
pub async fn send_mouse( &mut self, request: impl IntoRequest<MouseEvent>, ) -> Result<Response<()>, Status>
pub async fn inject_wheel( &mut self, request: impl IntoStreamingRequest<Message = WheelEvent>, ) -> Result<Response<()>, Status>
Sourcepub async fn stream_input_event(
&mut self,
request: impl IntoStreamingRequest<Message = InputEvent>,
) -> Result<Response<()>, Status>
pub async fn stream_input_event( &mut self, request: impl IntoStreamingRequest<Message = InputEvent>, ) -> Result<Response<()>, Status>
Stream a series of input events to the emulator, the events will arrive in order.
Sourcepub async fn send_phone(
&mut self,
request: impl IntoRequest<PhoneCall>,
) -> Result<Response<PhoneResponse>, Status>
pub async fn send_phone( &mut self, request: impl IntoRequest<PhoneCall>, ) -> Result<Response<PhoneResponse>, Status>
Make a phone call.
Sourcepub async fn send_sms(
&mut self,
request: impl IntoRequest<SmsMessage>,
) -> Result<Response<PhoneResponse>, Status>
pub async fn send_sms( &mut self, request: impl IntoRequest<SmsMessage>, ) -> Result<Response<PhoneResponse>, Status>
Sends an sms message to the emulator.
Sourcepub async fn set_phone_number(
&mut self,
request: impl IntoRequest<PhoneNumber>,
) -> Result<Response<PhoneResponse>, Status>
pub async fn set_phone_number( &mut self, request: impl IntoRequest<PhoneNumber>, ) -> Result<Response<PhoneResponse>, Status>
Sends an sms message to the emulator.
Sourcepub async fn get_status(
&mut self,
request: impl IntoRequest<()>,
) -> Result<Response<EmulatorStatus>, Status>
pub async fn get_status( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<EmulatorStatus>, Status>
Retrieve the status of the emulator. This will contain general hardware information, and whether the device has booted or not.
Sourcepub async fn get_screenshot(
&mut self,
request: impl IntoRequest<ImageFormat>,
) -> Result<Response<Image>, Status>
pub async fn get_screenshot( &mut self, request: impl IntoRequest<ImageFormat>, ) -> Result<Response<Image>, Status>
Gets an individual screenshot in the desired format.
The image will be scaled to the desired ImageFormat, while maintaining the aspect ratio. The returned image will never exceed resolution of the device display. Not setting the width or height (i.e. they are 0) will result in using the display width and height.
The resulting image will be properly oriented and can be displayed directly without post processing. For example, if the device has a 1080x1920 screen and is in landscape mode and called with no width or height parameter, it will return a 1920x1080 image.
The dimensions of the returned image will never exceed the corresponding display dimensions. For example, this method will return a 1920x1080 screenshot, if the display resolution is 1080x1920 and a screenshot of 2048x2048 is requested when the device is in landscape mode.
This method will return an empty image if the display is not visible.
Sourcepub async fn stream_screenshot(
&mut self,
request: impl IntoRequest<ImageFormat>,
) -> Result<Response<Streaming<Image>>, Status>
pub async fn stream_screenshot( &mut self, request: impl IntoRequest<ImageFormat>, ) -> Result<Response<Streaming<Image>>, Status>
Streams a series of screenshots in the desired format.
A new frame will be delivered whenever the device produces a new frame. Beware that this can produce a significant amount of data and that certain translations can be very costly. For example, streaming a series of png images is very cpu intensive.
Images are produced according to the getScreenshot API described above.
If the display is inactive, or becomes inactive, an empty image will be delivered. Images will be delived again if the display becomes active and new frames are produced.
Sourcepub async fn stream_audio(
&mut self,
request: impl IntoRequest<AudioFormat>,
) -> Result<Response<Streaming<AudioPacket>>, Status>
pub async fn stream_audio( &mut self, request: impl IntoRequest<AudioFormat>, ) -> Result<Response<Streaming<AudioPacket>>, Status>
Streams a series of audio packets in the desired format. A new frame will be delivered whenever the emulated device produces a new audio frame. You can expect packets to be delivered in intervals of 20-30ms.
Be aware that this can block when the emulator does not produce any audio whatsoever!
Sourcepub async fn inject_audio(
&mut self,
request: impl IntoStreamingRequest<Message = AudioPacket>,
) -> Result<Response<()>, Status>
pub async fn inject_audio( &mut self, request: impl IntoStreamingRequest<Message = AudioPacket>, ) -> Result<Response<()>, Status>
Injects a series of audio packets to the android microphone. A new frame will be delivered whenever the emulated device requests a new audio frame. Audio is usually delivered at a rate that the emulator is requesting frames. Audio will be stored in a temporary buffer that can hold 300ms of audio.
Notes:
-
Only the first audio format packet that is delivered will be honored. There is no need to send the audio format multiple times.
-
Real time audio currently immediately overrides the buffer. This means you must provide a constant rate of audio packets. The real time mode is experimental. Timestamps of audio packets might be used in the future to improve synchronization.
-
INVALID_ARGUMENT (code 3) The sampling rate was too high/low
-
INVALID_ARGUMENT (code 3) The audio packet was too large to handle.
-
FAILED_PRECONDITION (code 9) If there was a microphone registered already.
Sourcepub async fn get_logcat(
&mut self,
request: impl IntoRequest<LogMessage>,
) -> Result<Response<LogMessage>, Status>
👎Deprecated
pub async fn get_logcat( &mut self, request: impl IntoRequest<LogMessage>, ) -> Result<Response<LogMessage>, Status>
Deprecated, please use the streamLogcat method instead.
Sourcepub async fn stream_logcat(
&mut self,
request: impl IntoRequest<LogMessage>,
) -> Result<Response<Streaming<LogMessage>>, Status>
pub async fn stream_logcat( &mut self, request: impl IntoRequest<LogMessage>, ) -> Result<Response<Streaming<LogMessage>>, Status>
Streams the logcat output from the emulator. Note that parsed logcat messages are only available after L (Api >23)
Sourcepub async fn set_vm_state(
&mut self,
request: impl IntoRequest<VmRunState>,
) -> Result<Response<()>, Status>
pub async fn set_vm_state( &mut self, request: impl IntoRequest<VmRunState>, ) -> Result<Response<()>, Status>
Transition the virtual machine to the desired state. Note that some states are only observable. For example you cannot transition to the error state.
Sourcepub async fn get_vm_state(
&mut self,
request: impl IntoRequest<()>,
) -> Result<Response<VmRunState>, Status>
pub async fn get_vm_state( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<VmRunState>, Status>
Gets the state of the virtual machine.
Sourcepub async fn set_display_configurations(
&mut self,
request: impl IntoRequest<DisplayConfigurations>,
) -> Result<Response<DisplayConfigurations>, Status>
pub async fn set_display_configurations( &mut self, request: impl IntoRequest<DisplayConfigurations>, ) -> Result<Response<DisplayConfigurations>, Status>
Atomically changes the current multi-display configuration. After this call the given display configurations will be activated. You can only update secondary displays. Displays with id 0 will be ignored.
This call can result in the removal or addition of secondary displays, the final display state can be observed by the returned configuration.
The following gRPC error codes can be returned:
- FAILED_PRECONDITION (code 9) if the AVD does not support a configurable secondary display.
- INVALID_ARGUMENT (code 3) if:
- The same display id is defined multiple times.
- The display configurations are outside valid ranges. See DisplayConfiguration for details on valid ranges.
- INTERNAL (code 13) if there was an internal emulator failure.
Sourcepub async fn get_display_configurations(
&mut self,
request: impl IntoRequest<()>,
) -> Result<Response<DisplayConfigurations>, Status>
pub async fn get_display_configurations( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<DisplayConfigurations>, Status>
Returns all currently valid logical displays.
The gRPC error code FAILED_PRECONDITION (code 9) is returned if the AVD does not support a configurable secondary display.
Sourcepub async fn stream_notification(
&mut self,
request: impl IntoRequest<()>,
) -> Result<Response<Streaming<Notification>>, Status>
pub async fn stream_notification( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<Streaming<Notification>>, Status>
Notifies client of the following changes:
- Virtual scene camera status change.
- Display configuration changes from extended ui. This will only be fired if the user makes modifications the extended displays through the extended control tab.
Note that this method will send the initial virtual scene state immediately.
Sourcepub async fn rotate_virtual_scene_camera(
&mut self,
request: impl IntoRequest<RotationRadian>,
) -> Result<Response<()>, Status>
pub async fn rotate_virtual_scene_camera( &mut self, request: impl IntoRequest<RotationRadian>, ) -> Result<Response<()>, Status>
Rotation angles are relative to the camera’s current orientation. The coordinate system is right-handed and is defined as follows: x axis is pointing right y axis is pointing up z axis is pointing towards the viewer The z component of rotation is not used when calling this method.
Sourcepub async fn set_virtual_scene_camera_velocity(
&mut self,
request: impl IntoRequest<Velocity>,
) -> Result<Response<()>, Status>
pub async fn set_virtual_scene_camera_velocity( &mut self, request: impl IntoRequest<Velocity>, ) -> Result<Response<()>, Status>
Velocity is absolute and is measured in meters per second. The coordinate system is right-handed and is defined as follows: x axis is pointing right y axis is pointing up z axis is pointing towards the viewer
Sourcepub async fn set_posture(
&mut self,
request: impl IntoRequest<Posture>,
) -> Result<Response<()>, Status>
pub async fn set_posture( &mut self, request: impl IntoRequest<Posture>, ) -> Result<Response<()>, Status>
Set foldable posture
Sourcepub async fn get_brightness(
&mut self,
request: impl IntoRequest<BrightnessValue>,
) -> Result<Response<BrightnessValue>, Status>
pub async fn get_brightness( &mut self, request: impl IntoRequest<BrightnessValue>, ) -> Result<Response<BrightnessValue>, Status>
Get the backlight brightness. The following gRPC error codes can be returned:
- FAILED_PRECONDITION (code 9) if the AVD does not support hw-control.
Sourcepub async fn set_brightness(
&mut self,
request: impl IntoRequest<BrightnessValue>,
) -> Result<Response<()>, Status>
pub async fn set_brightness( &mut self, request: impl IntoRequest<BrightnessValue>, ) -> Result<Response<()>, Status>
Set the backlight brightness. The following gRPC error codes can be returned:
- FAILED_PRECONDITION (code 9) if the AVD does not support hw-control.
- INVALID_ARGUMENT (code 3) The brightness exceeds the valid range.
Sourcepub async fn get_display_mode(
&mut self,
request: impl IntoRequest<()>,
) -> Result<Response<DisplayMode>, Status>
pub async fn get_display_mode( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<DisplayMode>, Status>
Returns the current mode of the primary display of a resizable AVD. The following gRPC error codes can be returned:
- FAILED_PRECONDITION (code 9) if the AVD is not resizable.
Sourcepub async fn set_display_mode(
&mut self,
request: impl IntoRequest<DisplayMode>,
) -> Result<Response<()>, Status>
pub async fn set_display_mode( &mut self, request: impl IntoRequest<DisplayMode>, ) -> Result<Response<()>, Status>
Sets the size of the primary display of a resizable AVD. Fails if the AVD is not resizable. The following gRPC error codes can be returned:
- FAILED_PRECONDITION (code 9) if the AVD is not resizable.
Trait Implementations§
Source§impl<T: Clone> Clone for EmulatorControllerClient<T>
impl<T: Clone> Clone for EmulatorControllerClient<T>
Source§fn clone(&self) -> EmulatorControllerClient<T>
fn clone(&self) -> EmulatorControllerClient<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<T> !Freeze for EmulatorControllerClient<T>
impl<T> RefUnwindSafe for EmulatorControllerClient<T>where
T: RefUnwindSafe,
impl<T> Send for EmulatorControllerClient<T>where
T: Send,
impl<T> Sync for EmulatorControllerClient<T>where
T: Sync,
impl<T> Unpin for EmulatorControllerClient<T>where
T: Unpin,
impl<T> UnwindSafe for EmulatorControllerClient<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request