Skip to main content

DeviceServerHandler

Trait DeviceServerHandler 

Source
pub trait DeviceServerHandler<___T: Transport = Channel> {
    // Required methods
    fn transmit(
        &mut self,
        request: Request<Transmit, ___T>,
        responder: Responder<Transmit, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn receive(
        &mut self,
        request: Request<Receive, ___T>,
        responder: Responder<Receive, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn exchange(
        &mut self,
        request: Request<Exchange, ___T>,
        responder: Responder<Exchange, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn register_vmo(
        &mut self,
        request: Request<RegisterVmo, ___T>,
        responder: Responder<RegisterVmo, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn unregister_vmo(
        &mut self,
        request: Request<UnregisterVmo, ___T>,
        responder: Responder<UnregisterVmo, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn transmit_vector(
        &mut self,
        request: Request<TransmitVector, ___T>,
        responder: Responder<TransmitVector, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn receive_vector(
        &mut self,
        request: Request<ReceiveVector, ___T>,
        responder: Responder<ReceiveVector, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn exchange_vector(
        &mut self,
        request: Request<ExchangeVector, ___T>,
        responder: Responder<ExchangeVector, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn can_assert_cs(
        &mut self,
        responder: Responder<CanAssertCs, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn assert_cs(
        &mut self,
        responder: Responder<AssertCs, ___T>,
    ) -> impl Future<Output = ()> + Send;
    fn deassert_cs(
        &mut self,
        responder: Responder<DeassertCs, ___T>,
    ) -> impl Future<Output = ()> + Send;
}
Expand description

A server handler for the Device protocol.

See Device for more details.

Required Methods§

Source

fn transmit( &mut self, request: Request<Transmit, ___T>, responder: Responder<Transmit, ___T>, ) -> impl Future<Output = ()> + Send

Sends the data in buffer to the device.

Source

fn receive( &mut self, request: Request<Receive, ___T>, responder: Responder<Receive, ___T>, ) -> impl Future<Output = ()> + Send

Receives data from the device into buffer.

Source

fn exchange( &mut self, request: Request<Exchange, ___T>, responder: Responder<Exchange, ___T>, ) -> impl Future<Output = ()> + Send

Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must be the same.

Source

fn register_vmo( &mut self, request: Request<RegisterVmo, ___T>, responder: Responder<RegisterVmo, ___T>, ) -> impl Future<Output = ()> + Send

Registers a VMO and transfers ownership to the driver. vmo_id: The ID chosen by the client that will be used in operations on this VMO. vmo: The handle, offset, and size of this VMO. IO operations on this VMO will be relative to the offset and size specified here. rights: A bit field of SharedVmoRight values indicating how this VMO may be used. Callers should assume that the driver will map and/or pin the VMO using these rights.

Source

fn unregister_vmo( &mut self, request: Request<UnregisterVmo, ___T>, responder: Responder<UnregisterVmo, ___T>, ) -> impl Future<Output = ()> + Send

Unmaps and/or unpins the VMO and returns the handle to the caller.

Source

fn transmit_vector( &mut self, request: Request<TransmitVector, ___T>, responder: Responder<TransmitVector, ___T>, ) -> impl Future<Output = ()> + Send

Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.

Source

fn receive_vector( &mut self, request: Request<ReceiveVector, ___T>, responder: Responder<ReceiveVector, ___T>, ) -> impl Future<Output = ()> + Send

Half-duplex receive data from a SPI device; always reads the full size requested.

Source

fn exchange_vector( &mut self, request: Request<ExchangeVector, ___T>, responder: Responder<ExchangeVector, ___T>, ) -> impl Future<Output = ()> + Send

Full-duplex SPI transaction. Received data will exactly equal the length of the transmit buffer.

Source

fn can_assert_cs( &mut self, responder: Responder<CanAssertCs, ___T>, ) -> impl Future<Output = ()> + Send

Returns true if the device can call |AssertCs()| and |DeassertCs()|.

Source

fn assert_cs( &mut self, responder: Responder<AssertCs, ___T>, ) -> impl Future<Output = ()> + Send

Assert CS for this device. Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.

Source

fn deassert_cs( &mut self, responder: Responder<DeassertCs, ___T>, ) -> impl Future<Output = ()> + Send

Deassert CS for this device. Returns ZX_ERR_BAD_STATE if CS is already deasserted. Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§