// Path: public-java/io/iamcontent-usb/src/main/java/com/iamcontent/io/usb/EasedUsbDevice.java
// public static EasedUsbDevice eased(UsbDevice device) {
// 	if (device instanceof EasyUsbDevice) 
// 		return (EasedUsbDevice) device;
// 	else
// 		return new EasedUsbDevice(device);
// }
// 
// Path: public-java/io/iamcontent-usb/src/main/java/com/iamcontent/io/usb/EasyUsbDevice.java
// @SuppressWarnings("rawtypes")
// public interface EasyUsbDevice extends UsbDevice {
// 	String getManufacturerString();
// 
// 	String getSerialNumberString();
// 
// 	String getProductString();
// 
// 	UsbStringDescriptor getUsbStringDescriptor(byte index);
// 
// 	String getString(byte index);
// 
// 	void syncSubmit(UsbControlIrp irp);
// 
// 	void asyncSubmit(UsbControlIrp irp);
// 
// 	void syncSubmit(List list);
// 
// 	void asyncSubmit(List list);
// }
// 
// Path: public-java/io/iamcontent-usb/src/main/java/com/iamcontent/io/usb/Usb.java
// public class Usb {
// 
//     public static EasyUsbDevice device(short vendorId, short productId) {
//         return first(devices(vendorId, productId));
//     }
// 
//     public static EasyUsbDevice device(Predicate<UsbDevice> shouldIncludeDevice) {
//         return first(devices(shouldIncludeDevice));
//     }
// 
//     public static List<EasyUsbDevice> devices(short vendorId, short productId) {
//     	return devices(deviceHasVendorIdAndProductId(vendorId, productId));
//     }
// 
//     public static List<EasyUsbDevice> devices(Predicate<UsbDevice> shouldIncludeDevice) {
//         final UsbDeviceFinder deviceFinder = usbDeviceFinder(shouldIncludeDevice);
//         deviceFinder.exploreRootUsbHub();
// 		return deviceFinder.getDevices();
//     }
// 
//     public static UsbHub rootUsbHub() {
//         try {
//             return usbServices().getRootUsbHub();
//         } catch (Exception e) {
//             throw new UsbRuntimeException(e);
//         }
//     }
// 
//     public static UsbServices usbServices() {
//         try {
//             return UsbHostManager.getUsbServices();
//         } catch (Exception e) {
//             throw new UsbRuntimeException(e);
//         }
//     }
// 
//     private static <T> T first(List<T> l) {
//         try {
//             return l.get(0);
//         } catch (IndexOutOfBoundsException e) {
//             throw new UsbRuntimeException("No suitable USB Device found.");
//         }
//     }
//     
//     private Usb() {
//     }
// }


import com.iamcontent.io.usb.EasyUsbDevice;
import com.iamcontent.io.usb.Usb;
import static com.iamcontent.io.usb.EasedUsbDevice.eased;
import static java.util.Arrays.asList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import javax.usb.UsbConst;
import javax.usb.UsbControlIrp;
import javax.usb.UsbDevice;

		MOTOR_1_FORWARD(Actuator.MOTOR_1, (byte) 0x01), MOTOR_1_BACKWARD(Actuator.MOTOR_1, (byte) 0x02), MOTOR_1_STOP(Actuator.MOTOR_1, (byte) 0x00),
		MOTOR_2_FORWARD(Actuator.MOTOR_2, (byte) 0x04), MOTOR_2_BACKWARD(Actuator.MOTOR_2, (byte) 0x08), MOTOR_2_STOP(Actuator.MOTOR_2, (byte) 0x00),
		MOTOR_3_FORWARD(Actuator.MOTOR_3, (byte) 0x10), MOTOR_3_BACKWARD(Actuator.MOTOR_3, (byte) 0x20), MOTOR_3_STOP(Actuator.MOTOR_3, (byte) 0x00),
		MOTOR_4_FORWARD(Actuator.MOTOR_4, (byte) 0x40), MOTOR_4_BACKWARD(Actuator.MOTOR_4, (byte) 0x80), MOTOR_4_STOP(Actuator.MOTOR_4, (byte) 0x00),
		MOTOR_5_FORWARD(Actuator.MOTOR_5, (byte) 0x01), MOTOR_5_BACKWARD(Actuator.MOTOR_5, (byte) 0x02), MOTOR_5_STOP(Actuator.MOTOR_5, (byte) 0x00),
		LED_ON(Actuator.LED, (byte) 0x01), LED_OFF(Actuator.LED, (byte) 0x00);

		final Actuator actuator;
		final byte bits;

		private Command(Actuator actuator, byte bits) {
			this.actuator = actuator;
			this.bits = bits;
		}

		public Actuator getActuator() {
			return actuator;
		}
	}

	private final EasyUsbDevice device;

	private final Map<Actuator, Command> currentCommands = everythingTurnedOff();

	/**
	 * Creates an instance with the first OWI 535 device that is found.
	 */
	public Owi535UsbMotorController() {
		final short defaultVendorId = 0x1267;
		final short defaultProductId = 0x0;

// Path: public-java/io/iamcontent-usb/src/main/java/com/iamcontent/io/usb/EasedUsbDevice.java
// public static EasedUsbDevice eased(UsbDevice device) {
// 	if (device instanceof EasyUsbDevice) 
// 		return (EasedUsbDevice) device;
// 	else
// 		return new EasedUsbDevice(device);
// }
// 
// Path: public-java/io/iamcontent-usb/src/main/java/com/iamcontent/io/usb/EasyUsbDevice.java
// @SuppressWarnings("rawtypes")
// public interface EasyUsbDevice extends UsbDevice {
// 	String getManufacturerString();
// 
// 	String getSerialNumberString();
// 
// 	String getProductString();
// 
// 	UsbStringDescriptor getUsbStringDescriptor(byte index);
// 
// 	String getString(byte index);
// 
// 	void syncSubmit(UsbControlIrp irp);
// 
// 	void asyncSubmit(UsbControlIrp irp);
// 
// 	void syncSubmit(List list);
// 
// 	void asyncSubmit(List list);
// }
// 
// Path: public-java/io/iamcontent-usb/src/main/java/com/iamcontent/io/usb/Usb.java
// public class Usb {
// 
//     public static EasyUsbDevice device(short vendorId, short productId) {
//         return first(devices(vendorId, productId));
//     }
// 
//     public static EasyUsbDevice device(Predicate<UsbDevice> shouldIncludeDevice) {
//         return first(devices(shouldIncludeDevice));
//     }
// 
//     public static List<EasyUsbDevice> devices(short vendorId, short productId) {
//     	return devices(deviceHasVendorIdAndProductId(vendorId, productId));
//     }
// 
//     public static List<EasyUsbDevice> devices(Predicate<UsbDevice> shouldIncludeDevice) {
//         final UsbDeviceFinder deviceFinder = usbDeviceFinder(shouldIncludeDevice);
//         deviceFinder.exploreRootUsbHub();
// 		return deviceFinder.getDevices();
//     }
// 
//     public static UsbHub rootUsbHub() {
//         try {
//             return usbServices().getRootUsbHub();
//         } catch (Exception e) {
//             throw new UsbRuntimeException(e);
//         }
//     }
// 
//     public static UsbServices usbServices() {
//         try {
//             return UsbHostManager.getUsbServices();
//         } catch (Exception e) {
//             throw new UsbRuntimeException(e);
//         }
//     }
// 
//     private static <T> T first(List<T> l) {
//         try {
//             return l.get(0);
//         } catch (IndexOutOfBoundsException e) {
//             throw new UsbRuntimeException("No suitable USB Device found.");
//         }
//     }
//     
//     private Usb() {
//     }
// }


// Path: public-java/devices/iamcontent-owi-motor-controllers/src/main/java/com/iamcontent/device/controller/owi/Owi535UsbMotorController.java
import com.iamcontent.io.usb.EasyUsbDevice;
import com.iamcontent.io.usb.Usb;
import static com.iamcontent.io.usb.EasedUsbDevice.eased;
import static java.util.Arrays.asList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import javax.usb.UsbConst;
import javax.usb.UsbControlIrp;
import javax.usb.UsbDevice;

		MOTOR_1_FORWARD(Actuator.MOTOR_1, (byte) 0x01), MOTOR_1_BACKWARD(Actuator.MOTOR_1, (byte) 0x02), MOTOR_1_STOP(Actuator.MOTOR_1, (byte) 0x00),
		MOTOR_2_FORWARD(Actuator.MOTOR_2, (byte) 0x04), MOTOR_2_BACKWARD(Actuator.MOTOR_2, (byte) 0x08), MOTOR_2_STOP(Actuator.MOTOR_2, (byte) 0x00),
		MOTOR_3_FORWARD(Actuator.MOTOR_3, (byte) 0x10), MOTOR_3_BACKWARD(Actuator.MOTOR_3, (byte) 0x20), MOTOR_3_STOP(Actuator.MOTOR_3, (byte) 0x00),
		MOTOR_4_FORWARD(Actuator.MOTOR_4, (byte) 0x40), MOTOR_4_BACKWARD(Actuator.MOTOR_4, (byte) 0x80), MOTOR_4_STOP(Actuator.MOTOR_4, (byte) 0x00),
		MOTOR_5_FORWARD(Actuator.MOTOR_5, (byte) 0x01), MOTOR_5_BACKWARD(Actuator.MOTOR_5, (byte) 0x02), MOTOR_5_STOP(Actuator.MOTOR_5, (byte) 0x00),
		LED_ON(Actuator.LED, (byte) 0x01), LED_OFF(Actuator.LED, (byte) 0x00);

		final Actuator actuator;
		final byte bits;

		private Command(Actuator actuator, byte bits) {
			this.actuator = actuator;
			this.bits = bits;
		}

		public Actuator getActuator() {
			return actuator;
		}
	}

	private final EasyUsbDevice device;

	private final Map<Actuator, Command> currentCommands = everythingTurnedOff();

	/**
	 * Creates an instance with the first OWI 535 device that is found.
	 */
	public Owi535UsbMotorController() {
		final short defaultVendorId = 0x1267;
		final short defaultProductId = 0x0;

		device = Usb.device(defaultVendorId, defaultProductId);
