pub trait ServerOperation {
// Required methods
fn srm_status(&self) -> SingleResponseMode;
fn is_complete(&self) -> bool;
fn handle_peer_request(
&mut self,
request: RequestPacket,
) -> Result<OperationRequest, Error>;
fn handle_application_response(
&mut self,
response: Result<ApplicationResponse, ObexOperationError>,
) -> Result<Vec<ResponsePacket>, 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§
Sourcefn srm_status(&self) -> SingleResponseMode
fn srm_status(&self) -> SingleResponseMode
Returns the current SRM mode of the operation.
Sourcefn is_complete(&self) -> bool
fn is_complete(&self) -> bool
Returns true if the operation is complete (e.g. all response packets have been sent).
Sourcefn handle_peer_request(
&mut self,
request: RequestPacket,
) -> Result<OperationRequest, Error>
fn handle_peer_request( &mut self, request: RequestPacket, ) -> 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.
Sourcefn handle_application_response(
&mut self,
response: Result<ApplicationResponse, ObexOperationError>,
) -> Result<Vec<ResponsePacket>, Error>
fn handle_application_response( &mut self, response: Result<ApplicationResponse, ObexOperationError>, ) -> Result<Vec<ResponsePacket>, Error>
Handle a response received from the upper layer application profile.
response
is Okresponse
is Errresponse
was
successfully handled.
Returns Error if there was an internal operation error.
Provided Methods§
Sourcefn check_headers_for_srm(
srm_supported_locally: bool,
headers: &HeaderSet,
) -> Option<SingleResponseMode>where
Self: Sized,
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.