Page 1 of 1
set DeviceSerialNumber?
Posted: Thu Jul 09, 2020 8:29 am
by StanGreen
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
Re: set DeviceSerialNumber?
Posted: Thu Jul 09, 2020 8:50 am
by fraser
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);
}
}
}
Re: set DeviceSerialNumber?
Posted: Thu Jul 09, 2020 8:53 am
by StanGreen
I found the way to do this:
DigitalOutput.setDeviceSerialNumber(serial);
I don't understand why the example will not compile.
Re: set DeviceSerialNumber?
Posted: Thu Jul 09, 2020 9:31 am
by StanGreen
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.
Re: set DeviceSerialNumber?
Posted: Thu Jul 09, 2020 3:00 pm
by jdecoux
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.