Structure to hold all mockable callbacks for the Responder. Test fixtures can use this to set up and verify interactions. The generic ResponderTest fixture will own an instance of this struct and pass it to the NativeResponderTest constructor.
Public Member Functions | |
bool | OnStartRead () override |
bool | OnStartWrite () override |
bool | OnWrite (ConstByteSpan data) override |
Result< ConstByteSpan > | OnRead () override |
bool | OnStop () override |
void | SetOnStartReadCb (pw::Function< bool()> &&cb) |
void | SetOnStartWriteCb (pw::Function< bool()> &&cb) |
void | SetOnWriteCb (pw::Function< bool(ConstByteSpan)> &&cb) |
void | SetOnReadCb (pw::Function< Result< ConstByteSpan >()> &&cb) |
void | SetOnStopCb (pw::Function< bool()> &&cb) |
virtual bool | OnStartRead () |
virtual bool | OnStartWrite () |
virtual bool | OnWrite (ConstByteSpan data) |
virtual Result< ConstByteSpan > | OnRead () |
virtual bool | OnStop () |
|
inlineoverridevirtual |
Called when data is needed from the bus.
The responder implementation is responsible for handling hardware that doesn't support a hardware cache. In those cases follow-up interrupts for reading the next byte should consume the next byte from the original span until all the bytes have been consumed. At which point this function will be called again.
Reimplemented from pw::i2c::ResponderEvents.
|
inlineoverridevirtual |
Called when a read start condition is seen.
Reimplemented from pw::i2c::ResponderEvents.
|
inlineoverridevirtual |
Called when a write start condition is seen.
Reimplemented from pw::i2c::ResponderEvents.
|
inlineoverridevirtual |
Called when the stop condition is received.
Reimplemented from pw::i2c::ResponderEvents.
|
inlineoverridevirtual |
Called when data is available on the bus.
Depending on the IC, some buses have hardware caches so they will call this function once with a few bytes while others will call this once per byte. Either way, the write is not considered complete until the stop condition is called.
Reimplemented from pw::i2c::ResponderEvents.