7#include <gmock/gmock.h>
30 for (
const auto [type,
frameId] :
31 std::array<std::pair<std::uint16_t, std::uint16_t>, 2>{
45 nrd.
argsLength =
static_cast<std::uint32_t
>(blocks.size());
48 nrd.
actualCount =
static_cast<std::uint32_t
>(blocks.size());
58 sends.push_back(data);
62 void Open(
const std::string&, std::uint16_t,
bool =
false)
override
67 Bytes Receive(std::chrono::milliseconds, asio::ip::udp::endpoint&)
override
73 void SendTo(
const Bytes& data,
const asio::ip::udp::endpoint&)
override
75 sends.push_back(data);
void Open(const std::string &, std::uint16_t, bool=false) override
Open the transport and configure the remote endpoint.
Bytes Receive(std::chrono::milliseconds, asio::ip::udp::endpoint &) override
Wait for an incoming byte array and capture the sender's endpoint.
std::vector< Bytes > sends
std::vector< Bytes > requests
void Close() noexcept override
Close the transport.
Bytes SendReceive(const Bytes &request, std::chrono::milliseconds) override
void Send(const Bytes &data) override
void SendTo(const Bytes &data, const asio::ip::udp::endpoint &) override
Send a byte array of data to a specific remote asio endpoint.
constexpr std::uint8_t VERSION_HIGH
Version high.
constexpr std::uint8_t VERSION_LOW
Version low.
void PutU8(std::vector< std::uint8_t > &out, std::uint8_t value)
Append a single byte to a buffer.
void PutU16(std::vector< std::uint8_t > &out, std::uint16_t value)
Append a 16-bit value to a buffer in big-endian order.
constexpr std::uint16_t kInputFrameId
std::vector< std::uint8_t > Bytes
Generic byte buffer alias used throughout the library for raw wire data.
constexpr std::uint16_t kOutputFrameId
PROFINET DCE/RPC protocol structures and IO-Device connection API.
static constexpr std::uint16_t BLOCK_TYPE
Block type identifier for IOCRBlockRes.
static constexpr std::size_t kSize
Size in bytes of this block.
NRD (Network Representation Data) wrapper carrying the actual IOD payload.
Bytes payload
The wrapped IOD data.
Bytes ToBytes() const
Serialize this wrapper and payload back to raw bytes.
std::uint32_t argsLength
Length in bytes of the arguments (usually equals ActualCount).
std::uint32_t offset
Byte offset into the logical result (0 unless fragmented).
std::uint32_t argsMaximumStatus
Maximum status/argument buffer size accepted by the caller.
std::uint32_t maximumCount
Maximum number of bytes the caller can accept.
std::uint32_t actualCount
Actual length in bytes of Payload.
std::uint16_t frameId
Ethernet FrameID.