10
10
from tickit .adapters .specifications .regex_command import RegexCommand
11
11
from tickit .adapters .tcp import CommandAdapter
12
12
13
- from tickit_devices .merlin .commands import (
13
+ from tickit_devices .merlin .merlin import MerlinDetector , State
14
+ from tickit_devices .merlin .parameters import (
14
15
DLIM ,
15
16
PREFIX ,
16
17
CommandType ,
17
18
ErrorCode ,
18
19
commands ,
19
20
)
20
- from tickit_devices .merlin .merlin import MerlinDetector , State
21
21
from tickit_devices .merlin .tcp import TcpPushAdapter
22
22
23
23
LOGGER = logging .getLogger ("MerlinControlAdapter" )
@@ -48,7 +48,8 @@ async def get(self, parameter: str) -> bytes:
48
48
value = "0"
49
49
code = ErrorCode .UNDERSTOOD
50
50
if (
51
- parameter not in commands [CommandType .GET ] + commands [CommandType .SET ]
51
+ parameter
52
+ not in list (commands [CommandType .GET ]) + list (commands [CommandType .SET ])
52
53
or not parameter in self .detector .parameters
53
54
):
54
55
code = ErrorCode .UNRECOGNISED
@@ -69,7 +70,7 @@ async def get(self, parameter: str) -> bytes:
69
70
70
71
@RegexCommand (r"MPX,[0-9]{10},CMD,([a-zA-Z0-9]*)$" , format = "utf-8" )
71
72
async def cmd (self , command_name : str ) -> bytes :
72
- command = getattr ( self .detector , f" { command_name } _cmd" , None )
73
+ command = self .detector . commands . get ( command_name , None )
73
74
if command_name not in commands [CommandType .CMD ] or command is None :
74
75
LOGGER .error (f"Merlin does not have a command { command } " )
75
76
code = ErrorCode .UNRECOGNISED
0 commit comments