|
PebbleOS
|
Buffers inbound message payloads and schedules endpoint handlers. More...
#include <session_receive_router.h>
Data Fields | |
| Receiver *(* | prepare )(CommSession *session, const PebbleProtocolEndpoint *endpoint, size_t total_payload_length) |
| Prepare a Receiver context for a new message. | |
| void(* | write )(Receiver *receiver, const uint8_t *data, size_t length) |
| Write payload data of the current message. | |
| void(* | finish )(Receiver *receiver) |
| Signal that the whole payload has been written. | |
| void(* | cleanup )(Receiver *receiver) |
| Discard the current message because the session closed. | |
Buffers inbound message payloads and schedules endpoint handlers.
Message receiver implementation, see struct ReceiverImplementation.
A receiver creates a Receiver context (prepare), buffers payload data (write) and schedules the endpoint handler (finish). It can be specific to one endpoint (Put Bytes needs a large buffer) or shared by endpoints with similar buffering needs.
Several sessions may be writing partial messages concurrently; the receiver must handle that. All callbacks are mandatory.
| void(* ReceiverImplementation::cleanup) (Receiver *receiver) |
Discard the current message because the session closed.
Releases the Receiver context without calling the endpoint handler.
| receiver | Receiver context. |
| void(* ReceiverImplementation::finish) (Receiver *receiver) |
Signal that the whole payload has been written.
Schedules the endpoint handler and releases the Receiver context.
| receiver | Receiver context. |
| Receiver *(* ReceiverImplementation::prepare) (CommSession *session, const PebbleProtocolEndpoint *endpoint, size_t total_payload_length) |
Prepare a Receiver context for a new message.
The endpoint's receiver_opt is available through endpoint.
| session | Session receiving the message. |
| endpoint | Destination endpoint. |
| total_payload_length | Payload length in bytes. |
| void(* ReceiverImplementation::write) (Receiver *receiver, const uint8_t *data, size_t length) |
Write payload data of the current message.
| receiver | Receiver context. |
| data | Payload data. |
| length | Length of data in bytes. |