template<size_t kMaxConcurrentClientTransfers, size_t kMaxConcurrentServerTransfers>
class pw::transfer::Thread< kMaxConcurrentClientTransfers, kMaxConcurrentServerTransfers >
Dedicated background thread for processing client and server transfer events.
Derives from pw::thread::ThreadCore so it can be passed directly when creating a pw::thread::Thread. A single Thread instance can be shared between a Client and a TransferService.
- Template Parameters
-
| kMaxConcurrentClientTransfers | Maximum number of concurrent client transfers supported (may be 0 if only running a server). |
| kMaxConcurrentServerTransfers | Maximum number of concurrent server transfers supported (may be 0 if only running a client). |
|
| | Thread (ByteSpan chunk_buffer, ByteSpan encode_buffer) |
| |
|
| TransferThread (span< ClientContext > client_transfers, span< ServerContext > server_transfers, ByteSpan chunk_buffer, ByteSpan encode_buffer) |
| |
| void | SetServerCompletionCallback (pw::Function< void(uint32_t, pw::Status)> &&cb) |
| |
|
void | NotifyServerCompletion (uint32_t session_id, Status status) |
| |
|
void | StartClientTransfer (TransferType type, ProtocolVersion version, uint32_t resource_id, uint32_t handle_id, stream::Stream *stream, const TransferParameters &max_parameters, Function< void(Status)> &&on_completion, chrono::SystemClock::duration timeout, chrono::SystemClock::duration initial_timeout, uint8_t max_retries, uint32_t max_lifetime_retries, uint32_t initial_offset=0) |
| |
|
void | StartServerTransfer (TransferType type, ProtocolVersion version, uint32_t session_id, uint32_t resource_id, ConstByteSpan raw_chunk, const TransferParameters &max_parameters, chrono::SystemClock::duration timeout, uint8_t max_retries, uint32_t max_lifetime_retries, uint32_t initial_offset=0) |
| |
|
void | ProcessClientChunk (ConstByteSpan chunk) |
| |
|
void | ProcessServerChunk (ConstByteSpan chunk) |
| |
|
void | SendServerStatus (TransferType type, uint32_t session_id, ProtocolVersion version, Status status) |
| |
|
void | CancelClientTransfer (uint32_t handle_id) |
| |
|
void | EndClientTransfer (uint32_t session_id, Status status, bool send_status_chunk=false) |
| |
|
void | EndServerTransfer (uint32_t session_id, Status status, bool send_status_chunk=false) |
| |
| void | SetClientReadStream (rpc::RawClientReaderWriter &read_stream, Client *client, Function< void(ConstByteSpan)> &&on_next, internal::SetStreamBehavior behavior) |
| |
|
void | CloseClientReadStream (Client *client) |
| |
| void | SetClientWriteStream (rpc::RawClientReaderWriter &write_stream, Client *client, Function< void(ConstByteSpan)> &&on_next, internal::SetStreamBehavior behavior) |
| |
|
void | CloseClientWriteStream (Client *client) |
| |
| void | SetServerReadStream (rpc::RawServerReaderWriter &read_stream, Function< void(ConstByteSpan)> &&on_next) |
| |
| void | SetServerWriteStream (rpc::RawServerReaderWriter &write_stream, Function< void(ConstByteSpan)> &&on_next) |
| |
|
bool | AddTransferHandler (Handler &handler) |
| |
|
bool | RemoveTransferHandler (Handler &handler) |
| |
|
size_t | max_chunk_size () const |
| |
|
void | Terminate () |
| |
|
void | WaitUntilEventIsProcessed () |
| |
|
void | SimulateClientTimeout (uint32_t session_id) |
| |
|
void | SimulateServerTimeout (uint32_t session_id) |
| |
|
void | EnqueueResourceEvent (uint32_t resource_id, ResourceStatusCallback &&callback) |
| |