5050from .errors import SlmpPracticalPathWarning
5151
5252
53- def SlmpClient (* args : object , ** kwargs : object ) -> _StandardSlmpClient :
54- """Internal low-level constructor for CLI probe commands."""
55- kwargs ["_allow_manual_profile" ] = True
56- return _StandardSlmpClient (* args , ** kwargs )
53+ class SlmpClient (_StandardSlmpClient ):
54+ """Internal low-level client for CLI probe commands."""
55+
56+ def __init__ (
57+ self ,
58+ host : str ,
59+ port : int = 5000 ,
60+ * ,
61+ transport : str = "tcp" ,
62+ timeout : float = 3.0 ,
63+ plc_family : object | None = None ,
64+ plc_series : PLCSeries | str | None = None ,
65+ frame_type : FrameType | str | None = None ,
66+ default_target : SlmpTarget | None = None ,
67+ monitoring_timer : int = 0x0010 ,
68+ raise_on_error : bool = True ,
69+ trace_hook : Callable [[SlmpTraceFrame ], None ] | None = None ,
70+ device_family : object | None = None ,
71+ ) -> None :
72+ super ().__init__ (
73+ host ,
74+ port ,
75+ transport = transport ,
76+ timeout = timeout ,
77+ plc_family = plc_family ,
78+ plc_series = plc_series ,
79+ frame_type = frame_type ,
80+ default_target = default_target ,
81+ monitoring_timer = monitoring_timer ,
82+ raise_on_error = raise_on_error ,
83+ trace_hook = trace_hook ,
84+ device_family = device_family ,
85+ _allow_manual_profile = True ,
86+ )
5787
5888
5989def _int_auto (text : str ) -> int :
@@ -1698,7 +1728,7 @@ def _resolve_report_output(
16981728
16991729
17001730def _probe_device_read_with_series (
1701- client : SlmpClient ,
1731+ client : _StandardSlmpClient ,
17021732 * ,
17031733 device : str ,
17041734 points : int ,
@@ -1796,7 +1826,7 @@ def _compatibility_subprobe(
17961826
17971827
17981828def _compatibility_request_subprobe (
1799- client : SlmpClient ,
1829+ client : _StandardSlmpClient ,
18001830 * ,
18011831 name : str ,
18021832 command : int | Command ,
@@ -1812,7 +1842,7 @@ def _compatibility_request_subprobe(
18121842
18131843
18141844def _compatibility_probe_direct_word_write_restore (
1815- client : SlmpClient ,
1845+ client : _StandardSlmpClient ,
18161846 * ,
18171847 device : str ,
18181848 preferred_write_value : int ,
@@ -1831,7 +1861,7 @@ def _compatibility_probe_direct_word_write_restore(
18311861
18321862
18331863def _compatibility_probe_direct_bit_write_restore (
1834- client : SlmpClient ,
1864+ client : _StandardSlmpClient ,
18351865 * ,
18361866 device : str ,
18371867 series : PLCSeries ,
@@ -1846,7 +1876,7 @@ def _compatibility_probe_direct_bit_write_restore(
18461876
18471877
18481878def _compatibility_probe_random_word_write_restore (
1849- client : SlmpClient ,
1879+ client : _StandardSlmpClient ,
18501880 * ,
18511881 devices : Sequence [str ],
18521882 preferred_write_value : int ,
@@ -1868,7 +1898,7 @@ def _compatibility_probe_random_word_write_restore(
18681898
18691899
18701900def _compatibility_probe_random_bit_write_restore (
1871- client : SlmpClient ,
1901+ client : _StandardSlmpClient ,
18721902 * ,
18731903 devices : Sequence [str ],
18741904 series : PLCSeries ,
@@ -1890,7 +1920,7 @@ def _compatibility_probe_random_bit_write_restore(
18901920
18911921
18921922def _compatibility_probe_block_write_restore (
1893- client : SlmpClient ,
1923+ client : _StandardSlmpClient ,
18941924 * ,
18951925 word_device : str | None ,
18961926 bit_device : str | None ,
@@ -1943,7 +1973,7 @@ def _compatibility_probe_block_write_restore(
19431973
19441974
19451975def _compatibility_probe_memory_write_restore (
1946- client : SlmpClient ,
1976+ client : _StandardSlmpClient ,
19471977 * ,
19481978 head_address : int ,
19491979 preferred_write_value : int ,
@@ -1962,7 +1992,7 @@ def _compatibility_probe_memory_write_restore(
19621992
19631993def _compatibility_run_command (
19641994 spec : CompatibilityCommandSpec ,
1965- client : SlmpClient ,
1995+ client : _StandardSlmpClient ,
19661996 * ,
19671997 series : PLCSeries ,
19681998 args : argparse .Namespace ,
@@ -2246,7 +2276,7 @@ def _block_read_mixed_detail() -> str:
22462276 raise ValueError (f"unsupported compatibility command code: { spec .code } " )
22472277
22482278
2249- def _probe_sm400_series (client : SlmpClient ) -> tuple [PLCSeries , list [bool ]]:
2279+ def _probe_sm400_series (client : _StandardSlmpClient ) -> tuple [PLCSeries , list [bool ]]:
22502280 series , values = _probe_device_read_with_series (
22512281 client ,
22522282 device = "SM400" ,
@@ -2435,7 +2465,7 @@ def _format_manual_value(kind: str, value: int | bool) -> str:
24352465 return f"0x{ int (value ):04X} ({ int (value )} )"
24362466
24372467
2438- def _read_manual_row_value (client : SlmpClient , row : DeviceMatrixRow , * , series : str ) -> int | bool :
2468+ def _read_manual_row_value (client : _StandardSlmpClient , row : DeviceMatrixRow , * , series : str ) -> int | bool :
24392469 code = row .device_code .upper ()
24402470 number = parse_device (row .device ).number
24412471 if code == "LTC" :
@@ -2458,7 +2488,7 @@ def _read_manual_row_value(client: SlmpClient, row: DeviceMatrixRow, *, series:
24582488
24592489
24602490def _write_manual_row_value (
2461- client : SlmpClient ,
2491+ client : _StandardSlmpClient ,
24622492 row : DeviceMatrixRow ,
24632493 value : int | bool ,
24642494 * ,
@@ -2826,7 +2856,7 @@ def _trace_hook(trace: SlmpTraceFrame) -> None:
28262856
28272857
28282858def _run_extended_device_word_probe (
2829- client : SlmpClient ,
2859+ client : _StandardSlmpClient ,
28302860 * ,
28312861 item_name : str ,
28322862 device : str ,
@@ -2872,7 +2902,7 @@ def _run_extended_device_word_probe(
28722902
28732903
28742904def _run_extended_device_word_span_probe (
2875- client : SlmpClient ,
2905+ client : _StandardSlmpClient ,
28762906 * ,
28772907 item_name : str ,
28782908 device : str ,
@@ -2983,7 +3013,7 @@ def _format_counter(counter: dict[str, int] | Sequence[tuple[str, int]]) -> str:
29833013
29843014
29853015def _raw_device_read (
2986- client : SlmpClient ,
3016+ client : _StandardSlmpClient ,
29873017 * ,
29883018 device : str ,
29893019 points : int ,
@@ -3002,7 +3032,7 @@ def _raw_device_read(
30023032
30033033
30043034def _raw_device_write (
3005- client : SlmpClient ,
3035+ client : _StandardSlmpClient ,
30063036 * ,
30073037 device : str ,
30083038 values : Sequence [int | bool ],
0 commit comments