1212from p4p import Type , Value
1313
1414from p4pillon .composite_handler import CompositeHandler
15- from p4pillon .nt .identify import is_scalararray
15+ from p4pillon .nt .identify import id_nttype , is_scalararray
1616from p4pillon .nthandlers import ComposeableRulesHandler
1717from p4pillon .rules import (
1818 AlarmNTEnumRule ,
@@ -56,6 +56,7 @@ class SharedNT(SharedPV, ABC):
5656 registered_handlers : list [type [BaseRule ]] = [
5757 AlarmRule ,
5858 ControlRule ,
59+ AlarmNTEnumRule ,
5960 ValueAlarmRule ,
6061 TimestampRule ,
6162 CalcRule ,
@@ -66,9 +67,12 @@ def __init__(
6667 * ,
6768 auth_handlers : OrderedDict [str , Handler ] | None = None ,
6869 user_handlers : OrderedDict [str , Handler ] | None = None ,
69- handler_constructors : dict [ str , Any ] | None = None ,
70+ registered_handlers : list [ type [ BaseRule ] ] | None = None ,
7071 ** kwargs ,
7172 ):
73+ if registered_handlers :
74+ self .registered_handlers = registered_handlers
75+
7276 # Create a CompositeHandler. If there is no user supplied handler, and this is not
7377 # an NT type then it won't do anything. Unfortunately, an empty CompositeHandler
7478 # will be discarded and won't be passed to the super().__init__
@@ -85,11 +89,6 @@ def __init__(
8589 if name and component_handler :
8690 handler [name ] = component_handler
8791
88- if handler_constructors and "alarmNTEnum" in handler_constructors :
89- handler ["alarmNTEnum" ] = ComposeableRulesHandler (
90- AlarmNTEnumRule (handler_constructors ["alarmNTEnum" ])
91- )
92-
9392 if user_handlers :
9493 handler = handler | user_handlers
9594
@@ -240,7 +239,13 @@ def __setup_registered_rule(
240239 if len (supported_nttypes ) == 1 and supported_nttypes == [SupportedNTTypes .ALL ]:
241240 pass
242241 else :
243- raise NotImplementedError ("We're not yet testing for NT type!" )
242+ matchfound = False
243+ type_id = id_nttype (nttype )
244+ for supported_nttype in supported_nttypes :
245+ if supported_nttype == type_id :
246+ matchfound = True
247+ if not matchfound :
248+ return (name , None , kwargs )
244249
245250 if required_fields :
246251 for required_field in required_fields :
0 commit comments