Provides access for communicating using a MasterSyncSerial object.
More...
#include <MasterSyncSerialAccess.hpp>
|
| typedef std::initializer_list< std::uint8_t > | ByteList |
| |
|
| | MasterSyncSerialAccess () |
| | Makes a useless access object. More...
|
| |
| | ~MasterSyncSerialAccess () |
| | Ends the conversation and closes communication. More...
|
| |
| void | converse (Conversation &conv) |
| | Has a half-duplex Conversation with the connected device. More...
|
| |
| void | receive (std::uint8_t *buff, duds::general::Bits bits) |
| | Receives bits of data. More...
|
| |
| void | receive (std::int8_t *buff, duds::general::Bits bits) |
| | Receives bits of data using signed bytes for convenience. More...
|
| |
| void | retire () |
| | Ends the conversation and closes communication. More...
|
| |
| void | start () |
| | Starts a conversation; transitions from the open state to the communicating state. More...
|
| |
| void | stop () |
| | Ends the conversation; transitions from the communicating state to the open state. More...
|
| |
| void | transfer (const std::uint8_t *__restrict__ out, std::uint8_t *__restrict__ in, duds::general::Bits bits) |
| | Sends and/or receives bits of data. More...
|
| |
| void | transfer (const std::int8_t *__restrict__ out, std::int8_t *__restrict__ in, duds::general::Bits bits) |
| | Sends and/or receives bits of data using signed bytes for convenience. More...
|
| |
| void | transfer (const ByteList &out, std::uint8_t *__restrict__ in, duds::general::Bits bits) |
| | Sends and/or receives bits of data. More...
|
| |
| void | transmit (const std::uint8_t *buff, duds::general::Bits bits) |
| | Sends bits of data. More...
|
| |
| void | transmit (const std::int8_t *buff, duds::general::Bits bits) |
| | Sends bits of data using signed bytes for convenience. More...
|
| |
| void | transmit (const ByteList &buff) |
| | Sends bytes stored in a temporary value. More...
|
| |
Provides access for communicating using a MasterSyncSerial object.
Not derived from Conversationalist to avoid a virtual function table. Not sure if that is a good or bad decision. The objects are expected to be made on the stack just before use and then destroyed, giving them a short lifespan, so this may reduce overhead a little. The use of Conversationalist seems to be more sensible on MasterSyncSerial, which is a Conversationalist. A converse() function with the same prototype and usage as defined in Conversationalist is part of this class.
- Author
- Jeff Jackowski
Definition at line 28 of file MasterSyncSerialAccess.hpp.
◆ ByteList
◆ MasterSyncSerialAccess() [1/2]
| duds::hardware::interface::MasterSyncSerialAccess::MasterSyncSerialAccess |
( |
std::shared_ptr< MasterSyncSerial > |
m | ) |
|
|
inlineprivate |
◆ MasterSyncSerialAccess() [2/2]
| duds::hardware::interface::MasterSyncSerialAccess::MasterSyncSerialAccess |
( |
| ) |
|
|
inline |
◆ ~MasterSyncSerialAccess()
| duds::hardware::interface::MasterSyncSerialAccess::~MasterSyncSerialAccess |
( |
| ) |
|
|
inline |
◆ converse()
| void duds::hardware::interface::MasterSyncSerialAccess::converse |
( |
Conversation & |
conv | ) |
|
|
inline |
Has a half-duplex Conversation with the connected device.
The Conversation object defines all input and output parameters. On the ConversationPart objects, the MpfBreak flag is honored, but the MpfVarlen flag is ignored. The transmit() and receive() functions are called to move the data.
- Precondition
- The object is in the open state or the communicating state.
- Postcondition
- The object is in the open state, but not the communicating state.
- Parameters
-
| conv | The conversation to have with the device on the other end. |
- Exceptions
-
Definition at line 266 of file MasterSyncSerialAccess.hpp.
◆ receive() [1/2]
| void duds::hardware::interface::MasterSyncSerialAccess::receive |
( |
std::uint8_t * |
buff, |
|
|
duds::general::Bits |
bits |
|
) |
| |
|
inline |
Receives bits of data.
If full duplex communication is used, transmitted data is undefined unless an implementation cares to have a definition.
- Precondition
- The object is in the communicating state from a prior call to start().
- Parameters
-
| buff | The buffer that will receive the data. |
| bits | The number of bits to send. Implementations may impose limitations on this value, like requiring a multiple of 8. |
- Exceptions
-
Definition at line 231 of file MasterSyncSerialAccess.hpp.
Referenced by receive().
◆ receive() [2/2]
| void duds::hardware::interface::MasterSyncSerialAccess::receive |
( |
std::int8_t * |
buff, |
|
|
duds::general::Bits |
bits |
|
) |
| |
|
inline |
Receives bits of data using signed bytes for convenience.
If full duplex communication is used, transmitted data is undefined unless an implementation cares to have a definition.
- Precondition
- The object is in the communicating state from a prior call to start().
- Parameters
-
| buff | The buffer that will receive the data. |
| bits | The number of bits to send. Implementations may impose limitations on this value, like requiring a multiple of 8. |
- Exceptions
-
Definition at line 251 of file MasterSyncSerialAccess.hpp.
◆ retire()
| void duds::hardware::interface::MasterSyncSerialAccess::retire |
( |
| ) |
|
|
inline |
◆ start()
| void duds::hardware::interface::MasterSyncSerialAccess::start |
( |
| ) |
|
|
inline |
Starts a conversation; transitions from the open state to the communicating state.
Definition at line 71 of file MasterSyncSerialAccess.hpp.
◆ stop()
| void duds::hardware::interface::MasterSyncSerialAccess::stop |
( |
| ) |
|
|
inline |
Ends the conversation; transitions from the communicating state to the open state.
Definition at line 78 of file MasterSyncSerialAccess.hpp.
◆ transfer() [1/3]
| void duds::hardware::interface::MasterSyncSerialAccess::transfer |
( |
const std::uint8_t *__restrict__ |
out, |
|
|
std::uint8_t *__restrict__ |
in, |
|
|
duds::general::Bits |
bits |
|
) |
| |
|
inline |
Sends and/or receives bits of data.
If full duplex communication is not supported, one of the buffers should be given a NULL pointer. The buffers must not overlap.
- Precondition
- The object is in the communicating state from a prior call to start().
- Parameters
-
| out | The data to transmit, or NULL to not transmit. |
| in | The buffer that will receive data, or NULL if nothing will be received. |
| bits | The number of bits to transfer. Implementations may impose limitations on this value, like requiring a multiple of 8. |
- Exceptions
-
Definition at line 101 of file MasterSyncSerialAccess.hpp.
Referenced by transfer().
◆ transfer() [2/3]
| void duds::hardware::interface::MasterSyncSerialAccess::transfer |
( |
const std::int8_t *__restrict__ |
out, |
|
|
std::int8_t *__restrict__ |
in, |
|
|
duds::general::Bits |
bits |
|
) |
| |
|
inline |
Sends and/or receives bits of data using signed bytes for convenience.
If full duplex communication is not supported, one of the buffers should be given a NULL pointer. The buffers must not overlap.
- Precondition
- The object is in the communicating state from a prior call to start().
- Parameters
-
| out | The data to transmit, or NULL to not transmit. |
| in | The buffer that will receive data, or NULL if nothing will be received. |
| bits | The number of bits to transfer. Implementations may impose limitations on this value, like requiring a multiple of 8. |
- Exceptions
-
Definition at line 129 of file MasterSyncSerialAccess.hpp.
◆ transfer() [3/3]
| void duds::hardware::interface::MasterSyncSerialAccess::transfer |
( |
const ByteList & |
out, |
|
|
std::uint8_t *__restrict__ |
in, |
|
|
duds::general::Bits |
bits |
|
) |
| |
|
inline |
Sends and/or receives bits of data.
If full duplex communication is not supported, one of the buffers should be given a NULL pointer. The buffers must not overlap.
- Precondition
- The object is in the communicating state from a prior call to start().
- Parameters
-
| out | The data to transmit in an initializer list. |
| in | The buffer that will receive data, or NULL if nothing will be received. |
| bits | The number of bits to transfer. Implementations may impose limitations on this value, like requiring a multiple of 8. |
- Exceptions
-
Definition at line 156 of file MasterSyncSerialAccess.hpp.
◆ transmit() [1/3]
| void duds::hardware::interface::MasterSyncSerialAccess::transmit |
( |
const std::uint8_t * |
buff, |
|
|
duds::general::Bits |
bits |
|
) |
| |
|
inline |
Sends bits of data.
If full duplex communication is used, received data is lost.
- Precondition
- The object is in the communicating state from a prior call to start().
- Parameters
-
| buff | The data to transmit. |
| bits | The number of bits to send. Implementations may impose limitations on this value, like requiring a multiple of 8. |
- Exceptions
-
Definition at line 178 of file MasterSyncSerialAccess.hpp.
Referenced by transmit().
◆ transmit() [2/3]
| void duds::hardware::interface::MasterSyncSerialAccess::transmit |
( |
const std::int8_t * |
buff, |
|
|
duds::general::Bits |
bits |
|
) |
| |
|
inline |
Sends bits of data using signed bytes for convenience.
If full duplex communication is used, received data is lost.
- Precondition
- The object is in the communicating state from a prior call to start().
- Parameters
-
| buff | The data to transmit. |
| bits | The number of bits to send. Implementations may impose limitations on this value, like requiring a multiple of 8. |
- Exceptions
-
Definition at line 196 of file MasterSyncSerialAccess.hpp.
◆ transmit() [3/3]
| void duds::hardware::interface::MasterSyncSerialAccess::transmit |
( |
const ByteList & |
buff | ) |
|
|
inline |
Sends bytes stored in a temporary value.
If full duplex communication is used, received data is lost.
- Precondition
- The object is in the communicating state from a prior call to start().
- Parameters
-
| buff | The data to transmit as a list of bytes. |
- Exceptions
-
Definition at line 212 of file MasterSyncSerialAccess.hpp.
◆ MasterSyncSerial::access [1/2]
◆ MasterSyncSerial::access [2/2]
◆ MasterSyncSerial::retire
◆ mss
| std::shared_ptr<MasterSyncSerial> duds::hardware::interface::MasterSyncSerialAccess::mss |
|
private |
The documentation for this class was generated from the following file: