I am indeed doing something similar to what you suggested: i created a file full of dbpf's and im trying to use the "execute" function of streamDevice to do a protocol file with:
call_file {
execute "< file_with_dbpfs.cmd";
}
And a PV in the form:
record(stringout, "$(P)$(R)UpdateConfig"){
field(DESC, "Filename from which to get values.")
field(OUT, "@iocsh_functions.proto call_file")
}
Untill now i had no success but it seems to be some silly mistake that i still didnt have time to debug.
Thanks,
Marco
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:* Nariyoshi, Pedro <nariyosh at frib.msu.edu>
*Sent:* 28 November 2022 13:50
*To:* Marco A. Barra Montevechi Filho <marco.filho at lnls.br>; tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
*Subject:* Re: How to: IOC reading information from file?
Hi Marco,
I don't know if there's a native functionality for this, but for some of our IOCs we use python to do some of these things. You can add something like "system 'python3 iocApp/py/script.py arguments &'" to the startup script. The script would do a camonitor 'MYRECORD:Output' and have a callback to read the file and do the respective actions. It's not as clean as your original proposition, but it should be faster to get running until you figure something a better solution.
*Pedro Nariyoshi*
Software Controls Engineer
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824, USA
Tel. 517-908-7352
Email: nariyosh at frib.msu.edu <mailto:nariyosh at frib.msu.edu>
1633986722804
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:* Marco A. Barra Montevechi Filho <marco.filho at lnls.br>
*Sent:* Thursday, November 24, 2022 10:02 AM
*To:* tech-talk at aps.anl.gov
*Subject:* How to: IOC reading information from file?
*[EXTERNAL] This email originated from outside of FRIB*
Hello all.
I want to create a set of configuration files (probably json, yaml or even txt) that i can make my IOC read and put the values into PVs. I could swear i read something about reading configuration files in EPICS documentation before but i cant for the life of me find it again.
Desired functionality would be something like:
file config0.yaml has: {"my_var" : 0}
file config1.yaml has: {"my_var" : 1}
And then i would have a record, say MYRECORD:Output that when i do:
caput MYRECORD:Output "config0.yaml"
the record would output 0 to its output link. And
caput MYRECORD:Output "config1.yaml"
the record would output 1 to its output link.
Is there any module or record that offers similar functionality?
Thanks in advance,
Marco
Aviso Legal: Esta mensagem e seus anexos podem conter informações confidenciais e/ou de uso restrito. Observe atentamente seu conteúdo e considere eventual consulta ao remetente antes de copiá-la, divulgá-la ou distribuí-la. Se você recebeu esta mensagem por engano, por favor avise o remetente e apague-a imediatamente.
Disclaimer: This email and its attachments may contain confidential and/or privileged information. Observe its content carefully and consider possible querying to the sender before copying, disclosing or distributing it. If you have received this email by mistake, please notify the sender and delete it immediately.