Scalar attribute values in Array[1] using JTango

Hi,

Using the JTango 9 (Java) API on a customer site, I get scalar attribute values embedded in an array.
Typically, I get Boolean or String scalar values in an array[1].
(I have double-checked with AtkPanel that the attribute type is really a scalar type).

Using the same JTango API (with the same java code), I don't see this issue on my TangoBox.

Any explanation about this behavior? Is install/config issues could explain this?

Thanks,
Jerome
Hi Jerome

And what do you see ?
Another value ? Another configuration (not a boolean or String, or array size different) ?

If value is different, what is the value returned by TestDevice ?

Pascal
Hi Pascal,

I see the right type and value, but embedded in an array of one element.
For instance, for string "test", I'll get ["test"]

Thanks,
Jerome
Hello,

Some more questions:
What is the code that returns this array?
Is the source device/attribute is the same in your customer configuration and your tango box?

Gwenaëlle.
In TANGO all attribute values are transferred in an array.
Scalar:
READ_ONLY array[1]
READ_WRITE array[2]
Spectum n values:
READ_ONLY array[n]
READ_WRITE array[2*n]
…….

Pascal
@Pascal,
ok, but since I'm using the JTango extractXXX calls, I should'nt get an array for scalar values.

Typically, for boolean values, the code is as follows:

Object value;
AttrDataFormat dataFormat = deviceAttribute.getDataFormat();
if (dataFormat == AttrDataFormat.SCALAR) {
    value = deviceAttribute.extractBoolean();
} else {
    value = deviceAttribute.extractBooleanArray();
}

@Gwenaëlle,
No, the device/attribute is *not* the same in the customer configuration.
But I've checker (from AtkPanel) the attribute is really a scalar one.

Seems there is a mismatch in DataFormat between Scalar an Array.
Is this could be caused by an issue in Tango configuration/install?
Or by the device server implementation?

Thanks,
Jerome
Edited 5 years ago
Are you using the same JTango release ?
Which one (client and server side) ?

We are using the same JTango library on the client side: JTango-9.1.2
On the server side, it may vary, depending on the device server we are connected to.
Is there any restriction about compatibility between JTango versions ?

Thanks,
Jerome
Hi,

My 50 cents:

DeviceAttribute has DataFormat == UNKNOWN by default, so in your case it might be the reason: you fall through if to else, hence Array. Debug would say exactly.

Why do not you use one of the high level APIs? There is JTangoClientLang (or so) embedded into JTango and ezTangORB: link source, link maven.

With this you can just do:


Object value = proxy.readAttribute("my-boolean-attribute")

or to be more specific:


boolean value = proxy.readAttribute("my-boolean-attribute")

Obviously that would not fix you problem, but at least less typing.

Finally as I can see you store value in Object, so I think it is even better to have arrays everywhere - the rest of the code becomes much more cleaner, this is how it is done in TINE BTW
Hi Igor,

Thanks for your response.

About ezTangORB, I'd like to stick to Tango official repositories (https://github.com/tango-controls).
About JTango Client Lang, I didn't know there is a high level API, if it can simplify my code it would be nice!
If you could give me a small usage example it would be great.

Thanks,
Jerome
 
Register or login to create to post a reply.