MC Protocol Serial C++ 0.2.3
MC protocol serial library for MCU-oriented environments
Loading...
Searching...
No Matches
high_level.hpp File Reference

Optional string-address helpers and protocol presets for common library entry paths. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include <cctype>
#include "mcprotocol/serial/span_compat.hpp"
#include "mcprotocol/serial/status.hpp"
#include "mcprotocol/serial/string_view_compat.hpp"
#include "mcprotocol/serial/types.hpp"

Go to the source code of this file.

Classes

struct  mcprotocol::serial::highlevel::detail::DeviceParseSpec
 
struct  mcprotocol::serial::highlevel::RandomReadSpec
 String-address spec used to build sparse random-read or monitor requests. More...
 
struct  mcprotocol::serial::highlevel::RandomWriteWordSpec
 String-address spec used to build sparse random word-write items. More...
 
struct  mcprotocol::serial::highlevel::RandomWriteBitSpec
 String-address spec used to build sparse random bit-write items. More...
 

Namespaces

namespace  mcprotocol
 
namespace  mcprotocol::serial
 
namespace  mcprotocol::serial::highlevel
 
namespace  mcprotocol::serial::highlevel::detail
 

Functions

constexpr char mcprotocol::serial::highlevel::detail::ascii_upper (char value) noexcept
 
bool mcprotocol::serial::highlevel::detail::parse_u32 (std::string_view text, std::uint32_t &out_value, int base) noexcept
 
constexpr bool mcprotocol::serial::highlevel::detail::is_double_word_device (DeviceCode code) noexcept
 
constexpr ProtocolConfig mcprotocol::serial::highlevel::make_c4_binary_protocol (PlcSeries series=PlcSeries::Q_L) noexcept
 Returns a practical default for Q/L-era Format5 / Binary / C4.
 
constexpr ProtocolConfig mcprotocol::serial::highlevel::make_c4_ascii_format4_protocol (PlcSeries series=PlcSeries::Q_L) noexcept
 Returns a practical default for Format4 / ASCII / C4.
 
constexpr ProtocolConfig mcprotocol::serial::highlevel::make_c4_ascii_format2_protocol (PlcSeries series=PlcSeries::Q_L) noexcept
 Returns a practical default for Format2 / ASCII / C4.
 
Status mcprotocol::serial::highlevel::parse_device_address (std::string_view text, DeviceAddress &out_device) noexcept
 Parses a plain MC device string such as D100, M100, X10, or B20.
 
Status mcprotocol::serial::highlevel::make_batch_read_words_request (std::string_view head_device, std::uint16_t points, BatchReadWordsRequest &out_request) noexcept
 Builds a contiguous word-read request from a string address such as D100.
 
Status mcprotocol::serial::highlevel::make_batch_read_bits_request (std::string_view head_device, std::uint16_t points, BatchReadBitsRequest &out_request) noexcept
 Builds a contiguous bit-read request from a string address such as M100.
 
Status mcprotocol::serial::highlevel::make_batch_write_words_request (std::string_view head_device, std::span< const std::uint16_t > words, BatchWriteWordsRequest &out_request) noexcept
 Builds a contiguous word-write request from a string address such as D100.
 
Status mcprotocol::serial::highlevel::make_batch_write_bits_request (std::string_view head_device, std::span< const BitValue > bits, BatchWriteBitsRequest &out_request) noexcept
 Builds a contiguous bit-write request from a string address such as M100.
 
Status mcprotocol::serial::highlevel::make_random_read_item (std::string_view device, RandomReadItem &out_item, bool double_word=false) noexcept
 Builds one sparse random-read item from a string address.
 
Status mcprotocol::serial::highlevel::make_random_write_word_item (std::string_view device, std::uint32_t value, RandomWriteWordItem &out_item, bool double_word=false) noexcept
 Builds one sparse random word-write item from a string address.
 
Status mcprotocol::serial::highlevel::make_random_write_bit_item (std::string_view device, BitValue value, RandomWriteBitItem &out_item) noexcept
 Builds one sparse random bit-write item from a string address.
 
Status mcprotocol::serial::highlevel::make_random_read_request (std::span< const RandomReadSpec > specs, std::span< RandomReadItem > out_items, RandomReadRequest &out_request) noexcept
 Builds a sparse random-read request from string-address specs.
 
Status mcprotocol::serial::highlevel::make_monitor_registration (std::span< const RandomReadSpec > specs, std::span< RandomReadItem > out_items, MonitorRegistration &out_request) noexcept
 Builds a sparse monitor registration payload from string-address specs.
 
Status mcprotocol::serial::highlevel::make_random_write_word_items (std::span< const RandomWriteWordSpec > specs, std::span< RandomWriteWordItem > out_items, std::span< const RandomWriteWordItem > &out_item_view) noexcept
 Builds sparse random word-write items from string-address specs.
 
Status mcprotocol::serial::highlevel::make_random_write_bit_items (std::span< const RandomWriteBitSpec > specs, std::span< RandomWriteBitItem > out_items, std::span< const RandomWriteBitItem > &out_item_view) noexcept
 Builds sparse random bit-write items from string-address specs.
 

Variables

constexpr std::array< DeviceParseSpec, 39 > mcprotocol::serial::highlevel::detail::kDeviceParseSpecs
 

Detailed Description

Optional string-address helpers and protocol presets for common library entry paths.

This layer does not replace MelsecSerialClient. It only reduces setup and request-building friction for the most common cases:

  • choose a baseline ProtocolConfig
  • parse D100, M100, X10, B20 style addresses
  • build contiguous and sparse request items without hand-filling DeviceAddress

Definition in file high_level.hpp.