conson-xp 1.45.0__py3-none-any.whl → 1.47.0__py3-none-any.whl
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.45.0.dist-info → conson_xp-1.47.0.dist-info}/METADATA +1 -1
- conson_xp-1.47.0.dist-info/RECORD +210 -0
- xp/__init__.py +3 -2
- xp/cli/commands/conbus/conbus.py +1 -1
- xp/cli/commands/conbus/conbus_actiontable_commands.py +33 -15
- xp/cli/commands/conbus/conbus_autoreport_commands.py +8 -4
- xp/cli/commands/conbus/conbus_blink_commands.py +20 -10
- xp/cli/commands/conbus/conbus_config_commands.py +2 -1
- xp/cli/commands/conbus/conbus_custom_commands.py +4 -2
- xp/cli/commands/conbus/conbus_datapoint_commands.py +10 -5
- xp/cli/commands/conbus/conbus_discover_commands.py +8 -4
- xp/cli/commands/conbus/conbus_event_commands.py +8 -4
- xp/cli/commands/conbus/conbus_export_commands.py +8 -4
- xp/cli/commands/conbus/conbus_lightlevel_commands.py +16 -8
- xp/cli/commands/conbus/conbus_linknumber_commands.py +8 -4
- xp/cli/commands/conbus/conbus_modulenumber_commands.py +8 -4
- xp/cli/commands/conbus/conbus_msactiontable_commands.py +78 -40
- xp/cli/commands/conbus/conbus_output_commands.py +16 -8
- xp/cli/commands/conbus/conbus_raw_commands.py +6 -3
- xp/cli/commands/conbus/conbus_receive_commands.py +6 -3
- xp/cli/commands/conbus/conbus_scan_commands.py +6 -3
- xp/cli/commands/file_commands.py +6 -3
- xp/cli/commands/homekit/homekit.py +4 -2
- xp/cli/commands/homekit/homekit_start_commands.py +2 -1
- xp/cli/commands/module_commands.py +8 -4
- xp/cli/commands/reverse_proxy_commands.py +8 -4
- xp/cli/commands/server/server_commands.py +6 -3
- xp/cli/commands/telegram/telegram_blink_commands.py +4 -2
- xp/cli/commands/telegram/telegram_checksum_commands.py +4 -2
- xp/cli/commands/telegram/telegram_discover_commands.py +2 -1
- xp/cli/commands/telegram/telegram_linknumber_commands.py +4 -2
- xp/cli/commands/telegram/telegram_parse_commands.py +4 -2
- xp/cli/commands/telegram/telegram_version_commands.py +2 -1
- xp/cli/commands/term/term_commands.py +4 -2
- xp/cli/main.py +2 -1
- xp/cli/utils/click_tree.py +6 -3
- xp/cli/utils/datapoint_type_choice.py +4 -2
- xp/cli/utils/decorators.py +42 -21
- xp/cli/utils/error_handlers.py +16 -8
- xp/cli/utils/formatters.py +22 -11
- xp/cli/utils/module_type_choice.py +4 -2
- xp/cli/utils/serial_number_type.py +4 -2
- xp/cli/utils/system_function_choice.py +4 -2
- xp/cli/utils/xp_module_type.py +4 -2
- xp/models/actiontable/actiontable.py +8 -8
- xp/models/actiontable/actiontable_type.py +20 -0
- xp/models/actiontable/msactiontable_xp20.py +8 -4
- xp/models/actiontable/msactiontable_xp24.py +12 -6
- xp/models/actiontable/msactiontable_xp33.py +20 -10
- xp/models/conbus/conbus.py +8 -4
- xp/models/conbus/conbus_autoreport.py +4 -2
- xp/models/conbus/conbus_blink.py +4 -2
- xp/models/conbus/conbus_client_config.py +6 -3
- xp/models/conbus/conbus_connection_status.py +4 -2
- xp/models/conbus/conbus_custom.py +4 -2
- xp/models/conbus/conbus_datapoint.py +4 -2
- xp/models/conbus/conbus_discover.py +6 -3
- xp/models/conbus/conbus_event_list.py +4 -2
- xp/models/conbus/conbus_event_raw.py +4 -2
- xp/models/conbus/conbus_export.py +2 -1
- xp/models/conbus/conbus_lightlevel.py +4 -2
- xp/models/conbus/conbus_linknumber.py +4 -2
- xp/models/conbus/conbus_logger_config.py +8 -4
- xp/models/conbus/conbus_output.py +4 -2
- xp/models/conbus/conbus_raw.py +4 -2
- xp/models/conbus/conbus_receive.py +4 -2
- xp/models/conbus/conbus_writeconfig.py +4 -2
- xp/models/config/conson_module_config.py +8 -4
- xp/models/homekit/homekit_accessory.py +4 -2
- xp/models/homekit/homekit_config.py +12 -6
- xp/models/log_entry.py +16 -8
- xp/models/protocol/conbus_protocol.py +36 -18
- xp/models/response.py +12 -8
- xp/models/telegram/action_type.py +4 -2
- xp/models/telegram/datapoint_type.py +4 -2
- xp/models/telegram/event_telegram.py +14 -7
- xp/models/telegram/event_type.py +2 -1
- xp/models/telegram/input_action_type.py +2 -1
- xp/models/telegram/input_type.py +2 -1
- xp/models/telegram/module_type.py +24 -12
- xp/models/telegram/module_type_code.py +2 -1
- xp/models/telegram/output_telegram.py +16 -10
- xp/models/telegram/reply_telegram.py +24 -13
- xp/models/telegram/system_function.py +6 -3
- xp/models/telegram/system_telegram.py +10 -6
- xp/models/telegram/telegram.py +2 -1
- xp/models/telegram/telegram_type.py +2 -1
- xp/models/telegram/timeparam_type.py +2 -1
- xp/models/term/connection_state.py +4 -2
- xp/models/term/module_state.py +2 -1
- xp/models/term/protocol_keys_config.py +6 -3
- xp/models/term/status_message.py +2 -1
- xp/models/term/telegram_display.py +2 -1
- xp/models/write_config_type.py +4 -2
- xp/services/actiontable/actiontable_serializer.py +34 -41
- xp/services/actiontable/download_state_machine.py +281 -0
- xp/services/actiontable/msactiontable_xp20_serializer.py +77 -49
- xp/services/actiontable/msactiontable_xp24_serializer.py +78 -53
- xp/services/actiontable/msactiontable_xp33_serializer.py +39 -9
- xp/services/actiontable/serializer_protocol.py +76 -0
- xp/services/conbus/actiontable/actiontable_download_service.py +134 -280
- xp/services/conbus/actiontable/actiontable_list_service.py +17 -4
- xp/services/conbus/actiontable/actiontable_show_service.py +10 -6
- xp/services/conbus/actiontable/actiontable_upload_service.py +17 -9
- xp/services/conbus/conbus_blink_all_service.py +16 -8
- xp/services/conbus/conbus_blink_service.py +14 -7
- xp/services/conbus/conbus_custom_service.py +16 -8
- xp/services/conbus/conbus_datapoint_queryall_service.py +18 -9
- xp/services/conbus/conbus_datapoint_service.py +18 -9
- xp/services/conbus/conbus_discover_service.py +24 -13
- xp/services/conbus/conbus_event_list_service.py +11 -7
- xp/services/conbus/conbus_event_raw_service.py +18 -10
- xp/services/conbus/conbus_export_service.py +28 -14
- xp/services/conbus/conbus_output_service.py +18 -10
- xp/services/conbus/conbus_raw_service.py +16 -8
- xp/services/conbus/conbus_receive_service.py +18 -10
- xp/services/conbus/conbus_scan_service.py +18 -10
- xp/services/conbus/msactiontable/msactiontable_upload_service.py +17 -9
- xp/services/conbus/write_config_service.py +18 -9
- xp/services/homekit/homekit_cache_service.py +12 -6
- xp/services/homekit/homekit_conbus_service.py +12 -6
- xp/services/homekit/homekit_config_validator.py +34 -17
- xp/services/homekit/homekit_conson_validator.py +18 -9
- xp/services/homekit/homekit_dimminglight.py +14 -7
- xp/services/homekit/homekit_dimminglight_service.py +14 -7
- xp/services/homekit/homekit_hap_service.py +18 -9
- xp/services/homekit/homekit_lightbulb.py +10 -5
- xp/services/homekit/homekit_lightbulb_service.py +10 -5
- xp/services/homekit/homekit_module_service.py +8 -4
- xp/services/homekit/homekit_outlet.py +14 -7
- xp/services/homekit/homekit_outlet_service.py +12 -6
- xp/services/homekit/homekit_service.py +24 -12
- xp/services/log_file_service.py +16 -8
- xp/services/module_type_service.py +10 -5
- xp/services/protocol/conbus_event_protocol.py +140 -21
- xp/services/protocol/conbus_protocol.py +36 -19
- xp/services/protocol/protocol_factory.py +12 -6
- xp/services/protocol/telegram_protocol.py +12 -6
- xp/services/reverse_proxy_service.py +26 -14
- xp/services/server/base_server_service.py +42 -23
- xp/services/server/client_buffer_manager.py +12 -7
- xp/services/server/cp20_server_service.py +10 -7
- xp/services/server/device_service_factory.py +12 -8
- xp/services/server/server_service.py +18 -11
- xp/services/server/xp130_server_service.py +11 -8
- xp/services/server/xp20_server_service.py +16 -10
- xp/services/server/xp230_server_service.py +10 -7
- xp/services/server/xp24_server_service.py +22 -13
- xp/services/server/xp33_server_service.py +44 -25
- xp/services/telegram/telegram_blink_service.py +14 -8
- xp/services/telegram/telegram_checksum_service.py +12 -7
- xp/services/telegram/telegram_datapoint_service.py +14 -9
- xp/services/telegram/telegram_discover_service.py +28 -15
- xp/services/telegram/telegram_link_number_service.py +18 -10
- xp/services/telegram/telegram_output_service.py +24 -12
- xp/services/telegram/telegram_service.py +22 -11
- xp/services/telegram/telegram_version_service.py +14 -8
- xp/services/term/protocol_monitor_service.py +30 -16
- xp/services/term/state_monitor_service.py +39 -21
- xp/term/protocol.py +12 -6
- xp/term/state.py +12 -7
- xp/term/widgets/help_menu.py +6 -3
- xp/term/widgets/modules_list.py +20 -10
- xp/term/widgets/protocol_log.py +12 -6
- xp/term/widgets/status_footer.py +10 -5
- xp/utils/checksum.py +6 -3
- xp/utils/dependencies.py +26 -31
- xp/utils/event_helper.py +6 -4
- xp/utils/logging.py +6 -3
- xp/utils/serialization.py +30 -16
- xp/utils/state_machine.py +16 -9
- xp/utils/time_utils.py +6 -3
- conson_xp-1.45.0.dist-info/RECORD +0 -210
- xp/services/conbus/msactiontable/msactiontable_download_service.py +0 -275
- xp/services/conbus/msactiontable/msactiontable_list_service.py +0 -100
- xp/services/conbus/msactiontable/msactiontable_show_service.py +0 -89
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,28 +2,77 @@
|
|
|
2
2
|
|
|
3
3
|
from xp.models.actiontable.msactiontable_xp24 import InputAction, Xp24MsActionTable
|
|
4
4
|
from xp.models.telegram.input_action_type import InputActionType
|
|
5
|
+
from xp.models.telegram.system_function import SystemFunction
|
|
5
6
|
from xp.models.telegram.timeparam_type import TimeParam
|
|
7
|
+
from xp.services.actiontable.serializer_protocol import ActionTableSerializerProtocol
|
|
6
8
|
from xp.utils.serialization import de_nibbles, nibbles
|
|
7
9
|
|
|
8
10
|
|
|
9
|
-
class Xp24MsActionTableSerializer:
|
|
11
|
+
class Xp24MsActionTableSerializer(ActionTableSerializerProtocol):
|
|
10
12
|
"""Handles serialization/deserialization of XP24 action tables to/from telegrams."""
|
|
11
13
|
|
|
12
14
|
@staticmethod
|
|
13
|
-
def
|
|
14
|
-
"""
|
|
15
|
+
def download_type() -> SystemFunction:
|
|
16
|
+
"""
|
|
17
|
+
Get the download system function type.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
The download system function: DOWNLOAD_MSACTIONTABLE
|
|
21
|
+
"""
|
|
22
|
+
return SystemFunction.DOWNLOAD_MSACTIONTABLE
|
|
23
|
+
|
|
24
|
+
@staticmethod
|
|
25
|
+
def from_encoded_string(encoded_data: str) -> Xp24MsActionTable:
|
|
26
|
+
"""
|
|
27
|
+
Deserialize action table from raw data parts.
|
|
15
28
|
|
|
16
29
|
Args:
|
|
17
|
-
|
|
30
|
+
encoded_data: Raw action table data string.
|
|
18
31
|
|
|
19
32
|
Returns:
|
|
20
|
-
|
|
33
|
+
Deserialized XP24 MS action table.
|
|
34
|
+
|
|
35
|
+
Raises:
|
|
36
|
+
ValueError: If data length is not 68 bytes.
|
|
21
37
|
"""
|
|
22
|
-
|
|
38
|
+
raw_length = len(encoded_data)
|
|
39
|
+
if raw_length != 68:
|
|
40
|
+
raise ValueError(
|
|
41
|
+
f"Msactiontable is not 68 bytes long ({raw_length}): {encoded_data}"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# Remove action table count AAAA, AAAB .
|
|
45
|
+
stripped_data = encoded_data[4:]
|
|
46
|
+
|
|
47
|
+
# Take first 64 chars (32 bytes) as per pseudocode
|
|
48
|
+
hex_data = stripped_data[:64]
|
|
49
|
+
|
|
50
|
+
# Convert hex string to bytes using deNibble (A-P encoding)
|
|
51
|
+
data = de_nibbles(hex_data)
|
|
52
|
+
|
|
53
|
+
# Decode input actions from positions 0-3 (2 bytes each)
|
|
54
|
+
input_actions = []
|
|
55
|
+
for pos in range(4):
|
|
56
|
+
input_action = Xp24MsActionTableSerializer._decode_input_action(data, pos)
|
|
57
|
+
input_actions.append(input_action)
|
|
58
|
+
|
|
59
|
+
action_table = Xp24MsActionTable(
|
|
60
|
+
input1_action=input_actions[0],
|
|
61
|
+
input2_action=input_actions[1],
|
|
62
|
+
input3_action=input_actions[2],
|
|
63
|
+
input4_action=input_actions[3],
|
|
64
|
+
mutex12=data[8] != 0, # With A-P encoding: AA=0 (False), AB=1 (True)
|
|
65
|
+
mutex34=data[9] != 0,
|
|
66
|
+
mutual_deadtime=data[10],
|
|
67
|
+
curtain12=data[11] != 0,
|
|
68
|
+
curtain34=data[12] != 0,
|
|
69
|
+
)
|
|
70
|
+
return action_table
|
|
23
71
|
|
|
24
72
|
@staticmethod
|
|
25
|
-
def
|
|
26
|
-
"""
|
|
73
|
+
def to_encoded_string(action_table: Xp24MsActionTable) -> str:
|
|
74
|
+
"""
|
|
75
|
+
Serialize action table to telegram format.
|
|
27
76
|
|
|
28
77
|
Args:
|
|
29
78
|
action_table: XP24 MS action table to serialize.
|
|
@@ -56,64 +105,40 @@ class Xp24MsActionTableSerializer:
|
|
|
56
105
|
# Add padding to reach 32 bytes (19 more bytes needed)
|
|
57
106
|
raw_bytes.extend([0x00] * 19)
|
|
58
107
|
|
|
59
|
-
#
|
|
60
|
-
encoded_data = nibbles(bytes(raw_bytes))
|
|
61
|
-
|
|
108
|
+
# Build byte array for the action table (32 bytes total)
|
|
62
109
|
# Prepend action table count "AAAA" (4 chars) -> total 68 chars
|
|
63
|
-
return "AAAA" +
|
|
110
|
+
return "AAAA" + nibbles(raw_bytes)
|
|
64
111
|
|
|
65
112
|
@staticmethod
|
|
66
|
-
def
|
|
67
|
-
"""
|
|
113
|
+
def to_short_string(action_table: Xp24MsActionTable) -> list[str]:
|
|
114
|
+
"""
|
|
115
|
+
Serialize XP24 action table to humane compact readable format.
|
|
68
116
|
|
|
69
117
|
Args:
|
|
70
|
-
|
|
118
|
+
action_table: XP24 action table to serialize
|
|
71
119
|
|
|
72
120
|
Returns:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Raises:
|
|
76
|
-
ValueError: If data length is not 68 bytes.
|
|
121
|
+
Human-readable string describing XP24 action table
|
|
77
122
|
"""
|
|
78
|
-
|
|
79
|
-
if raw_length != 68:
|
|
80
|
-
raise ValueError(
|
|
81
|
-
f"Msactiontable is not 68 bytes long ({raw_length}): {msactiontable_rawdata}"
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
# Remove action table count AAAA, AAAB .
|
|
85
|
-
data = msactiontable_rawdata[4:]
|
|
86
|
-
|
|
87
|
-
# Take first 64 chars (32 bytes) as per pseudocode
|
|
88
|
-
hex_data = data[:64]
|
|
123
|
+
return action_table.to_short_format()
|
|
89
124
|
|
|
90
|
-
|
|
91
|
-
|
|
125
|
+
@staticmethod
|
|
126
|
+
def from_short_string(action_strings: list[str]) -> Xp24MsActionTable:
|
|
127
|
+
"""
|
|
128
|
+
Serialize XP24 action table to humane compact readable format.
|
|
92
129
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
for pos in range(4):
|
|
96
|
-
input_action = Xp24MsActionTableSerializer._decode_input_action(
|
|
97
|
-
raw_bytes, pos
|
|
98
|
-
)
|
|
99
|
-
input_actions.append(input_action)
|
|
130
|
+
Args:
|
|
131
|
+
action_strings: XP24 action table to serialize
|
|
100
132
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
input4_action=input_actions[3],
|
|
106
|
-
mutex12=raw_bytes[8] != 0, # With A-P encoding: AA=0 (False), AB=1 (True)
|
|
107
|
-
mutex34=raw_bytes[9] != 0,
|
|
108
|
-
mutual_deadtime=raw_bytes[10],
|
|
109
|
-
curtain12=raw_bytes[11] != 0,
|
|
110
|
-
curtain34=raw_bytes[12] != 0,
|
|
111
|
-
)
|
|
112
|
-
return action_table
|
|
133
|
+
Returns:
|
|
134
|
+
Human-readable string describing XP24 action table
|
|
135
|
+
"""
|
|
136
|
+
return Xp24MsActionTable.from_short_format(action_strings)
|
|
113
137
|
|
|
114
138
|
@staticmethod
|
|
115
|
-
def _decode_input_action(raw_bytes:
|
|
116
|
-
"""
|
|
139
|
+
def _decode_input_action(raw_bytes: bytes, pos: int) -> InputAction:
|
|
140
|
+
"""
|
|
141
|
+
Decode input action from raw bytes.
|
|
117
142
|
|
|
118
143
|
Args:
|
|
119
144
|
raw_bytes: Raw byte array containing action data.
|
|
@@ -5,16 +5,29 @@ from xp.models.actiontable.msactiontable_xp33 import (
|
|
|
5
5
|
Xp33Output,
|
|
6
6
|
Xp33Scene,
|
|
7
7
|
)
|
|
8
|
+
from xp.models.telegram.system_function import SystemFunction
|
|
8
9
|
from xp.models.telegram.timeparam_type import TimeParam
|
|
10
|
+
from xp.services.actiontable.serializer_protocol import ActionTableSerializerProtocol
|
|
9
11
|
from xp.utils.serialization import bits_to_byte, byte_to_bits, de_nibbles, nibbles
|
|
10
12
|
|
|
11
13
|
|
|
12
|
-
class Xp33MsActionTableSerializer:
|
|
14
|
+
class Xp33MsActionTableSerializer(ActionTableSerializerProtocol):
|
|
13
15
|
"""Handles serialization/deserialization of XP33 action tables to/from telegrams."""
|
|
14
16
|
|
|
15
17
|
@staticmethod
|
|
16
|
-
def
|
|
17
|
-
"""
|
|
18
|
+
def download_type() -> SystemFunction:
|
|
19
|
+
"""
|
|
20
|
+
Get the download system function type.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
The download system function: DOWNLOAD_MSACTIONTABLE
|
|
24
|
+
"""
|
|
25
|
+
return SystemFunction.DOWNLOAD_MSACTIONTABLE
|
|
26
|
+
|
|
27
|
+
@staticmethod
|
|
28
|
+
def to_short_string(action_table: Xp33MsActionTable) -> list[str]:
|
|
29
|
+
"""
|
|
30
|
+
Serialize XP33 action table to humane compact readable format.
|
|
18
31
|
|
|
19
32
|
Args:
|
|
20
33
|
action_table: XP33 action table to serialize
|
|
@@ -24,6 +37,19 @@ class Xp33MsActionTableSerializer:
|
|
|
24
37
|
"""
|
|
25
38
|
return action_table.to_short_format()
|
|
26
39
|
|
|
40
|
+
@staticmethod
|
|
41
|
+
def from_short_string(action_strings: list[str]) -> Xp33MsActionTable:
|
|
42
|
+
"""
|
|
43
|
+
Serialize XP33 action table to humane compact readable format.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
action_strings: XP33 action table to serialize
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
Human-readable string describing XP33 action table
|
|
50
|
+
"""
|
|
51
|
+
return Xp33MsActionTable.from_short_format(action_strings)
|
|
52
|
+
|
|
27
53
|
@staticmethod
|
|
28
54
|
def _percentage_to_byte(percentage: int) -> int:
|
|
29
55
|
"""Convert percentage (0-100) to byte value for telegram encoding."""
|
|
@@ -48,8 +74,9 @@ class Xp33MsActionTableSerializer:
|
|
|
48
74
|
return TimeParam.NONE
|
|
49
75
|
|
|
50
76
|
@staticmethod
|
|
51
|
-
def
|
|
52
|
-
"""
|
|
77
|
+
def to_encoded_string(action_table: Xp33MsActionTable) -> str:
|
|
78
|
+
"""
|
|
79
|
+
Serialize action table to telegram format.
|
|
53
80
|
|
|
54
81
|
Args:
|
|
55
82
|
action_table: XP33 MS action table to serialize.
|
|
@@ -115,8 +142,9 @@ class Xp33MsActionTableSerializer:
|
|
|
115
142
|
return "AAAA" + encoded_data
|
|
116
143
|
|
|
117
144
|
@staticmethod
|
|
118
|
-
def
|
|
119
|
-
"""
|
|
145
|
+
def from_encoded_string(msactiontable_rawdata: str) -> Xp33MsActionTable:
|
|
146
|
+
"""
|
|
147
|
+
Deserialize action table from raw data parts.
|
|
120
148
|
|
|
121
149
|
Args:
|
|
122
150
|
msactiontable_rawdata: Raw action table data string.
|
|
@@ -165,7 +193,8 @@ class Xp33MsActionTableSerializer:
|
|
|
165
193
|
|
|
166
194
|
@staticmethod
|
|
167
195
|
def _decode_output(raw_bytes: bytearray, output_index: int) -> Xp33Output:
|
|
168
|
-
"""
|
|
196
|
+
"""
|
|
197
|
+
Extract output configuration from raw bytes.
|
|
169
198
|
|
|
170
199
|
Args:
|
|
171
200
|
raw_bytes: Raw byte array containing output data.
|
|
@@ -219,7 +248,8 @@ class Xp33MsActionTableSerializer:
|
|
|
219
248
|
|
|
220
249
|
@staticmethod
|
|
221
250
|
def _decode_scene(raw_bytes: bytearray, scene_index: int) -> Xp33Scene:
|
|
222
|
-
"""
|
|
251
|
+
"""
|
|
252
|
+
Extract scene configuration from raw bytes.
|
|
223
253
|
|
|
224
254
|
Args:
|
|
225
255
|
raw_bytes: Raw byte array containing scene data.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Protocol for action table serializers."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Protocol
|
|
4
|
+
|
|
5
|
+
from xp.models.telegram.system_function import SystemFunction
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ActionTableSerializerProtocol(Protocol):
|
|
9
|
+
"""
|
|
10
|
+
Protocol defining the interface for action table serializers.
|
|
11
|
+
|
|
12
|
+
All action table serializers (ActionTableSerializer, Xp20MsActionTableSerializer,
|
|
13
|
+
Xp24MsActionTableSerializer, Xp33MsActionTableSerializer) implement this protocol.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def download_type() -> SystemFunction:
|
|
18
|
+
"""
|
|
19
|
+
Get the download system function type.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
The download system function: DOWNLOAD_MSACTIONTABLE or DOWNLOAD_ACTIONTABLE
|
|
23
|
+
"""
|
|
24
|
+
...
|
|
25
|
+
|
|
26
|
+
@staticmethod
|
|
27
|
+
def from_encoded_string(encoded_data: str) -> Any:
|
|
28
|
+
"""
|
|
29
|
+
Deserialize encoded telegram data to action table model.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
encoded_data: Encoded string from telegram (A-P nibble encoding).
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
Deserialized action table model.
|
|
36
|
+
"""
|
|
37
|
+
...
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def to_encoded_string(action_table: Any) -> str:
|
|
41
|
+
"""
|
|
42
|
+
Serialize action table model to encoded telegram format.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
action_table: Action table model to serialize.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
Encoded string for telegram transmission.
|
|
49
|
+
"""
|
|
50
|
+
...
|
|
51
|
+
|
|
52
|
+
@staticmethod
|
|
53
|
+
def from_short_string(action_strings: list[str]) -> Any:
|
|
54
|
+
"""
|
|
55
|
+
Deserialize human-readable short format to action table model.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
action_strings: List of short format strings.
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
Deserialized action table model.
|
|
62
|
+
"""
|
|
63
|
+
...
|
|
64
|
+
|
|
65
|
+
@staticmethod
|
|
66
|
+
def to_short_string(action_table: Any) -> list[str]:
|
|
67
|
+
"""
|
|
68
|
+
Serialize action table model to human-readable short format.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
action_table: Action table model to serialize.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
List of human-readable short format strings.
|
|
75
|
+
"""
|
|
76
|
+
...
|