added PV for the PV type; convert type name to field type; added workaround for enum PV not working
This commit is contained in:
@ -5,11 +5,21 @@ from log import log
|
|||||||
from utils import toggle
|
from utils import toggle
|
||||||
|
|
||||||
|
|
||||||
|
DTYPES = {
|
||||||
|
"float": "ai",
|
||||||
|
"int": "longin",
|
||||||
|
"bool": "bi",
|
||||||
|
"str": "stringin"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FN_ENTRIES = "/ioc/data/SATES20-CPCL-DYNA/entries"
|
FN_ENTRIES = "/ioc/data/SATES20-CPCL-DYNA/entries"
|
||||||
FN_DB_TMPL = "/ioc/data/SATES20-CPCL-DYNA/dynamic.template"
|
FN_DB_TMPL = "/ioc/data/SATES20-CPCL-DYNA/dynamic.template"
|
||||||
|
|
||||||
|
|
||||||
pv_name = PV("SATES20-DYNA:NAME")
|
pv_name = PV("SATES20-DYNA:NAME")
|
||||||
|
pv_dtyp = PV("SATES20-DYNA:TYPE")
|
||||||
|
pv_dtyp.get_ctrlvars() # without this, the enum returns only str(number)
|
||||||
|
|
||||||
|
|
||||||
@toggle
|
@toggle
|
||||||
@ -18,7 +28,9 @@ def cb_add(value=None, **kwargs):
|
|||||||
if not name:
|
if not name:
|
||||||
log.info(f"add: ignoring name={repr(name)}")
|
log.info(f"add: ignoring name={repr(name)}")
|
||||||
return
|
return
|
||||||
log.info(f"add: name={repr(name)} {kwargs}")
|
dtyp = pv_dtyp.get(as_string=True)
|
||||||
|
dtyp = DTYPES[dtyp]
|
||||||
|
log.info(f"add: name={repr(name)} type={repr(dtyp)} {kwargs}")
|
||||||
data = load_data(FN_ENTRIES)
|
data = load_data(FN_ENTRIES)
|
||||||
data.add(name)
|
data.add(name)
|
||||||
save_data(data, FN_ENTRIES)
|
save_data(data, FN_ENTRIES)
|
||||||
|
Reference in New Issue
Block a user