Strange unit info in Java

Post your Java discussions here
Post Reply
mikeg
Newbie
Posts: 0
Joined: Wed May 15, 2013 1:01 pm

Strange unit info in Java

Post by mikeg » Wed May 15, 2013 1:11 pm

Hey there.

I'm writing a java application to use the Picoscope 2204 for data gathering. To communicate I use the JNA for creating a library with the dll.

Opening the Osciloscope is working. For the 2nd step I tried to read the Variant Info with the ps2000_get_unit_info function.
It seems to work but the problem is I can't read it because it seems to be in chinese or something like that.

Code: Select all

  
        lin = 3;
        info = new char[length];
        OLibrary.INSTANCE.ps2000_get_unit_info(handle1, info, length, lin);
        for(int i = 0;i<info.length;i++){
            System.out.print(info[i]+"|");
        }
And I get this output:
㈲|㐰|
Is there something I'm doing wrong? Or could it be the language of the device is something asian?

Help is much appreciated

Best regards Mike

Hitesh
Site Admin
Site Admin
Posts: 2829
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Strange unit info in Java

Post by Hitesh » Thu May 16, 2013 1:52 pm

This topic has been moved to the Java area:

http://www.picotech.com/support/topic12171.html
Hitesh

Technical Support Engineer

Hitesh
Site Admin
Site Admin
Posts: 2829
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Strange unit info in Java

Post by Hitesh » Thu May 16, 2013 2:15 pm

Hi mikeg,

I've not used JNA myself but there is an example using JNI on this forum which does work, which suggests that it might be the way JNA is interpreting the character arrays being written to.

When using JNI, the character array written to by the ps2000_get_unit_info function is converted to a UTF String - does JNA do this?

Looking at data types, perhaps you can use char* which maps to a Java String?

Regards,
Hitesh

Technical Support Engineer

Post Reply