Hi Florian.
There might be a better way but I use functools.partial to do this, like so:
from p4p.client.thread import Context
from functools import partial
ctxt = Context('pva', nt=False)
def cb(name, value):
print('New value', name, value['value'])
sub = ctxt.monitor('SOME:PV:NAME', partial(cb, 'SOME:PV:NAME'))
Cheers,
Matt
On 17/05/2022, 10:57, "Tech-talk on behalf of Florian Feldbauer via Tech-talk" <tech-talk-bounces at aps.anl.gov on behalf of tech-talk at aps.anl.gov> wrote:
Hey all,
I wanted to write a small python script that monitors multiple pvs in
our system using p4p.
If I use the same callback routine for all PVs, is it possible to get
the name of the PV, that triggered the callback?
I did not see any attributes of the passed p4p values that could work in
identifying the PV.
Thanks in advance for your help,
Florian
--
Ruhr-Universität Bochum
AG der Experimentalphysik I
Dr. Florian Feldbauer
NB 2/131 / Fach 125
Universitätsstr. 150
D-44801 Bochum
Office: NB 2/134
Phone: (+49)234 / 32-23563
Fax: (+49)234 / 32-14170
https://paluma.ruhr-uni-bochum.de
- References:
- P4P monitor get pvname Florian Feldbauer via Tech-talk
- Navigate by Date:
- Prev:
P4P monitor get pvname Florian Feldbauer via Tech-talk
- Next:
compilation error with redis Pierrick M Hanlet 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
2020
2021
<2022>
2023
2024
- Navigate by Thread:
- Prev:
P4P monitor get pvname Florian Feldbauer via Tech-talk
- Next:
compilation error with redis Pierrick M Hanlet 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
2020
2021
<2022>
2023
2024
|