/** * Use this method to get a Device. You can get a device by its name or its number. Use * printDevices to see what devices are available on your system. * * @param i_deviceNumber int, number of the device to open * @return ControllDevice, the device coresponding to the given number or name * @example procontroll * @related ControllIO * @related ControllDevice * @related getNumberOfDevices ( ) * @related printDevices ( ) * @shortdesc Use this method to get a device. * @usage application */ public ControllDevice getDevice(final int i_deviceNumber) { if (i_deviceNumber >= getNumberOfDevices()) { throw new RuntimeException("There is no device with the number " + i_deviceNumber + "."); } ControllDevice result = (ControllDevice) devices.get(i_deviceNumber); result.open(); return result; }
/** @param i_deviceName String, name of the device to open */ public ControllDevice getDevice(final String i_deviceName) { for (int i = 0; i < getNumberOfDevices(); i++) { ControllDevice device = (ControllDevice) devices.get(i); if (device.getName().equals(i_deviceName)) { device.open(); return device; } } throw new RuntimeException("There is no device with the name " + i_deviceName + "."); }