Skip to main content

DeviceLocalServerHandler

Trait DeviceLocalServerHandler 

Source
pub trait DeviceLocalServerHandler<___T: Transport = DriverChannel> {
    // Required methods
    fn get_info(
        &mut self,
        responder: Responder<GetInfo, ___T>,
    ) -> impl Future<Output = ()>;
    fn config(
        &mut self,
        request: Request<Config, ___T>,
        responder: Responder<Config, ___T>,
    ) -> impl Future<Output = ()>;
    fn enable(
        &mut self,
        request: Request<Enable, ___T>,
        responder: Responder<Enable, ___T>,
    ) -> impl Future<Output = ()>;
    fn read(
        &mut self,
        responder: Responder<Read, ___T>,
    ) -> impl Future<Output = ()>;
    fn write(
        &mut self,
        request: Request<Write, ___T>,
        responder: Responder<Write, ___T>,
    ) -> impl Future<Output = ()>;
    fn cancel_all(
        &mut self,
        responder: Responder<CancelAll, ___T>,
    ) -> impl Future<Output = ()>;

    // Provided method
    fn on_unknown_interaction(
        &mut self,
        ordinal: u64,
    ) -> impl Future<Output = ()> { ... }
}
Expand description

A server handler for the Device protocol.

See Device for more details.

Required Methods§

Source

fn get_info( &mut self, responder: Responder<GetInfo, ___T>, ) -> impl Future<Output = ()>

Source

fn config( &mut self, request: Request<Config, ___T>, responder: Responder<Config, ___T>, ) -> impl Future<Output = ()>

Configures the given serial port. Values of flags are defined in the constants above.

  • error one of the following values:
  • `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is
  •                          transitioning to a low-power state.
  • Other values may be returned for driver- or device-specific errors.
Source

fn enable( &mut self, request: Request<Enable, ___T>, responder: Responder<Enable, ___T>, ) -> impl Future<Output = ()>

Enable or disable the device. If already enabled and enable is true, this is a no-op and returns successfully. If already disabled and enable is false, this is a no-op and returns successfully.

  • request enable true to enable the device, or false to disable it.
  • error one of the following values:
  • `ZX_ERR_BAD_STATE`: `enable` was false, and a `Read()` or `Write()` call was pending.
  • `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is
  •                          transitioning to a low-power state.
Source

fn read(&mut self, responder: Responder<Read, ___T>) -> impl Future<Output = ()>

Perform a read operation. Returns immediately if data has been received since the last call; otherwise the request is completed the next time data is received (clients can use the hanging-get pattern to be notified of new data).

  • response data the bytes read from the device.
  • error one of the following values:
  • `ZX_ERR_BAD_STATE`: The device was not enabled.
  • `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.
  • `ZX_ERR_ALREADY_BOUND`: Another `Read()` call was already pending.
  • `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is
  •                          transitioning to a low-power state.
  • Other values may be returned for driver- or device-specific errors.
Source

fn write( &mut self, request: Request<Write, ___T>, responder: Responder<Write, ___T>, ) -> impl Future<Output = ()>

Perform a write operation. Returns when all bytes have been written, or when an error is encountered.

  • request data the bytes to write to the device.
  • error one of the following values:
  • `ZX_ERR_BAD_STATE`: The device was not enabled.
  • `ZX_ERR_CANCELED`: The call was canceled by `CancelAll()`.
  • `ZX_ERR_ALREADY_BOUND`: Another `Write()` call was already pending.
  • `ZX_ERR_IO_NOT_PRESENT`: The serial controller is in a low-power state or is
  •                          transitioning to a low-power state.
  • Other values may be returned for driver- or device-specific errors.
Source

fn cancel_all( &mut self, responder: Responder<CancelAll, ___T>, ) -> impl Future<Output = ()>

Immediately cancels all outstanding asynchronous I/O

Provided Methods§

Source

fn on_unknown_interaction(&mut self, ordinal: u64) -> impl Future<Output = ()>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<___H, ___T> DeviceLocalServerHandler<___T> for Local<___H>
where ___H: DeviceServerHandler<___T>, ___T: Transport,

Source§

async fn get_info(&mut self, responder: Responder<GetInfo, ___T>)

Source§

async fn config( &mut self, request: Request<Config, ___T>, responder: Responder<Config, ___T>, )

Source§

async fn enable( &mut self, request: Request<Enable, ___T>, responder: Responder<Enable, ___T>, )

Source§

async fn read(&mut self, responder: Responder<Read, ___T>)

Source§

async fn write( &mut self, request: Request<Write, ___T>, responder: Responder<Write, ___T>, )

Source§

async fn cancel_all(&mut self, responder: Responder<CancelAll, ___T>)

Source§

async fn on_unknown_interaction(&mut self, ordinal: u64)

Implementors§