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  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: How to check if a PV is initially disconnected using org.phoebus.pv.PV.onValueEvent().subscribe()
From: "Wang, Lin via Tech-talk" <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Thu, 16 May 2024 23:29:11 +0800 (GMT+08:00)

Dear all,


When monitoring a PV using the following Java code snippet, if the status of the PV changes from connected to disconnected, valueChanged() will be invoked and the disconnected status can be checked. However, if the initial status of the PV is already disconnected, then valueChanged() will not be invoked, thus I do not know if the PV is disconnected or "connected but has no new value".


import org.epics.vtype.VType;
import org.phoebus.pv.PV;
import org.phoebus.pv.PVPool;
import io.reactivex.rxjava3.disposables.Disposable;

public class Test {
    public void start() throws Exception
    {
        PV pv = PVPool.getPV("test:123");
        Disposable pv_flow = pv.onValueEvent().subscribe(this::valueChanged);
    }

    private void valueChanged(final VType value)
    {
        if (PV.isDisconnected(value))
        {
            System.out.println("PV is disconnected");
        }
    }
}


How can I check if the PV is initially disconnected or is not available at all using this monitoring approach?



Thanks,

Lin










Replies:
Re: [EXTERNAL] How to check if a PV is initially disconnected using org.phoebus.pv.PV.onValueEvent().subscribe() Kasemir, Kay via Tech-talk

Navigate by Date:
Prev: Magna Power TS Zumbruch, Peter Dr. via Tech-talk
Next: Re: urldefense.us URLs? (was: New Git mirror for the SNL-Sequencer (code and docs)) NICOLE Rémi 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: RE: Magna Power TS Abdalla Ahmad via Tech-talk
Next: Re: [EXTERNAL] How to check if a PV is initially disconnected using org.phoebus.pv.PV.onValueEvent().subscribe() Kasemir, Kay 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
ANJ, 19 May 2024 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·