slmp-connect-python 0.1.4__tar.gz → 0.1.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. slmp_connect_python-0.1.14/PKG-INFO +236 -0
  2. slmp_connect_python-0.1.14/README.md +202 -0
  3. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/pyproject.toml +3 -8
  4. slmp_connect_python-0.1.14/slmp/__init__.py +196 -0
  5. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp/async_client.py +138 -28
  6. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp/cli.py +55 -19
  7. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp/client.py +128 -29
  8. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp/core.py +372 -38
  9. slmp_connect_python-0.1.14/slmp/device_ranges.py +814 -0
  10. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp/utils.py +746 -83
  11. slmp_connect_python-0.1.14/slmp_connect_python.egg-info/PKG-INFO +236 -0
  12. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp_connect_python.egg-info/SOURCES.txt +4 -5
  13. slmp_connect_python-0.1.14/tests/test_async_client.py +395 -0
  14. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/tests/test_bugs_and_edges.py +32 -32
  15. slmp_connect_python-0.1.14/tests/test_cpu_operation_state.py +59 -0
  16. slmp_connect_python-0.1.14/tests/test_device_ranges.py +204 -0
  17. slmp_connect_python-0.1.14/tests/test_device_vectors.py +30 -0
  18. slmp_connect_python-0.1.14/tests/test_shared_spec.py +131 -0
  19. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/tests/test_slmp.py +236 -12
  20. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/tests/test_utils.py +675 -466
  21. slmp_connect_python-0.1.4/PKG-INFO +0 -247
  22. slmp_connect_python-0.1.4/README.md +0 -213
  23. slmp_connect_python-0.1.4/slmp/__init__.py +0 -119
  24. slmp_connect_python-0.1.4/slmp_connect_python.egg-info/PKG-INFO +0 -247
  25. slmp_connect_python-0.1.4/tests/test_async_client.py +0 -215
  26. slmp_connect_python-0.1.4/tests/test_device_vectors.py +0 -28
  27. slmp_connect_python-0.1.4/tests/test_live_sim.py +0 -76
  28. slmp_connect_python-0.1.4/tests/test_live_sim_3e.py +0 -58
  29. slmp_connect_python-0.1.4/tests/test_live_sim_exhaustive.py +0 -124
  30. slmp_connect_python-0.1.4/tests/test_live_sim_mixed_frames.py +0 -80
  31. slmp_connect_python-0.1.4/tests/test_live_sim_ultimate.py +0 -129
  32. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/LICENSE +0 -0
  33. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/setup.cfg +0 -0
  34. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp/constants.py +0 -0
  35. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp/errors.py +0 -0
  36. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp/py.typed +0 -0
  37. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp_connect_python.egg-info/dependency_links.txt +0 -0
  38. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp_connect_python.egg-info/entry_points.txt +0 -0
  39. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp_connect_python.egg-info/requires.txt +0 -0
  40. {slmp_connect_python-0.1.4 → slmp_connect_python-0.1.14}/slmp_connect_python.egg-info/top_level.txt +0 -0
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.4
2
+ Name: slmp-connect-python
3
+ Version: 0.1.14
4
+ Summary: SLMP Connect Python: client library for Mitsubishi SLMP binary communication
5
+ Author: fa-yoshinobu
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/fa-yoshinobu/plc-comm-slmp-python
8
+ Project-URL: Repository, https://github.com/fa-yoshinobu/plc-comm-slmp-python
9
+ Project-URL: Issues, https://github.com/fa-yoshinobu/plc-comm-slmp-python/issues
10
+ Keywords: slmp,melsec,mitsubishi,plc,3e,4e,binary
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: System :: Networking
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Provides-Extra: dev
25
+ Requires-Dist: build>=1.2; extra == "dev"
26
+ Requires-Dist: mypy>=1.10; extra == "dev"
27
+ Requires-Dist: pre-commit>=3.7; extra == "dev"
28
+ Requires-Dist: pytest>=8.0; extra == "dev"
29
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
30
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.6; extra == "dev"
32
+ Requires-Dist: twine>=5.1; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ [![CI](https://github.com/fa-yoshinobu/plc-comm-slmp-python/actions/workflows/ci.yml/badge.svg)](https://github.com/fa-yoshinobu/plc-comm-slmp-python/actions/workflows/ci.yml)
36
+ [![Documentation](https://img.shields.io/badge/docs-GitHub_Pages-blue.svg)](https://fa-yoshinobu.github.io/plc-comm-slmp-python/)
37
+ [![PyPI](https://img.shields.io/pypi/v/slmp-connect-python.svg)](https://pypi.org/project/slmp-connect-python/)
38
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
39
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
40
+ [![Static Analysis: Ruff](https://img.shields.io/badge/Lint-Ruff-black.svg)](https://github.com/astral-sh/ruff)
41
+
42
+ # SLMP Protocol for Python
43
+
44
+ ![Illustration](https://raw.githubusercontent.com/fa-yoshinobu/plc-comm-slmp-python/main/docsrc/assets/melsec.png)
45
+
46
+ High-level SLMP helpers for Mitsubishi PLC communication over Binary 3E and 4E frames.
47
+
48
+ This repository treats the high-level helper layer as the recommended user surface:
49
+
50
+ - `SlmpConnectionOptions`
51
+ - `open_and_connect` / `open_and_connect_sync`
52
+ - `AsyncSlmpClient`
53
+ - `QueuedAsyncSlmpClient`
54
+ - `SlmpClient`
55
+ - `normalize_address`
56
+ - `parse_address` / `try_parse_address` / `format_address`
57
+ - `read_typed` / `write_typed`
58
+ - `read_words_single_request` / `read_dwords_single_request`
59
+ - `read_words_chunked` / `read_dwords_chunked`
60
+ - `write_bit_in_word`
61
+ - `read_named` / `write_named`
62
+ - `poll`
63
+
64
+ ## Installation
65
+
66
+ ```bash
67
+ pip install slmp-connect-python
68
+ ```
69
+
70
+ The latest release lives at <https://pypi.org/project/slmp-connect-python/>, where wheel and tarball downloads and metadata are available.
71
+
72
+ ## Quick Start
73
+
74
+ Recommended async path:
75
+
76
+ ```python
77
+ import asyncio
78
+
79
+ from slmp import SlmpConnectionOptions, open_and_connect, read_named, write_typed
80
+
81
+
82
+ async def main() -> None:
83
+ options = SlmpConnectionOptions(
84
+ host="192.168.250.100",
85
+ plc_family="iq-f",
86
+ port=1025,
87
+ )
88
+ async with await open_and_connect(options) as client:
89
+ before = await read_named(client, ["D100", "D200:F", "D50.3"])
90
+ print("before:", before)
91
+
92
+ await write_typed(client, "D100", "U", 42)
93
+
94
+ after = await read_named(client, ["D100", "D200:F", "D50.3"])
95
+ print("after:", after)
96
+
97
+
98
+ asyncio.run(main())
99
+ ```
100
+
101
+ Choose canonical `plc_family` explicitly.
102
+ In the recommended high-level helper layer, the only PLC selector is `plc_family`.
103
+
104
+ ## High-Level PLC Selection
105
+
106
+ For normal application code:
107
+
108
+ - set `plc_family`
109
+ - let the library derive the fixed frame type, access profile, `X` / `Y` text rule, and device-range family
110
+ - do not pass raw `frame_type`, `plc_series`, or `device_family`
111
+
112
+ | `plc_family` | Derived `frame_type` | Derived `access_profile` | `X` / `Y` text | Derived range family | Notes |
113
+ | --- | --- | --- | --- | --- | --- |
114
+ | `iq-f` | `3e` | `ql` | octal | `iq-f` | live-validated |
115
+ | `iq-r` | `4e` | `iqr` | hexadecimal | `iq-r` | live-validated |
116
+ | `iq-l` | `4e` | `iqr` | hexadecimal | `iq-l` | live-validated on `L16HCPU` |
117
+ | `mx-f` | `4e` | `iqr` | hexadecimal | `mx-f` | provisional; review in `TODO.md` |
118
+ | `mx-r` | `4e` | `iqr` | hexadecimal | `mx-r` | provisional; review in `TODO.md` |
119
+ | `qcpu` | `3e` | `ql` | hexadecimal | `qcpu` | retained path |
120
+ | `lcpu` | `3e` | `ql` | hexadecimal | `lcpu` | retained path |
121
+ | `qnu` | `3e` | `ql` | hexadecimal | `qnu` | retained path |
122
+ | `qnudv` | `3e` | `ql` | hexadecimal | `qnudv` | retained path |
123
+
124
+ Low-level compatibility tools may still work with raw `frame_type` / `plc_series`, but that is not the normal public helper path.
125
+
126
+ High-level accepted `plc_family` values:
127
+
128
+ | Canonical | Typical target | Notes |
129
+ | --- | --- | --- |
130
+ | `iq-f` | FX5 / iQ-F | `X` / `Y` use manual octal text |
131
+ | `iq-r` | iQ-R | `X` / `Y` use hexadecimal text |
132
+ | `iq-l` | iQ-L | independent iQ-L range rules; live-validated on `L16HCPU` |
133
+ | `mx-f` | MX-F | pending live validation |
134
+ | `mx-r` | MX-R | pending live validation |
135
+ | `qcpu` | QCPU | `3e/ql` fixed profile |
136
+ | `lcpu` | LCPU | `3e/ql` fixed profile |
137
+ | `qnu` | QnU | `3e/ql` fixed profile |
138
+ | `qnudv` | QnUDV | `3e/ql` fixed profile |
139
+
140
+ Practical rules:
141
+
142
+ - non-`iQ-F` `X` / `Y`: text such as `X20` / `Y20` is interpreted as hexadecimal
143
+ - `iQ-F` / FX5 `X` / `Y`: text such as `X100` / `Y100` is interpreted as manual octal notation and encoded to the binary numeric value
144
+ - example: `X100` on `iQ-F` becomes binary device number `0x40`
145
+ - if you pass a numeric `DeviceRef`, string notation is already resolved, so `plc_family` is not needed for that one address
146
+ - short aliases such as `iqf`, `iqr`, `q`, `l`, and `qnudvcpu` are rejected
147
+
148
+ ## Supported PLC Registers
149
+
150
+ Start with these public high-level families first:
151
+
152
+ - word devices: `D`, `SD`, `R`, `ZR`, `TN`, `CN`
153
+ - bit devices: `M`, `X`, `Y`, `SM`, `B`
154
+ - typed forms: `D200:F`, `D300:L`, `D100:S`
155
+ - mixed snapshot forms: `D50.3`, `D100`, `D200:F`
156
+ - current-value long families: `LTN`, `LSTN`, `LCN`
157
+ - 32-bit index register: `LZ`
158
+
159
+ Long-family route notes:
160
+
161
+ - `LTN`, `LSTN`, `LCN`, and `LZ` default to 32-bit `:D` access in high-level helpers.
162
+ - `LCN` current-value reads and writes use random dword access in the high-level helpers.
163
+ - `LTS`, `LTC`, `LSTS`, and `LSTC` state reads use the long timer 4-word decode helpers.
164
+ - `LCS` and `LCC` state reads use direct bit read.
165
+ - High-level state writes for `LTS`/`LTC`/`LSTS`/`LSTC`/`LCS`/`LCC` use random bit write (`0x1402`).
166
+ - Low-level direct bit writes and direct word writes to these long-family logical forms are guarded before transport.
167
+
168
+ See the full public table in [Supported PLC Registers](docsrc/user/SUPPORTED_REGISTERS.md).
169
+
170
+ ## Public Documentation
171
+
172
+ - [Getting Started](docsrc/user/GETTING_STARTED.md)
173
+ - [Supported PLC Registers](docsrc/user/SUPPORTED_REGISTERS.md)
174
+ - [Latest Communication Verification](docsrc/user/LATEST_COMMUNICATION_VERIFICATION.md)
175
+ - [User Guide](docsrc/user/USER_GUIDE.md)
176
+ - [Samples](docsrc/user/SAMPLES.md)
177
+ - [Error Codes](docsrc/user/ERROR_CODES.md)
178
+
179
+ Maintainer-only notes and retained evidence live under `internal_docs/`.
180
+
181
+ ## High-Level API Guide
182
+
183
+ ### Address Normalization
184
+
185
+ ```python
186
+ from slmp import format_address, normalize_address, parse_address
187
+
188
+ print(normalize_address("x20")) # X20
189
+ print(normalize_address("d200")) # D200
190
+ print(normalize_address("x100", plc_family="iq-f")) # X100
191
+
192
+ parsed = parse_address("d200:f")
193
+ print(parsed.base_device, parsed.dtype) # D200 F
194
+ print(format_address(parsed)) # D200:F
195
+ ```
196
+
197
+ ### Single Typed Values
198
+
199
+ ```python
200
+ from slmp import read_typed, write_typed
201
+
202
+ temperature = await read_typed(client, "D200", "F")
203
+ counter = await read_typed(client, "D300", "L")
204
+ await write_typed(client, "D100", "U", 1234)
205
+ ```
206
+
207
+ Use `.bit` notation only with word devices such as `D50.3`.
208
+ Address bit devices directly as `M1000`, `M1001`, `X20`, or `Y20`.
209
+ For communication, `X` / `Y` string addresses require explicit `plc_family`.
210
+
211
+ ### Device Range Catalog
212
+
213
+ Use `plc_family` and read the derived family SD block once.
214
+
215
+ ```python
216
+ from slmp import SlmpClient
217
+
218
+ with SlmpClient("192.168.250.100", 1025, plc_family="qnu") as client:
219
+ catalog = client.read_device_range_catalog()
220
+ for entry in catalog.entries:
221
+ print(entry.device, entry.point_count, entry.address_range)
222
+ ```
223
+
224
+ This path does not call `read_type_name()`. The client uses the fixed range family derived from `plc_family`.
225
+
226
+ ## Development
227
+
228
+ ```bash
229
+ run_ci.bat
230
+ build_docs.bat
231
+ release_check.bat
232
+ ```
233
+
234
+ ## License
235
+
236
+ Distributed under the [MIT License](LICENSE).
@@ -0,0 +1,202 @@
1
+ [![CI](https://github.com/fa-yoshinobu/plc-comm-slmp-python/actions/workflows/ci.yml/badge.svg)](https://github.com/fa-yoshinobu/plc-comm-slmp-python/actions/workflows/ci.yml)
2
+ [![Documentation](https://img.shields.io/badge/docs-GitHub_Pages-blue.svg)](https://fa-yoshinobu.github.io/plc-comm-slmp-python/)
3
+ [![PyPI](https://img.shields.io/pypi/v/slmp-connect-python.svg)](https://pypi.org/project/slmp-connect-python/)
4
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+ [![Static Analysis: Ruff](https://img.shields.io/badge/Lint-Ruff-black.svg)](https://github.com/astral-sh/ruff)
7
+
8
+ # SLMP Protocol for Python
9
+
10
+ ![Illustration](https://raw.githubusercontent.com/fa-yoshinobu/plc-comm-slmp-python/main/docsrc/assets/melsec.png)
11
+
12
+ High-level SLMP helpers for Mitsubishi PLC communication over Binary 3E and 4E frames.
13
+
14
+ This repository treats the high-level helper layer as the recommended user surface:
15
+
16
+ - `SlmpConnectionOptions`
17
+ - `open_and_connect` / `open_and_connect_sync`
18
+ - `AsyncSlmpClient`
19
+ - `QueuedAsyncSlmpClient`
20
+ - `SlmpClient`
21
+ - `normalize_address`
22
+ - `parse_address` / `try_parse_address` / `format_address`
23
+ - `read_typed` / `write_typed`
24
+ - `read_words_single_request` / `read_dwords_single_request`
25
+ - `read_words_chunked` / `read_dwords_chunked`
26
+ - `write_bit_in_word`
27
+ - `read_named` / `write_named`
28
+ - `poll`
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install slmp-connect-python
34
+ ```
35
+
36
+ The latest release lives at <https://pypi.org/project/slmp-connect-python/>, where wheel and tarball downloads and metadata are available.
37
+
38
+ ## Quick Start
39
+
40
+ Recommended async path:
41
+
42
+ ```python
43
+ import asyncio
44
+
45
+ from slmp import SlmpConnectionOptions, open_and_connect, read_named, write_typed
46
+
47
+
48
+ async def main() -> None:
49
+ options = SlmpConnectionOptions(
50
+ host="192.168.250.100",
51
+ plc_family="iq-f",
52
+ port=1025,
53
+ )
54
+ async with await open_and_connect(options) as client:
55
+ before = await read_named(client, ["D100", "D200:F", "D50.3"])
56
+ print("before:", before)
57
+
58
+ await write_typed(client, "D100", "U", 42)
59
+
60
+ after = await read_named(client, ["D100", "D200:F", "D50.3"])
61
+ print("after:", after)
62
+
63
+
64
+ asyncio.run(main())
65
+ ```
66
+
67
+ Choose canonical `plc_family` explicitly.
68
+ In the recommended high-level helper layer, the only PLC selector is `plc_family`.
69
+
70
+ ## High-Level PLC Selection
71
+
72
+ For normal application code:
73
+
74
+ - set `plc_family`
75
+ - let the library derive the fixed frame type, access profile, `X` / `Y` text rule, and device-range family
76
+ - do not pass raw `frame_type`, `plc_series`, or `device_family`
77
+
78
+ | `plc_family` | Derived `frame_type` | Derived `access_profile` | `X` / `Y` text | Derived range family | Notes |
79
+ | --- | --- | --- | --- | --- | --- |
80
+ | `iq-f` | `3e` | `ql` | octal | `iq-f` | live-validated |
81
+ | `iq-r` | `4e` | `iqr` | hexadecimal | `iq-r` | live-validated |
82
+ | `iq-l` | `4e` | `iqr` | hexadecimal | `iq-l` | live-validated on `L16HCPU` |
83
+ | `mx-f` | `4e` | `iqr` | hexadecimal | `mx-f` | provisional; review in `TODO.md` |
84
+ | `mx-r` | `4e` | `iqr` | hexadecimal | `mx-r` | provisional; review in `TODO.md` |
85
+ | `qcpu` | `3e` | `ql` | hexadecimal | `qcpu` | retained path |
86
+ | `lcpu` | `3e` | `ql` | hexadecimal | `lcpu` | retained path |
87
+ | `qnu` | `3e` | `ql` | hexadecimal | `qnu` | retained path |
88
+ | `qnudv` | `3e` | `ql` | hexadecimal | `qnudv` | retained path |
89
+
90
+ Low-level compatibility tools may still work with raw `frame_type` / `plc_series`, but that is not the normal public helper path.
91
+
92
+ High-level accepted `plc_family` values:
93
+
94
+ | Canonical | Typical target | Notes |
95
+ | --- | --- | --- |
96
+ | `iq-f` | FX5 / iQ-F | `X` / `Y` use manual octal text |
97
+ | `iq-r` | iQ-R | `X` / `Y` use hexadecimal text |
98
+ | `iq-l` | iQ-L | independent iQ-L range rules; live-validated on `L16HCPU` |
99
+ | `mx-f` | MX-F | pending live validation |
100
+ | `mx-r` | MX-R | pending live validation |
101
+ | `qcpu` | QCPU | `3e/ql` fixed profile |
102
+ | `lcpu` | LCPU | `3e/ql` fixed profile |
103
+ | `qnu` | QnU | `3e/ql` fixed profile |
104
+ | `qnudv` | QnUDV | `3e/ql` fixed profile |
105
+
106
+ Practical rules:
107
+
108
+ - non-`iQ-F` `X` / `Y`: text such as `X20` / `Y20` is interpreted as hexadecimal
109
+ - `iQ-F` / FX5 `X` / `Y`: text such as `X100` / `Y100` is interpreted as manual octal notation and encoded to the binary numeric value
110
+ - example: `X100` on `iQ-F` becomes binary device number `0x40`
111
+ - if you pass a numeric `DeviceRef`, string notation is already resolved, so `plc_family` is not needed for that one address
112
+ - short aliases such as `iqf`, `iqr`, `q`, `l`, and `qnudvcpu` are rejected
113
+
114
+ ## Supported PLC Registers
115
+
116
+ Start with these public high-level families first:
117
+
118
+ - word devices: `D`, `SD`, `R`, `ZR`, `TN`, `CN`
119
+ - bit devices: `M`, `X`, `Y`, `SM`, `B`
120
+ - typed forms: `D200:F`, `D300:L`, `D100:S`
121
+ - mixed snapshot forms: `D50.3`, `D100`, `D200:F`
122
+ - current-value long families: `LTN`, `LSTN`, `LCN`
123
+ - 32-bit index register: `LZ`
124
+
125
+ Long-family route notes:
126
+
127
+ - `LTN`, `LSTN`, `LCN`, and `LZ` default to 32-bit `:D` access in high-level helpers.
128
+ - `LCN` current-value reads and writes use random dword access in the high-level helpers.
129
+ - `LTS`, `LTC`, `LSTS`, and `LSTC` state reads use the long timer 4-word decode helpers.
130
+ - `LCS` and `LCC` state reads use direct bit read.
131
+ - High-level state writes for `LTS`/`LTC`/`LSTS`/`LSTC`/`LCS`/`LCC` use random bit write (`0x1402`).
132
+ - Low-level direct bit writes and direct word writes to these long-family logical forms are guarded before transport.
133
+
134
+ See the full public table in [Supported PLC Registers](docsrc/user/SUPPORTED_REGISTERS.md).
135
+
136
+ ## Public Documentation
137
+
138
+ - [Getting Started](docsrc/user/GETTING_STARTED.md)
139
+ - [Supported PLC Registers](docsrc/user/SUPPORTED_REGISTERS.md)
140
+ - [Latest Communication Verification](docsrc/user/LATEST_COMMUNICATION_VERIFICATION.md)
141
+ - [User Guide](docsrc/user/USER_GUIDE.md)
142
+ - [Samples](docsrc/user/SAMPLES.md)
143
+ - [Error Codes](docsrc/user/ERROR_CODES.md)
144
+
145
+ Maintainer-only notes and retained evidence live under `internal_docs/`.
146
+
147
+ ## High-Level API Guide
148
+
149
+ ### Address Normalization
150
+
151
+ ```python
152
+ from slmp import format_address, normalize_address, parse_address
153
+
154
+ print(normalize_address("x20")) # X20
155
+ print(normalize_address("d200")) # D200
156
+ print(normalize_address("x100", plc_family="iq-f")) # X100
157
+
158
+ parsed = parse_address("d200:f")
159
+ print(parsed.base_device, parsed.dtype) # D200 F
160
+ print(format_address(parsed)) # D200:F
161
+ ```
162
+
163
+ ### Single Typed Values
164
+
165
+ ```python
166
+ from slmp import read_typed, write_typed
167
+
168
+ temperature = await read_typed(client, "D200", "F")
169
+ counter = await read_typed(client, "D300", "L")
170
+ await write_typed(client, "D100", "U", 1234)
171
+ ```
172
+
173
+ Use `.bit` notation only with word devices such as `D50.3`.
174
+ Address bit devices directly as `M1000`, `M1001`, `X20`, or `Y20`.
175
+ For communication, `X` / `Y` string addresses require explicit `plc_family`.
176
+
177
+ ### Device Range Catalog
178
+
179
+ Use `plc_family` and read the derived family SD block once.
180
+
181
+ ```python
182
+ from slmp import SlmpClient
183
+
184
+ with SlmpClient("192.168.250.100", 1025, plc_family="qnu") as client:
185
+ catalog = client.read_device_range_catalog()
186
+ for entry in catalog.entries:
187
+ print(entry.device, entry.point_count, entry.address_range)
188
+ ```
189
+
190
+ This path does not call `read_type_name()`. The client uses the fixed range family derived from `plc_family`.
191
+
192
+ ## Development
193
+
194
+ ```bash
195
+ run_ci.bat
196
+ build_docs.bat
197
+ release_check.bat
198
+ ```
199
+
200
+ ## License
201
+
202
+ Distributed under the [MIT License](LICENSE).
@@ -4,17 +4,17 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "slmp-connect-python"
7
- version = "0.1.4"
7
+ version = "0.1.14"
8
8
  description = "SLMP Connect Python: client library for Mitsubishi SLMP binary communication"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
11
  dependencies = []
12
12
  authors = [{ name = "fa-yoshinobu" }]
13
+ license = "MIT"
13
14
 
14
15
  license-files = ["LICENSE"]
15
16
  keywords = ["slmp", "melsec", "mitsubishi", "plc", "3e", "4e", "binary"]
16
17
  classifiers = [
17
- "License :: OSI Approved :: MIT License",
18
18
  "Development Status :: 3 - Alpha",
19
19
  "Intended Audience :: Developers",
20
20
  "Programming Language :: Python :: 3",
@@ -67,7 +67,7 @@ slmp-regression-suite = "slmp.cli:regression_suite_main"
67
67
 
68
68
  [tool.setuptools.packages.find]
69
69
  include = ["slmp*"]
70
- exclude = ["tests*", "scripts*", "docsrc/maintainer*", "docsrc/validation*"]
70
+ exclude = ["tests*", "scripts*", "internal_docs*"]
71
71
 
72
72
  [tool.setuptools]
73
73
  include-package-data = true
@@ -111,8 +111,3 @@ show_missing = true
111
111
 
112
112
 
113
113
 
114
-
115
-
116
-
117
-
118
-
@@ -0,0 +1,196 @@
1
+ """SLMP client library with high-level helpers as the recommended user surface.
2
+
3
+ The primary user-facing entry points are:
4
+
5
+ - ``read_typed`` / ``write_typed``
6
+ - ``read_words_single_request`` / ``read_dwords_single_request``
7
+ - ``read_words_chunked`` / ``read_dwords_chunked``
8
+ - ``write_bit_in_word``
9
+ - ``read_named`` / ``write_named``
10
+ - ``poll``
11
+ """
12
+
13
+ __version__ = "0.1.14"
14
+
15
+ from .async_client import AsyncSlmpClient
16
+ from .client import SlmpClient
17
+ from .constants import Command, FrameType, ModuleIONo, PLCSeries
18
+ from .core import (
19
+ DEVICE_CODES,
20
+ BlockReadResult,
21
+ CpuOperationState,
22
+ CpuOperationStatus,
23
+ DeviceBlockResult,
24
+ DeviceRef,
25
+ ExtensionSpec,
26
+ LabelArrayReadPoint,
27
+ LabelArrayReadResult,
28
+ LabelArrayWritePoint,
29
+ LabelRandomReadResult,
30
+ LabelRandomWritePoint,
31
+ LongTimerResult,
32
+ MonitorResult,
33
+ RandomReadResult,
34
+ SlmpResponse,
35
+ SlmpTarget,
36
+ SlmpTraceFrame,
37
+ TypeNameInfo,
38
+ decode_cpu_operation_state,
39
+ parse_device,
40
+ parse_extended_device,
41
+ )
42
+ from .device_ranges import (
43
+ SlmpDeviceRangeCatalog,
44
+ SlmpDeviceRangeCategory,
45
+ SlmpDeviceRangeEntry,
46
+ SlmpDeviceRangeFamily,
47
+ SlmpDeviceRangeNotation,
48
+ build_device_range_catalog_for_family,
49
+ family_label,
50
+ normalize_device_range_family,
51
+ read_device_range_catalog_for_family,
52
+ read_device_range_catalog_for_family_sync,
53
+ )
54
+ from .errors import (
55
+ SlmpBoundaryBehaviorWarning,
56
+ SlmpError,
57
+ SlmpPracticalPathWarning,
58
+ SlmpUnsupportedDeviceError,
59
+ )
60
+ from .utils import (
61
+ QueuedAsyncSlmpClient,
62
+ SlmpAddress,
63
+ SlmpConnectionOptions,
64
+ format_address,
65
+ normalize_address,
66
+ open_and_connect,
67
+ open_and_connect_sync,
68
+ parse_address,
69
+ poll,
70
+ poll_sync,
71
+ read_bits,
72
+ read_bits_sync,
73
+ read_dwords,
74
+ read_dwords_chunked,
75
+ read_dwords_chunked_sync,
76
+ read_dwords_single_request,
77
+ read_dwords_single_request_sync,
78
+ read_dwords_sync,
79
+ read_named,
80
+ read_named_sync,
81
+ read_typed,
82
+ read_typed_sync,
83
+ read_words,
84
+ read_words_chunked,
85
+ read_words_chunked_sync,
86
+ read_words_single_request,
87
+ read_words_single_request_sync,
88
+ read_words_sync,
89
+ try_parse_address,
90
+ write_bit_in_word,
91
+ write_bit_in_word_sync,
92
+ write_bits,
93
+ write_bits_sync,
94
+ write_dwords_chunked,
95
+ write_dwords_chunked_sync,
96
+ write_dwords_single_request,
97
+ write_dwords_single_request_sync,
98
+ write_named,
99
+ write_named_sync,
100
+ write_typed,
101
+ write_typed_sync,
102
+ write_words_chunked,
103
+ write_words_chunked_sync,
104
+ write_words_single_request,
105
+ write_words_single_request_sync,
106
+ )
107
+
108
+ __all__ = [
109
+ "AsyncSlmpClient",
110
+ "BlockReadResult",
111
+ "Command",
112
+ "CpuOperationState",
113
+ "CpuOperationStatus",
114
+ "DEVICE_CODES",
115
+ "DeviceBlockResult",
116
+ "DeviceRef",
117
+ "ExtensionSpec",
118
+ "FrameType",
119
+ "LabelArrayReadPoint",
120
+ "LabelArrayReadResult",
121
+ "LabelArrayWritePoint",
122
+ "LabelRandomReadResult",
123
+ "LabelRandomWritePoint",
124
+ "LongTimerResult",
125
+ "ModuleIONo",
126
+ "MonitorResult",
127
+ "PLCSeries",
128
+ "QueuedAsyncSlmpClient",
129
+ "SlmpConnectionOptions",
130
+ "SlmpAddress",
131
+ "RandomReadResult",
132
+ "SlmpClient",
133
+ "SlmpBoundaryBehaviorWarning",
134
+ "SlmpError",
135
+ "SlmpPracticalPathWarning",
136
+ "SlmpUnsupportedDeviceError",
137
+ "SlmpResponse",
138
+ "SlmpTarget",
139
+ "SlmpTraceFrame",
140
+ "TypeNameInfo",
141
+ "decode_cpu_operation_state",
142
+ "format_address",
143
+ "SlmpDeviceRangeCatalog",
144
+ "SlmpDeviceRangeCategory",
145
+ "SlmpDeviceRangeEntry",
146
+ "SlmpDeviceRangeFamily",
147
+ "SlmpDeviceRangeNotation",
148
+ "normalize_address",
149
+ "normalize_device_range_family",
150
+ "open_and_connect",
151
+ "open_and_connect_sync",
152
+ "parse_address",
153
+ "parse_extended_device",
154
+ "parse_device",
155
+ "poll",
156
+ "poll_sync",
157
+ "read_bits",
158
+ "read_bits_sync",
159
+ "read_dwords",
160
+ "read_dwords_chunked",
161
+ "read_dwords_chunked_sync",
162
+ "read_dwords_single_request",
163
+ "read_dwords_single_request_sync",
164
+ "read_dwords_sync",
165
+ "read_named",
166
+ "read_named_sync",
167
+ "read_typed",
168
+ "read_typed_sync",
169
+ "read_device_range_catalog_for_family",
170
+ "read_device_range_catalog_for_family_sync",
171
+ "read_words",
172
+ "read_words_chunked",
173
+ "read_words_chunked_sync",
174
+ "read_words_single_request",
175
+ "read_words_single_request_sync",
176
+ "read_words_sync",
177
+ "write_bit_in_word",
178
+ "write_bit_in_word_sync",
179
+ "write_bits",
180
+ "write_bits_sync",
181
+ "write_dwords_chunked",
182
+ "write_dwords_chunked_sync",
183
+ "write_dwords_single_request",
184
+ "write_dwords_single_request_sync",
185
+ "write_named",
186
+ "write_named_sync",
187
+ "write_typed",
188
+ "write_typed_sync",
189
+ "write_words_chunked",
190
+ "write_words_chunked_sync",
191
+ "write_words_single_request",
192
+ "write_words_single_request_sync",
193
+ "try_parse_address",
194
+ "build_device_range_catalog_for_family",
195
+ "family_label",
196
+ ]