6 #include <hal_freertos/stream_buffer.h>
8 #ifndef SATCAT5_FREERTOS_STRM_BUF_SEMPHR_TIMEOUT_MS
9 #define SATCAT5_FREERTOS_STRM_BUF_SEMPHR_TIMEOUT_MS 1
12 #ifndef SATCAT5_FREERTOS_STRM_BUFF_SEND_TIMEOUT_MS
13 #define SATCAT5_FREERTOS_STRM_BUFF_SEND_TIMEOUT_MS 1
18 StreamBuffer::StreamBuffer(
21 StreamBufferHandle_t* stream_buff_handle,
22 SemaphoreHandle_t* stream_buff_semphr)
23 : satcat5::io::WriteableRedirect(&m_tx)
24 , m_tx(txbuff, txbytes, 0)
25 , m_handle(stream_buff_handle)
26 , m_semphr(stream_buff_semphr)
39 m_status = xSemaphoreTake(
41 pdMS_TO_TICKS(SATCAT5_FREERTOS_STRM_BUF_SEMPHR_TIMEOUT_MS));
47 m_status = xStreamBufferSend(
51 pdMS_TO_TICKS(SATCAT5_FREERTOS_STRM_BUFF_SEND_TIMEOUT_MS));
54 xSemaphoreGive(*m_semphr);
PacketBuffer to StreamBuffer adapter.
void data_rcvd(satcat5::io::Readable *src)
The data_rcvd() callback is polled whenever data is available.
const u8 * peek(unsigned nbytes) const
Peek nbytes into the circular buffer.
unsigned get_peek_ready() const
Find the longest available contiguous segment that can be requested by peek().
bool read_consume(unsigned nbytes) override
Read and discard 0 or more bytes.
Abstract API for reading byte-streams and packets.
virtual void set_callback(satcat5::io::EventListener *callback)
Update registered callback for data_rcvd() events.