Skip to content

SLMP C++ API Reference

This file is generated from Doxygen XML for the public C++ headers. Do not edit it manually; run scripts/generate_api_reference.py instead. The public API requires strict ISO C++17 without compiler extensions.

Header Inputs

  • src/slmp_minimal.h
  • src/slmp_high_level.h
  • src/slmp_arduino_transport.h
  • src/slmp_error_codes.h
  • src/slmp_utility.h

API Groups

API Group SLMP_Core

Essential SLMP client and types.

This is the low-level API surface. Use it when you want explicit DeviceAddress values, caller-owned buffers, and direct control over request scheduling and transport behavior.

Enums

Error

Error codes returned by SLMP operations.

Value Description
Ok = 0 Operation successful
InvalidArgument One or more arguments are invalid (e.g. nullptr or range error)
UnsupportedDevice The requested device code is not supported by this library or target PLC
BufferTooSmall Provided buffer capacity is insufficient for request or response
NotConnected Transport layer is not connected
Timeout The configured absolute transaction deadline expired
Closed The active operation was interrupted by local close()
TransportError A non-timeout transport I/O failure occurred
ProtocolError Malformed packet or protocol violation detected
PlcError PLC returned a non-zero end code (use SlmpClient::lastEndCode to get details)
ProfileFeatureBlocked Strict PLC profile guard blocked a feature before transport
Busy An asynchronous operation is already in progress
OutcomeUnknown A state-changing request may have reached the PLC, but confirmation failed

ProfileFeatureKey

Capability feature keys used by the built-in Ethernet profile guard.

Value Description
TypeName
Direct
Random
Block
Monitor
ExtModuleAccess
ExtLinkDirect
HgCpuBuffer
LongDevicePath
Lz32BitPath

FrameType

SLMP frame formats supported by the library.

Value Description
Frame3E Standard 3E frame (most common for Q/L/iQ-R)
Frame4E 4E frame (extended functionality, used for iQ-R specific features)

CompatibilityMode

Subcommand selection for device access.

Determines whether to use modern iQ-R extended subcommands or legacy Q/L subcommands.

Value Description
iQR Use subcommands 0x0002/0x0003 (iQ-R series extensions). Supports larger address ranges
Legacy Use subcommands 0x0000/0x0001 (Legacy Q/L series)

PlcProfile

Canonical PLC profile used by the core client for profile-specific guards.

Value Description
Unspecified = 0
IqF = 1
IqR = 2
IqRRj71En71 = 14
IqL = 3
MxF = 4
MxR = 5
MxRRj71En71 = 15
QCpu = 6
LCpu = 7
QnU = 8
QnUDV = 9
QCpuQj71E71100 = 10
LCpuLj71E71100 = 11
QnUQj71E71100 = 12
QnUDVQj71E71100 = 13

API Group SLMP_Devices

Device codes and addressing helpers.

Enums

DeviceCode

SLMP binary device codes (Subcommand dependent).

Value Description
SM = 0x0091 Special Relay
SD = 0x00A9 Special Register
X = 0x009C Input
Y = 0x009D Output
M = 0x0090 Internal Relay
L = 0x0092 Latch Relay
F = 0x0093 Annunciator
V = 0x0094 Edge Relay
B = 0x00A0 Link Relay
S = 0x0098 Step Relay
D = 0x00A8 Data Register
W = 0x00B4 Link Register
TS = 0x00C1 Timer Contact
TC = 0x00C0 Timer Coil
TN = 0x00C2 Timer Current Value
LTS = 0x0051 Long Timer Contact
LTC = 0x0050 Long Timer Coil
LTN = 0x0052 Long Timer Current Value
STS = 0x00C7 Retentive Timer Contact
STC = 0x00C6 Retentive Timer Coil
STN = 0x00C8 Retentive Timer Current Value
LSTS = 0x0059 Long Retentive Timer Contact
LSTC = 0x0058 Long Retentive Timer Coil
LSTN = 0x005A Long Retentive Timer Current Value
CS = 0x00C4 Counter Contact
CC = 0x00C3 Counter Coil
CN = 0x00C5 Counter Current Value
LCS = 0x0055 Long Counter Contact
LCC = 0x0054 Long Counter Coil
LCN = 0x0056 Long Counter Current Value
SB = 0x00A1 Link Special Relay
SW = 0x00B5 Link Special Register
DX = 0x00A2 Direct Input
DY = 0x00A3 Direct Output
Z = 0x00CC Index Register
LZ = 0x0062 Long Index Register
R = 0x00AF File Register
ZR = 0x00B0 File Register (Continuous)
RD = 0x002C Refresh Data Register
G = 0x00AB Buffer Memory
HG = 0x002E Long Buffer Memory

Functions

isBitDeviceCode

bool slmp::isBitDeviceCode(DeviceCode code) noexcept

Return true when a device family has bit-addressable semantic units.

isWordDeviceCode

bool slmp::isWordDeviceCode(DeviceCode code) noexcept

Return true when a device family has word-addressable semantic units.

API Group SLMP_HighLevel

User-facing helpers layered on top of slmp::SlmpClient.

Aliases

Snapshot

using slmp::highlevel::Snapshot = std::vector<NamedValue>

Ordered list returned by readNamed and consumed by writeNamed.

The order matches the caller-provided address order. This makes the structure convenient for result presentation and for one-request named writes. Word and DWord values may share one random-write request; bit values use one random-bit request. Mixed command families and bit-in-word read-modify-write addresses are rejected before transport.

PlcProfile

using slmp::highlevel::PlcProfile = ::slmp::PlcProfile

Enums

ValueType

Logical value kind used by the high-level facade.

Value Description
Bit One logical bit
U16 Unsigned 16-bit integer
S16 Signed 16-bit integer
U32 Unsigned 32-bit integer
S32 Signed 32-bit integer
Float32 IEEE-754 float32 value

BatchKind

Read-plan batching strategy for one named address.

Value Description
None Not eligible for the single-request named-read contract
Word Read through batched random word access
Dword Read through batched random dword access
BitInWord Read one bit from a batched word value

DeviceRangeCategory

Logical grouping for one device-range entry.

Value Description
Bit
Word
TimerCounter
Index
FileRegister

DeviceRangeNotation

Rendered public address numbering style for one PLC profile.

Value Description
Base10
Base8
Base16

Functions

plcProfileCanonicalName

const char * slmp::highlevel::plcProfileCanonicalName(PlcProfile family)

Return the canonical lowercase profile name.

family Selected PLC profile. Profile name such as melsec:iq-f.

Parameter Description
family Selected PLC profile.

Returns: Profile name such as melsec:iq-f.

parsePlcProfile

Error slmp::highlevel::parsePlcProfile(const char *text, PlcProfile &out_profile)

Parse one canonical profile name.

text Canonical profile name such as melsec:iq-r. out_profile Receives the parsed profile. Error::Ok on success, or Error::InvalidArgument for null, unknown, or unspecified names.

Parameter Description
text Canonical profile name such as melsec:iq-r.
out_profile Receives the parsed profile.

Returns: Error::Ok on success, or Error::InvalidArgument for null, unknown, or unspecified names.

availablePlcProfiles

const PlcProfile * slmp::highlevel::availablePlcProfiles(size_t &count)

Return the connection-selectable built-in profiles.

count Receives the number of entries in the returned array. Pointer to a stable, library-owned array. The array excludes Unspecified and the abstract melsec:qcpu base profile.

Parameter Description
count Receives the number of entries in the returned array.

Returns: Pointer to a stable, library-owned array. The array excludes Unspecified and the abstract melsec:qcpu base profile.

plcProfileDescriptors

const PlcProfileDescriptor * slmp::highlevel::plcProfileDescriptors(size_t &count)

Return all canonical profiles with display, connection, and base-profile metadata.

count Receives the number of descriptors in the returned array. Pointer to a stable, library-owned descriptor array. The abstract melsec:qcpu entry is included with PlcProfileDescriptor::connectable set to false.

Parameter Description
count Receives the number of descriptors in the returned array.

Returns: Pointer to a stable, library-owned descriptor array. The abstract melsec:qcpu entry is included with PlcProfileDescriptor::connectable set to false.

plcProfileDisplayName

const char * slmp::highlevel::plcProfileDisplayName(PlcProfile family)

Return the canonical human-readable display name for a PLC profile.

family Selected PLC profile. Profile display name such as MELSEC iQ-R (built-in).

Parameter Description
family Selected PLC profile.

Returns: Profile display name such as MELSEC iQ-R (built-in).

plcProfileDefaults

PlcProfileDefaults slmp::highlevel::plcProfileDefaults(PlcProfile family)

Resolve the fixed defaults for one PLC profile.

family Selected PLC profile. Derived frame, compatibility mode, address profile, and range profile.

Parameter Description
family Selected PLC profile.

Returns: Derived frame, compatibility mode, address profile, and range profile.

deviceRangeProfileLabel

const char * slmp::highlevel::deviceRangeProfileLabel(PlcProfile profile)

Return the stable display label for one explicit device-range PLC profile.

profile Selected PLC profile. Profile label text such as IQ-F.

Parameter Description
profile Selected PLC profile.

Returns: Profile label text such as IQ-F.

readDeviceRangeCatalogForPlcProfile

Error slmp::highlevel::readDeviceRangeCatalogForPlcProfile(SlmpClient &client, PlcProfile profile, DeviceRangeCatalog &out)

Read the configured device-range catalog for one explicit PLC profile.

This helper reads the profile-specific SD block and formats entries such as points=1024 and range=X0000-X1777.

QCPU, LCPU, QnU, and QnUDV also run direct read probes for runtime Z/ZR behavior after the SD block is loaded. This is an explicit read-only, non-atomic evidence aggregate. Its complete profile/rule/probe decision plan is validated before the first request, its synchronous calls own one uninterrupted client turn, and catalog entries retain their declared order. Expected PLC NG probe responses mean "not readable"; timeout, transport, protocol, lifecycle, or local-validation failures stop the aggregate and leave out unchanged.

The explicit profile is an assertion about the connected client and must exactly equal SlmpClient::plcProfile, including unit-specific profile identity. A mismatch returns Error::InvalidArgument before transport. This helper does not call ReadTypeName.

client Connected low-level client instance. profile Explicit PLC profile to use for the SD block mapping. out Receives the resolved device-range catalog. Error::Ok on complete success; otherwise the first error, with no partial catalog published through out.

Parameter Description
client Connected low-level client instance.
profile Explicit PLC profile to use for the SD block mapping.
out Receives the resolved device-range catalog.

Returns: Error::Ok on complete success; otherwise the first error, with no partial catalog published through out.

parseAddressSpec

Error slmp::highlevel::parseAddressSpec(const char *address, PlcProfile family, AddressSpec &out)

Parse a high-level address string.

Accepted forms: - D100:U - D100:S - D200:D - D200:L - D200:F - D50.3 - M1000:BIT

Dtype suffixes are interpreted as: - :BIT direct bit device - :U unsigned 16-bit - :S signed 16-bit - :D unsigned 32-bit - :L signed 32-bit - :F float32

Addresses without an explicit suffix are rejected. Use .n notation for a bit inside a word device.

address Address string to parse. family Explicit PLC profile used for string-device interpretation. out Parsed result. Error::Ok on success.

Parameter Description
address Address string to parse.
family Explicit PLC profile used for string-device interpretation.
out Parsed result.

Returns: Error::Ok on success.

formatAddressSpec

Error slmp::highlevel::formatAddressSpec(const AddressSpec &spec, PlcProfile family, char *out, size_t out_size)

Format one parsed high-level address into canonical uppercase text.

The formatted result uses MELSEC numbering rules for the target device family and preserves explicit dtype suffixes when the address needs them to round-trip one logical value.

Examples: - D100:U - D200:F - D50.A - X1A:BIT

spec Parsed address specification to format. family Explicit PLC profile used for string-device formatting. out Caller-provided destination buffer. out_size Destination buffer size in bytes. Error::Ok on success.

Parameter Description
spec Parsed address specification to format.
family Explicit PLC profile used for string-device formatting.
out Caller-provided destination buffer.
out_size Destination buffer size in bytes.

Returns: Error::Ok on success.

normalizeAddress

Error slmp::highlevel::normalizeAddress(const char *address, PlcProfile family, char *out, size_t out_size)

Parse and immediately format one user-facing address into canonical text.

This helper is useful when firmware accepts free-form user input and wants one normalized spelling for logging, caching, or configuration storage.

Example: charnormalized[32]={}; slmp::highlevel::normalizeAddress("d200:f",slmp::PlcProfile::IqR,normalized,sizeof(normalized)); //normalized->"D200:F"

address User-facing address string. family Explicit PLC profile used for string-device interpretation. out Caller-provided destination buffer. out_size Destination buffer size in bytes. Error::Ok on success.

Parameter Description
address User-facing address string.
family Explicit PLC profile used for string-device interpretation.
out Caller-provided destination buffer.
out_size Destination buffer size in bytes.

Returns: Error::Ok on success.

readTyped

Error slmp::highlevel::readTyped(SlmpClient &client, const char *device, const char *dtype, Value &out)

Read one logical value by device string and explicit dtype.

Supported dtypes: BIT, U, S, D, L, F.

D, L, and F consume two consecutive PLC words in little-endian order. BIT is intended for direct bit devices such as M1000; to access a bit inside a word device use the address-form overload with .bit notation.

Example: plc.setPlcProfile(slmp::PlcProfile::IqR); slmp::highlevel::Valuevalue; slmp::highlevel::readTyped(plc,"D100","U",value);

The operation derives its PLC profile from client and returns Error::InvalidArgument when the client profile is unspecified. A valid call emits exactly one device-read request.

client Connected low-level client instance. device Base device string such as D100. dtype Logical type name such as U or F. out Receives the decoded logical value. Error::Ok on success.

Parameter Description
client Connected low-level client instance.
device Base device string such as D100.
dtype Logical type name such as U or F.
out Receives the decoded logical value.

Returns: Error::Ok on success.

readTyped

Error slmp::highlevel::readTyped(SlmpClient &client, const char *address, Value &out)

Read one logical value using one address string such as D100:U or D200:F.

This overload is the most convenient form for application code because the type is declared in the address string.

Examples: - Z100:U - RD100:D - LTS10:BIT - D50.3

client Connected low-level client instance. address High-level address string. out Receives the decoded logical value. Error::Ok on success. The operation derives its PLC profile from client and returns Error::InvalidArgument when the client profile is unspecified. A valid call emits exactly one device-read request, including .bit reads.

Parameter Description
client Connected low-level client instance.
address High-level address string.
out Receives the decoded logical value.

Returns: Error::Ok on success.

writeTyped

Error slmp::highlevel::writeTyped(SlmpClient &client, const char *device, const char *dtype, const Value &value)

Write one logical value by device string and explicit dtype.

Supported dtypes: BIT, U, S, D, L, F.

For 32-bit values, the helper writes two consecutive PLC words in little-endian order. This helper does not implicitly mask or range-limit the payload beyond the target dtype conversion.

client Connected low-level client instance. device Base device string such as D100. dtype Logical type name such as U or F. value Logical value to encode and write. Error::Ok on success. The operation derives its PLC profile from client and returns Error::InvalidArgument when the client profile is unspecified. A valid call emits exactly one device-write request.

Parameter Description
client Connected low-level client instance.
device Base device string such as D100.
dtype Logical type name such as U or F.
value Logical value to encode and write.

Returns: Error::Ok on success.

writeTyped

Error slmp::highlevel::writeTyped(SlmpClient &client, const char *address, const Value &value)

Write one logical value using one address string such as D100:U, D200:F, or D50.3.

This overload supports both direct bit devices and word-bit expressions. Ordinary typed addresses emit exactly one device-write request. When the address uses .bit, the helper instead performs the same two-request read-modify-write as writeBitInWord: first one word read, then one word write. That operation is not atomic with PLC logic or other controllers and neither request is retried automatically. Both requests are fully admitted before the initial read, so a locally invalid write target or insufficient request capacity cannot cause a read-only partial operation.

client Connected low-level client instance. address High-level address string. value Logical value to encode and write. Error::Ok on success. The operation derives its PLC profile from client and returns Error::InvalidArgument when the client profile is unspecified.

Parameter Description
client Connected low-level client instance.
address High-level address string.
value Logical value to encode and write.

Returns: Error::Ok on success.

writeBitInWord

Error slmp::highlevel::writeBitInWord(SlmpClient &client, const char *device, int bit_index, bool value)

Update one bit inside a word device using read-modify-write.

Example: D50.3.

The helper first reads the source word, updates one bit in memory, and then writes the modified word back to the PLC. This explicit two-request helper is not atomic with PLC logic or other controllers and does not retry either request automatically. It always writes after a successful read, even when the selected bit was already equal to value. One local client turn and one absolute post-admission deadline cover both requests. Both requests are fully admitted before the initial read, so a locally invalid write target or insufficient request capacity cannot cause a read-only partial operation.

client Connected low-level client instance. device Base word device string such as D50. bit_index Bit index within the word, 0..15. value Bit state to write. Error::Ok on success. The operation derives its PLC profile from client and returns Error::InvalidArgument when the client profile is unspecified.

Parameter Description
client Connected low-level client instance.
device Base word device string such as D50.
bit_index Bit index within the word, 0..15.
value Bit state to write.

Returns: Error::Ok on success.

writeBitInWordModuleBuf

Error slmp::highlevel::writeBitInWordModuleBuf(SlmpClient &client, uint16_t slot, bool use_hg, uint32_t dev_no, int bit_index, bool value)

Update one bit through an immutable U-qualified module-buffer word route.

The operation has the same complete preflight, mandatory read/write, shared deadline, non-PLC-atomic, no-retry, and outcome-unknown contract as writeBitInWord.

writeBitInWordLinkDirect

Error slmp::highlevel::writeBitInWordLinkDirect(SlmpClient &client, uint8_t j_net, DeviceCode code, uint32_t dev_no, int bit_index, bool value)

Update one bit through an immutable J-qualified link-direct word route.

The operation has the same complete preflight, mandatory read/write, shared deadline, non-PLC-atomic, no-retry, and outcome-unknown contract as writeBitInWord.

compileReadPlan

Error slmp::highlevel::compileReadPlan(const std::vector< std::string > &addresses, PlcProfile family, ReadPlan &out)

Compile a reusable mixed read plan.

This separates address parsing from repeated polling. The resulting plan can be reused by readNamed or Poller.

Batchable word and dword devices are deduplicated automatically, so requesting D100:U, D100:S, and D100.3 results in one word-device entry in the compiled plan.

Compilation applies the Random Read limit for family's canonical default compatibility mode. readNamed revalidates the effective client mode before transport, so a manually overridden compatibility mode can reject a plan that was valid for the profile default.

addresses Caller-provided high-level addresses. family Explicit PLC profile used to parse every address. out Receives the compiled plan. Error::Ok on success.

Parameter Description
addresses Caller-provided high-level addresses.
family Explicit PLC profile used to parse every address.
out Receives the compiled plan.

Returns: Error::Ok on success.

readNamed

Error slmp::highlevel::readNamed(SlmpClient &client, const std::vector< std::string > &addresses, Snapshot &out)

Read a mixed logical snapshot by address strings.

Example: slmp::highlevel::Snapshotsnapshot; slmp::highlevel::readNamed(plc,{"SM400:BIT","D100:U","D200:F","D50.3"},snapshot);

The helper emits exactly one random-read request. Expressions that cannot be represented by that request, and plans that exceed one-request limits, are rejected before transport rather than being read in multiple requests.

client Connected low-level client instance. addresses Caller-provided address list. out Receives the logical values in caller order. Error::Ok on success. The operation derives its PLC profile from client and returns Error::InvalidArgument when the client profile is unspecified.

Parameter Description
client Connected low-level client instance.
addresses Caller-provided address list.
out Receives the logical values in caller order.

Returns: Error::Ok on success.

readNamed

Error slmp::highlevel::readNamed(SlmpClient &client, const ReadPlan &plan, Snapshot &out)

Read a mixed logical snapshot using a previously compiled plan.

This overload is the preferred fast path for repeated sampling because the parsing and batching decision has already been done by compileReadPlan.

client Connected low-level client instance. plan Previously compiled read plan. out Receives the logical values in plan order. Error::Ok on success.

Parameter Description
client Connected low-level client instance.
plan Previously compiled read plan.
out Receives the logical values in plan order.

Returns: Error::Ok on success.

writeNamed

Error slmp::highlevel::writeNamed(SlmpClient &client, const Snapshot &updates)

Write a mixed logical snapshot.

The complete collection is encoded as one random-write request. Word and DWord values may share that request; bit values use the random-bit command. Mixed command families and bit-in-word read-modify-write are rejected before transport.

client Connected low-level client instance. updates Ordered address/value pairs to write. Error::Ok on success. The operation derives its PLC profile from client and returns Error::InvalidArgument when the client profile is unspecified.

Parameter Description
client Connected low-level client instance.
updates Ordered address/value pairs to write.

Returns: Error::Ok on success.

API Group SLMP_Transport

Abstraction for communication layers.

Enums

CpuOperationStatus

Decoded CPU operation state from the lower 4 bits of SD203.

Value Description
Unknown = 0xFF
Run = 0x00
Stop = 0x02
Pause = 0x03

API Group SLMP_Utils

Helper functions for protocol management and debugging.

Functions

errorString

const char * slmp::errorString(Error error)

Get descriptive string for Error code.

endCodeString

const char * slmp::endCodeString(uint16_t end_code)

Get a compact code-derived label for an SLMP end code (PLC error code).

Get the stable code-derived key for an SLMP end code.

Implemented in optional slmp_error_codes.cpp. Include/link that file only when end-code labels or category helpers are needed. The returned pointer refers to an internal rotating buffer. Copy the string or use formatEndCodeString() when the value must be retained long-term.

The returned pointer refers to an internal rotating buffer. Copy the string or use formatEndCodeString() when the value must be retained long-term.

formatEndCodeString

char * slmp::formatEndCodeString(uint16_t end_code, char *buffer, size_t buffer_size)

Format a compact code-derived SLMP end-code label into caller-owned storage.

Format the stable code-derived key for an SLMP end code.

The buffer must have room for at least 19 bytes including the null terminator.

The output buffer must have room for at least 19 bytes, including the null terminator for a string such as "slmp_end_code_c810". Returns buffer on success, or nullptr when the buffer is missing or too small.

isRemotePasswordEndCode

bool slmp::isRemotePasswordEndCode(uint16_t end_code)

Return true when an SLMP end code is related to remote password protection.

Return true when the SLMP end code is related to remote password protection.

formatHexBytes

size_t slmp::formatHexBytes(const uint8_t *data, size_t length, char *out, size_t out_capacity)

Helper to format bytes as a hex string (e.g. "01 02 AB"). Used for logging.

Namespaces

Namespace slmp

Root namespace for all SLMP communication components.

Aliases

TcpKeepAliveConfigurator

using slmp::TcpKeepAliveConfigurator = bool (*)(::Client& client, uint32_t idle_seconds)

ArduinoClientTransmitPolicy

using slmp::ArduinoClientTransmitPolicy = size_t (*)( ::Client& client, const uint8_t* data, size_t length)

Functions

writeArduinoClientWhenReady

size_t slmp::writeArduinoClientWhenReady(::Client &client, const uint8_t *data, size_t length)

Write only when the generic Arduino client reports immediate capacity.

Bytes written, or zero when the client is not currently writable.

Returns: Bytes written, or zero when the client is not currently writable.

Namespace slmp::dev

Fluent API for defining device addresses.

This namespace is the recommended way to create DeviceAddress values in application code. It keeps the call site explicit about whether the PLC uses decimal numbering or MELSEC hexadecimal numbering.

Typical usage: autod100=slmp::dev::D(profile,slmp::dev::dec(100)); autox1a=slmp::dev::X(profile,slmp::dev::hex(0x1A)); autord10=slmp::dev::RD(profile,slmp::dev::dec(10)); autoltn0=slmp::dev::LTN(profile,slmp::dev::dec(0));

Device families exposed here match the generic direct-access helpers in SlmpClient. Extended devices such as U\G, U\HG, and J\device use ExtDeviceSpec instead of these factory helpers.

Functions

dec

DecNo slmp::dev::dec(uint32_t value)

Mark a PLC device number as decimal.

value Decimal device number, for example 100 for D100. Decimal-number wrapper consumed by the device helper factories.

Parameter Description
value Decimal device number, for example 100 for D100.

Returns: Decimal-number wrapper consumed by the device helper factories.

hex

HexNo slmp::dev::hex(uint32_t value)

Mark a PLC device number as hexadecimal.

value Hexadecimal device number, for example 0x1A for X1A. Hexadecimal-number wrapper consumed by the device helper factories.

Parameter Description
value Hexadecimal device number, for example 0x1A for X1A.

Returns: Hexadecimal-number wrapper consumed by the device helper factories.

FDevice

DeviceAddress slmp::dev::FDevice(PlcProfile profile, DecNo number)

Create an annunciator (F) device address.

profile Canonical PLC profile bound to the address. number Decimal annunciator number such as slmp::dev::dec(10). Device address for F. This helper is named FDevice instead of F because some embedded toolchains define F as a macro.

Parameter Description
profile Canonical PLC profile bound to the address.
number Decimal annunciator number such as slmp::dev::dec(10).

Returns: Device address for F.

blockRead

DeviceBlockRead slmp::dev::blockRead(DeviceAddress device, uint16_t points)

Create a contiguous block-read descriptor.

device First device in the block. points Number of points to read from device onward. Descriptor suitable for SlmpClient::readBlock and related APIs.

Parameter Description
device First device in the block.
points Number of points to read from device onward.

Returns: Descriptor suitable for SlmpClient::readBlock and related APIs.

blockWrite

DeviceBlockWrite slmp::dev::blockWrite(DeviceAddress device, const uint16_t *values, uint16_t points)

Create a contiguous block-write descriptor.

device First device in the block. values Caller-owned 16-bit block-point values in PLC order. points Number of 16-bit block points to write from values. Descriptor suitable for SlmpClient::writeBlock and related APIs. For bit-block writes, each uint16_t element is one packed block point representing 16 consecutive bit devices. Every bit pattern from 0x0000 through 0xFFFF is valid and is serialized little-endian without boolean normalization. This differs from direct and random bit writes, which accept one bool value per device.

Parameter Description
device First device in the block.
values Caller-owned 16-bit block-point values in PLC order.
points Number of 16-bit block points to write from values.

Returns: Descriptor suitable for SlmpClient::writeBlock and related APIs.

Namespace slmp::module_io

Named SLMP request-header module I/O numbers for CPU routing from SLMP specification SH080956.

Variables And Constants

ControlSystemCpu

uint16_t slmp::module_io::ControlSystemCpu = 0x03D0

Control system CPU in a redundant CPU system

StandbySystemCpu

uint16_t slmp::module_io::StandbySystemCpu = 0x03D1

Standby system CPU in a redundant CPU system

SystemACpu

uint16_t slmp::module_io::SystemACpu = 0x03D2

System A CPU in a redundant CPU system

SystemBCpu

uint16_t slmp::module_io::SystemBCpu = 0x03D3

System B CPU in a redundant CPU system

MultipleCpu1

uint16_t slmp::module_io::MultipleCpu1 = 0x03E0

CPU No. 1 in a multi-CPU system

MultipleCpu2

uint16_t slmp::module_io::MultipleCpu2 = 0x03E1

CPU No. 2 in a multi-CPU system

MultipleCpu3

uint16_t slmp::module_io::MultipleCpu3 = 0x03E2

CPU No. 3 in a multi-CPU system

MultipleCpu4

uint16_t slmp::module_io::MultipleCpu4 = 0x03E3

CPU No. 4 in a multi-CPU system

RemoteHead1

uint16_t slmp::module_io::RemoteHead1 = MultipleCpu1

Remote head No. 1 route

RemoteHead2

uint16_t slmp::module_io::RemoteHead2 = MultipleCpu2

Remote head No. 2 route

ControlSystemRemoteHead

uint16_t slmp::module_io::ControlSystemRemoteHead = ControlSystemCpu

Control system remote head route

StandbySystemRemoteHead

uint16_t slmp::module_io::StandbySystemRemoteHead = StandbySystemCpu

Standby system remote head route

OwnStation

uint16_t slmp::module_io::OwnStation = 0x03FF

Own station route

Classes

Class slmp::ArduinoClientTransport

Transport adapter for Arduino 'Client' objects (TCP).

Wraps classes like WiFiClient, EthernetClient, or GSMClient. Implements reliable stream-based communication for SLMP 3E/4E frames.

Member Functions

ArduinoClientTransport

slmp::ArduinoClientTransport::ArduinoClientTransport(::Client &client, TcpKeepAliveConfigurator keepalive_configurator, ArduinoClientTransmitPolicy transmit_policy)

Wrap an existing Arduino Client.

client Reference to an Arduino Client object (e.g., WiFiClient). keepalive_configurator Platform adapter that applies the fixed 30-second TCP keepalive idle after connection. transmit_policy Platform adapter that performs one demonstrably non-blocking transmit attempt.

Parameter Description
client Reference to an Arduino Client object (e.g., WiFiClient).
keepalive_configurator Platform adapter that applies the fixed 30-second TCP keepalive idle after connection.
transmit_policy Platform adapter that performs one demonstrably non-blocking transmit attempt.

connect

bool slmp::ArduinoClientTransport::connect(const char *host, uint16_t port) override

Connect to a numeric IPv4 PLC address via TCP.

close

void slmp::ArduinoClientTransport::close() override

Stop the client and close connection.

connected

bool slmp::ArduinoClientTransport::connected() const override

Check if the TCP socket is connected.

maximumRequestFrameSize

size_t slmp::ArduinoClientTransport::maximumRequestFrameSize() const override

TCP is stream-oriented; the SLMP data-length field is the limit.

writeAll

bool slmp::ArduinoClientTransport::writeAll(const uint8_t *data, size_t length) override

Block until all data is written to the stream.

readExact

bool slmp::ArduinoClientTransport::readExact(uint8_t *data, size_t length, uint32_t timeout_ms) override

Block until exact length is read from the stream or timeout occurs.

write

size_t slmp::ArduinoClientTransport::write(const uint8_t *data, size_t length) override

Non-blocking write to the stream.

read

size_t slmp::ArduinoClientTransport::read(uint8_t *data, size_t length) override

Non-blocking read from the stream.

available

size_t slmp::ArduinoClientTransport::available() override

Check number of bytes available in the stream.

cooperativeWait

void slmp::ArduinoClientTransport::cooperativeWait(uint32_t maximum_wait_ms) override

Yield to the Arduino scheduler/network stack for at most the supplied bound.

currentDatagramBytesRemaining

bool slmp::ArduinoClientTransport::currentDatagramBytesRemaining(size_t &bytes) const override

TCP is stream-oriented and has no datagram boundary.

Class slmp::ArduinoUdpTransport

Transport adapter for Arduino 'UDP' objects.

Wraps classes like WiFiUDP or EthernetUDP. Manages remote endpoint (host/port) and packet framing for SLMP. Only datagrams whose source IP address and port match the configured numeric remote endpoint are exposed to the SLMP decoder; other datagrams are drained.

UDP is connectionless; "connected" state in this class simply means that begin() has been called and remote endpoint is known.

Member Functions

ArduinoUdpTransport

slmp::ArduinoUdpTransport::ArduinoUdpTransport(::UDP &udp, uint16_t local_port=0)

Wrap an existing Arduino UDP object.

udp Reference to UDP object. local_port Local port to bind to (0 = request an ephemeral port).

Parameter Description
udp Reference to UDP object.
local_port Local port to bind to (0 = request an ephemeral port).

connect

bool slmp::ArduinoUdpTransport::connect(const char *host, uint16_t port) override

Set a numeric IPv4 remote address and begin listening on the local port.

close

void slmp::ArduinoUdpTransport::close() override

Stop listening and clear remote endpoint.

connected

bool slmp::ArduinoUdpTransport::connected() const override

True if the transport is initialized.

maximumRequestFrameSize

size_t slmp::ArduinoUdpTransport::maximumRequestFrameSize() const override

IPv4 UDP maximum complete datagram payload.

writeAll

bool slmp::ArduinoUdpTransport::writeAll(const uint8_t *data, size_t length) override

Send a single UDP packet containing the frame.

readExact

bool slmp::ArduinoUdpTransport::readExact(uint8_t *data, size_t length, uint32_t timeout_ms) override

Block until a UDP packet of exact length is received or timeout.

write

size_t slmp::ArduinoUdpTransport::write(const uint8_t *data, size_t length) override

Non-blocking packet send. Returns length on success.

read

size_t slmp::ArduinoUdpTransport::read(uint8_t *data, size_t length) override

Non-blocking read from the current received packet.

available

size_t slmp::ArduinoUdpTransport::available() override

Check if a new packet has arrived and return its size.

cooperativeWait

void slmp::ArduinoUdpTransport::cooperativeWait(uint32_t maximum_wait_ms) override

Yield to the Arduino scheduler/network stack for at most the supplied bound.

currentDatagramBytesRemaining

bool slmp::ArduinoUdpTransport::currentDatagramBytesRemaining(size_t &bytes) const override

Report the unread bytes in the currently parsed UDP datagram.

Class slmp::highlevel::BitInWordWriteOperation

Non-blocking two-request bit-in-word operation for the asynchronous client API.

begin validates the complete read/write plan before starting the read. Repeated update calls drive the read and the following write under one absolute timeout. The write always occurs, even when the selected bit already has the requested value. cancel retires the client transport; cancellation after write transmission may have started is reported through the client's normal outcome-unknown status.

Member Functions

BitInWordWriteOperation

slmp::highlevel::BitInWordWriteOperation::BitInWordWriteOperation()=default

~BitInWordWriteOperation

slmp::highlevel::BitInWordWriteOperation::~BitInWordWriteOperation()

BitInWordWriteOperation

slmp::highlevel::BitInWordWriteOperation::BitInWordWriteOperation(const BitInWordWriteOperation &)=delete

operator=

BitInWordWriteOperation & slmp::highlevel::BitInWordWriteOperation::operator=(const BitInWordWriteOperation &)=delete

begin

Error slmp::highlevel::BitInWordWriteOperation::begin(SlmpClient &client, const char *device, int bit_index, bool value, uint32_t now_ms)

beginModuleBuf

Error slmp::highlevel::BitInWordWriteOperation::beginModuleBuf(SlmpClient &client, uint16_t slot, bool use_hg, uint32_t dev_no, int bit_index, bool value, uint32_t now_ms)

beginLinkDirect

Error slmp::highlevel::BitInWordWriteOperation::beginLinkDirect(SlmpClient &client, uint8_t j_net, DeviceCode code, uint32_t dev_no, int bit_index, bool value, uint32_t now_ms)

update

void slmp::highlevel::BitInWordWriteOperation::update(uint32_t now_ms)

cancel

void slmp::highlevel::BitInWordWriteOperation::cancel()

isBusy

bool slmp::highlevel::BitInWordWriteOperation::isBusy() const

result

Error slmp::highlevel::BitInWordWriteOperation::result() const

Class slmp::highlevel::Poller

Reusable snapshot poller that keeps one compiled read plan.

Compilation also owns the validated Random Read payload, compact result indexes, and reusable value storage. The first execution binds the poller to the exact client identity and canonical profile/frame/compatibility. Every execution still applies the client's current serial, monitoring timer, timeout, connection lifecycle, and complete response validation.

This class does not sleep. The caller controls timing and repeatedly calls readOnce from a scheduler, main loop, or RTOS task. Use a separate Poller for another client instance or configuration. A client bound by the first execution must outlive the Poller; destroying that client invalidates the binding even if another client is later constructed at the same address.

Member Functions

Poller

slmp::highlevel::Poller::Poller()=default

Poller

slmp::highlevel::Poller::Poller(const ReadPlan &plan)

Construct a poller from an already-compiled plan.

compile

Error slmp::highlevel::Poller::compile(const std::vector< std::string > &addresses, PlcProfile family)

Compile and store one reusable read plan with an explicit PLC profile.

readOnce

Error slmp::highlevel::Poller::readOnce(SlmpClient &client, Snapshot &out) const

Execute one snapshot read with the stored compiled plan.

client Connected low-level client instance. out Receives the logical values in plan order. Error::Ok on success.

Parameter Description
client Connected low-level client instance.
out Receives the logical values in plan order.

Returns: Error::Ok on success.

plan

const ReadPlan & slmp::highlevel::Poller::plan() const

Return the currently stored compiled plan for inspection or reuse.

Class slmp::DeviceAddress

Immutable, profile-bound device code and wire address.

Member Functions

DeviceAddress

slmp::DeviceAddress::DeviceAddress(PlcProfile profile_value, DeviceCode code_value, uint32_t number_value)

profile

PlcProfile slmp::DeviceAddress::profile() const noexcept

Canonical PLC profile used to interpret and format this address.

code

DeviceCode slmp::DeviceAddress::code() const noexcept

Device type code such as D, M, or X.

number

uint32_t slmp::DeviceAddress::number() const noexcept

Wire-level numeric address.

Class slmp::ITransport

Abstract interface for the underlying transport layer (TCP/UDP/Serial).

Implement this interface to support custom communication stacks. For Arduino-compatible ESP32/RP2040 cores, see ArduinoClientTransport or ArduinoUdpTransport.

Member Functions

~ITransport

virtual slmp::ITransport::~ITransport()=default

connect

virtual bool slmp::ITransport::connect(const char *host, uint16_t port)=0

Connect to an IPv4 host.

IPv6 is unsupported. Implementations may accept an IPv4 literal or a hostname, but hostname resolution must select IPv4 only and must never fall back to IPv6. This explicit operation is outside the SLMP transaction deadline; the implementation owns and documents its connection blocking bound.

close

virtual void slmp::ITransport::close()=0

Close connection.

connected

virtual bool slmp::ITransport::connected() const =0

Check connection status.

maximumRequestFrameSize

virtual size_t slmp::ITransport::maximumRequestFrameSize() const =0

Maximum complete request frame accepted by this transport.

Stream transports return static_cast(-1). Datagram adapters return their complete datagram ceiling. Every custom transport must declare this explicitly so a datagram transport cannot silently bypass request-size validation.

writeAll

virtual bool slmp::ITransport::writeAll(const uint8_t *data, size_t length)=0

Block until all data is written.

readExact

virtual bool slmp::ITransport::readExact(uint8_t *data, size_t length, uint32_t timeout_ms)=0

Block until exact length is read.

write

virtual size_t slmp::ITransport::write(const uint8_t *data, size_t length)=0

Non-blocking write; must return promptly so the client can enforce its absolute deadline.

read

virtual size_t slmp::ITransport::read(uint8_t *data, size_t length)=0

Non-blocking read; must return promptly so the client can enforce its absolute deadline.

available

virtual size_t slmp::ITransport::available()=0

Check pending read data length.

cooperativeWait

virtual void slmp::ITransport::cooperativeWait(uint32_t maximum_wait_ms)=0

Cooperatively wait for transport or scheduler progress.

Synchronous SlmpClient operations call this exactly once after an update cycle leaves an active request without protocol or transport progress. maximum_wait_ms is bounded by the remaining absolute transaction deadline. The implementation may return earlier, but must relinquish execution to the platform scheduler/network stack or block for relevant transport readiness, and must not return later than the supplied bound.

This operation must not send, receive, complete, retry, replay, or otherwise mutate an SLMP request. An empty implementation that leaves a synchronous caller in an unbounded tight spin does not conform.

currentDatagramBytesRemaining

virtual bool slmp::ITransport::currentDatagramBytesRemaining(size_t &bytes) const =0

Report bytes remaining in the datagram currently being read.

Datagram transports return true after assigning bytes. Stream transports return false. The SLMP decoder uses a known datagram boundary to reject truncated or concatenated response packets before their payload is interpreted.

Class slmp::SlmpClient

Main SLMP client implementation.

This class is the core low-level client. It is designed to be: - Memory Efficient: No dynamic allocation. User provides buffers. - Flexible: Supports synchronous (blocking) and asynchronous (non-blocking) calls. - Robust: Validates buffer capacities and protocol state.

Use this class directly when you want deterministic firmware behavior. If you prefer string device addresses such as D100 or D200:F, see the optional helper facade in slmp_high_level.h.

Each low-level operation emits at most one SLMP request and never splits or retries automatically. The client preflights its complete request frame, maximum response frame, and caller output capacity before encoding or transport activity. A device range must also fit the selected wire-format namespace: Legacy/Q-L specifications end at 0xFFFFFF, while iQ-R specifications end at 0xFFFFFFFF. Link-direct device specifications are always Q/L layout and therefore always end at 0xFFFFFF. An ordinary word-device DWord or float32 consumes two device numbers. Word-unit access to a bit device consumes sixteen bit numbers per wire word, its DWord form consumes thirty-two, and one packed bit-block point also consumes sixteen. Native long/DWord families retain their protocol-defined logical-device widths. These wire checks do not impose a PLC model's usable device-range catalog. Only one operation may be active per instance; same-instance cross-thread invocation is unsupported. Synchronous methods call ITransport::cooperativeWait only after an update cycle makes no progress. The first consecutive no-progress cycle requests a scheduler yield with a zero-millisecond bound; later consecutive no-progress cycles use at most a one-millisecond bound and reset to yield-first after progress. Asynchronous begin/update operation never calls that hook.

Enums

RemoteMode

Value Description
Normal = 0x0001U
Force = 0x0003U

RemoteClearMode

Value Description
NoClear = 0x0000U
ClearExceptLatch = 0x0001U
ClearAll = 0x0002U

Member Functions

SlmpClient

slmp::SlmpClient::SlmpClient(ITransport &transport, PlcProfile profile, const TargetAddress &target, uint8_t *tx_buffer, size_t tx_capacity, uint8_t *rx_buffer, size_t rx_capacity)

Initialize client with transport and buffers.

transport Reference to transport implementation (must remain valid). profile Concrete PLC profile. Unspecified profiles cannot connect or send. target Complete SLMP route used by requests. tx_buffer Pointer to transmission buffer. tx_capacity Capacity of tx_buffer in bytes. rx_buffer Pointer to reception buffer. rx_capacity Capacity of rx_buffer in bytes.

Parameter Description
transport Reference to transport implementation (must remain valid).
profile Concrete PLC profile. Unspecified profiles cannot connect or send.
target Complete SLMP route used by requests.
tx_buffer Pointer to transmission buffer.
tx_capacity Capacity of tx_buffer in bytes.
rx_buffer Pointer to reception buffer.
rx_capacity Capacity of rx_buffer in bytes.

connect

bool slmp::SlmpClient::connect(const char *host, uint16_t port)

Connect the configured transport to one PLC endpoint.

host PLC IPv4 address or hostname resolved by the transport to IPv4 only. port SLMP TCP or UDP port such as 1025. True when the underlying transport reports a successful IPv4 connect. IPv6 literals are rejected before the transport is called. The transport owns any connection deadline; setTimeoutMs controls only an SLMP transaction after connection. An active client returns false and exposes Error::Busy through lastError. Call this once before using the synchronous helper API such as readWords, readOneDWord, or writeOneFloat32.

Parameter Description
host PLC IPv4 address or hostname resolved by the transport to IPv4 only.
port SLMP TCP or UDP port such as 1025.

Returns: True when the underlying transport reports a successful IPv4 connect. IPv6 literals are rejected before the transport is called. The transport owns any connection deadline; setTimeoutMs controls only an SLMP transaction after connection. An active client returns false and exposes Error::Busy through lastError.

close

void slmp::SlmpClient::close()

Close the current transport connection and clear in-flight state.

connected

bool slmp::SlmpClient::connected() const

Check whether the transport is currently connected.

target

const TargetAddress & slmp::SlmpClient::target() const

Get current target station routing.

frameType

FrameType slmp::SlmpClient::frameType() const

Get the profile-derived or explicitly paired manual frame format.

compatibilityMode

CompatibilityMode slmp::SlmpClient::compatibilityMode() const

Get the profile-derived or explicitly paired manual compatibility mode.

setPlcProfile

Error slmp::SlmpClient::setPlcProfile(PlcProfile profile)

Set a concrete PLC profile and apply its frame/compatibility defaults.

Error::Ok on success, or Error::InvalidArgument when the profile is not connection-selectable, or Error::Busy while a request is active. The existing configuration is kept when the change is rejected.

Returns: Error::Ok on success, or Error::InvalidArgument when the profile is not connection-selectable, or Error::Busy while a request is active. The existing configuration is kept when the change is rejected.

plcProfile

PlcProfile slmp::SlmpClient::plcProfile() const

Return the concrete PLC profile retained by the client.

setManualProfile

Error slmp::SlmpClient::setManualProfile(PlcProfile profile, FrameType frame_type, CompatibilityMode mode)

Set an explicit PLC profile while manually selecting frame and compatibility mode.

This is intended for low-level verification and compatibility tooling that must emit a specific SLMP frame shape while still keeping profile-based guards active. Unknown enum values and changes during an active request are rejected without changing the existing configuration. Normal applications should prefer setPlcProfile.

setBlockAccessEnabled

void slmp::SlmpClient::setBlockAccessEnabled(bool enabled)

Enable or disable Read/Write Block commands when the selected PLC profile permits them.

blockAccessEnabled

bool slmp::SlmpClient::blockAccessEnabled() const

Return whether Read/Write Block commands are effectively enabled after PLC-profile guards.

setMonitoringTimer

void slmp::SlmpClient::setMonitoringTimer(uint16_t monitoring_timer)

Set SLMP monitoring timer (units of 250ms). How long the PLC should wait for internal processing.

monitoringTimer

uint16_t slmp::SlmpClient::monitoringTimer() const

Get current monitoring timer value.

setTimeoutMs

Error slmp::SlmpClient::setTimeoutMs(uint32_t timeout_ms)

Set the absolute request timeout in milliseconds. Zero is rejected.

This is an idle-only configuration operation. While any request is active it returns Error::Busy, including when timeout_ms is zero, and does not alter either the configured value or the active request. The deadline starts immediately before the active request's first transport write attempt and snapshots the then-configured timeout. It is not extended by partial I/O, discarded responses for another route or 4E serial number, or later configuration attempts.

timeoutMs

uint32_t slmp::SlmpClient::timeoutMs() const

Get current timeout value.

lastError

Error slmp::SlmpClient::lastError() const

Get the error code from the last operation.

lastOutcomeUnknownReason

Error slmp::SlmpClient::lastOutcomeUnknownReason() const

Return the machine-readable cause retained for Error::OutcomeUnknown.

Returns Error::Ok unless lastError is Error::OutcomeUnknown. An outcome-unknown result must never be retried automatically; inspect the affected PLC state first.

lastEndCode

uint16_t slmp::SlmpClient::lastEndCode() const

Get the PLC-specific end code from the last operation. Valid if lastError() is Error::PlcError.

hasLastErrorInfo

bool slmp::SlmpClient::hasLastErrorInfo() const

Return true when the last PLC error included a structured 9-byte error information block.

lastErrorInfo

const SlmpErrorInfo & slmp::SlmpClient::lastErrorInfo() const

Get structured error information from the last PLC error response.

hasLastProfileFeatureErrorInfo

bool slmp::SlmpClient::hasLastProfileFeatureErrorInfo() const

Return true when the last error was a strict profile feature guard.

lastProfileFeatureErrorInfo

const ProfileFeatureErrorInfo & slmp::SlmpClient::lastProfileFeatureErrorInfo() const

Get structured information from the last strict profile guard error.

lastRequestFrame

const uint8_t * slmp::SlmpClient::lastRequestFrame() const

Get pointer to the raw request frame buffer.

lastRequestFrameLength

size_t slmp::SlmpClient::lastRequestFrameLength() const

Get the actual length of the last request frame.

lastResponseFrame

const uint8_t * slmp::SlmpClient::lastResponseFrame() const

Get pointer to the raw response frame buffer.

lastResponseFrameLength

size_t slmp::SlmpClient::lastResponseFrameLength() const

Get the actual length of the last response frame.

trafficStats

TrafficStats slmp::SlmpClient::trafficStats() const

Return cumulative traffic counters for this client lifetime.

readTypeName

Error slmp::SlmpClient::readTypeName(TypeNameInfo &out)

Read PLC model information for diagnostics.

Profile selection is intentionally explicit in the high-level API. Do not infer the active profile from this response. out Receives the PLC model name and optional model code. Operation result.

Parameter Description
out Receives the PLC model name and optional model code.

Returns: Operation result.

readCpuOperationState

Error slmp::SlmpClient::readCpuOperationState(CpuOperationState &out)

Read SD203 and decode the CPU operation state from the lower 4 bits.

out Receives the decoded state and raw masked code. Operation result.

Parameter Description
out Receives the decoded state and raw masked code.

Returns: Operation result.

readWords

Error slmp::SlmpClient::readWords(const DeviceAddress &device, uint16_t points, uint16_t *values, size_t value_capacity)

Read contiguous word devices.

device Start address. points Number of words to read. values Buffer to store read values. value_capacity Capacity of values buffer (in elements).

Parameter Description
device Start address.
points Number of words to read.
values Buffer to store read values.
value_capacity Capacity of values buffer (in elements).

writeWords

Error slmp::SlmpClient::writeWords(const DeviceAddress &device, const uint16_t *values, size_t count)

Write a contiguous word-device range.

device First word device in the range. values Word values in PLC order. count Number of words to write. Operation result.

Parameter Description
device First word device in the range.
values Word values in PLC order.
count Number of words to write.

Returns: Operation result.

readBits

Error slmp::SlmpClient::readBits(const DeviceAddress &device, uint16_t points, bool *values, size_t value_capacity)

Read a contiguous bit-device range as boolean values.

device First bit device in the range. points Number of bit points to read. values Output buffer for the returned bit states. value_capacity Capacity of values in elements. Operation result.

Parameter Description
device First bit device in the range.
points Number of bit points to read.
values Output buffer for the returned bit states.
value_capacity Capacity of values in elements.

Returns: Operation result.

writeBits

Error slmp::SlmpClient::writeBits(const DeviceAddress &device, const bool *values, size_t count)

Write a contiguous bit-device range from boolean values.

device First bit device in the range. values Bit values in PLC order. count Number of bit points to write. Operation result.

Parameter Description
device First bit device in the range.
values Bit values in PLC order.
count Number of bit points to write.

Returns: Operation result.

readDWords

Error slmp::SlmpClient::readDWords(const DeviceAddress &device, uint16_t points, uint32_t *values, size_t value_capacity)

Read a contiguous DWord range as unsigned 32-bit values.

device First device in the range. points Number of 32-bit values to read. values Output buffer for the returned values. value_capacity Capacity of values in elements. Operation result.

Parameter Description
device First device in the range.
points Number of 32-bit values to read.
values Output buffer for the returned values.
value_capacity Capacity of values in elements.

Returns: Operation result.

writeDWords

Error slmp::SlmpClient::writeDWords(const DeviceAddress &device, const uint32_t *values, size_t count)

Write a contiguous DWord range from unsigned 32-bit values.

device First device in the range. values 32-bit values in PLC order. count Number of 32-bit values to write. Operation result.

Parameter Description
device First device in the range.
values 32-bit values in PLC order.
count Number of 32-bit values to write.

Returns: Operation result.

readFloat32s

Error slmp::SlmpClient::readFloat32s(const DeviceAddress &device, uint16_t points, float *values, size_t value_capacity)

Read a contiguous range of IEEE-754 float32 values.

device First device in the range. points Number of float32 values to read. values Output buffer for the returned values. value_capacity Capacity of values in elements. Operation result.

Parameter Description
device First device in the range.
points Number of float32 values to read.
values Output buffer for the returned values.
value_capacity Capacity of values in elements.

Returns: Operation result.

writeFloat32s

Error slmp::SlmpClient::writeFloat32s(const DeviceAddress &device, const float *values, size_t count)

Write a contiguous range of IEEE-754 float32 values.

device First device in the range. values Float32 values in PLC order. count Number of float32 values to write. Operation result.

Parameter Description
device First device in the range.
values Float32 values in PLC order.
count Number of float32 values to write.

Returns: Operation result.

readOneWord

Error slmp::SlmpClient::readOneWord(const DeviceAddress &device, uint16_t &value)

Read one 16-bit word value through the synchronous helper API.

writeOneWord

Error slmp::SlmpClient::writeOneWord(const DeviceAddress &device, uint16_t value)

Write one 16-bit word value through the synchronous helper API.

readOneBit

Error slmp::SlmpClient::readOneBit(const DeviceAddress &device, bool &value)

Read one direct bit-device value through the synchronous helper API.

writeOneBit

Error slmp::SlmpClient::writeOneBit(const DeviceAddress &device, bool value)

Write one direct bit-device value through the synchronous helper API.

readOneDWord

Error slmp::SlmpClient::readOneDWord(const DeviceAddress &device, uint32_t &value)

Read one unsigned 32-bit value through the synchronous helper API.

writeOneDWord

Error slmp::SlmpClient::writeOneDWord(const DeviceAddress &device, uint32_t value)

Write one unsigned 32-bit value through the synchronous helper API.

readOneFloat32

Error slmp::SlmpClient::readOneFloat32(const DeviceAddress &device, float &value)

Read one IEEE-754 float32 value through the synchronous helper API.

writeOneFloat32

Error slmp::SlmpClient::writeOneFloat32(const DeviceAddress &device, float value)

Write one IEEE-754 float32 value through the synchronous helper API.

readRandom

Error slmp::SlmpClient::readRandom(const DeviceAddress *word_devices, size_t word_count, uint16_t *word_values, size_t word_value_capacity, const DeviceAddress *dword_devices, size_t dword_count, uint32_t *dword_values, size_t dword_value_capacity)

Perform random read of multiple word and dword devices.

Allows reading non-contiguous addresses in one request. This is one of the main low-level batching primitives behind the optional high-level snapshot helpers.

writeRandomWords

Error slmp::SlmpClient::writeRandomWords(const DeviceAddress *word_devices, const uint16_t *word_values, size_t word_count, const DeviceAddress *dword_devices, const uint32_t *dword_values, size_t dword_count)

Perform random write of multiple word and dword devices.

This is the low-level counterpart to mixed typed writes in the optional helper layer.

writeRandomBits

Error slmp::SlmpClient::writeRandomBits(const DeviceAddress *bit_devices, const bool *bit_values, size_t bit_count)

Perform random write of multiple bit devices.

readRandomExt

Error slmp::SlmpClient::readRandomExt(const ExtDeviceSpec *word_devices, size_t word_count, uint16_t *word_values, size_t word_value_capacity, const ExtDeviceSpec *dword_devices, size_t dword_count, uint32_t *dword_values, size_t dword_value_capacity)

Random read using extended device specs (module buffer or link direct).

writeRandomWordsExt

Error slmp::SlmpClient::writeRandomWordsExt(const ExtDeviceSpec *word_devices, const uint16_t *word_values, size_t word_count, const ExtDeviceSpec *dword_devices, const uint32_t *dword_values, size_t dword_count)

Random write words using extended device specs.

writeRandomBitsExt

Error slmp::SlmpClient::writeRandomBitsExt(const ExtDeviceSpec *bit_devices, const bool *bit_values, size_t bit_count)

Random write bits using extended device specs.

registerMonitorDevices

Error slmp::SlmpClient::registerMonitorDevices(const DeviceAddress *word_devices, size_t word_count, const DeviceAddress *dword_devices, size_t dword_count)

Register devices for monitoring (command 0x0801).

Register once, then call runMonitorCycle repeatedly to read current values without rebuilding the monitor list every cycle.

registerMonitorDevicesExt

Error slmp::SlmpClient::registerMonitorDevicesExt(const ExtDeviceSpec *word_devices, size_t word_count, const ExtDeviceSpec *dword_devices, size_t dword_count)

Register devices for monitoring using extended device specs (command 0x0801).

runMonitorCycle

Error slmp::SlmpClient::runMonitorCycle(uint16_t *word_values, size_t word_value_capacity, uint16_t word_count, uint32_t *dword_values, size_t dword_value_capacity, uint16_t dword_count)

Execute monitor cycle (command 0x0802).

Returns values for the devices previously registered by registerMonitorDevices or registerMonitorDevicesExt. The combined count must be nonzero and within the active profile's monitor-registration limit. word_values Destination for registered word-device values. word_value_capacity Number of uint16_t elements available in word_values. word_count Expected registered word-device count. dword_values Destination for registered DWord-device values. dword_value_capacity Number of uint32_t elements available in dword_values. dword_count Expected registered DWord-device count.

Parameter Description
word_values Destination for registered word-device values.
word_value_capacity Number of uint16_t elements available in word_values.
word_count Expected registered word-device count.
dword_values Destination for registered DWord-device values.
dword_value_capacity Number of uint32_t elements available in dword_values.
dword_count Expected registered DWord-device count.

readBlock

Error slmp::SlmpClient::readBlock(const DeviceBlockRead *word_blocks, size_t word_block_count, const DeviceBlockRead *bit_blocks, size_t bit_block_count, uint16_t *word_values, size_t word_value_capacity, uint16_t *bit_values, size_t bit_value_capacity)

Read multiple contiguous blocks in one request. Blocks can be word-units or bit-units.

writeBlock

Error slmp::SlmpClient::writeBlock(const DeviceBlockWrite *word_blocks, size_t word_block_count, const DeviceBlockWrite *bit_blocks, size_t bit_block_count)

Write multiple contiguous blocks in one request.

remoteRun

Error slmp::SlmpClient::remoteRun(RemoteMode mode, RemoteClearMode clear_mode)

Remote RUN command. Set PLC to RUN state.

remoteStop

Error slmp::SlmpClient::remoteStop()

Remote STOP command. Set PLC to STOP state.

remotePause

Error slmp::SlmpClient::remotePause(RemoteMode mode)

Remote PAUSE command. Set PLC to PAUSE state.

remoteLatchClear

Error slmp::SlmpClient::remoteLatchClear()

Remote LATCH CLEAR command.

remoteReset

Error slmp::SlmpClient::remoteReset()

Send Remote RESET, close the transport after transmission, and require reconnect before another request.

selfTestLoopback

Error slmp::SlmpClient::selfTestLoopback(const uint8_t *data, size_t data_length, uint8_t *out, size_t out_capacity, size_t &out_length)

Execute Self-test loopback. Verifies the declared length, exact response size, and byte-for-byte echo.

clearError

Error slmp::SlmpClient::clearError()

Clear PLC error state (Resets the error LED/status).

remotePasswordUnlock

Error slmp::SlmpClient::remotePasswordUnlock(const char *password)

Unlock remote password protected access.

remotePasswordLock

Error slmp::SlmpClient::remotePasswordLock(const char *password)

Lock remote password protected access.

update

void slmp::SlmpClient::update(uint32_t now_ms)

Advance asynchronous state machine. Must be called frequently in your main loop to process pending I/O.

now_ms Current system time in milliseconds.

Parameter Description
now_ms Current system time in milliseconds.

isBusy

bool slmp::SlmpClient::isBusy() const

Check if an asynchronous operation is currently active.

beginReadTypeName

Error slmp::SlmpClient::beginReadTypeName(TypeNameInfo &out, uint32_t now_ms)

Start async ReadTypeName. Result will be in out when busy becomes false.

beginReadWords

Error slmp::SlmpClient::beginReadWords(const DeviceAddress &device, uint16_t points, uint16_t *values, size_t value_capacity, uint32_t now_ms)

Start async ReadWords. Result will be in values when busy becomes false.

beginWriteWords

Error slmp::SlmpClient::beginWriteWords(const DeviceAddress &device, const uint16_t *values, size_t count, uint32_t now_ms)

Start async WriteWords.

beginReadBits

Error slmp::SlmpClient::beginReadBits(const DeviceAddress &device, uint16_t points, bool *values, size_t value_capacity, uint32_t now_ms)

Start async ReadBits.

beginWriteBits

Error slmp::SlmpClient::beginWriteBits(const DeviceAddress &device, const bool *values, size_t count, uint32_t now_ms)

Start async WriteBits.

beginReadDWords

Error slmp::SlmpClient::beginReadDWords(const DeviceAddress &device, uint16_t points, uint32_t *values, size_t value_capacity, uint32_t now_ms)

Start async ReadDWords.

beginWriteDWords

Error slmp::SlmpClient::beginWriteDWords(const DeviceAddress &device, const uint32_t *values, size_t count, uint32_t now_ms)

Start async WriteDWords.

beginReadFloat32s

Error slmp::SlmpClient::beginReadFloat32s(const DeviceAddress &device, uint16_t points, float *values, size_t value_capacity, uint32_t now_ms)

Start async ReadFloat32s.

beginWriteFloat32s

Error slmp::SlmpClient::beginWriteFloat32s(const DeviceAddress &device, const float *values, size_t count, uint32_t now_ms)

Start async WriteFloat32s.

beginReadRandom

Error slmp::SlmpClient::beginReadRandom(const DeviceAddress *word_devices, size_t word_count, uint16_t *word_values, size_t word_value_capacity, const DeviceAddress *dword_devices, size_t dword_count, uint32_t *dword_values, size_t dword_value_capacity, uint32_t now_ms)

Start async ReadRandom.

beginWriteRandomWords

Error slmp::SlmpClient::beginWriteRandomWords(const DeviceAddress *word_devices, const uint16_t *word_values, size_t word_count, const DeviceAddress *dword_devices, const uint32_t *dword_values, size_t dword_count, uint32_t now_ms)

Start async WriteRandomWords.

beginWriteRandomBits

Error slmp::SlmpClient::beginWriteRandomBits(const DeviceAddress *bit_devices, const bool *bit_values, size_t bit_count, uint32_t now_ms)

Start async WriteRandomBits.

beginReadRandomExt

Error slmp::SlmpClient::beginReadRandomExt(const ExtDeviceSpec *word_devices, size_t word_count, uint16_t *word_values, size_t word_value_capacity, const ExtDeviceSpec *dword_devices, size_t dword_count, uint32_t *dword_values, size_t dword_value_capacity, uint32_t now_ms)

Start async ReadRandomExt.

beginWriteRandomWordsExt

Error slmp::SlmpClient::beginWriteRandomWordsExt(const ExtDeviceSpec *word_devices, const uint16_t *word_values, size_t word_count, const ExtDeviceSpec *dword_devices, const uint32_t *dword_values, size_t dword_count, uint32_t now_ms)

Start async WriteRandomWordsExt.

beginWriteRandomBitsExt

Error slmp::SlmpClient::beginWriteRandomBitsExt(const ExtDeviceSpec *bit_devices, const bool *bit_values, size_t bit_count, uint32_t now_ms)

Start async WriteRandomBitsExt.

beginRegisterMonitorDevices

Error slmp::SlmpClient::beginRegisterMonitorDevices(const DeviceAddress *word_devices, size_t word_count, const DeviceAddress *dword_devices, size_t dword_count, uint32_t now_ms)

Start async RegisterMonitorDevices.

beginRegisterMonitorDevicesExt

Error slmp::SlmpClient::beginRegisterMonitorDevicesExt(const ExtDeviceSpec *word_devices, size_t word_count, const ExtDeviceSpec *dword_devices, size_t dword_count, uint32_t now_ms)

Start async RegisterMonitorDevicesExt.

beginRunMonitorCycle

Error slmp::SlmpClient::beginRunMonitorCycle(uint16_t *word_values, size_t word_value_capacity, uint16_t word_count, uint32_t *dword_values, size_t dword_value_capacity, uint16_t dword_count, uint32_t now_ms)

Start async RunMonitorCycle.

beginReadBlock

Error slmp::SlmpClient::beginReadBlock(const DeviceBlockRead *word_blocks, size_t word_block_count, const DeviceBlockRead *bit_blocks, size_t bit_block_count, uint16_t *word_values, size_t word_value_capacity, uint16_t *bit_values, size_t bit_value_capacity, uint32_t now_ms)

Start async ReadBlock.

beginWriteBlock

Error slmp::SlmpClient::beginWriteBlock(const DeviceBlockWrite *word_blocks, size_t word_block_count, const DeviceBlockWrite *bit_blocks, size_t bit_block_count, uint32_t now_ms)

Start async WriteBlock.

beginRemoteRun

Error slmp::SlmpClient::beginRemoteRun(RemoteMode mode, RemoteClearMode clear_mode, uint32_t now_ms)

Start async RemoteRun.

beginRemoteStop

Error slmp::SlmpClient::beginRemoteStop(uint32_t now_ms)

Start async RemoteStop.

beginRemotePause

Error slmp::SlmpClient::beginRemotePause(RemoteMode mode, uint32_t now_ms)

Start async RemotePause.

beginRemoteLatchClear

Error slmp::SlmpClient::beginRemoteLatchClear(uint32_t now_ms)

Start async RemoteLatchClear.

beginRemoteReset

Error slmp::SlmpClient::beginRemoteReset(uint32_t now_ms)

Start async RemoteReset; successful transmission closes the transport.

beginSelfTestLoopback

Error slmp::SlmpClient::beginSelfTestLoopback(const uint8_t *data, size_t data_length, uint8_t *out, size_t out_capacity, size_t *out_length, uint32_t now_ms)

Start async SelfTestLoopback. The request payload is snapshotted before this method returns. Completion requires an exact response length, declared length, and payload echo.

beginClearError

Error slmp::SlmpClient::beginClearError(uint32_t now_ms)

Start async ClearError.

beginRemotePasswordUnlock

Error slmp::SlmpClient::beginRemotePasswordUnlock(const char *password, uint32_t now_ms)

Start async RemotePasswordUnlock.

beginRemotePasswordLock

Error slmp::SlmpClient::beginRemotePasswordLock(const char *password, uint32_t now_ms)

Start async RemotePasswordLock.

readLongTimer

Error slmp::SlmpClient::readLongTimer(int head_no, int points, LongTimerResult *out, size_t capacity)

Read one or more long timers (LTN device, 4 words per entry).

head_no Starting LTN device number (e.g. 0 for LTN0). points Number of timers to read. out Output buffer for decoded results. capacity Capacity of out buffer (in elements).

Parameter Description
head_no Starting LTN device number (e.g. 0 for LTN0).
points Number of timers to read.
out Output buffer for decoded results.
capacity Capacity of out buffer (in elements).

beginReadLongTimer

Error slmp::SlmpClient::beginReadLongTimer(int head_no, int points, LongTimerResult *out, size_t capacity, uint32_t now_ms)

Start async readLongTimer.

readLongRetentiveTimer

Error slmp::SlmpClient::readLongRetentiveTimer(int head_no, int points, LongTimerResult *out, size_t capacity)

Read one or more long retentive timers (LSTN device, 4 words per entry).

beginReadLongRetentiveTimer

Error slmp::SlmpClient::beginReadLongRetentiveTimer(int head_no, int points, LongTimerResult *out, size_t capacity, uint32_t now_ms)

Start async readLongRetentiveTimer.

readLtcStates

Error slmp::SlmpClient::readLtcStates(int head_no, int points, bool *out, size_t capacity)

Read coil states (LTC) for long timers at headNo..headNo+points-1.

readLtsStates

Error slmp::SlmpClient::readLtsStates(int head_no, int points, bool *out, size_t capacity)

Read contact states (LTS) for long timers.

readLstcStates

Error slmp::SlmpClient::readLstcStates(int head_no, int points, bool *out, size_t capacity)

Read coil states (LSTC) for long retentive timers.

readLstsStates

Error slmp::SlmpClient::readLstsStates(int head_no, int points, bool *out, size_t capacity)

Read contact states (LSTS) for long retentive timers.

readWordsModuleBuf

Error slmp::SlmpClient::readWordsModuleBuf(uint16_t slot, bool use_hg, uint32_t dev_no, uint16_t points, uint16_t *out, size_t capacity)

Read words from intelligent module buffer memory.

slot Module slot number in hex (e.g. 3 for U3, 0x3E0 for U3E0). use_hg true for HG (extended buffer), false for G (normal buffer). dev_no Device number (buffer memory address). points Number of words to read. out Output buffer. capacity Capacity of out buffer (in elements).

Parameter Description
slot Module slot number in hex (e.g. 3 for U3, 0x3E0 for U3E0).
use_hg true for HG (extended buffer), false for G (normal buffer).
dev_no Device number (buffer memory address).
points Number of words to read.
out Output buffer.
capacity Capacity of out buffer (in elements).

beginReadWordsModuleBuf

Error slmp::SlmpClient::beginReadWordsModuleBuf(uint16_t slot, bool use_hg, uint32_t dev_no, uint16_t points, uint16_t *out, size_t capacity, uint32_t now_ms)

Start async readWordsModuleBuf.

writeWordsModuleBuf

Error slmp::SlmpClient::writeWordsModuleBuf(uint16_t slot, bool use_hg, uint32_t dev_no, const uint16_t *values, size_t count)

Write words to intelligent module buffer memory.

beginWriteWordsModuleBuf

Error slmp::SlmpClient::beginWriteWordsModuleBuf(uint16_t slot, bool use_hg, uint32_t dev_no, const uint16_t *values, size_t count, uint32_t now_ms)

Start async writeWordsModuleBuf.

readWordsLinkDirect

Error slmp::SlmpClient::readWordsLinkDirect(uint8_t j_net, DeviceCode code, uint32_t dev_no, uint16_t points, uint16_t *out, size_t capacity)

Read words from a link direct device (CC-Link IE J\device).

j_net J-network number (0..255). code Device code. dev_no Device number. points Number of words to read. out Output buffer. capacity Capacity of out buffer (in elements).

Parameter Description
j_net J-network number (0..255).
code Device code.
dev_no Device number.
points Number of words to read.
out Output buffer.
capacity Capacity of out buffer (in elements).

beginReadWordsLinkDirect

Error slmp::SlmpClient::beginReadWordsLinkDirect(uint8_t j_net, DeviceCode code, uint32_t dev_no, uint16_t points, uint16_t *out, size_t capacity, uint32_t now_ms)

Start async readWordsLinkDirect.

writeWordsLinkDirect

Error slmp::SlmpClient::writeWordsLinkDirect(uint8_t j_net, DeviceCode code, uint32_t dev_no, const uint16_t *values, size_t count)

Write words to a link direct device.

beginWriteWordsLinkDirect

Error slmp::SlmpClient::beginWriteWordsLinkDirect(uint8_t j_net, DeviceCode code, uint32_t dev_no, const uint16_t *values, size_t count, uint32_t now_ms)

Start async writeWordsLinkDirect.

readBitsLinkDirect

Error slmp::SlmpClient::readBitsLinkDirect(uint8_t j_net, DeviceCode code, uint32_t dev_no, uint16_t points, bool *out, size_t capacity)

Read bits from a link direct device (16-point units).

beginReadBitsLinkDirect

Error slmp::SlmpClient::beginReadBitsLinkDirect(uint8_t j_net, DeviceCode code, uint32_t dev_no, uint16_t points, bool *out, size_t capacity, uint32_t now_ms)

Start async readBitsLinkDirect.

writeBitsLinkDirect

Error slmp::SlmpClient::writeBitsLinkDirect(uint8_t j_net, DeviceCode code, uint32_t dev_no, const bool *values, size_t count)

Write bits to a link direct device (16-point units).

beginWriteBitsLinkDirect

Error slmp::SlmpClient::beginWriteBitsLinkDirect(uint8_t j_net, DeviceCode code, uint32_t dev_no, const bool *values, size_t count, uint32_t now_ms)

Start async writeBitsLinkDirect.

readMemoryWords

Error slmp::SlmpClient::readMemoryWords(uint32_t head_address, uint16_t word_length, uint16_t *out, size_t capacity)

Read words from PLC memory (command 0x0613).

head_address 32-bit starting memory address. word_length Number of words to read. out Output buffer. capacity Capacity of out buffer (in elements).

Parameter Description
head_address 32-bit starting memory address.
word_length Number of words to read.
out Output buffer.
capacity Capacity of out buffer (in elements).

beginReadMemoryWords

Error slmp::SlmpClient::beginReadMemoryWords(uint32_t head_address, uint16_t word_length, uint16_t *out, size_t capacity, uint32_t now_ms)

Start async readMemoryWords.

writeMemoryWords

Error slmp::SlmpClient::writeMemoryWords(uint32_t head_address, const uint16_t *values, size_t count)

Write words to PLC memory (command 0x1613).

beginWriteMemoryWords

Error slmp::SlmpClient::beginWriteMemoryWords(uint32_t head_address, const uint16_t *values, size_t count, uint32_t now_ms)

Start async writeMemoryWords.

readExtendUnitBytes

Error slmp::SlmpClient::readExtendUnitBytes(uint32_t head_address, uint16_t byte_length, uint16_t module_no, uint8_t *out, size_t capacity)

Read raw bytes from an extend unit (command 0x0601).

head_address 32-bit starting address. byte_length Number of bytes to read. module_no Configured Extend Unit module I/O number. out Output buffer. capacity Capacity of out buffer in bytes.

Parameter Description
head_address 32-bit starting address.
byte_length Number of bytes to read.
module_no Configured Extend Unit module I/O number.
out Output buffer.
capacity Capacity of out buffer in bytes.

beginReadExtendUnitBytes

Error slmp::SlmpClient::beginReadExtendUnitBytes(uint32_t head_address, uint16_t byte_length, uint16_t module_no, uint8_t *out, size_t capacity, uint32_t now_ms)

Start async readExtendUnitBytes.

readExtendUnitWords

Error slmp::SlmpClient::readExtendUnitWords(uint32_t head_address, uint16_t word_length, uint16_t module_no, uint16_t *out, size_t capacity)

Read words from an extend unit (command 0x0601).

readExtendUnitWord

Error slmp::SlmpClient::readExtendUnitWord(uint32_t head_address, uint16_t module_no, uint16_t &value)

Read single word from an extend unit.

readExtendUnitDWord

Error slmp::SlmpClient::readExtendUnitDWord(uint32_t head_address, uint16_t module_no, uint32_t &value)

Read single DWord (2 words, little-endian) from an extend unit.

writeExtendUnitBytes

Error slmp::SlmpClient::writeExtendUnitBytes(uint32_t head_address, uint16_t module_no, const uint8_t *data, size_t byte_length)

Write raw bytes to an extend unit (command 0x1601).

beginWriteExtendUnitBytes

Error slmp::SlmpClient::beginWriteExtendUnitBytes(uint32_t head_address, uint16_t module_no, const uint8_t *data, size_t byte_length, uint32_t now_ms)

Start async writeExtendUnitBytes.

writeExtendUnitWords

Error slmp::SlmpClient::writeExtendUnitWords(uint32_t head_address, uint16_t module_no, const uint16_t *values, size_t count)

Write words to an extend unit (command 0x1601).

writeExtendUnitWord

Error slmp::SlmpClient::writeExtendUnitWord(uint32_t head_address, uint16_t module_no, uint16_t value)

Write single word to an extend unit.

writeExtendUnitDWord

Error slmp::SlmpClient::writeExtendUnitDWord(uint32_t head_address, uint16_t module_no, uint32_t value)

Write single DWord (2 words, little-endian) to an extend unit.

readArrayLabels

Error slmp::SlmpClient::readArrayLabels(const LabelArrayReadPoint *points, size_t point_count, LabelArrayReadResult *out, size_t out_capacity, size_t *out_count, const LabelName *abbrevs=nullptr, size_t abbrev_count=0)

Read array labels from the PLC (command 0x041A).

points Array of read point descriptors. point_count Number of points. out Output buffer for results. result.data pointers are valid until the next operation. out_capacity Capacity of out buffer (in elements). out_count Receives the number of results written. abbrevs Optional abbreviation label names (may be nullptr). abbrev_count Number of abbreviation labels. Response count, unit, logical length, payload bounds, and trailing data are validated before success is returned.

Parameter Description
points Array of read point descriptors.
point_count Number of points.
out Output buffer for results. result.data pointers are valid until the next operation.
out_capacity Capacity of out buffer (in elements).
out_count Receives the number of results written.
abbrevs Optional abbreviation label names (may be nullptr).
abbrev_count Number of abbreviation labels.

beginReadArrayLabels

Error slmp::SlmpClient::beginReadArrayLabels(const LabelArrayReadPoint *points, size_t point_count, LabelArrayReadResult *out, size_t out_capacity, size_t *out_count, const LabelName *abbrevs, size_t abbrev_count, uint32_t now_ms)

Start async readArrayLabels.

writeArrayLabels

Error slmp::SlmpClient::writeArrayLabels(const LabelArrayWritePoint *points, size_t point_count, const LabelName *abbrevs=nullptr, size_t abbrev_count=0)

Write array labels to the PLC (command 0x141A).

Requires the exact padded two-byte wire length for every point.

beginWriteArrayLabels

Error slmp::SlmpClient::beginWriteArrayLabels(const LabelArrayWritePoint *points, size_t point_count, const LabelName *abbrevs, size_t abbrev_count, uint32_t now_ms)

Start async writeArrayLabels.

readRandomLabels

Error slmp::SlmpClient::readRandomLabels(const LabelName *labels, size_t label_count, LabelRandomReadResult *out, size_t out_capacity, size_t *out_count, size_t maximum_response_data_bytes, const LabelName *abbrevs=nullptr, size_t abbrev_count=0)

Read random labels from the PLC (command 0x041C).

labels Array of label names. label_count Number of labels. out Output buffer for results. out_capacity Capacity of out buffer. out_count Receives the number of results written. maximum_response_data_bytes Maximum encoded label-result data accepted for this request, including the result-count field and each result's length/type fields and value bytes. The client uses this bound to prove receive-buffer capacity before transmission. abbrevs Optional abbreviation labels. abbrev_count Number of abbreviation labels.

Parameter Description
labels Array of label names.
label_count Number of labels.
out Output buffer for results.
out_capacity Capacity of out buffer.
out_count Receives the number of results written.
maximum_response_data_bytes Maximum encoded label-result data accepted for this request, including the result-count field and each result's length/type fields and value bytes. The client uses this bound to prove receive-buffer capacity before transmission.
abbrevs Optional abbreviation labels.
abbrev_count Number of abbreviation labels.

beginReadRandomLabels

Error slmp::SlmpClient::beginReadRandomLabels(const LabelName *labels, size_t label_count, LabelRandomReadResult *out, size_t out_capacity, size_t *out_count, size_t maximum_response_data_bytes, const LabelName *abbrevs, size_t abbrev_count, uint32_t now_ms)

Start async readRandomLabels.

writeRandomLabels

Error slmp::SlmpClient::writeRandomLabels(const LabelRandomWritePoint *points, size_t point_count, const LabelName *abbrevs=nullptr, size_t abbrev_count=0)

Write random labels to the PLC (command 0x141B).

Every write buffer must have a positive, even byte length.

beginWriteRandomLabels

Error slmp::SlmpClient::beginWriteRandomLabels(const LabelRandomWritePoint *points, size_t point_count, const LabelName *abbrevs, size_t abbrev_count, uint32_t now_ms)

Start async writeRandomLabels.

Class slmp::ReconnectHelper

Automates PLC connection maintenance.

Handles periodic retry logic when the connection is lost, ensuring the application remains connected without blocking the main loop.

Member Functions

ReconnectHelper

slmp::ReconnectHelper::ReconnectHelper(SlmpClient &client, const char *host, uint16_t port, const ReconnectOptions &options=ReconnectOptions())

Initialize helper with client and target endpoint.

client Reference to an initialized SlmpClient. host Target IP address or hostname. port Target Port (usually 1025 or 1280). options Reconnection configuration.

Parameter Description
client Reference to an initialized SlmpClient.
host Target IP address or hostname.
port Target Port (usually 1025 or 1280).
options Reconnection configuration.

ensureConnected

bool slmp::ReconnectHelper::ensureConnected(uint32_t now_ms)

Check and restore connection if needed.

If already connected, returns true immediately. If disconnected, attempts to connect only if ReconnectOptions::retry_interval_ms has elapsed since the last attempt.

now_ms Current system time in milliseconds. true if currently connected (or just successfully reconnected).

Parameter Description
now_ms Current system time in milliseconds.

Returns: true if currently connected (or just successfully reconnected).

consumeConnectedEdge

bool slmp::ReconnectHelper::consumeConnectedEdge()

Detect a rising edge of the connection state.

Returns true only ONCE when a new connection is established. Useful for triggering initialization logic like reading PLC type or setting up monitors.

true if a NEW connection was established since the last call to this method.

Returns: true if a NEW connection was established since the last call to this method.

valid

bool slmp::ReconnectHelper::valid() const

Return whether endpoint and retry options passed construction validation.

forceReconnect

void slmp::ReconnectHelper::forceReconnect(uint32_t now_ms)

Manually trigger a reconnection attempt on the next call to ensureConnected.

Closes the current connection and resets the retry timer to allow an immediate attempt if desired.

Structs

Struct slmp::highlevel::Value

Tagged logical value used by typed read, write, and named snapshots.

Only the field that matches type is meaningful. This struct is intentionally simple so it can be stack-allocated, copied into snapshots, and passed through firmware code without pulling in a heavier variant type.

Fields

type

ValueType slmp::highlevel::Value::type = ValueType::U16

Declared logical type of this value

bit

bool slmp::highlevel::Value::bit = false

Boolean payload for ValueType::Bit

u16

uint16_t slmp::highlevel::Value::u16 = 0U

Unsigned 16-bit payload

s16

int16_t slmp::highlevel::Value::s16 = 0

Signed 16-bit payload

u32

uint32_t slmp::highlevel::Value::u32 = 0UL

Unsigned 32-bit payload

s32

int32_t slmp::highlevel::Value::s32 = 0L

Signed 32-bit payload

f32

float slmp::highlevel::Value::f32 = 0.0f

Float32 payload

Member Functions

bitValue

static Value slmp::highlevel::Value::bitValue(bool value)

Create a boolean logical value.

value Boolean payload. Tagged Value initialized as ValueType::Bit.

Parameter Description
value Boolean payload.

Returns: Tagged Value initialized as ValueType::Bit.

u16Value

static Value slmp::highlevel::Value::u16Value(uint16_t value)

Create an unsigned 16-bit logical value.

value Unsigned 16-bit payload. Tagged Value initialized as ValueType::U16.

Parameter Description
value Unsigned 16-bit payload.

Returns: Tagged Value initialized as ValueType::U16.

s16Value

static Value slmp::highlevel::Value::s16Value(int16_t value)

Create a signed 16-bit logical value.

value Signed 16-bit payload. Tagged Value initialized as ValueType::S16.

Parameter Description
value Signed 16-bit payload.

Returns: Tagged Value initialized as ValueType::S16.

u32Value

static Value slmp::highlevel::Value::u32Value(uint32_t value)

Create an unsigned 32-bit logical value.

value Unsigned 32-bit payload. Tagged Value initialized as ValueType::U32.

Parameter Description
value Unsigned 32-bit payload.

Returns: Tagged Value initialized as ValueType::U32.

s32Value

static Value slmp::highlevel::Value::s32Value(int32_t value)

Create a signed 32-bit logical value.

value Signed 32-bit payload. Tagged Value initialized as ValueType::S32.

Parameter Description
value Signed 32-bit payload.

Returns: Tagged Value initialized as ValueType::S32.

float32Value

static Value slmp::highlevel::Value::float32Value(float value)

Create an IEEE-754 float32 logical value.

value Float payload. Tagged Value initialized as ValueType::Float32.

Parameter Description
value Float payload.

Returns: Tagged Value initialized as ValueType::Float32.

Struct slmp::highlevel::AddressSpec

Parsed logical address accepted by the high-level helpers.

Examples: - D100:U - D100:S - D200:F - D50.3 - M1000:BIT

Device families accepted by the parser include: - standard relay/register devices such as D, M, X, Y, R, ZR - long timer families LTN, LTS, LTC - long retentive timer families LSTN, LSTS, LSTC - long counter families LCN, LCS, LCC - index/register families Z, LZ, and RD

The .bit notation is valid only for word devices and maps to a read-modify-write flow on writes.

Fields

device

DeviceAddress slmp::highlevel::AddressSpec::device {PlcProfile::Unspecified, DeviceCode::D, 0U}

Populated by the profile-required parser

type

ValueType slmp::highlevel::AddressSpec::type = ValueType::U16

Logical value type requested by the caller

bit_index

int slmp::highlevel::AddressSpec::bit_index = -1

Bit index for D50.3 style access, otherwise -1

explicit_type

bool slmp::highlevel::AddressSpec::explicit_type = false

True when the input used an explicit suffix such as :F

Struct slmp::highlevel::ReadPlanEntry

One compiled entry in a named-read or poll plan.

A plan entry keeps both the original caller string and the normalized low-level interpretation so repeated polling does not need to re-parse the address expression.

Fields

address

std::string slmp::highlevel::ReadPlanEntry::address

Original caller-provided address string

spec

AddressSpec slmp::highlevel::ReadPlanEntry::spec

Parsed logical address

kind

BatchKind slmp::highlevel::ReadPlanEntry::kind = BatchKind::None

Batching strategy selected for this address

Struct slmp::highlevel::ReadPlan

Compiled snapshot plan reused by readNamed and Poller.

The entries vector preserves caller order for user-facing results. The word_devices and dword_devices vectors hold deduplicated batchable devices in the order chosen by the compiler so the runtime can perform one random-read request for many named addresses. Hand-built plans are validated at execution; an entry absent from its batch vector is rejected instead of being synthesized as value zero.

Fields

profile

PlcProfile slmp::highlevel::ReadPlan::profile = PlcProfile::Unspecified

Profile used to compile every address in this plan

entries

std::vector<ReadPlanEntry> slmp::highlevel::ReadPlan::entries

Snapshot entries in caller order

word_devices

std::vector<DeviceAddress> slmp::highlevel::ReadPlan::word_devices

Unique batched word devices

dword_devices

std::vector<DeviceAddress> slmp::highlevel::ReadPlan::dword_devices

Unique batched dword devices

Struct slmp::highlevel::NamedValue

One result item in a named snapshot.

Fields

address

std::string slmp::highlevel::NamedValue::address

Original caller-provided address string

value

Value slmp::highlevel::NamedValue::value

Decoded logical value

Struct slmp::highlevel::PlcProfileDefaults

Resolved fixed defaults for one PlcProfile.

Fields

frame_type

FrameType slmp::highlevel::PlcProfileDefaults::frame_type

Derived SLMP frame type

compatibility_mode

CompatibilityMode slmp::highlevel::PlcProfileDefaults::compatibility_mode

Derived low-level compatibility mode

address_profile

PlcProfile slmp::highlevel::PlcProfileDefaults::address_profile

String-address profile used by the helper parser

range_profile

PlcProfile slmp::highlevel::PlcProfileDefaults::range_profile

PLC profile used for SD-range helpers

Struct slmp::highlevel::PlcProfileDescriptor

Canonical metadata used to select and describe one PLC profile.

A null base_profile means that the canonical profile has no declared base profile.

Fields

canonical_name

const char* slmp::highlevel::PlcProfileDescriptor::canonical_name

Stable configuration identifier

display_name

const char* slmp::highlevel::PlcProfileDescriptor::display_name

Human-readable UI label

connectable

bool slmp::highlevel::PlcProfileDescriptor::connectable

True when standard connection helpers accept it

base_profile

const char* slmp::highlevel::PlcProfileDescriptor::base_profile

Canonical base profile, or null

Struct slmp::highlevel::DeviceRangeEntry

One device-range row for one public device code such as D or STS.

Fields

device

std::string slmp::highlevel::DeviceRangeEntry::device

Public device code such as D or X

category

DeviceRangeCategory slmp::highlevel::DeviceRangeEntry::category = DeviceRangeCategory::Word

Logical category for grouping

is_bit_device

bool slmp::highlevel::DeviceRangeEntry::is_bit_device = false

True when this device is normally bit-addressed

supported

bool slmp::highlevel::DeviceRangeEntry::supported = false

False when the PLC profile does not support this device

lower_bound

uint32_t slmp::highlevel::DeviceRangeEntry::lower_bound = 0U

Always zero in the current profile rules

upper_bound

uint32_t slmp::highlevel::DeviceRangeEntry::upper_bound = 0U

Inclusive last address when has_upper_bound is true

has_upper_bound

bool slmp::highlevel::DeviceRangeEntry::has_upper_bound = false

True when a finite last address is known

point_count

uint32_t slmp::highlevel::DeviceRangeEntry::point_count = 0U

Configured point count when has_point_count is true

has_point_count

bool slmp::highlevel::DeviceRangeEntry::has_point_count = false

True when the PLC/configuration exposes a usable count

address_range

std::string slmp::highlevel::DeviceRangeEntry::address_range

Preformatted range such as X0000-X1777 or empty when unavailable

notation

DeviceRangeNotation slmp::highlevel::DeviceRangeEntry::notation = DeviceRangeNotation::Base10

Rendered numbering style

source

std::string slmp::highlevel::DeviceRangeEntry::source

Rule source such as SD300 or Fixed family limit

notes

std::string slmp::highlevel::DeviceRangeEntry::notes

Optional profile-specific note

Struct slmp::highlevel::DeviceRangeCatalog

Resolved device-range catalog for one explicit PLC profile selection.

Fields

model

std::string slmp::highlevel::DeviceRangeCatalog::model

Synthetic profile label such as IQ-F

model_code

uint16_t slmp::highlevel::DeviceRangeCatalog::model_code = 0U

Always zero for explicit profile reads

has_model_code

bool slmp::highlevel::DeviceRangeCatalog::has_model_code = false

False because no type-name query is used here

plc_profile

PlcProfile slmp::highlevel::DeviceRangeCatalog::plc_profile = PlcProfile::IqR

Caller-selected PLC profile

entries

std::vector<DeviceRangeEntry> slmp::highlevel::DeviceRangeCatalog::entries

Device rows in stable output order

Struct slmp::TrafficStats

Immutable lifetime traffic-counter snapshot for one client.

Fields

request_count

uint64_t slmp::TrafficStats::request_count

Complete request frames accepted by the transport

tx_bytes

uint64_t slmp::TrafficStats::tx_bytes

Bytes in complete request frames accepted by the transport

rx_bytes

uint64_t slmp::TrafficStats::rx_bytes

Bytes in complete response frames received

Struct slmp::SlmpErrorInfo

Structured SLMP error information returned after a non-zero end code.

When at least the 9-byte structured block is present, the client exposes it only after its route, command, and subcommand match the active request. Additional trailing response data is permitted and remains available from SlmpClient::lastResponseFrame.

Fields

present

bool slmp::SlmpErrorInfo::present = false

True when the PLC response contained the 9-byte error information block

network

uint8_t slmp::SlmpErrorInfo::network = 0U

Network number reported by the PLC

station

uint8_t slmp::SlmpErrorInfo::station = 0U

Station number reported by the PLC

module_io

uint16_t slmp::SlmpErrorInfo::module_io = 0U

Module I/O number reported by the PLC

multidrop

uint8_t slmp::SlmpErrorInfo::multidrop = 0U

Multidrop station number reported by the PLC

command

uint16_t slmp::SlmpErrorInfo::command = 0U

Command code associated with the PLC error

subcommand

uint16_t slmp::SlmpErrorInfo::subcommand = 0U

Subcommand code associated with the PLC error

raw

uint8_t slmp::SlmpErrorInfo::raw[9] = {}

Raw 9-byte error information block

Struct slmp::ProfileFeatureErrorInfo

Structured information for Error::ProfileFeatureBlocked.

Fields

present

bool slmp::ProfileFeatureErrorInfo::present = false

True when the last error was produced by the profile guard

profile

PlcProfile slmp::ProfileFeatureErrorInfo::profile = PlcProfile::Unspecified

Selected PLC profile

profile_id

const char* slmp::ProfileFeatureErrorInfo::profile_id = nullptr

Canonical profile ID such as melsec:qnudv

feature_key

const char* slmp::ProfileFeatureErrorInfo::feature_key = nullptr

Capability feature key such as block

state

const char* slmp::ProfileFeatureErrorInfo::state = nullptr

Capability state, blocked or unverified

evidence

const char* slmp::ProfileFeatureErrorInfo::evidence = nullptr

Evidence or policy note from the embedded table

Struct slmp::DeviceBlockRead

Description for a contiguous block of devices to read.

Fields

device

DeviceAddress slmp::DeviceBlockRead::device

Starting device address

points

uint16_t slmp::DeviceBlockRead::points

Number of points to read

Struct slmp::DeviceBlockWrite

Description for a contiguous block of devices to write.

Fields

device

DeviceAddress slmp::DeviceBlockWrite::device

Starting device address

values

const uint16_t* slmp::DeviceBlockWrite::values

Pointer to 16-bit block-point values; bit blocks pack 16 devices per element

points

uint16_t slmp::DeviceBlockWrite::points

Number of 16-bit block points to write

Struct slmp::dev::DecNo

Wrapper type used to mark a device number as decimal.

Fields

value

uint32_t slmp::dev::DecNo::value

Struct slmp::dev::HexNo

Wrapper type used to mark a device number as hexadecimal.

Fields

value

uint32_t slmp::dev::HexNo::value

Struct slmp::LongTimerResult

Decoded result for one long timer or long retentive timer entry.

Each entry occupies 4 words in the device memory: [current_lo, current_hi, status_word, reserved].

This structure is returned by the dedicated long timer helpers instead of exposing the raw 4-word payload directly. The helper keeps the wire format available through status_word while also decoding the current value and the commonly-used contact / coil bits.

Fields

current_value

uint32_t slmp::LongTimerResult::current_value

Current timer value assembled from current_lo and current_hi

contact

bool slmp::LongTimerResult::contact

Contact state (LTS / LSTS, decoded from status_word & 0x0002)

coil

bool slmp::LongTimerResult::coil

Coil state (LTC / LSTC, decoded from status_word & 0x0001)

status_word

uint16_t slmp::LongTimerResult::status_word

Raw status word returned by the PLC for callers that need bit-exact inspection

Struct slmp::LabelName

UTF-16-LE label name for label commands.

Use 2-byte characters as-is from the label string. staticconstuint16_tkMyLabel[]={'V','a','r','1'}; slmp::LabelNamename={kMyLabel,4};

Fields

chars

const uint16_t* slmp::LabelName::chars

UTF-16-LE characters

length

uint16_t slmp::LabelName::length

Number of characters (not bytes)

Struct slmp::LabelArrayReadPoint

Single label read entry for SlmpClient::readArrayLabels.

Unit 0 is a logical bit count and occupies ceil(length / 16) * 2 wire bytes. Unit 1 is a logical byte count and occupies ceil(length / 2) * 2 wire bytes.

Fields

label

LabelName slmp::LabelArrayReadPoint::label

unit_specification

uint8_t slmp::LabelArrayReadPoint::unit_specification

0=bit, 1=byte

array_data_length

uint16_t slmp::LabelArrayReadPoint::array_data_length

Logical bit or byte count; must be non-zero

Struct slmp::LabelArrayReadResult

Single label read result from SlmpClient::readArrayLabels.

data points into the internal rx_buffer and is valid only until the next operation.

Fields

dt_id

uint8_t slmp::LabelArrayReadResult::dt_id

Data type identifier

unit_specification

uint8_t slmp::LabelArrayReadResult::unit_specification

0=bit, 1=byte

array_data_length

uint16_t slmp::LabelArrayReadResult::array_data_length

Logical bit or byte count

data

const uint8_t* slmp::LabelArrayReadResult::data

Pointer into rx_buffer (valid until next operation)

data_bytes

size_t slmp::LabelArrayReadResult::data_bytes

Byte length of data

Struct slmp::LabelArrayWritePoint

Single label write entry for SlmpClient::writeArrayLabels.

data_bytes must equal the padded two-byte wire length derived from unit_specification and array_data_length.

Fields

label

LabelName slmp::LabelArrayWritePoint::label

unit_specification

uint8_t slmp::LabelArrayWritePoint::unit_specification

0=bit, 1=byte

array_data_length

uint16_t slmp::LabelArrayWritePoint::array_data_length

Logical bit or byte count; must be non-zero

data

const uint8_t* slmp::LabelArrayWritePoint::data

Data to write

data_bytes

size_t slmp::LabelArrayWritePoint::data_bytes

Exact padded wire length

Struct slmp::LabelRandomReadResult

Single result from SlmpClient::readRandomLabels.

data points into the internal rx_buffer and is valid only until the next operation.

Fields

dt_id

uint8_t slmp::LabelRandomReadResult::dt_id

Data type identifier

spare

uint8_t slmp::LabelRandomReadResult::spare

Reserved byte

result_length

uint16_t slmp::LabelRandomReadResult::result_length

Positive, even byte length of data

data

const uint8_t* slmp::LabelRandomReadResult::data

Pointer into rx_buffer (valid until next operation)

Struct slmp::LabelRandomWritePoint

Single write entry for SlmpClient::writeRandomLabels.

Fields

label

LabelName slmp::LabelRandomWritePoint::label

data

const uint8_t* slmp::LabelRandomWritePoint::data

Data to write

data_bytes

uint16_t slmp::LabelRandomWritePoint::data_bytes

Positive, even byte length

Struct slmp::ExtDeviceSpec

Extended device address for Ext variants (readRandomExt, etc.).

Represents either a module buffer (U\G / U\HG) or link direct (J\device) target. Use the static factory methods to construct.

Enums

Kind

Value Description
ModuleBuf
LinkDirect

Fields

kind

enum slmp::ExtDeviceSpec::Kind slmp::ExtDeviceSpec::kind

mod

ModuleBufferAddress slmp::ExtDeviceSpec::mod
LinkDirectAddress slmp::ExtDeviceSpec::link

Member Functions

moduleBuf

static ExtDeviceSpec slmp::ExtDeviceSpec::moduleBuf(uint16_t slot, bool use_hg, uint32_t dev_no) noexcept

Construct a module buffer device (U\G or U\HG).

linkDirect

static ExtDeviceSpec slmp::ExtDeviceSpec::linkDirect(uint8_t j_net, DeviceCode code, uint32_t dev_no) noexcept

Construct a link direct device (J\device).

Struct slmp::ExtDeviceSpec::ModuleBufferAddress

Fields

slot

uint16_t slmp::ExtDeviceSpec::ModuleBufferAddress::slot

use_hg

bool slmp::ExtDeviceSpec::ModuleBufferAddress::use_hg

dev_no

uint32_t slmp::ExtDeviceSpec::ModuleBufferAddress::dev_no

Struct slmp::ExtDeviceSpec::LinkDirectAddress

Fields

j_net

uint8_t slmp::ExtDeviceSpec::LinkDirectAddress::j_net

code

DeviceCode slmp::ExtDeviceSpec::LinkDirectAddress::code

dev_no

uint32_t slmp::ExtDeviceSpec::LinkDirectAddress::dev_no

Struct slmp::TargetAddress

SLMP target station routing information.

Fields

network

uint8_t slmp::TargetAddress::network

Network number

station

uint8_t slmp::TargetAddress::station

Station number

module_io

uint16_t slmp::TargetAddress::module_io

Module I/O number

multidrop

uint8_t slmp::TargetAddress::multidrop

Multidrop station number

Member Functions

TargetAddress

slmp::TargetAddress::TargetAddress(uint8_t network_value, uint8_t station_value, uint16_t module_io_value, uint8_t multidrop_value)

Struct slmp::TypeNameInfo

PLC model and hardware information.

Fields

model

char slmp::TypeNameInfo::model[17]

Model name string (max 16 chars + null)

model_code

uint16_t slmp::TypeNameInfo::model_code

Internal model code

has_model_code

bool slmp::TypeNameInfo::has_model_code

True if model code is valid

Struct slmp::CpuOperationState

Decoded CPU operation state read from SD203.

Fields

status

CpuOperationStatus slmp::CpuOperationState::status = CpuOperationStatus::Unknown

Decoded operation state

raw_status_word

uint16_t slmp::CpuOperationState::raw_status_word = 0U

Full raw word value read from SD203

raw_code

uint8_t slmp::CpuOperationState::raw_code = 0U

Lower 4-bit masked status code from SD203

Struct slmp::SlmpClient::AsyncContext

Enums

Type

Value Description
None
ReadTypeName
ReadWords
WriteWords
ReadBits
WriteBits
ReadDWords
WriteDWords
ReadFloat32s
WriteFloat32s
ReadRandom
WriteRandomWords
WriteRandomBits
ReadBlock
WriteBlock
RemoteRun
RemoteStop
RemotePause
RemoteLatchClear
RemoteReset
SelfTest
ClearError
PasswordUnlock
PasswordLock
ReadLongTimer Reads LTN/LSTN words and decodes to LongTimerResult[]
ReadLongTimerStates Reads LTN/LSTN words and projects contact/coil states
ReadModuleBufWords Extended device read (module buffer), word subcommand (0x0080/0x0082)
WriteModuleBufWords Extended device write (module buffer), word subcommand (0x0080/0x0082)
ReadLinkDirectWords Link direct read, sub 0x0080
WriteWordsLinkDirect Link direct write words, sub 0x0080
ReadLinkDirectBits Link direct read bits, sub 0x0081
WriteBitsLinkDirect Link direct write bits, sub 0x0081
ReadMemoryWords Memory read (0x0613)
WriteMemoryWords Memory write (0x1613)
ReadExtendUnitBytes Extend unit read (0x0601)
WriteExtendUnitBytes Extend unit write (0x1601)
ReadArrayLabels Label array read (0x041A)
WriteArrayLabels Label array write (0x141A)
ReadRandomLabels Label random read (0x041C)
WriteRandomLabels Label random write (0x141B)
ReadRandomExt Extended random read (0x0403 sub 0x0080/0x0082)
WriteRandomWordsExt Extended random write words (0x1402 sub 0x0080/0x0082)
WriteRandomBitsExt Extended random write bits (0x1402 sub 0x0081/0x0083)
RegisterMonitorDevices Register monitor devices (0x0801 sub 0x0000/0x0002)
RegisterMonitorDevicesExt Register monitor devices ext (0x0801 sub 0x0080/0x0082)
RunMonitorCycle Run monitor cycle (0x0802)

Fields

type

Type slmp::SlmpClient::AsyncContext::type = Type::None

common

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::common

points

uint16_t slmp::SlmpClient::AsyncContext::points

values

void* slmp::SlmpClient::AsyncContext::values

out

TypeNameInfo* slmp::SlmpClient::AsyncContext::out

readTypeName

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::readTypeName

dword_count

uint16_t slmp::SlmpClient::AsyncContext::dword_count

dword_values

uint32_t* slmp::SlmpClient::AsyncContext::dword_values

readRandom

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::readRandom

word_count

uint16_t slmp::SlmpClient::AsyncContext::word_count

word_values

uint16_t* slmp::SlmpClient::AsyncContext::word_values

bit_values

uint16_t* slmp::SlmpClient::AsyncContext::bit_values

readBlock

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::readBlock

total_bit_points

size_t slmp::SlmpClient::AsyncContext::total_bit_points

total_word_points

size_t slmp::SlmpClient::AsyncContext::total_word_points

out

uint8_t* slmp::SlmpClient::AsyncContext::out

out_capacity

size_t slmp::SlmpClient::AsyncContext::out_capacity

out_length

size_t* slmp::SlmpClient::AsyncContext::out_length

selfTest

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::selfTest

word_blocks

const DeviceBlockWrite* slmp::SlmpClient::AsyncContext::word_blocks

word_block_count

size_t slmp::SlmpClient::AsyncContext::word_block_count

bit_blocks

const DeviceBlockWrite* slmp::SlmpClient::AsyncContext::bit_blocks

bit_block_count

size_t slmp::SlmpClient::AsyncContext::bit_block_count

writeBlock

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::writeBlock

out

LongTimerResult* slmp::SlmpClient::AsyncContext::out

readLongTimer

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::readLongTimer

contacts

bool slmp::SlmpClient::AsyncContext::contacts

out

bool* slmp::SlmpClient::AsyncContext::out

readLongTimerStates

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::readLongTimerStates

requested_count

size_t slmp::SlmpClient::AsyncContext::requested_count

out

LabelArrayReadResult* slmp::SlmpClient::AsyncContext::out

capacity

size_t slmp::SlmpClient::AsyncContext::capacity

out_count

size_t* slmp::SlmpClient::AsyncContext::out_count

readArrayLabels

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::readArrayLabels

out

LabelRandomReadResult* slmp::SlmpClient::AsyncContext::out

readRandomLabels

struct slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::readRandomLabels

data

union slmp::SlmpClient::AsyncContext slmp::SlmpClient::AsyncContext::data

Struct slmp::ReconnectOptions

Configuration for the ReconnectHelper.

Fields

retry_interval_ms

uint32_t slmp::ReconnectOptions::retry_interval_ms = 3000

Minimum time between connection attempts. Prevents hammering the network or PLC when the connection is physically down

Member Functions

ReconnectOptions

slmp::ReconnectOptions::ReconnectOptions()=default

ReconnectOptions

slmp::ReconnectOptions::ReconnectOptions(uint32_t retry_interval_ms_value)