EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: How to write a soft record with a constant long string value
From: "Johnson, Andrew N. via Tech-talk" <tech-talk at aps.anl.gov>
To: "Cobb, Tom (DLSLtd,RAL,LSCI)" <tom.cobb at diamond.ac.uk>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Tue, 18 Aug 2020 15:45:10 +0000
Hi Tom,

On Aug 18, 2020, at 4:04 AM, Cobb, Tom (DLSLtd,RAL,LSCI) via Tech-talk <tech-talk at aps.anl.gov> wrote:

I would like to write a database file with a single record that holds a constant chunk of JSON (generated by a script at IOC build time). I would prefer to do this by writing the JSON into the database file itself, rather than having to use a separate file, or dbpf.

Does anyone know if this is possible?

You can load arbitrary JSON into a record info tag, but not directly into any other field type at the moment. It should be relatively easy to write device support or an aSub subroutine to copy the contents of an info tag into a long string field though:

woz$ cat ~/db/test.db 
record(lsi, "json") {
  info(json, {"this": ["is", "json"], # Comments,
    # spaces and newlines are stripped.
    "does": ["this", "help?"]})
}
woz$ bin/darwin-x86/softIoc -d ~/db/test.db 
dbLoadDatabase("/Users/anj/Software/epics/base-7.0/bin/darwin-x86/../../dbd/softIoc.dbd")
softIoc_registerRecordDeviceDriver(pdbbase)
dbLoadRecords("/Users/anj/db/test.db")
iocInit()
Starting iocInit
############################################################################
## EPICS R7.0.4.1-rc1-DEV
## Rev. R7.0.4.1-rc1-14-ga808e3c7900b79f22eb5-dirty
############################################################################
iocRun: All initialization complete
epics> dbli
json info(json, "{"this":["is","json"],"does":["this","help?"]}")

HTH,

- Andrew


-- 
Complexity comes for free, simplicity you have to work for.


Replies:
Re: How to write a soft record with a constant long string value Cobb, Tom (DLSLtd,RAL,LSCI) via Tech-talk
References:
How to write a soft record with a constant long string value Cobb, Tom (DLSLtd,RAL,LSCI) via Tech-talk

Navigate by Date:
Prev: Re: EPICS7 and Python Matt Newville via Tech-talk
Next: Re: EPICS7 and Python Juan F. Esteban Müller via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: How to write a soft record with a constant long string value Cobb, Tom (DLSLtd,RAL,LSCI) via Tech-talk
Next: Re: How to write a soft record with a constant long string value Cobb, Tom (DLSLtd,RAL,LSCI) via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 19 Aug 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·