pub trait ServerOperation {
    // Required methods
    fn srm_status(&self) -> SingleResponseMode;
    fn is_complete(&self) -> bool;
    fn handle_peer_request(
        &mut self,
        request: Packet<OpCode>
    ) -> Result<OperationRequest, Error>;
    fn handle_application_response(
        &mut self,
        response: Result<ApplicationResponse, ObexOperationError>
    ) -> Result<Vec<Packet<ResponseCode>>, Error>;

    // Provided method
    fn check_headers_for_srm(
        srm_supported_locally: bool,
        headers: &HeaderSet
    ) -> Option<SingleResponseMode>
       where Self: Sized { ... }
}
Expand description

An interface for implementing a multi-step OBEX operation. Currently, the only two such operations are GET and PUT. See OBEX 1.5 Sections 3.4.3 & 3.4.4.

Required Methods§

source

fn srm_status(&self) -> SingleResponseMode

Returns the current SRM mode of the operation.

source

fn is_complete(&self) -> bool

Returns true if the operation is complete (e.g. all response packets have been sent).

source

fn handle_peer_request( &mut self, request: Packet<OpCode> ) -> Result<OperationRequest, Error>

Handle a request packet received from the OBEX client. Returns an OperationRequest to be handled by the OBEX server on success, Error if the request was invalid or couldn’t be handled.

source

fn handle_application_response( &mut self, response: Result<ApplicationResponse, ObexOperationError> ) -> Result<Vec<Packet<ResponseCode>>, Error>

Handle a response received from the upper layer application profile. response is Ok if the application accepted the GET or PUT request. response is Err if the application rejected the GET or PUT request. Returns response packets to be sent to the remote peer if the application response was successfully handled. Returns Error if there was an internal operation error.

Provided Methods§

source

fn check_headers_for_srm( srm_supported_locally: bool, headers: &HeaderSet ) -> Option<SingleResponseMode>
where Self: Sized,

Checks the provided headers for the SRM flag and returns the negotiated SRM mode if present, None otherwise.

Implementors§