Drv::ByteStreamBufferAdapter
1. Introduction
The Drv::ByteStreamBufferAdapter is a passive component that serves as an adapter between two different driver interfaces in F´:
- The
ByteStreamDriverinterface, which is used for sending and receiving streams of bytes - The
PassiveBufferDriverinterface, which is used for sending and receivingFw::Bufferobjects
This adapter component allows components that expect a PassiveBufferDriver interface to communicate with components that provide a ByteStreamDriver interface, bridging the gap between these two different models of data transfer.
2. Requirements
| Name | Description | Validation |
|---|---|---|
| DRV-BSB-ADAPTER-001 | The component shall adapt the ByteStreamDriver interface to the PassiveBufferDriver interface | Unit Test |
| DRV-BSB-ADAPTER-002 | The component shall handle buffer ownership transfers between the two interfaces | Unit Test |
| DRV-BSB-ADAPTER-003 | The component shall monitor the ByteStreamDriver readiness state | Unit Test |
| DRV-BSB-ADAPTER-004 | The component shall emit events on error conditions | Unit Test |
3. Design
3.1 Assumptions
The design of ByteStreamBufferAdapter assumes the following:
- The byte stream driver will properly signal ready status before accepting data.
- Buffer ownership follows the standard Return-To-Sender pattern: buffers are owned by the receiver until returned.
- The byte stream driver operates correctly and returns buffers sent to it when it is done processing.
3.3. State
The component maintains a single state variable:
m_driverIsReady: An atomic boolean that tracks whether theByteStreamDriveris ready to receive data. Initialized tofalseand set totruewhen a ready signal is received from the driver.