MC Protocol Serial C++ 0.2.3
MC protocol serial library for MCU-oriented environments
Loading...
Searching...
No Matches
mcprotocol::serial::PosixSyncClient Class Reference

Host-side synchronous convenience wrapper built on PosixSerialPort and MelsecSerialClient. More...

#include <host_sync.hpp>

Public Member Functions

 PosixSyncClient ()=default
 
 PosixSyncClient (const PosixSyncClient &)=delete
 
PosixSyncClientoperator= (const PosixSyncClient &)=delete
 
Status open (const PosixSerialConfig &serial_config, const ProtocolConfig &protocol_config) noexcept
 Opens the serial port and configures the underlying MC protocol client.
 
void close () noexcept
 Closes the serial port and clears any in-flight request state.
 
bool is_open () const noexcept
 Returns whether the underlying serial port is open.
 
const ProtocolConfigprotocol_config () const noexcept
 Returns the currently configured protocol settings.
 
Status read_cpu_model (CpuModelInfo &out_info) noexcept
 Reads the remote CPU model synchronously.
 
Status remote_run (RemoteOperationMode mode=RemoteOperationMode::DoNotExecuteForcibly, RemoteRunClearMode clear_mode=RemoteRunClearMode::DoNotClear) noexcept
 Issues remote RUN (1001) synchronously.
 
Status remote_stop () noexcept
 Issues remote STOP (1002) synchronously.
 
Status remote_pause (RemoteOperationMode mode=RemoteOperationMode::DoNotExecuteForcibly) noexcept
 Issues remote PAUSE (1003) synchronously.
 
Status remote_latch_clear () noexcept
 Issues remote latch clear (1005) synchronously.
 
Status unlock_remote_password (std::string_view remote_password) noexcept
 Unlocks remote-password-protected access (1630) synchronously.
 
Status lock_remote_password (std::string_view remote_password) noexcept
 Locks remote-password-protected access (1631) synchronously.
 
Status clear_error_information () noexcept
 Clears serial/C24 error information (1617) synchronously.
 
Status remote_reset () noexcept
 Issues remote RESET (1006) synchronously.
 
Status read_user_frame (const UserFrameReadRequest &request, UserFrameRegistrationData &out_data) noexcept
 Reads user-frame registration data synchronously (0610).
 
Status write_user_frame (const UserFrameWriteRequest &request) noexcept
 Writes user-frame registration data synchronously (1610, subcommand 0000).
 
Status delete_user_frame (const UserFrameDeleteRequest &request) noexcept
 Deletes user-frame registration data synchronously (1610, subcommand 0001).
 
Status control_global_signal (const GlobalSignalControlRequest &request) noexcept
 Controls C24 global signal ON/OFF synchronously (1618).
 
Status initialize_c24_transmission_sequence () noexcept
 Initializes C24 format-5 transmission sequence synchronously (1615).
 
Status deregister_cpu_monitoring () noexcept
 Deregisters programmable-controller CPU monitoring synchronously (0631).
 
Status read_words (std::string_view head_device, std::uint16_t points, std::span< std::uint16_t > out_words) noexcept
 Reads contiguous words synchronously from a string address such as D100.
 
Status read_words (std::string_view head_device, std::span< std::uint16_t > out_words) noexcept
 Reads contiguous words synchronously using out_words.size() as the point count.
 
Status read_extended_file_register_words (const ExtendedFileRegisterBatchReadWordsRequest &request, std::span< std::uint16_t > out_words) noexcept
 Reads extended file-register words synchronously.
 
Status direct_read_extended_file_register_words (const ExtendedFileRegisterDirectBatchReadWordsRequest &request, std::span< std::uint16_t > out_words) noexcept
 Reads direct extended file-register words synchronously.
 
Status read_bits (std::string_view head_device, std::uint16_t points, std::span< BitValue > out_bits) noexcept
 Reads contiguous bits synchronously from a string address such as M100.
 
Status read_bits (std::string_view head_device, std::span< BitValue > out_bits) noexcept
 Reads contiguous bits synchronously using out_bits.size() as the point count.
 
Status write_words (std::string_view head_device, std::span< const std::uint16_t > words) noexcept
 Writes contiguous words synchronously to a string address such as D100.
 
Status write_extended_file_register_words (const ExtendedFileRegisterBatchWriteWordsRequest &request) noexcept
 Writes extended file-register words synchronously.
 
Status direct_write_extended_file_register_words (const ExtendedFileRegisterDirectBatchWriteWordsRequest &request) noexcept
 Writes direct extended file-register words synchronously.
 
Status write_bits (std::string_view head_device, std::span< const BitValue > bits) noexcept
 Writes contiguous bits synchronously to a string address such as M100.
 
Status random_read (std::span< const highlevel::RandomReadSpec > items, std::span< std::uint32_t > out_values) noexcept
 Reads sparse word/dword items synchronously from string-address specs.
 
Status random_read (std::string_view device, std::uint32_t &out_value, bool double_word=false) noexcept
 Reads one sparse word/dword item synchronously from a string address.
 
Status random_write_words (std::span< const highlevel::RandomWriteWordSpec > items) noexcept
 Writes sparse word/dword items synchronously from string-address specs.
 
Status random_write_extended_file_register_words (std::span< const ExtendedFileRegisterRandomWriteWordItem > items) noexcept
 Writes extended file-register words randomly.
 
Status random_write_word (std::string_view device, std::uint32_t value, bool double_word=false) noexcept
 Writes one sparse word/dword item synchronously from a string address.
 
Status random_write_bits (std::span< const highlevel::RandomWriteBitSpec > items) noexcept
 Writes sparse bit items synchronously from string-address specs.
 
Status random_write_bit (std::string_view device, BitValue value) noexcept
 Writes one sparse bit item synchronously from a string address.
 
Status register_monitor (std::span< const highlevel::RandomReadSpec > items) noexcept
 Registers a sparse monitor synchronously from string-address specs.
 
Status register_monitor (std::string_view device, bool double_word=false) noexcept
 Registers one sparse monitor item synchronously from a string address.
 
Status register_extended_file_register_monitor (const ExtendedFileRegisterMonitorRegistration &request) noexcept
 Registers extended file-register monitor data synchronously.
 
Status read_monitor (std::span< std::uint32_t > out_values) noexcept
 Reads the most recently registered monitor items synchronously.
 
Status read_monitor (std::uint32_t &out_value) noexcept
 Reads one previously registered monitor item synchronously.
 
Status read_extended_file_register_monitor (std::span< std::uint16_t > out_words) noexcept
 Reads the most recently registered extended file-register monitor items synchronously.
 

Detailed Description

Host-side synchronous convenience wrapper built on PosixSerialPort and MelsecSerialClient.

This class is intentionally small:

  • it keeps the existing low-level client unchanged
  • it opens a host-side serial port
  • it runs one request synchronously from TX to completion
  • it exposes string-address helpers for common contiguous, sparse random, and monitor operations

Use it on Windows or POSIX hosts when you want a simpler bring-up path than manually driving pending_tx_frame(), notify_tx_complete(), on_rx_bytes(), and poll().

Definition at line 32 of file host_sync.hpp.

Constructor & Destructor Documentation

◆ PosixSyncClient() [1/2]

mcprotocol::serial::PosixSyncClient::PosixSyncClient ( )
default

◆ PosixSyncClient() [2/2]

mcprotocol::serial::PosixSyncClient::PosixSyncClient ( const PosixSyncClient )
delete

Member Function Documentation

◆ clear_error_information()

Status mcprotocol::serial::PosixSyncClient::clear_error_information ( )
noexcept

Clears serial/C24 error information (1617) synchronously.

◆ close()

void mcprotocol::serial::PosixSyncClient::close ( )
noexcept

Closes the serial port and clears any in-flight request state.

◆ control_global_signal()

Status mcprotocol::serial::PosixSyncClient::control_global_signal ( const GlobalSignalControlRequest request)
noexcept

Controls C24 global signal ON/OFF synchronously (1618).

◆ delete_user_frame()

Status mcprotocol::serial::PosixSyncClient::delete_user_frame ( const UserFrameDeleteRequest request)
noexcept

Deletes user-frame registration data synchronously (1610, subcommand 0001).

◆ deregister_cpu_monitoring()

Status mcprotocol::serial::PosixSyncClient::deregister_cpu_monitoring ( )
noexcept

Deregisters programmable-controller CPU monitoring synchronously (0631).

◆ direct_read_extended_file_register_words()

Status mcprotocol::serial::PosixSyncClient::direct_read_extended_file_register_words ( const ExtendedFileRegisterDirectBatchReadWordsRequest request,
std::span< std::uint16_t out_words 
)
noexcept

Reads direct extended file-register words synchronously.

◆ direct_write_extended_file_register_words()

Status mcprotocol::serial::PosixSyncClient::direct_write_extended_file_register_words ( const ExtendedFileRegisterDirectBatchWriteWordsRequest request)
noexcept

Writes direct extended file-register words synchronously.

◆ initialize_c24_transmission_sequence()

Status mcprotocol::serial::PosixSyncClient::initialize_c24_transmission_sequence ( )
noexcept

Initializes C24 format-5 transmission sequence synchronously (1615).

◆ is_open()

bool mcprotocol::serial::PosixSyncClient::is_open ( ) const
noexcept

Returns whether the underlying serial port is open.

◆ lock_remote_password()

Status mcprotocol::serial::PosixSyncClient::lock_remote_password ( std::string_view  remote_password)
noexcept

Locks remote-password-protected access (1631) synchronously.

◆ open()

Status mcprotocol::serial::PosixSyncClient::open ( const PosixSerialConfig serial_config,
const ProtocolConfig protocol_config 
)
noexcept

Opens the serial port and configures the underlying MC protocol client.

◆ operator=()

PosixSyncClient & mcprotocol::serial::PosixSyncClient::operator= ( const PosixSyncClient )
delete

◆ protocol_config()

const ProtocolConfig & mcprotocol::serial::PosixSyncClient::protocol_config ( ) const
noexcept

Returns the currently configured protocol settings.

◆ random_read() [1/2]

Status mcprotocol::serial::PosixSyncClient::random_read ( std::span< const highlevel::RandomReadSpec items,
std::span< std::uint32_t out_values 
)
noexcept

Reads sparse word/dword items synchronously from string-address specs.

◆ random_read() [2/2]

Status mcprotocol::serial::PosixSyncClient::random_read ( std::string_view  device,
std::uint32_t out_value,
bool  double_word = false 
)
noexcept

Reads one sparse word/dword item synchronously from a string address.

◆ random_write_bit()

Status mcprotocol::serial::PosixSyncClient::random_write_bit ( std::string_view  device,
BitValue  value 
)
noexcept

Writes one sparse bit item synchronously from a string address.

◆ random_write_bits()

Status mcprotocol::serial::PosixSyncClient::random_write_bits ( std::span< const highlevel::RandomWriteBitSpec items)
noexcept

Writes sparse bit items synchronously from string-address specs.

◆ random_write_extended_file_register_words()

Status mcprotocol::serial::PosixSyncClient::random_write_extended_file_register_words ( std::span< const ExtendedFileRegisterRandomWriteWordItem items)
noexcept

Writes extended file-register words randomly.

◆ random_write_word()

Status mcprotocol::serial::PosixSyncClient::random_write_word ( std::string_view  device,
std::uint32_t  value,
bool  double_word = false 
)
noexcept

Writes one sparse word/dword item synchronously from a string address.

◆ random_write_words()

Status mcprotocol::serial::PosixSyncClient::random_write_words ( std::span< const highlevel::RandomWriteWordSpec items)
noexcept

Writes sparse word/dword items synchronously from string-address specs.

◆ read_bits() [1/2]

Status mcprotocol::serial::PosixSyncClient::read_bits ( std::string_view  head_device,
std::span< BitValue out_bits 
)
noexcept

Reads contiguous bits synchronously using out_bits.size() as the point count.

◆ read_bits() [2/2]

Status mcprotocol::serial::PosixSyncClient::read_bits ( std::string_view  head_device,
std::uint16_t  points,
std::span< BitValue out_bits 
)
noexcept

Reads contiguous bits synchronously from a string address such as M100.

◆ read_cpu_model()

Status mcprotocol::serial::PosixSyncClient::read_cpu_model ( CpuModelInfo out_info)
noexcept

Reads the remote CPU model synchronously.

◆ read_extended_file_register_monitor()

Status mcprotocol::serial::PosixSyncClient::read_extended_file_register_monitor ( std::span< std::uint16_t out_words)
noexcept

Reads the most recently registered extended file-register monitor items synchronously.

◆ read_extended_file_register_words()

Status mcprotocol::serial::PosixSyncClient::read_extended_file_register_words ( const ExtendedFileRegisterBatchReadWordsRequest request,
std::span< std::uint16_t out_words 
)
noexcept

Reads extended file-register words synchronously.

◆ read_monitor() [1/2]

Status mcprotocol::serial::PosixSyncClient::read_monitor ( std::span< std::uint32_t out_values)
noexcept

Reads the most recently registered monitor items synchronously.

◆ read_monitor() [2/2]

Status mcprotocol::serial::PosixSyncClient::read_monitor ( std::uint32_t out_value)
noexcept

Reads one previously registered monitor item synchronously.

◆ read_user_frame()

Status mcprotocol::serial::PosixSyncClient::read_user_frame ( const UserFrameReadRequest request,
UserFrameRegistrationData out_data 
)
noexcept

Reads user-frame registration data synchronously (0610).

◆ read_words() [1/2]

Status mcprotocol::serial::PosixSyncClient::read_words ( std::string_view  head_device,
std::span< std::uint16_t out_words 
)
noexcept

Reads contiguous words synchronously using out_words.size() as the point count.

◆ read_words() [2/2]

Status mcprotocol::serial::PosixSyncClient::read_words ( std::string_view  head_device,
std::uint16_t  points,
std::span< std::uint16_t out_words 
)
noexcept

Reads contiguous words synchronously from a string address such as D100.

◆ register_extended_file_register_monitor()

Status mcprotocol::serial::PosixSyncClient::register_extended_file_register_monitor ( const ExtendedFileRegisterMonitorRegistration request)
noexcept

Registers extended file-register monitor data synchronously.

◆ register_monitor() [1/2]

Status mcprotocol::serial::PosixSyncClient::register_monitor ( std::span< const highlevel::RandomReadSpec items)
noexcept

Registers a sparse monitor synchronously from string-address specs.

◆ register_monitor() [2/2]

Status mcprotocol::serial::PosixSyncClient::register_monitor ( std::string_view  device,
bool  double_word = false 
)
noexcept

Registers one sparse monitor item synchronously from a string address.

◆ remote_latch_clear()

Status mcprotocol::serial::PosixSyncClient::remote_latch_clear ( )
noexcept

Issues remote latch clear (1005) synchronously.

◆ remote_pause()

Status mcprotocol::serial::PosixSyncClient::remote_pause ( RemoteOperationMode  mode = RemoteOperationMode::DoNotExecuteForcibly)
noexcept

Issues remote PAUSE (1003) synchronously.

◆ remote_reset()

Status mcprotocol::serial::PosixSyncClient::remote_reset ( )
noexcept

Issues remote RESET (1006) synchronously.

Some targets reset before returning a response. In that case the underlying client treats a pure response-timeout with no received bytes as success for this operation.

◆ remote_run()

Status mcprotocol::serial::PosixSyncClient::remote_run ( RemoteOperationMode  mode = RemoteOperationMode::DoNotExecuteForcibly,
RemoteRunClearMode  clear_mode = RemoteRunClearMode::DoNotClear 
)
noexcept

Issues remote RUN (1001) synchronously.

◆ remote_stop()

Status mcprotocol::serial::PosixSyncClient::remote_stop ( )
noexcept

Issues remote STOP (1002) synchronously.

◆ unlock_remote_password()

Status mcprotocol::serial::PosixSyncClient::unlock_remote_password ( std::string_view  remote_password)
noexcept

Unlocks remote-password-protected access (1630) synchronously.

◆ write_bits()

Status mcprotocol::serial::PosixSyncClient::write_bits ( std::string_view  head_device,
std::span< const BitValue bits 
)
noexcept

Writes contiguous bits synchronously to a string address such as M100.

◆ write_extended_file_register_words()

Status mcprotocol::serial::PosixSyncClient::write_extended_file_register_words ( const ExtendedFileRegisterBatchWriteWordsRequest request)
noexcept

Writes extended file-register words synchronously.

◆ write_user_frame()

Status mcprotocol::serial::PosixSyncClient::write_user_frame ( const UserFrameWriteRequest request)
noexcept

Writes user-frame registration data synchronously (1610, subcommand 0000).

◆ write_words()

Status mcprotocol::serial::PosixSyncClient::write_words ( std::string_view  head_device,
std::span< const std::uint16_t words 
)
noexcept

Writes contiguous words synchronously to a string address such as D100.


The documentation for this class was generated from the following file: