Package org.usb4java

Examples of org.usb4java.DeviceList


     *
     * @return The test device or null if none.
     */
    private Device findTestDevice()
    {
        final DeviceList list = new DeviceList();
        if (LibUsb.getDeviceList(this.context, list) <= 0)
        {
            return null;
        }
        try
View Full Code Here


    @Test
    public void testGetParent()
    {
        assumeUsbTestsEnabled();
        assumeNotNull(this.device);
        final DeviceList list = new DeviceList();
        LibUsb.getDeviceList(this.context, list);
        try
        {
            final Device parent = LibUsb.getParent(this.device);
View Full Code Here

     */
    @Test
    public void testGetAndFreeDeviceList()
    {
        assumeUsbTestsEnabled();
        final DeviceList list = new DeviceList();
        assertTrue(LibUsb.getDeviceList(this.context, list) >= 0);
        LibUsb.freeDeviceList(list, true);

        try
        {
View Full Code Here

     */
    @Test
    public void testGetAndFreeDeviceListWithDefaultContext()
    {
        assumeUsbTestsEnabled();
        final DeviceList list = new DeviceList();
        assertEquals(0, LibUsb.init(null));
        try
        {
            assertTrue(LibUsb.getDeviceList(null, list) >= 0);
            LibUsb.freeDeviceList(list, true);
View Full Code Here

    @Test(expected = IllegalStateException.class)
    public void testGetDeviceListWithUninitializedContext()
    {
        assumeUsbTestsEnabled();
        final Context context = new Context();
        LibUsb.getDeviceList(context, new DeviceList());
    }
View Full Code Here

     */
    @Test(expected = IllegalStateException.class)
    public void testFreeDeviceListWithUninitializedList()
    {
        assumeUsbTestsEnabled();
        LibUsb.freeDeviceList(new DeviceList(), true);
    }
View Full Code Here

     */
    @Test
    public void testDeviceList()
    {
        assumeUsbTestsEnabled();
        final DeviceList list = new DeviceList();
        final int result = LibUsb.getDeviceList(this.context, list);
        assertTrue(
            "At least one USB device must be present for the simple unit tests",
            result > 0);
        assertEquals(result, list.getSize());
        int i = 0;
        for (final Device device : list)
        {
            assertNotNull(device);
            assertEquals(device, list.get(i));
            assertEquals(Device.class, device.getClass());
            i++;
        }
        LibUsb.freeDeviceList(list, true);
    }
View Full Code Here

TOP

Related Classes of org.usb4java.DeviceList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.