Juan,
The only widgets that deal directly with waveform of chars as a long
string are the text entry/update. The reason that your code is not
working is that setValue checks type and the type created by
createIntArray (int[]) is not one of the recognized types. Integer []
is supported so if you can create this ( I'm just not that fluent in
Javascript ) then I think that you can do what you want.
I have done a test edit of the code and have come up with the following
patch that will allow passing int[] to the setValue so that your
original script should work, although I had trouble since you created an
array of 10 elements but had a longer string. This section of code is
not mine so I am going to pass this off to others in the group to accept
& commit. This will not fix your immediate issue but should make it
possible to do this in the future.
John Hammonds
diff -r a6e2537a9c5c
core/plugins/org.csstudio.utility.pv.epics/src/org/csstudio/utility/pv/epics/EPICS_V3_PV.java
---
a/core/plugins/org.csstudio.utility.pv.epics/src/org/csstudio/utility/pv/epics/EPICS_V3_PV.java
Thu Oct 27 13:54:01 2011 -0500
+++
b/core/plugins/org.csstudio.utility.pv.epics/src/org/csstudio/utility/pv/epics/EPICS_V3_PV.java
Wed Nov 23 10:58:49 2011 -0600
@@ -495,7 +495,7 @@
final int val = ((Integer)new_value).intValue();
channel_ref.getChannel().put(val);
}
- else if (new_value instanceof Integer [])
+ else if (new_value instanceof Integer [] )
{
final Integer ival[] = (Integer [])new_value;
final int val[] = new int[ival.length];
@@ -503,8 +503,12 @@
val[i] = ival[i].intValue();
}
channel_ref.getChannel().put(val);
+ }
+ else if (new_value instanceof int[])
+ {
+ channel_ref.getChannel().put((int[])new_value);
} else {
- throw new Exception("Cannot handle type "
+ throw new Exception("Cannot handle data type "
+ new_value.getClass().getName());
}
}
On 11/23/2011 7:27 AM, [email protected] wrote:
Hi,
I have a waveform record setup as array of char (to support long string) and I'm trying to write a string to it via BOY Action button. I setup a "Write PV" action in the widget but the string does not get written, so perhaps long strings are not supported in BOY actions (it works for Text Inputs).
I tried a Javascript code to convert the string to an array of char via the following code:
importPackage(Packages.org.csstudio.opibuilder.scriptUtil);
var strArray = DataUtil.createIntArray(10);
var pv = widget.getPV();
var strText = "this is a test";
for(var i=0; i<strText.length; i++) {
strArray[i] = strText.charCodeAt(i);
}
pv.setValue(strArray);
but the script throws an exception in BOY's console "Wrapped java.lang.Exception: Cannot handle type [I".
Is there any way in BOY to write a string to a waveform record as an array of char (support long strings)? I'm using SNS CSS 3.0.2 (Basic) for MacOSX.
Thanks in advance,
Juan.
----------
Juan Carlos Guzman
Software Engineer
Australia Telescope National Facility
CSIRO Astronomy and Space Science
P.O.Box 76, Epping NSW 1710, Australia
Phone: +61 2 9372 4457
Fax: +61 2 9372 4310
Email: [email protected]<mailto:[email protected]>
--
John Hammonds
Software Services Group
APS Engineering Support Division
Argonne National Laboratory
[email protected]<mailto:[email protected]>
(630)252-5317
- Replies:
- RE: Writing long strings PV in BOY Chen, Xihui
- References:
- Writing long strings PV in BOY Juan.Guzman
- Navigate by Date:
- Prev:
Writing long strings PV in BOY Juan.Guzman
- Next:
Re: Gateway binary distribution available for RedHat 5.5 Martin Konrad
- 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:
Writing long strings PV in BOY Juan.Guzman
- Next:
RE: Writing long strings PV in BOY Chen, Xihui
- 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
|