HardFOC Core
API reference
Loading...
Searching...
No Matches
Classes | Namespaces
MockUart.h File Reference

Scriptable BaseUart fake for host tests. More...

#include "base/BaseUart.h"
#include <cstdint>
#include <deque>
#include <functional>
#include <vector>

Go to the source code of this file.

Classes

class  hf::host::MockUart
 

Namespaces

namespace  hf
 
namespace  hf::host
 

Detailed Description

Scriptable BaseUart fake for host tests.

Written bytes accumulate in TxBytes(); each Write()/Printf() call is also kept as one entry in TxWrites(). InjectRx() appends to the receive buffer that Read() and BytesAvailable() drain. A Read() asking for more bytes than are buffered returns UART_ERR_TIMEOUT and consumes nothing, matching the BaseUart contract that success means the whole buffer was filled. SetOnWrite() lets a test answer a request the moment it is sent (for request/response protocols such as TMCL or Modbus).