set DeviceSerialNumber?

Supporting Java SE version 7 and up
StanGreen
Phidgetsian
Posts: 5
Joined: Sat Jul 04, 2020 10:22 am
Contact:

set DeviceSerialNumber?

Postby StanGreen » Thu Jul 09, 2020 8:29 am

I have an app that controls multiple "1014 - PhidgetInterfaceKit 0/0/4", which requires the use of the serial numbers. The API doc does not show how to set the serial number. (BTW: is there a real Java Doc like in 21? The 22 API doc is very sparse.) The example shows:

int serial = 324781;
DigitalOutput do0 = new DigitalOutput();
do0.DeviceSerialNumber = serial;

But this fails the compile with:
error: cannot find symbol
do0.DeviceSerialNumber = serial;
^
symbol: variable DeviceSerialNumber
location: variable do0 of type DigitalOutput
^
So how do I set the serial number on the DigitalOutput?

Thanks,
Stan

fraser
Engineering
Posts: 280
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: set DeviceSerialNumber?

Postby fraser » Thu Jul 09, 2020 8:50 am

I think you want to use setDeviceSerialNumber(serial) in Java. Our code generator gives me this for 1014


import com.phidget22.*;

class Example {
public static void main(String[] args) {
try {
DigitalOutput ch = new DigitalOutput();
ch.setDeviceSerialNumber(123456);
ch.open(Phidget.DEFAULT_TIMEOUT);

// Do work...

ch.close();
} catch (PhidgetException ex) {
System.out.println("Failure: " + ex);
}
}
}

StanGreen
Phidgetsian
Posts: 5
Joined: Sat Jul 04, 2020 10:22 am
Contact:

Re: set DeviceSerialNumber?

Postby StanGreen » Thu Jul 09, 2020 8:53 am

I found the way to do this:
DigitalOutput.setDeviceSerialNumber(serial);

I don't understand why the example will not compile.

StanGreen
Phidgetsian
Posts: 5
Joined: Sat Jul 04, 2020 10:22 am
Contact:

Re: set DeviceSerialNumber?

Postby StanGreen » Thu Jul 09, 2020 9:31 am

fraser wrote:I think you want to use setDeviceSerialNumber(serial) in Java. Our code generator gives me this for 1014


import com.phidget22.*;

class Example {
public static void main(String[] args) {
try {
DigitalOutput ch = new DigitalOutput();
ch.setDeviceSerialNumber(123456);
ch.open(Phidget.DEFAULT_TIMEOUT);

// Do work...

ch.close();
} catch (PhidgetException ex) {
System.out.println("Failure: " + ex);
}
}
}


IMO: The example on the site should say what language it is. Also, I would still like to see a real Java Doc. The current version is non-standard and very hard to use.

jdecoux
Labview Developer
Posts: 124
Joined: Mon Nov 13, 2017 10:20 am
Contact:

Re: set DeviceSerialNumber?

Postby jdecoux » Thu Jul 09, 2020 3:00 pm

What page were you on that didn't list the language of the example? We have worked to allow settable languages in our documentation wherever possible, so it would be helpful to know if anything was missed.


Return to “Java”

Who is online

Users browsing this forum: No registered users and 2 guests