36#ifndef _OPENLCB_STREAMRECEIVER_HXX_
37#define _OPENLCB_STREAMRECEIVER_HXX_
81 Action wait_for_wakeup()
97 Action init_buffer_ready();
140 class StreamDataHandler;
141 friend class StreamDataHandler;
void handle_stream_complete()
Handles incoming stream data complete message.
Pool * rawBufferPool
Use this BufferPool to allocate raw buffers.
Buffer< RawData > RawBuffer
Buffers of this type will be allocated from the rawBufferPool to hold the payloads of untyped data st...
BufferPtr< RawData > RawBufferPtr
Holds a raw buffer.
BufferPtr< ByteChunk > ByteBufferPtr
Buffer pointer type for references.
#define STATE(_fn)
Turns a function name into an argument to be supplied to functions expecting a state.
Base class for all QMember types that hold data in an expandable format.
Action return_ok()
Terminates the flow and returns the request buffer to the caller with an error code of OK (zero).
StreamReceiveRequest * request()
Implementation of a Pool interface that takes memory from mainBufferPool (configurable) but limits th...
Return type for a state flow callback.
Service * service()
Return a pointer to the service I am bound to.
Action wait_and_call(Callback c)
Wait for resource to become available before proceeding to next state.
Action call_immediately(Callback c)
Imediately call the next state upon return.
Implementation of the OpenLCB interface abstraction for the CAN-bus interface standard.
Base class for NMRAnet nodes conforming to the asynchronous interface.
void cancel_request() override
Cancels the currently pending stream receive request.
Action wakeup()
Root of the flow when something happens in the handlers.
size_t totalByteCount_
How many bytes we have transmitted in this stream so far.
void unregister_handlers()
Removes all handlers that are registered.
void handle_stream_initiate(Buffer< GenMessage > *message)
Invoked by the GenericHandler when a stream initiate message arrives.
std::unique_ptr< StreamDataHandler > dataHandler_
Helper object that receives the actual stream CAN frames.
ByteBufferPtr currentBuffer_
The buffer that we are currently filling with incoming data.
Action have_raw_buffer()
Called when the allocation of the raw buffer is successful.
LimitedPool lastBufferPool_
This pool is used to allocate one raw buffer per stream window size.
Action init_reply()
Invoked when we get the stream initiate request.
void announced_stream()
Helper function for send() when a stream has to start synchronously.
uint8_t streamClosed_
1 if we received the stream complete message.
MessageHandler::GenericHandler streamInitiateHandler_
Helper class for incoming message for stream initiate.
uint8_t pendingInit_
1 if we received the stream init request message.
void send(Buffer< StreamReceiveRequest > *msg, unsigned prio=0) override
Implements the flow interface for the request API.
Action window_reached()
Invoked when the stream window runs out.
void handle_stream_complete(Buffer< GenMessage > *message)
Invoked by the GenericHandler when a stream complete message arrives.
uint16_t streamWindowRemaining_
Remaining stream window size.
uint8_t isWaiting_
1 if we are currently waiting for a notification
Action entry() override
This state is not used, but it's virtual abstract.
uint8_t pendingCancel_
1 if we received a cancel request
RawBufferPtr lastBuffer_
The buffer that will be the last one in this stream window.
const uint8_t assignedStreamId_
Unique stream ID at the destination (local) node, assigned at construction time.
void handle_bytes_received(const uint8_t *data, size_t len)
Handles data arriving from the network.
MessageHandler::GenericHandler streamCompleteHandler_
Helper class for incoming message for stream complete.