1111from fastcs .backends .epics .util import (
1212 MBB_STATE_FIELDS ,
1313 EpicsNameOptions ,
14- PvNamingConvention ,
14+ _convert_attribute_name_to_pv_name ,
1515 attr_is_enum ,
1616 enum_index_to_value ,
1717 enum_value_to_index ,
@@ -30,15 +30,6 @@ class EpicsIOCOptions:
3030 name_options : EpicsNameOptions = EpicsNameOptions ()
3131
3232
33- def _convert_attr_name_to_pv_name (
34- attr_name : str , naming_convention : PvNamingConvention
35- ) -> str :
36- if naming_convention == PvNamingConvention .PASCAL :
37- return attr_name .title ().replace ("_" , "" )
38- elif naming_convention == PvNamingConvention .CAPITALIZED :
39- return attr_name .upper ().replace ("_" , "-" )
40- return attr_name
41-
4233
4334class EpicsIOC :
4435 def __init__ (
@@ -80,8 +71,10 @@ def _add_sub_controller_pvi_info(self, pv_prefix: str, parent: BaseController):
8071 child_pvi = self ._name_options .pv_separator .join (
8172 [pv_prefix ]
8273 + [
83- _convert_attr_name_to_pv_name (
84- path , self ._name_options .pv_naming_convention
74+ _convert_attribute_name_to_pv_name (
75+ path ,
76+ self ._name_options .pv_naming_convention ,
77+ is_attribute = False
8578 )
8679 for path in child .path
8780 ]
@@ -96,14 +89,14 @@ def _add_sub_controller_pvi_info(self, pv_prefix: str, parent: BaseController):
9689 def _create_and_link_attribute_pvs (self , pv_prefix : str , mapping : Mapping ) -> None :
9790 for single_mapping in mapping .get_controller_mappings ():
9891 formatted_path = [
99- _convert_attr_name_to_pv_name (
100- p , self ._name_options .pv_naming_convention
92+ _convert_attribute_name_to_pv_name (
93+ p , self ._name_options .pv_naming_convention , is_attribute = False
10194 )
10295 for p in single_mapping .controller .path
10396 ]
10497 for attr_name , attribute in single_mapping .attributes .items ():
105- pv_name = _convert_attr_name_to_pv_name (
106- attr_name , self ._name_options .pv_naming_convention
98+ pv_name = _convert_attribute_name_to_pv_name (
99+ attr_name , self ._name_options .pv_naming_convention , is_attribute = True
107100 )
108101 _pv_prefix = self ._name_options .pv_separator .join (
109102 [pv_prefix ] + formatted_path
@@ -169,14 +162,14 @@ async def async_record_set(value: T):
169162 def _create_and_link_command_pvs (self , pv_prefix : str , mapping : Mapping ) -> None :
170163 for single_mapping in mapping .get_controller_mappings ():
171164 formatted_path = [
172- _convert_attr_name_to_pv_name (
173- p , self ._name_options .pv_naming_convention
165+ _convert_attribute_name_to_pv_name (
166+ p , self ._name_options .pv_naming_convention , is_attribute = False
174167 )
175168 for p in single_mapping .controller .path
176169 ]
177170 for attr_name , method in single_mapping .command_methods .items ():
178- pv_name = _convert_attr_name_to_pv_name (
179- attr_name , self ._name_options .pv_naming_convention
171+ pv_name = _convert_attribute_name_to_pv_name (
172+ attr_name , self ._name_options .pv_naming_convention , is_attribute = True
180173 )
181174 _pv_prefix = self ._name_options .pv_separator .join (
182175 [pv_prefix ] + formatted_path
0 commit comments