|
MC Protocol Serial C++ 0.2.3
MC protocol serial library for MCU-oriented environments
|
Frame-level encode/decode helper for complete serial MC frames. More...
#include <codec.hpp>
Static Public Member Functions | |
| static Status | validate_config (const ProtocolConfig &config) noexcept |
| Validates a static protocol configuration before encoding requests. | |
| static Status | encode_request (const ProtocolConfig &config, std::span< const std::uint8_t > request_data, std::span< std::uint8_t > out_frame, std::size_t &out_size) noexcept |
| Wraps command data in the configured serial frame format. | |
| static Status | encode_success_response (const ProtocolConfig &config, std::span< const std::uint8_t > response_data, std::span< std::uint8_t > out_frame, std::size_t &out_size) noexcept |
| Builds a success response frame for tests and local tools. | |
| static Status | encode_error_response (const ProtocolConfig &config, std::uint16_t error_code, std::span< std::uint8_t > out_frame, std::size_t &out_size) noexcept |
| Builds a PLC-error response frame for tests and local tools. | |
| static DecodeResult | decode_response (const ProtocolConfig &config, std::span< const std::uint8_t > bytes) noexcept |
Decodes one response frame from the front of bytes. | |
Frame-level encode/decode helper for complete serial MC frames.
Use this class when you already have a command payload and only need the outer serial frame layer, or when you need to decode a stream of returned bytes before passing the payload to a command-specific parser.
|
staticnoexcept |
Decodes one response frame from the front of bytes.
The caller can use bytes_consumed to drop the decoded prefix and continue stream processing.
|
staticnoexcept |
Builds a PLC-error response frame for tests and local tools.
|
staticnoexcept |
Wraps command data in the configured serial frame format.
request_data must already contain the command payload generated by CommandCodec.
|
staticnoexcept |
Builds a success response frame for tests and local tools.
This is mainly used by tests and local validation helpers. Library users typically decode real target responses instead of constructing synthetic ones.
|
staticnoexcept |
Validates a static protocol configuration before encoding requests.
This checks frame-family / code-mode compatibility, route constraints, and combinations that are compiled out by feature macros.