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> 2020 2021 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> 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Nested PVStructureArray With pvput |
From: | William Cork via Tech-talk <[email protected]> |
To: | Michael Davidsaver <[email protected]> |
Cc: | [email protected] |
Date: | Tue, 2 Apr 2019 22:37:16 -0700 |
On 4/2/19 8:23 PM, William Cork via Tech-talk wrote:
> Hi All,
>
> I’m working on a softIOC that will make calls to a Monit daemon to restart and monitor services under Monit.
>
> Right now, I have the following pv structure (a wip):
>
> |test:Monit:localhost structure string host http://localhost:2812 int poll 120 structure[] services structure string name testService boolean monitored true int state 0 string type SERVICE epics:nt/NTEnum:1.0 action enum_t value int index 0 string[] choices ["none", "enable", "disable", "start", "stop", "restart"] |
>
> Is it possible to change an element in the nested services list with pvput, or are the immutable?
> |pvput test:Monit:localhost services='...'| may be the wrong syntax?
> More precisely, can I change services[index of service I care about].action = "" of the action enums.
>
> Architecturally speaking, is it more ideal to have a bookkeeping PVArray that lists the provided services and individual PVs for each service?
Are you thinking to control this with a existing client application?
eg. an OPI client like cs-studio? I find that questions like this
are best approached by think from the prospective of a client.
What will a client want to do? What steps are involved?
Are there any issues of atomicity (eg. racing with other
clients). What configuration will a client need?
Now for the part for which I have a clear answer.
> pvput test:Monit:localhost services='...'
For the present the 'field=' syntax is limited to scalars and arrays of scalars.
It is possible to send an array of structures w/ pvput provided you're
building against Base >=3.15 (which includes a JSON parser). The syntax
is awkward though:
> $ pvput -h 2>&1|grep JSON
> JSON support is present
> Field values may be given with JSON syntax.
An empty array:
> pvput test:Monit:localhost '{"services":[]}'
One element with all default values.
> pvput test:Monit:localhost '{"services":[{}]}'
One element with one field having a non-default value.
> pvput test:Monit:localhost '{"services":[{"state":42}]}'