aioads 0.1.0.dev10__tar.gz → 0.1.0.dev11__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.
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/PKG-INFO +1 -1
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/ads_client.py +20 -2
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/pyproject.toml +1 -1
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/.github/dependabot.yml +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/.github/workflows/ci.yml +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/.github/workflows/publish.yml +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/.gitignore +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/.vscode/settings.json +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/LICENSE +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/README.md +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/ads_error_codes.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/ads_notifications.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/ads_symbol_cache.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/ads_symbol_parser.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/ams_address.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/ams_header.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/ams_service_port.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/ams_tcp_header.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/ads_add_notification.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/ads_command.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/ads_delete_notification.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/ads_read.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/ads_read_device_info.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/ads_read_state.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/ads_read_write.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/ads_write.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/ads_write_state.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/commands/errors.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/errors.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_enable_route.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_function.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_sum_read.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_sum_read_write.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_symbol_datatype_by_name.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_symbol_datatype_upload.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_symbol_info_by_name_ex.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_symbol_table_version.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_symbol_upload.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/functions/ads_symbol_upload_info.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/py.typed +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/stream.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/transport.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/aioads/utils/local_ip.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/docs/transmission_mode.md +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/docs/unittest_style_guide.html +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/examples/read_cmd_reuse_mqtt.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/examples/read_cycles.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/examples/read_cycles_mqtt.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/examples/read_multiple.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/examples/read_multiple_mqtt.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/examples/read_single.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/pdm.lock +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/__init__.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/builders.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/integration/README.md +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/integration/__init__.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/integration/base.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/integration/config.example.toml +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/integration/config.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/integration/test_connection.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/integration/test_memory.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/integration/test_performance.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/integration/test_read_symbols.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/__init__.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/__init__.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_add_notification.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_command.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_delete_notification.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_read.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_read_device_info.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_read_state.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_read_write.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_write.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_write_state.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_errors.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/__init__.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_enable_route.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_function.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_sum_read.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_sum_read_write.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_datatype_by_name.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_datatype_upload.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_info_by_name_ex.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_table_version.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_upload.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_upload_info.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_ads_client.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_ads_error_codes.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_ads_notifications.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_ads_symbol_cache.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_ads_symbol_parser.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_ams_address.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_ams_header.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_ams_tcp_header.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_errors.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_stream.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/test_transport.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/utils/__init__.py +0 -0
- {aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/utils/test_local_ip.py +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""ADS Client for communicating with ADS devices asynchronously."""
|
|
2
2
|
|
|
3
|
+
import asyncio
|
|
3
4
|
import logging
|
|
4
5
|
from contextlib import asynccontextmanager
|
|
5
6
|
from dataclasses import dataclass
|
|
@@ -14,6 +15,7 @@ from aioads.ads_symbol_parser import ISymbolParser
|
|
|
14
15
|
from aioads.ams_address import AmsAddress
|
|
15
16
|
from aioads.commands.ads_add_notification import TransmissionMode
|
|
16
17
|
from aioads.commands.ads_read import AdsReadCommand
|
|
18
|
+
from aioads.commands.ads_read import AdsReadResponse
|
|
17
19
|
from aioads.commands.ads_read_state import ReadStateCommand
|
|
18
20
|
from aioads.commands.errors import AdsCommandError
|
|
19
21
|
from aioads.functions.ads_enable_route import AdsEnableRoute
|
|
@@ -24,6 +26,7 @@ from aioads.functions.ads_symbol_datatype_upload import AdsSymbolDataTypeUpload
|
|
|
24
26
|
from aioads.functions.ads_symbol_info_by_name_ex import SymbolInfo
|
|
25
27
|
from aioads.functions.ads_symbol_upload import AdsSymbolUpload
|
|
26
28
|
from aioads.functions.ads_symbol_upload_info import AdsSymbolUploadInfo2
|
|
29
|
+
from aioads.stream import AdsStream
|
|
27
30
|
from aioads.transport import AdsTcpTransport
|
|
28
31
|
from aioads.transport import ITransport
|
|
29
32
|
|
|
@@ -292,7 +295,7 @@ class AdsClient:
|
|
|
292
295
|
# Pre-seed the result with lookup errors so the output preserves the
|
|
293
296
|
# requested order; successful entries are overwritten after the read.
|
|
294
297
|
# Symbols with a failed lookup cannot be read: their idx_group/offset
|
|
295
|
-
# would
|
|
298
|
+
# would misaligne the bulk response.
|
|
296
299
|
output: dict[str, SymbolReadResult] = {
|
|
297
300
|
name: SymbolReadResult(error_code, None)
|
|
298
301
|
for name, (error_code, _) in symbol_infos.items()
|
|
@@ -322,6 +325,22 @@ class AdsClient:
|
|
|
322
325
|
)
|
|
323
326
|
response = await sum_read.execute()
|
|
324
327
|
|
|
328
|
+
# Parsing is pure-Python and O(total payload size); run it off the
|
|
329
|
+
# event loop so large bulk reads don't block other tasks.
|
|
330
|
+
parsed = await asyncio.to_thread(
|
|
331
|
+
self._parse_sum_read_response, readable, response)
|
|
332
|
+
output.update(parsed)
|
|
333
|
+
return output
|
|
334
|
+
|
|
335
|
+
def _parse_sum_read_response(
|
|
336
|
+
self,
|
|
337
|
+
readable: list[tuple[str, SymbolInfo]],
|
|
338
|
+
response: list[tuple[AdsReadResponse, AdsStream]],
|
|
339
|
+
) -> dict[str, SymbolReadResult]:
|
|
340
|
+
"""
|
|
341
|
+
Parse the payloads of a bulk read into symbol values.
|
|
342
|
+
"""
|
|
343
|
+
output: dict[str, SymbolReadResult] = {}
|
|
325
344
|
for (name, info), (read_response, resp_payload) in zip(
|
|
326
345
|
readable, response, strict=True
|
|
327
346
|
):
|
|
@@ -336,7 +355,6 @@ class AdsClient:
|
|
|
336
355
|
raw_data=resp_payload,
|
|
337
356
|
),
|
|
338
357
|
)
|
|
339
|
-
|
|
340
358
|
return output
|
|
341
359
|
|
|
342
360
|
@asynccontextmanager
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/commands/test_ads_delete_notification.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_datatype_by_name.py
RENAMED
|
File without changes
|
{aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_datatype_upload.py
RENAMED
|
File without changes
|
{aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_info_by_name_ex.py
RENAMED
|
File without changes
|
{aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_table_version.py
RENAMED
|
File without changes
|
|
File without changes
|
{aioads-0.1.0.dev10 → aioads-0.1.0.dev11}/tests/unit/functions/test_ads_symbol_upload_info.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|