|
DUDS
|
Distributed Update of Data from Something
|
Represents a section of a half-duplex conversation with a device. More...
#include <ConversationPart.hpp>
Public Types | |
| typedef duds::general::BitFlags< struct ConversationPartFlags, std::uint16_t > | Flags |
| The type used to store flags that modify the operation of the classes derived from this class, or how the objects are used. More... | |
Public Member Functions | |
| ConversationPart (const ConversationPart &)=default | |
| Copies are OK. More... | |
| virtual | ~ConversationPart () |
| bool | bigEndian () const |
| True if this part is flagged as having data in big-endian form. More... | |
| ConversationPart & | bigEndian (bool big) |
| Changes the flagged endianess of this part. More... | |
| ConversationPart & | breakBefore () |
| Flags the conversation part to have a break before this part is sent. More... | |
| bool | extract () const |
| True if this part is flagged for extraction by ConversationExtractor. More... | |
| ConversationPart & | extract (bool ex) |
| Changes the extraction flag for this part. More... | |
| Flags | flags () const |
| Returns the flags. More... | |
| bool | input () const |
| True if this part is flagged for input use. More... | |
| virtual std::size_t | length () const =0 |
| Returns the length of the buffer following the start pointer. More... | |
| bool | littleEndian () const |
| True if this part is flagged as having data in little-endian form. More... | |
| ConversationPart & | littleEndian (bool little) |
| Changes the flagged endianess of this part. More... | |
| bool | output () const |
| True if this part is flagged for output use. More... | |
| virtual char * | start () const =0 |
| Returns a pointer to the begining of the conversation part's buffer. More... | |
| bool | varyingLength () const |
| True if this part is flagged as having a variable length. More... | |
Static Public Attributes | |
| static constexpr Flags | MpfBigendian = Flags::Bit(3) |
| True/set to expect data to be big-endian. More... | |
| static constexpr Flags | MpfBreak = Flags::Bit(4) |
| True/set to indicate that any kind of selection signal should be toggled, or a stop condition should occur, before communicating the part with this flag. More... | |
| static constexpr Flags | MpfExtract = Flags::Bit(1) |
| True/set to extract message part contents with the ConversationExtractor. More... | |
| static constexpr Flags | MpfInput = Flags::Bit(0) |
| True/set for input; false for output. More... | |
| static constexpr Flags | MpfVarlen = Flags::Bit(2) |
| True/set for a varying length; valid only for input. More... | |
Protected Member Functions | |
| ConversationPart (Flags f) | |
| Construct with the given flags. More... | |
| ConversationPart (Flags f, std::int16_t v) | |
| Construct with the given flags and an initial value for val16. More... | |
Protected Attributes | |
| std::int16_t | val16 |
| A small integer for derived classes to use. More... | |
Private Attributes | |
| Flags | mpf |
| A set of flags that alter the behavior of the message part. More... | |
Represents a section of a half-duplex conversation with a device.
The conversation part is stored in contiguous memory. It may either be used for input or output.
Several flags are defined that modify how a conversation part works or is used. All flags are named for the set state and are clear (not set) by default.
Definition at line 50 of file ConversationPart.hpp.
| typedef duds::general::BitFlags<struct ConversationPartFlags, std::uint16_t> duds::hardware::interface::ConversationPart::Flags |
The type used to store flags that modify the operation of the classes derived from this class, or how the objects are used.
Definition at line 57 of file ConversationPart.hpp.
|
inlineprotected |
Construct with the given flags.
Definition at line 104 of file ConversationPart.hpp.
|
inlineprotected |
Construct with the given flags and an initial value for val16.
Definition at line 108 of file ConversationPart.hpp.
|
default |
Copies are OK.
|
virtual |
Definition at line 20 of file ConversationPart.cpp.
|
inline |
True if this part is flagged as having data in big-endian form.
Definition at line 163 of file ConversationPart.hpp.
Referenced by duds::hardware::devices::instruments::AM2320::AM2320(), duds::hardware::devices::instruments::FXOS8700CQ::configure(), and duds::hardware::interface::operator<<().
|
inline |
Changes the flagged endianess of this part.
| big | True to flag as big-endian, false for little-endian. |
Definition at line 172 of file ConversationPart.hpp.
|
inline |
Flags the conversation part to have a break before this part is sent.
Exactly what this means and if it is honored is implementation specific. For I2C, it should cause a stop condition, followed by a start condition, and then this part's data. For SPI, it should cause the device's chip select to change to the unselected state briefly.
Definition at line 201 of file ConversationPart.hpp.
Referenced by duds::hardware::devices::instruments::AMG88xx::AMG88xx().
|
inline |
True if this part is flagged for extraction by ConversationExtractor.
Definition at line 141 of file ConversationPart.hpp.
|
inline |
Changes the extraction flag for this part.
Definition at line 149 of file ConversationPart.hpp.
|
inline |
Returns the flags.
Values are:
Definition at line 123 of file ConversationPart.hpp.
Referenced by duds::hardware::interface::linux::DevI2c::converse(), and duds::hardware::interface::MasterSyncSerial::converseAlreadyOpen().
|
inline |
True if this part is flagged for input use.
Definition at line 129 of file ConversationPart.hpp.
Referenced by duds::hardware::interface::ConversationVector::add(), duds::hardware::interface::linux::DevI2c::converse(), and duds::hardware::interface::MasterSyncSerial::converseAlreadyOpen().
|
pure virtual |
Returns the length of the buffer following the start pointer.
Implemented in duds::hardware::interface::ConversationVector, and duds::hardware::interface::ConversationExternal.
Referenced by duds::hardware::interface::linux::DevI2c::converse(), duds::hardware::interface::MasterSyncSerial::converseAlreadyOpen(), and duds::hardware::interface::ConversationExtractor::reset().
|
inline |
True if this part is flagged as having data in little-endian form.
Definition at line 179 of file ConversationPart.hpp.
|
inline |
Changes the flagged endianess of this part.
| little | True to flag as little-endian, false for big-endian. |
Definition at line 188 of file ConversationPart.hpp.
|
inline |
True if this part is flagged for output use.
Definition at line 135 of file ConversationPart.hpp.
|
pure virtual |
Returns a pointer to the begining of the conversation part's buffer.
The return type is not const because use for input will require a write operation. The implementation must not make changes to the part object, so the function is const.
Implemented in duds::hardware::interface::ConversationVector, and duds::hardware::interface::ConversationExternal.
Referenced by duds::hardware::interface::linux::DevI2c::converse(), duds::hardware::interface::MasterSyncSerial::converseAlreadyOpen(), and duds::hardware::interface::ConversationExtractor::reset().
|
inline |
True if this part is flagged as having a variable length.
It is only valid for input.
Definition at line 157 of file ConversationPart.hpp.
Referenced by duds::hardware::interface::linux::DevI2c::converse(), duds::hardware::interface::ConversationVector::setLength(), and duds::hardware::interface::ConversationVector::setStartOffset().
|
private |
A set of flags that alter the behavior of the message part.
Definition at line 94 of file ConversationPart.hpp.
|
static |
True/set to expect data to be big-endian.
Definition at line 77 of file ConversationPart.hpp.
|
static |
True/set to indicate that any kind of selection signal should be toggled, or a stop condition should occur, before communicating the part with this flag.
The flag is only used by code that implements the communication. Implementations are not required to honor the flag. Some implementations may honor it, but be unable to guarantee that another communication from another thread or process will not occur before resuming the conversation. Implementations should specify these details in the documentation.
Definition at line 88 of file ConversationPart.hpp.
Referenced by duds::hardware::interface::linux::DevI2c::converse(), and duds::hardware::interface::MasterSyncSerial::converseAlreadyOpen().
|
static |
True/set to extract message part contents with the ConversationExtractor.
This is honored for both input and output messages.
Definition at line 67 of file ConversationPart.hpp.
|
static |
True/set for input; false for output.
Definition at line 62 of file ConversationPart.hpp.
|
static |
True/set for a varying length; valid only for input.
Intended for use by communication code that takes Conversation objects; they can use the flag to tell there is a need to properly set the input length.
Definition at line 73 of file ConversationPart.hpp.
|
protected |
A small integer for derived classes to use.
Placed here because it won't increase the size of this class thanks to memory alignment.
Definition at line 100 of file ConversationPart.hpp.
Referenced by duds::hardware::interface::ConversationVector::length(), duds::hardware::interface::ConversationVector::reserve(), duds::hardware::interface::ConversationVector::setStartOffset(), and duds::hardware::interface::ConversationVector::start().