conson-xp 1.4.0__tar.gz → 1.6.0__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.
- {conson_xp-1.4.0 → conson_xp-1.6.0}/PKG-INFO +1 -1
- {conson_xp-1.4.0 → conson_xp-1.6.0}/pyproject.toml +1 -1
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/__init__.py +1 -1
- conson_xp-1.6.0/src/xp/services/actiontable/__init__.py +1 -0
- conson_xp-1.6.0/src/xp/services/actiontable/msactiontable_serializer.py +7 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/actiontable/actiontable_service.py +1 -1
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/actiontable/msactiontable_service.py +3 -3
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/server/base_server_service.py +119 -1
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/server/cp20_server_service.py +9 -1
- conson_xp-1.6.0/src/xp/services/server/device_service_factory.py +94 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/server/server_service.py +102 -59
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/server/xp130_server_service.py +10 -2
- conson_xp-1.6.0/src/xp/services/server/xp20_server_service.py +92 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/server/xp230_server_service.py +10 -2
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/server/xp24_server_service.py +54 -1
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/server/xp33_server_service.py +231 -2
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/utils/dependencies.py +21 -6
- conson_xp-1.6.0/tests/unit/test_services/test_device_service_factory.py +149 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_server_service.py +108 -65
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_xp20_action_table_serializer.py +1 -1
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_xp24_action_table_serializer.py +1 -1
- conson_xp-1.6.0/tests/unit/test_services/test_xp_server_services.py +360 -0
- conson_xp-1.4.0/src/xp/services/server/xp20_server_service.py +0 -50
- conson_xp-1.4.0/tests/unit/test_services/test_xp_server_services.py +0 -189
- {conson_xp-1.4.0 → conson_xp-1.6.0}/LICENSE +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/README.md +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/__main__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_actiontable_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_autoreport_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_blink_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_config_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_custom_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_datapoint_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_discover_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_lightlevel_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_linknumber_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_msactiontable_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_output_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_raw_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_receive_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/conbus/conbus_scan_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/file_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/homekit/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/homekit/homekit.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/homekit/homekit_start_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/module_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/reverse_proxy_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/server/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/server/server_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/telegram/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/telegram/telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/telegram/telegram_blink_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/telegram/telegram_checksum_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/telegram/telegram_discover_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/telegram/telegram_linknumber_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/telegram/telegram_parse_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/commands/telegram/telegram_version_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/main.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/utils/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/utils/click_tree.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/utils/datapoint_type_choice.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/utils/decorators.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/utils/error_handlers.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/utils/formatters.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/utils/serial_number_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/utils/system_function_choice.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/cli/utils/xp_module_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/connection/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/connection/exceptions.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/actiontable/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/actiontable/actiontable.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/actiontable/msactiontable_xp20.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/actiontable/msactiontable_xp24.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/actiontable/msactiontable_xp33.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_autoreport.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_blink.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_client_config.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_connection_status.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_custom.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_datapoint.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_discover.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_lightlevel.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_linknumber.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_output.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_raw.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_receive.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/conbus/conbus_writeconfig.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/homekit/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/homekit/homekit_accessory.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/homekit/homekit_config.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/homekit/homekit_conson_config.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/log_entry.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/protocol/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/protocol/conbus_protocol.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/response.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/action_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/datapoint_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/event_telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/event_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/input_action_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/input_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/module_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/module_type_code.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/output_telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/reply_telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/system_function.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/system_telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/telegram_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/telegram/timeparam_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/models/write_config_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/__init__.py +0 -0
- {conson_xp-1.4.0/src/xp/services/conbus → conson_xp-1.6.0/src/xp/services}/actiontable/actiontable_serializer.py +0 -0
- {conson_xp-1.4.0/src/xp/services/conbus → conson_xp-1.6.0/src/xp/services}/actiontable/msactiontable_xp20_serializer.py +0 -0
- {conson_xp-1.4.0/src/xp/services/conbus → conson_xp-1.6.0/src/xp/services}/actiontable/msactiontable_xp24_serializer.py +0 -0
- {conson_xp-1.4.0/src/xp/services/conbus → conson_xp-1.6.0/src/xp/services}/actiontable/msactiontable_xp33_serializer.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/actiontable/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_blink_all_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_blink_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_custom_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_datapoint_queryall_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_datapoint_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_discover_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_output_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_raw_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_receive_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/conbus_scan_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/write_config_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_cache_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_conbus_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_config_validator.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_conson_validator.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_dimminglight.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_dimminglight_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_hap_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_lightbulb.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_lightbulb_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_module_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_outlet.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_outlet_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/homekit/homekit_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/log_file_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/module_type_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/protocol/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/protocol/conbus_protocol.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/protocol/protocol_factory.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/protocol/telegram_protocol.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/reverse_proxy_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/server/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/telegram/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/telegram/telegram_blink_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/telegram/telegram_checksum_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/telegram/telegram_datapoint_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/telegram/telegram_discover_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/telegram/telegram_link_number_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/telegram/telegram_output_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/telegram/telegram_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/telegram/telegram_version_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/utils/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/utils/checksum.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/utils/event_helper.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/utils/serialization.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/utils/time_utils.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/.coverage +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/conftest.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/.coverage +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/telegram_test_data.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_actiontable_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_api/.coverage +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_api/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_blink_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_checksum_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_conbus_blink_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_conbus_datapoint_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_conbus_raw_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_conbus_receive_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_discovery_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_event_telegram_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_homekit_config_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_link_number_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_module_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_output_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_reverse_proxy_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_system_reply_telegram_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_version_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_xp20_action_table_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/integration/test_xp24_action_table_integration.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_api/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/test_click_tree.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/test_conbus_actiontable_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/test_conbus_blink_commands.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/test_datapoint_type_choice.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/test_decorators.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/test_error_handlers.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/test_formatters.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/test_serial_number_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_cli/test_system_function_choice.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_connection/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_connection/test_connection_init.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_connection/test_exceptions.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_encoding/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_encoding/test_latin1_edge_cases.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_conbus.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_conbus_client_send.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_conbus_discover.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_conbus_linknumber.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_event_telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_log_entry.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_module_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_reply_telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_system_telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_system_telegram_enhancements.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_version_telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_write_config_type.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_xp20_action_table.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_xp24_action_table.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_models/test_xp24_action_telegram.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_actiontable_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_base_server_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_blink_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_checksum_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_conbus_blink_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_conbus_raw_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_conbus_reverse_proxy_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_discovery_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_homekit_cache_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_homekit_config_validator.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_homekit_conson_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_homekit_services.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_log_file_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_module_type_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_protocol.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_telegram_input_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_telegram_protocol.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_telegram_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_version_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_xp24_action_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_xp24_action_table_service.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_services/test_xp33_action_table_serializer.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_utils/__init__.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_utils/test_checksum.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_utils/test_event_helper.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_utils/test_serialization.py +0 -0
- {conson_xp-1.4.0 → conson_xp-1.6.0}/tests/unit/test_utils/test_time_utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Action table utils."""
|
{conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/actiontable/actiontable_service.py
RENAMED
|
@@ -10,7 +10,7 @@ from xp.models.actiontable.actiontable import ActionTable
|
|
|
10
10
|
from xp.models.protocol.conbus_protocol import TelegramReceivedEvent
|
|
11
11
|
from xp.models.telegram.system_function import SystemFunction
|
|
12
12
|
from xp.models.telegram.telegram_type import TelegramType
|
|
13
|
-
from xp.services.
|
|
13
|
+
from xp.services.actiontable.actiontable_serializer import ActionTableSerializer
|
|
14
14
|
from xp.services.protocol import ConbusProtocol
|
|
15
15
|
from xp.services.telegram.telegram_service import TelegramService
|
|
16
16
|
|
{conson_xp-1.4.0 → conson_xp-1.6.0}/src/xp/services/conbus/actiontable/msactiontable_service.py
RENAMED
|
@@ -12,13 +12,13 @@ from xp.models.actiontable.msactiontable_xp33 import Xp33MsActionTable
|
|
|
12
12
|
from xp.models.protocol.conbus_protocol import TelegramReceivedEvent
|
|
13
13
|
from xp.models.telegram.system_function import SystemFunction
|
|
14
14
|
from xp.models.telegram.telegram_type import TelegramType
|
|
15
|
-
from xp.services.
|
|
15
|
+
from xp.services.actiontable.msactiontable_xp20_serializer import (
|
|
16
16
|
Xp20MsActionTableSerializer,
|
|
17
17
|
)
|
|
18
|
-
from xp.services.
|
|
18
|
+
from xp.services.actiontable.msactiontable_xp24_serializer import (
|
|
19
19
|
Xp24MsActionTableSerializer,
|
|
20
20
|
)
|
|
21
|
-
from xp.services.
|
|
21
|
+
from xp.services.actiontable.msactiontable_xp33_serializer import (
|
|
22
22
|
Xp33MsActionTableSerializer,
|
|
23
23
|
)
|
|
24
24
|
from xp.services.protocol import ConbusProtocol
|
|
@@ -5,8 +5,9 @@ containing common functionality like module type response generation.
|
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
import logging
|
|
8
|
+
import threading
|
|
8
9
|
from abc import ABC
|
|
9
|
-
from typing import Optional
|
|
10
|
+
from typing import Any, Optional
|
|
10
11
|
|
|
11
12
|
from xp.models import ModuleTypeCode
|
|
12
13
|
from xp.models.telegram.datapoint_type import DataPointType
|
|
@@ -42,6 +43,12 @@ class BaseServerService(ABC):
|
|
|
42
43
|
self.temperature: str = "+23,5§C"
|
|
43
44
|
self.voltage: str = "+12,5§V"
|
|
44
45
|
|
|
46
|
+
self.telegram_buffer: list[str] = []
|
|
47
|
+
self.telegram_buffer_lock = threading.Lock() # Lock for socket set
|
|
48
|
+
|
|
49
|
+
# MsActionTable download state (None, "ack_sent", "data_sent")
|
|
50
|
+
self.msactiontable_download_state: Optional[str] = None
|
|
51
|
+
|
|
45
52
|
def generate_datapoint_type_response(
|
|
46
53
|
self, datapoint_type: DataPointType
|
|
47
54
|
) -> Optional[str]:
|
|
@@ -147,6 +154,83 @@ class BaseServerService(ABC):
|
|
|
147
154
|
|
|
148
155
|
return None
|
|
149
156
|
|
|
157
|
+
def _get_msactiontable_serializer(self) -> Optional[Any]:
|
|
158
|
+
"""Get the MsActionTable serializer for this device.
|
|
159
|
+
|
|
160
|
+
Subclasses should override this to return their specific serializer.
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
The serializer instance, or None if not supported.
|
|
164
|
+
"""
|
|
165
|
+
return None
|
|
166
|
+
|
|
167
|
+
def _get_msactiontable(self) -> Optional[Any]:
|
|
168
|
+
"""Get the MsActionTable for this device.
|
|
169
|
+
|
|
170
|
+
Subclasses should override this to return their msactiontable instance.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
The msactiontable instance, or None if not supported.
|
|
174
|
+
"""
|
|
175
|
+
return None
|
|
176
|
+
|
|
177
|
+
def _handle_download_msactiontable_request(
|
|
178
|
+
self, request: SystemTelegram
|
|
179
|
+
) -> Optional[str]:
|
|
180
|
+
"""Handle F13D - DOWNLOAD_MSACTIONTABLE request.
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
request: The system telegram request to process.
|
|
184
|
+
|
|
185
|
+
Returns:
|
|
186
|
+
ACK telegram if request is valid, NAK otherwise.
|
|
187
|
+
"""
|
|
188
|
+
if (
|
|
189
|
+
request.system_function == SystemFunction.DOWNLOAD_MSACTIONTABLE
|
|
190
|
+
and self.msactiontable_download_state is None
|
|
191
|
+
):
|
|
192
|
+
self.msactiontable_download_state = "ack_sent"
|
|
193
|
+
# Send ACK and queue data telegram
|
|
194
|
+
return self._build_response_telegram(f"R{self.serial_number}F18D") # ACK
|
|
195
|
+
|
|
196
|
+
return self._build_response_telegram(f"R{self.serial_number}F19D") # NAK
|
|
197
|
+
|
|
198
|
+
def _handle_download_msactiontable_ack_request(
|
|
199
|
+
self, _request: SystemTelegram
|
|
200
|
+
) -> Optional[str]:
|
|
201
|
+
"""Handle MsActionTable download ACK protocol.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
_request: The system telegram request (unused, kept for signature consistency).
|
|
205
|
+
|
|
206
|
+
Returns:
|
|
207
|
+
Data telegram, EOF telegram, or NAK if state is invalid.
|
|
208
|
+
"""
|
|
209
|
+
serializer = self._get_msactiontable_serializer()
|
|
210
|
+
msactiontable = self._get_msactiontable()
|
|
211
|
+
|
|
212
|
+
# Only handle if serializer and msactiontable are available
|
|
213
|
+
if not serializer or msactiontable is None:
|
|
214
|
+
return None
|
|
215
|
+
|
|
216
|
+
# Handle F18D - CONTINUE (after ACK or data)
|
|
217
|
+
if self.msactiontable_download_state == "ack_sent":
|
|
218
|
+
# Send MsActionTable data
|
|
219
|
+
encoded_data = serializer.to_data(msactiontable)
|
|
220
|
+
data_telegram = self._build_response_telegram(
|
|
221
|
+
f"R{self.serial_number}F17D{encoded_data}"
|
|
222
|
+
)
|
|
223
|
+
self.msactiontable_download_state = "data_sent"
|
|
224
|
+
return data_telegram
|
|
225
|
+
|
|
226
|
+
elif self.msactiontable_download_state == "data_sent":
|
|
227
|
+
# Send EOF
|
|
228
|
+
eof_telegram = self._build_response_telegram(f"R{self.serial_number}F16D")
|
|
229
|
+
self.msactiontable_download_state = None
|
|
230
|
+
return eof_telegram
|
|
231
|
+
|
|
232
|
+
return self._build_response_telegram(f"R{self.serial_number}F19D") # NAK
|
|
233
|
+
|
|
150
234
|
def process_system_telegram(self, request: SystemTelegram) -> Optional[str]:
|
|
151
235
|
"""Template method for processing system telegrams.
|
|
152
236
|
|
|
@@ -173,6 +257,15 @@ class BaseServerService(ABC):
|
|
|
173
257
|
elif request.system_function == SystemFunction.ACTION:
|
|
174
258
|
return self._handle_action_request(request)
|
|
175
259
|
|
|
260
|
+
elif request.system_function == SystemFunction.DOWNLOAD_MSACTIONTABLE:
|
|
261
|
+
return self._handle_download_msactiontable_request(request)
|
|
262
|
+
|
|
263
|
+
elif (
|
|
264
|
+
request.system_function == SystemFunction.ACK
|
|
265
|
+
and self.msactiontable_download_state
|
|
266
|
+
):
|
|
267
|
+
return self._handle_download_msactiontable_ack_request(request)
|
|
268
|
+
|
|
176
269
|
self.logger.warning(f"Unhandled {self.device_type} request: {request}")
|
|
177
270
|
return None
|
|
178
271
|
|
|
@@ -257,3 +350,28 @@ class BaseServerService(ABC):
|
|
|
257
350
|
The response telegram string, or None if request cannot be handled.
|
|
258
351
|
"""
|
|
259
352
|
return None
|
|
353
|
+
|
|
354
|
+
def add_telegram_buffer(self, telegram: str) -> None:
|
|
355
|
+
"""Add telegram to the buffer.
|
|
356
|
+
|
|
357
|
+
Args:
|
|
358
|
+
telegram: The telegram string to add to the buffer.
|
|
359
|
+
"""
|
|
360
|
+
self.logger.debug(f"Add telegram to the buffer: {telegram}")
|
|
361
|
+
with self.telegram_buffer_lock:
|
|
362
|
+
self.telegram_buffer.append(telegram)
|
|
363
|
+
|
|
364
|
+
def collect_telegram_buffer(self) -> list[str]:
|
|
365
|
+
"""Collecting telegrams from the buffer.
|
|
366
|
+
|
|
367
|
+
Returns:
|
|
368
|
+
List of telegram strings from the buffer. The buffer is cleared after collection.
|
|
369
|
+
"""
|
|
370
|
+
self.logger.debug(
|
|
371
|
+
f"Collecting {self.serial_number} telegrams from buffer: {len(self.telegram_buffer)}"
|
|
372
|
+
)
|
|
373
|
+
with self.telegram_buffer_lock:
|
|
374
|
+
result = self.telegram_buffer.copy()
|
|
375
|
+
self.logger.debug(f"Resetting {self.serial_number} buffer")
|
|
376
|
+
self.telegram_buffer.clear()
|
|
377
|
+
return result
|
|
@@ -8,6 +8,7 @@ from typing import Dict, Optional
|
|
|
8
8
|
|
|
9
9
|
from xp.models import ModuleTypeCode
|
|
10
10
|
from xp.models.telegram.system_telegram import SystemTelegram
|
|
11
|
+
from xp.services.actiontable.msactiontable_serializer import MsActionTableSerializer
|
|
11
12
|
from xp.services.server.base_server_service import BaseServerService
|
|
12
13
|
|
|
13
14
|
|
|
@@ -25,11 +26,18 @@ class CP20ServerService(BaseServerService):
|
|
|
25
26
|
and implements CP20 telegram format.
|
|
26
27
|
"""
|
|
27
28
|
|
|
28
|
-
def __init__(
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
serial_number: str,
|
|
32
|
+
_variant: str = "",
|
|
33
|
+
_msactiontable_serializer: Optional[MsActionTableSerializer] = None,
|
|
34
|
+
):
|
|
29
35
|
"""Initialize CP20 server service.
|
|
30
36
|
|
|
31
37
|
Args:
|
|
32
38
|
serial_number: The device serial number.
|
|
39
|
+
_variant: Reserved parameter for consistency (unused).
|
|
40
|
+
_msactiontable_serializer: Generic MsActionTable serializer (unused).
|
|
33
41
|
"""
|
|
34
42
|
super().__init__(serial_number)
|
|
35
43
|
self.device_type = "CP20"
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Device Service Factory for creating device instances.
|
|
2
|
+
|
|
3
|
+
This module provides a factory for creating device service instances
|
|
4
|
+
with proper dependency injection of serializers.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from xp.services.actiontable.msactiontable_serializer import MsActionTableSerializer
|
|
8
|
+
from xp.services.actiontable.msactiontable_xp20_serializer import (
|
|
9
|
+
Xp20MsActionTableSerializer,
|
|
10
|
+
)
|
|
11
|
+
from xp.services.actiontable.msactiontable_xp24_serializer import (
|
|
12
|
+
Xp24MsActionTableSerializer,
|
|
13
|
+
)
|
|
14
|
+
from xp.services.actiontable.msactiontable_xp33_serializer import (
|
|
15
|
+
Xp33MsActionTableSerializer,
|
|
16
|
+
)
|
|
17
|
+
from xp.services.server.base_server_service import BaseServerService
|
|
18
|
+
from xp.services.server.cp20_server_service import CP20ServerService
|
|
19
|
+
from xp.services.server.xp20_server_service import XP20ServerService
|
|
20
|
+
from xp.services.server.xp24_server_service import XP24ServerService
|
|
21
|
+
from xp.services.server.xp33_server_service import XP33ServerService
|
|
22
|
+
from xp.services.server.xp130_server_service import XP130ServerService
|
|
23
|
+
from xp.services.server.xp230_server_service import XP230ServerService
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class DeviceServiceFactory:
|
|
27
|
+
"""Factory for creating device service instances.
|
|
28
|
+
|
|
29
|
+
Encapsulates device creation logic and handles serializer injection
|
|
30
|
+
for different device types.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
xp20ms_serializer: Xp20MsActionTableSerializer,
|
|
36
|
+
xp24ms_serializer: Xp24MsActionTableSerializer,
|
|
37
|
+
xp33ms_serializer: Xp33MsActionTableSerializer,
|
|
38
|
+
ms_serializer: MsActionTableSerializer,
|
|
39
|
+
):
|
|
40
|
+
"""Initialize device service factory.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
xp20ms_serializer: XP20 MsActionTable serializer (injected via DI).
|
|
44
|
+
xp24ms_serializer: XP24 MsActionTable serializer (injected via DI).
|
|
45
|
+
xp33ms_serializer: XP33 MsActionTable serializer (injected via DI).
|
|
46
|
+
ms_serializer: Generic MsActionTable serializer (injected via DI).
|
|
47
|
+
"""
|
|
48
|
+
self.xp20ms_serializer = xp20ms_serializer
|
|
49
|
+
self.xp24ms_serializer = xp24ms_serializer
|
|
50
|
+
self.xp33ms_serializer = xp33ms_serializer
|
|
51
|
+
self.ms_serializer = ms_serializer
|
|
52
|
+
|
|
53
|
+
def create_device(self, module_type: str, serial_number: str) -> BaseServerService:
|
|
54
|
+
"""Create device instance for given module type.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
module_type: Module type code (e.g., "XP20", "XP33LR").
|
|
58
|
+
serial_number: Device serial number.
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
Device service instance configured with appropriate serializer.
|
|
62
|
+
|
|
63
|
+
Raises:
|
|
64
|
+
ValueError: If module_type is unknown or unsupported.
|
|
65
|
+
"""
|
|
66
|
+
# Map module types to their constructors and parameters
|
|
67
|
+
if module_type == "CP20":
|
|
68
|
+
return CP20ServerService(serial_number, "CP20", self.ms_serializer)
|
|
69
|
+
|
|
70
|
+
elif module_type == "XP24":
|
|
71
|
+
return XP24ServerService(serial_number, "XP24", self.xp24ms_serializer)
|
|
72
|
+
|
|
73
|
+
elif module_type == "XP33":
|
|
74
|
+
return XP33ServerService(serial_number, "XP33", self.xp33ms_serializer)
|
|
75
|
+
|
|
76
|
+
elif module_type == "XP33LR":
|
|
77
|
+
return XP33ServerService(serial_number, "XP33LR", self.xp33ms_serializer)
|
|
78
|
+
|
|
79
|
+
elif module_type == "XP33LED":
|
|
80
|
+
return XP33ServerService(serial_number, "XP33LED", self.xp33ms_serializer)
|
|
81
|
+
|
|
82
|
+
elif module_type == "XP20":
|
|
83
|
+
return XP20ServerService(serial_number, "XP20", self.xp20ms_serializer)
|
|
84
|
+
|
|
85
|
+
elif module_type == "XP130":
|
|
86
|
+
return XP130ServerService(serial_number, "XP130", self.ms_serializer)
|
|
87
|
+
|
|
88
|
+
elif module_type == "XP230":
|
|
89
|
+
return XP230ServerService(serial_number, "XP230", self.ms_serializer)
|
|
90
|
+
|
|
91
|
+
else:
|
|
92
|
+
raise ValueError(
|
|
93
|
+
f"Unknown device type '{module_type}' for serial {serial_number}"
|
|
94
|
+
)
|
|
@@ -8,19 +8,14 @@ import logging
|
|
|
8
8
|
import socket
|
|
9
9
|
import threading
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
from typing import Dict, List, Optional
|
|
11
|
+
from typing import Dict, List, Optional
|
|
12
12
|
|
|
13
13
|
from xp.models.homekit.homekit_conson_config import (
|
|
14
14
|
ConsonModuleConfig,
|
|
15
15
|
ConsonModuleListConfig,
|
|
16
16
|
)
|
|
17
17
|
from xp.services.server.base_server_service import BaseServerService
|
|
18
|
-
from xp.services.server.
|
|
19
|
-
from xp.services.server.xp20_server_service import XP20ServerService
|
|
20
|
-
from xp.services.server.xp24_server_service import XP24ServerService
|
|
21
|
-
from xp.services.server.xp33_server_service import XP33ServerService
|
|
22
|
-
from xp.services.server.xp130_server_service import XP130ServerService
|
|
23
|
-
from xp.services.server.xp230_server_service import XP230ServerService
|
|
18
|
+
from xp.services.server.device_service_factory import DeviceServiceFactory
|
|
24
19
|
from xp.services.telegram.telegram_discover_service import TelegramDiscoverService
|
|
25
20
|
from xp.services.telegram.telegram_service import TelegramService
|
|
26
21
|
|
|
@@ -43,6 +38,7 @@ class ServerService:
|
|
|
43
38
|
self,
|
|
44
39
|
telegram_service: TelegramService,
|
|
45
40
|
discover_service: TelegramDiscoverService,
|
|
41
|
+
device_factory: DeviceServiceFactory,
|
|
46
42
|
config_path: str = "server.yml",
|
|
47
43
|
port: int = 10001,
|
|
48
44
|
):
|
|
@@ -51,25 +47,28 @@ class ServerService:
|
|
|
51
47
|
Args:
|
|
52
48
|
telegram_service: Service for parsing system telegrams.
|
|
53
49
|
discover_service: Service for handling discover requests.
|
|
50
|
+
device_factory: Factory for creating device service instances (injected via DI).
|
|
54
51
|
config_path: Path to the server configuration file.
|
|
55
52
|
port: TCP port to listen on.
|
|
56
53
|
"""
|
|
57
54
|
self.telegram_service = telegram_service
|
|
58
55
|
self.discover_service = discover_service
|
|
56
|
+
self.device_factory = device_factory
|
|
59
57
|
self.config_path = config_path
|
|
60
58
|
self.port = port
|
|
61
59
|
self.server_socket: Optional[socket.socket] = None
|
|
62
60
|
self.is_running = False
|
|
63
61
|
self.devices: List[ConsonModuleConfig] = []
|
|
64
|
-
self.device_services: Dict[
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
self.device_services: Dict[str, BaseServerService] = (
|
|
63
|
+
{}
|
|
64
|
+
) # serial -> device service instance
|
|
65
|
+
|
|
66
|
+
# Collect device buffer to broadcast to client
|
|
67
|
+
self.collector_thread: Optional[threading.Thread] = (
|
|
68
|
+
None # Background thread for storm
|
|
69
|
+
)
|
|
70
|
+
self.collector_stop_event = threading.Event() # Event to stop thread
|
|
71
|
+
self.collector_buffer: list[str] = [] # All collected buffers
|
|
73
72
|
|
|
74
73
|
# Set up logging
|
|
75
74
|
self.logger = logging.getLogger(__name__)
|
|
@@ -105,44 +104,14 @@ class ServerService:
|
|
|
105
104
|
serial_number = module.serial_number
|
|
106
105
|
|
|
107
106
|
try:
|
|
107
|
+
# Use factory to create device instance
|
|
108
|
+
self.device_services[serial_number] = self.device_factory.create_device(
|
|
109
|
+
module_type, serial_number
|
|
110
|
+
)
|
|
108
111
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
serial_number
|
|
113
|
-
)
|
|
114
|
-
if module_type == "XP24":
|
|
115
|
-
self.device_services[serial_number] = XP24ServerService(
|
|
116
|
-
serial_number
|
|
117
|
-
)
|
|
118
|
-
elif module_type == "XP33":
|
|
119
|
-
self.device_services[serial_number] = XP33ServerService(
|
|
120
|
-
serial_number, "XP33"
|
|
121
|
-
)
|
|
122
|
-
elif module_type == "XP33LR":
|
|
123
|
-
self.device_services[serial_number] = XP33ServerService(
|
|
124
|
-
serial_number, "XP33LR"
|
|
125
|
-
)
|
|
126
|
-
elif module_type == "XP33LED":
|
|
127
|
-
self.device_services[serial_number] = XP33ServerService(
|
|
128
|
-
serial_number, "XP33LED"
|
|
129
|
-
)
|
|
130
|
-
elif module_type == "XP20":
|
|
131
|
-
self.device_services[serial_number] = XP20ServerService(
|
|
132
|
-
serial_number
|
|
133
|
-
)
|
|
134
|
-
elif module_type == "XP130":
|
|
135
|
-
self.device_services[serial_number] = XP130ServerService(
|
|
136
|
-
serial_number
|
|
137
|
-
)
|
|
138
|
-
elif module_type == "XP230":
|
|
139
|
-
self.device_services[serial_number] = XP230ServerService(
|
|
140
|
-
serial_number
|
|
141
|
-
)
|
|
142
|
-
else:
|
|
143
|
-
self.logger.warning(
|
|
144
|
-
f"Unknown device type '{module_type}' for serial {serial_number}"
|
|
145
|
-
)
|
|
112
|
+
except ValueError as e:
|
|
113
|
+
# Factory raises ValueError for unknown device types
|
|
114
|
+
self.logger.warning(str(e))
|
|
146
115
|
|
|
147
116
|
except Exception as e:
|
|
148
117
|
self.logger.error(
|
|
@@ -167,6 +136,8 @@ class ServerService:
|
|
|
167
136
|
self.server_socket.bind(("0.0.0.0", self.port))
|
|
168
137
|
self.server_socket.listen(1) # Accept single connection as per spec
|
|
169
138
|
|
|
139
|
+
self._start_device_collector_thread()
|
|
140
|
+
|
|
170
141
|
self.is_running = True
|
|
171
142
|
self.logger.info(f"Conbus emulator server started on port {self.port}")
|
|
172
143
|
self.logger.info(
|
|
@@ -221,17 +192,44 @@ class ServerService:
|
|
|
221
192
|
) -> None:
|
|
222
193
|
"""Handle individual client connection."""
|
|
223
194
|
try:
|
|
195
|
+
|
|
196
|
+
idle_timeout = 300
|
|
197
|
+
rcv_timeout = 10
|
|
198
|
+
|
|
224
199
|
# Set timeout for idle connections (30 seconds as per spec)
|
|
225
|
-
client_socket.settimeout(
|
|
200
|
+
client_socket.settimeout(rcv_timeout)
|
|
201
|
+
timeout = idle_timeout / rcv_timeout
|
|
226
202
|
|
|
227
203
|
while True:
|
|
204
|
+
|
|
205
|
+
# send waiting buffer
|
|
206
|
+
for i in range(len(self.collector_buffer)):
|
|
207
|
+
buffer = self.collector_buffer.pop()
|
|
208
|
+
client_socket.send(buffer.encode("latin-1"))
|
|
209
|
+
self.logger.debug(f"Sent buffer to {client_address}")
|
|
210
|
+
|
|
228
211
|
# Receive data from client
|
|
229
|
-
data
|
|
212
|
+
self.logger.debug(f"Receiving data {client_address}")
|
|
213
|
+
data = None
|
|
214
|
+
try:
|
|
215
|
+
data = client_socket.recv(1024)
|
|
216
|
+
except socket.timeout:
|
|
217
|
+
self.logger.debug(
|
|
218
|
+
f"Timeout receiving data {client_address} ({timeout})"
|
|
219
|
+
)
|
|
220
|
+
finally:
|
|
221
|
+
timeout -= 1
|
|
222
|
+
|
|
230
223
|
if not data:
|
|
231
|
-
|
|
224
|
+
if timeout <= 0:
|
|
225
|
+
break
|
|
226
|
+
continue
|
|
227
|
+
|
|
228
|
+
# reset timeout on receiving data
|
|
229
|
+
timeout = idle_timeout / rcv_timeout
|
|
232
230
|
|
|
233
231
|
message = data.decode("latin-1").strip()
|
|
234
|
-
self.logger.
|
|
232
|
+
self.logger.debug(f"Received from {client_address}: {message}")
|
|
235
233
|
|
|
236
234
|
# Process request (discover or data request)
|
|
237
235
|
responses = self._process_request(message)
|
|
@@ -239,10 +237,10 @@ class ServerService:
|
|
|
239
237
|
# Send responses
|
|
240
238
|
for response in responses:
|
|
241
239
|
client_socket.send(response.encode("latin-1"))
|
|
242
|
-
self.logger.
|
|
240
|
+
self.logger.debug(f"Sent to {client_address}: {response[:-1]}")
|
|
243
241
|
|
|
244
242
|
except socket.timeout:
|
|
245
|
-
self.logger.
|
|
243
|
+
self.logger.debug(f"Client {client_address} timed out")
|
|
246
244
|
except Exception as e:
|
|
247
245
|
self.logger.error(f"Error handling client {client_address}: {e}")
|
|
248
246
|
finally:
|
|
@@ -390,3 +388,48 @@ class ServerService:
|
|
|
390
388
|
self.logger.info(
|
|
391
389
|
f"Configuration reloaded: {len(self.devices)} devices, {len(self.device_services)} services"
|
|
392
390
|
)
|
|
391
|
+
|
|
392
|
+
def _start_device_collector_thread(self) -> None:
|
|
393
|
+
"""Start device buffer collector thread."""
|
|
394
|
+
if self.collector_thread and self.collector_thread.is_alive():
|
|
395
|
+
self.logger.debug("Collector thread already running")
|
|
396
|
+
return
|
|
397
|
+
|
|
398
|
+
# Start background thread to send storm telegrams
|
|
399
|
+
self.collector_thread = threading.Thread(
|
|
400
|
+
target=self._device_collector_thread, daemon=True, name="DeviceCollector"
|
|
401
|
+
)
|
|
402
|
+
self.collector_thread.start()
|
|
403
|
+
self.logger.info("Collector thread started")
|
|
404
|
+
|
|
405
|
+
def _stop_device_collector_thread(self) -> None:
|
|
406
|
+
"""Stop device buffer collector thread."""
|
|
407
|
+
if not self.collector_thread or not self.collector_thread.is_alive():
|
|
408
|
+
self.logger.debug("Collector thread not running")
|
|
409
|
+
return
|
|
410
|
+
|
|
411
|
+
self.logger.info(f"Stopping collector thread: {self.collector_thread.name}")
|
|
412
|
+
|
|
413
|
+
# Wait for thread to finish (with timeout)
|
|
414
|
+
if self.collector_thread and self.collector_thread.is_alive():
|
|
415
|
+
self.collector_thread.join(timeout=1.0)
|
|
416
|
+
|
|
417
|
+
self.logger.info("Collector stopped.")
|
|
418
|
+
|
|
419
|
+
def _device_collector_thread(self) -> None:
|
|
420
|
+
"""Device buffer collector thread."""
|
|
421
|
+
self.logger.info("Collector thread starting")
|
|
422
|
+
|
|
423
|
+
while True:
|
|
424
|
+
self.logger.debug(
|
|
425
|
+
f"Collector thread collecting ({len(self.collector_buffer)})"
|
|
426
|
+
)
|
|
427
|
+
collected = 0
|
|
428
|
+
for device_service in self.device_services.values():
|
|
429
|
+
telegram_buffer = device_service.collect_telegram_buffer()
|
|
430
|
+
self.collector_buffer.extend(telegram_buffer)
|
|
431
|
+
collected += len(telegram_buffer)
|
|
432
|
+
|
|
433
|
+
# Wait a bit before checking again
|
|
434
|
+
self.logger.debug(f"Collector thread collected ({collected})")
|
|
435
|
+
self.collector_stop_event.wait(timeout=1)
|
|
@@ -5,9 +5,10 @@ including response generation and device configuration handling.
|
|
|
5
5
|
XP130 is an Ethernet/TCPIP interface module.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
from typing import Dict
|
|
8
|
+
from typing import Dict, Optional
|
|
9
9
|
|
|
10
10
|
from xp.models import ModuleTypeCode
|
|
11
|
+
from xp.services.actiontable.msactiontable_serializer import MsActionTableSerializer
|
|
11
12
|
from xp.services.server.base_server_service import BaseServerService
|
|
12
13
|
|
|
13
14
|
|
|
@@ -25,11 +26,18 @@ class XP130ServerService(BaseServerService):
|
|
|
25
26
|
and implements XP130 telegram format for Ethernet/TCPIP interface module.
|
|
26
27
|
"""
|
|
27
28
|
|
|
28
|
-
def __init__(
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
serial_number: str,
|
|
32
|
+
_variant: str = "",
|
|
33
|
+
_msactiontable_serializer: Optional[MsActionTableSerializer] = None,
|
|
34
|
+
):
|
|
29
35
|
"""Initialize XP130 server service.
|
|
30
36
|
|
|
31
37
|
Args:
|
|
32
38
|
serial_number: The device serial number.
|
|
39
|
+
_variant: Reserved parameter for consistency (unused).
|
|
40
|
+
_msactiontable_serializer: Generic MsActionTable serializer (unused).
|
|
33
41
|
"""
|
|
34
42
|
super().__init__(serial_number)
|
|
35
43
|
self.device_type = "XP130"
|