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  <20132014  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  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: CAJ can't handle DBR_String
From: Hugo Slepicka <[email protected]>
To: "Winkler, Carsten" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Wed, 21 Aug 2013 11:37:49 -0300
Hi Carsten,

This worked for me:
public class CAJBugTest {
    public static void main(String[] args) throws Exception {
        JCALibrary jca = JCALibrary.getInstance();
        Context ctxt = jca.createContext(JCALibrary.CHANNEL_ACCESS_JAVA);
        Channel ch = ctxt.createChannel("LNLS:ANEL:comentario");
        ch.addMonitor(DBRType.STRING, 1, Monitor.VALUE, new MonitorListener() {
            @Override
            public void monitorChanged(MonitorEvent ev) {
            String[] ret = (String[])ev.getDBR().getValue();
            System.out.println(ret[0]);
            }
        });
        ctxt.flushIO();
        Thread.sleep(5000);
        ch.destroy();
        ctxt.destroy();
    }
}


Here is the PV Info:
hslepicka@SOL7-LINUX ~/CT $ cainfo LNLS:ANEL:comentario
LNLS:ANEL:comentario
    State:            connected
    Host:             10.2.105.151:5064
    Access:           read, no write
    Native data type: DBF_STRING
    Request type:     DBR_STRING
    Element count:    1

-- 
Hugo Henrique Slepicka
Engenheiro de Computação
SOL - Software de Operação das Linhas de Luz
LNLS - Laboratório Nacional de Luz Síncrotron
CNPEM - Centro Nacional de Pesquisa em Energia e Materiais
5913 - [email protected]
www.lnls.br



On Wed, Aug 21, 2013 at 10:53 AM, Winkler, Carsten <[email protected]> wrote:
Hi,
my initial version used the  connection listener to add monitor with native data type. But it didn't work.
Carsten


"Kasemir, Kay" <[email protected]> schrieb:

Looks like you are asking for a DBRType.DOUBLE in the addMonitor, but the actual value (string) cannot be converted.
Ask for the 'native' value by adding a connection listener, then inside the connection listener do the addMonitor with the native data type.

-Kay

On Aug 21, 2013, at 5:44 AM, Carsten Winkler <[email protected]> wrote:

> Hi all,
>
> it seems CAJ can't handle DBR_String.
> If you request the value of a stringout or stringin EPICS variable you
> always get a NullPointerException.
> Also if you ask for the DESC field of any PV you'll get same error.
> If you dig deeper you see the DBRType of the created channel is
> UNKNOWN.  Where comes this type come from? You find the problem in
> "com.cosylab.epics.caj.CAJChannel.connectionCompleted(int sid, short
> typeCode, int elementCount) ". This function gets the parameter
> "typeCode" and the value of this parameter is "UNKNOWN" instead of
> "STRING". But who sets the "typeCode"? The "typeCode" will be extracted
> from the CA response header (AbstractCAResponseHandler) and here ends my
> trace.
> Did I miss something? Please check my source code and tell me what to do
> to get strings.
>
> public class CAJBugTest {
>     public static void main(String[] args) throws Exception {
>         JCALibrary jca = JCALibrary.getInstance();
>         Context ctxt = jca.createContext(JCALibrary.CHANNEL_ACCESS_JAVA);
>         Channel ch = ctxt.createChannel("INFOCL:scale.DESC");
>         ch.addMonitor(DBRType.DOUBLE, 1, Monitor.VALUE, new
> MonitorListener() {
>             @Override
>             public void monitorChanged(MonitorEvent ev) {
>                 System.out.println(ev.getDBR().getValue());
>             }
>         });
>         ctxt.flushIO();
>         Thread.sleep(5000);
>         ch.destroy();
>         ctxt.destroy();
>     }
> }
>
> Cheers,
> Carsten
>
> ________________________________
>
> Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
>
> Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.
>
> Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
> Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking
>
> Sitz Berlin, AG Charlottenburg, 89 HRB 5583
>
> Postadresse:
> Hahn-Meitner-Platz 1
> D-14109 Berlin
>
> http://www.helmholtz-berlin.de
>




Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

http://www.helmholtz-berlin.de


References:
CAJ can't handle DBR_String Carsten Winkler
Re: CAJ can't handle DBR_String Kasemir, Kay
AW: CAJ can't handle DBR_String Winkler, Carsten

Navigate by Date:
Prev: AW: CAJ can't handle DBR_String Winkler, Carsten
Next: query ioc/cas for list of channels Jameson Graef Rollins
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: AW: CAJ can't handle DBR_String Winkler, Carsten
Next: Re: CAJ can't handle DBR_String Carsten Winkler
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·