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  <20172018  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  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: NTNDArrays, Java
From: "Madden, Timothy J." <[email protected]>
To: Marty Kraimer <[email protected]>, "Kasemir, Kay" <[email protected]>
Cc: "Rivers, Mark L." <IMCEAEX-_O=ARGONNE+20NATIONAL+20LABORATORY_OU=EXCHANGE+20ADMINISTRATIVE+20GROUP+20+28FYDIBOHF23SPDLT+29_CN=RECIPIENTS_CN=[email protected]>, EPICS tech-talk <[email protected]>
Date: Tue, 14 Mar 2017 16:30:57 +0000
Thanks Marty

I think I have something working OK now, that has the case statemnt, but I am switching on things like
"int[]". or the strings.

It is here.
https://github.com/argonnexraydetector/MaddenNTNDArrayJavaClient/blob/master/src/epicsv4test/imageget.java

I had trouble w/ the API because there is a long line of single interitance in Java, and its hard
to remember all that stuff.

Now I know that things like PVField have data in them. Field is only introspection.
PV means data. Also I kept confusing "Field," which seems to mean a field in a PV with
field, which means a field in a struct. I guess in EPICS V4 it sort of means the same thing... but hard
to get my head around it.

T



From: Marty Kraimer [[email protected]]
Sent: Tuesday, March 14, 2017 10:15 AM
To: Madden, Timothy J.; Kasemir, Kay
Cc: EPICS tech-talk; Rivers, Mark L.
Subject: Re: NTNDArrays, Java

On 03/13/2017 04:43 PM, Madden, Timothy J. wrote:
Thanks Kay. That worked. I can now get the NTNDArray. I still have to use wrapUnsafe rather than wrap, ...but it works.

Another mystery:
When I call myarray.getValue() it returns a PVUnion. somehow the PVUnion knows that the data is ushort[] uint[] or whatever type the image data is.
How do we ask the PVUnion what data type it is? 


For the following you will want to add the import
import org.epics.pvdata.pv.*;

Try the following  starting with line 85
PVUnion pvu = myarray.getValue();
PVScalarArray pvarray = pvu.getField(PVScalarArray.class);
ScalarType scalarType= pvarray.getScalarArray().getElementType();
switch (scalarType) {
            case pvByte: {
                PVByteArray pv = (PVByteArray)pvarray;
               ...  // details left to reader!!!
                break;
            }
            case pvShort: {
               ...
                break;
            }
            case pvInt: {
                ...
                break;
            }
            case pvLong: {
                 ...
                break;
            }
            case pvUByte: {
                ...
                break;
            }
            case pvUShort: {
               ...
                break;
            }
            case pvUInt: {
                ...
                break;
            }
            case pvULong: {
               ...
                break;
            }
            case pvFloat: {
                ...
                break;
            }
            case pvDouble: {
                ...
                break;
            }
            default:
                throw new IllegalArgumentException("Unsupported scalarType  "
                        + scalarType.toString());
            }


Also to help you get going try the following starting with line 69
PVStructure pvs = easydata.getPVStructure();
System.out.println(pvs.getStructure());


Marty


In Eclipse I can trap on the code and see it is ushort, for my array, which is correct. But I cannot figure out
how my own code would know it i ushort. It must be the introspection interface? I have been mucking with with this....
I guess I use the convert utility to convert to a real Java tupe like int[]. But I have to know which Java type to use....

Thanks
Tim



________________________________________
From: Kasemir, Kay [[email protected]]
Sent: Monday, March 13, 2017 1:43 PM
To: Madden, Timothy J.
Cc: EPICS tech-talk
Subject: Re: NTNDArrays, Java

Not sure how to request the entire normative type on pvget.
Try "field()" as the request to get all fields:

   pvget -r "field()" ...

Same when you assemble request in Java:

  PVStructure read_request = CreateRequest.create().createRequest("field()");
  ... channel.createMonitor(.., read_request);


-Kay



References:
NTNDArrays, Java Madden, Timothy J.
Re: NTNDArrays, Java bob dalesio
RE: NTNDArrays, Java Mark Rivers
RE: NTNDArrays, Java Madden, Timothy J.
RE: NTNDArrays, Java Mark Rivers
RE: NTNDArrays, Java Madden, Timothy J.
Re: NTNDArrays, Java Kasemir, Kay
RE: NTNDArrays, Java Madden, Timothy J.
Re: NTNDArrays, Java Marty Kraimer

Navigate by Date:
Prev: Re: NTNDArrays, Java Marty Kraimer
Next: RE: NTNDArrays, Java Madden, Timothy J.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: NTNDArrays, Java Marty Kraimer
Next: RE: NTNDArrays, Java Madden, Timothy J.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
ANJ, 21 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·