EPICS Home

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: Marty Kraimer <[email protected]>
To: "Madden, Timothy J." <[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 11:15:26 -0400
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



Replies:
RE: NTNDArrays, Java Madden, Timothy J.
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.

Navigate by Date:
Prev: RE: NTNDArrays, Java Madden, Timothy J.
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 Madden, Timothy J.
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