• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UsbDisconnectedException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.usb.UsbDisconnectedException的典型用法代码示例。如果您正苦于以下问题:Java UsbDisconnectedException类的具体用法?Java UsbDisconnectedException怎么用?Java UsbDisconnectedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UsbDisconnectedException类属于javax.usb包,在下文中一共展示了UsbDisconnectedException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: close

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
@Override
public void close() {
  int phase = scalePhaser.getPhase();
  closing = true;
  while (busy) {
    phase = scalePhaser.awaitAdvance(phase);
  }
  try {
    if (pipe.isOpen()) {
      pipe.close();
    }
    if (iface.isActive()) {
      iface.release();
    }
  } catch (UsbException | UsbDisconnectedException ex) {
    Logger.getLogger(UsbScale.class.getName()).log(Level.SEVERE, "Unable to close scale cleanly", ex);
  }
}
 
开发者ID:RaspberryPiWithJava,项目名称:JavaScale,代码行数:19,代码来源:UsbScale.java


示例2: sendBytes

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
public synchronized void sendBytes(byte[] commands)
{
    try
    {
        byte[] data = new byte[3];
        data[0] = commands[0];
        data[1] = commands[1];
        data[2] = this.lightState;

        this.irp.setData(data);
        this.usbDevice.syncSubmit(this.irp);
    }
    catch (UsbException | IllegalArgumentException |
            UsbDisconnectedException ex)
    {
        Logger.getLogger(UsbRobotArm.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:swordmaster2k,项目名称:robotarmedge,代码行数:19,代码来源:UsbRobotArm.java


示例3: sendCommands

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
private void sendCommands()
{
    try
    {
        byte[] data = new byte[3];
        data[0] = (byte) (this.gripperState + this.wristState
                + this.elbowState + this.shoulderState);
        data[1] = this.baseState;
        data[2] = this.lightState;

        this.irp.setData(data);
        this.usbDevice.syncSubmit(this.irp);
    }
    catch (UsbException | IllegalArgumentException |
            UsbDisconnectedException ex)
    {
        Logger.getLogger(UsbRobotArm.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:swordmaster2k,项目名称:robotarmedge,代码行数:20,代码来源:UsbRobotArm.java


示例4: shutdown

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
public void shutdown() throws IOException {
	if (driverThread == null) {
		return;
	}
	try {
		driverThread.shutdown();
		
		if (this.pipe != null && this.pipe.getUsbEndpoint() != null
				&& this.pipe.getUsbEndpoint().getUsbInterface() != null) {
			this.pipe.getUsbEndpoint().getUsbInterface().release();	
		}
		
	} catch (UsbNotActiveException | UsbNotOpenException
			| UsbDisconnectedException | UsbException e) {
		throw new IOException(e);
	}
}
 
开发者ID:yadarts,项目名称:yadarts,代码行数:18,代码来源:SimplifiedEmprexUSBDriver.java


示例5: writeEEPROMByte

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
/**
 * Writes a single byte to the 256-byte EEPROM using the specified offset.
 *
 * Note: introduce a 5 millisecond delay between each successive write to
 * the EEPROM or subsequent writes may fail.
 */
public void writeEEPROMByte(DeviceHandle handle, byte offset, byte value)
    throws IllegalArgumentException, UsbDisconnectedException, UsbException
{
    if(offset < 0 || offset > 255)
    {
        throw new IllegalArgumentException("RTL2832 Tuner Controller - "
            + "EEPROM offset must be within range of 0 - 255");
    }

    int offsetAndValue = Integer.rotateLeft((0xFF & offset), 8) |
        (0xFF & value);

    writeRegister(handle, Block.I2C, EEPROM_ADDRESS, offsetAndValue, 2);
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:21,代码来源:RTL2832TunerController.java


示例6: getDeviceDetails

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
public static String getDeviceDetails( UsbDevice device ) 
	throws UsbException, UnsupportedEncodingException, UsbDisconnectedException
{
	StringBuilder sb = new StringBuilder();

	sb.append( device.getUsbDeviceDescriptor().toString() + "\n\n" );
	
	for( Object configObject: device.getUsbConfigurations() )
	{
		UsbConfiguration config = (UsbConfiguration)configObject;
		
		sb.append( config.getUsbConfigurationDescriptor().toString() + "\n\n" );
		
		for( Object interfaceObject: config.getUsbInterfaces() )
		{
			UsbInterface iface = (UsbInterface)interfaceObject;
			
			sb.append( iface.getUsbInterfaceDescriptor().toString() + "\n\n" );
			
			for( Object endpointObject: iface.getUsbEndpoints() )
			{
				UsbEndpoint endpoint = (UsbEndpoint)endpointObject;
				
				sb.append( endpoint.getUsbEndpointDescriptor().toString() + "\n\n" );
			}
		}
	}

	return sb.toString();
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:31,代码来源:USBUtils.java


示例7: testGetFirmwareVersionMutipleRadios

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
@Test
public void testGetFirmwareVersionMutipleRadios() throws UnsupportedEncodingException, UsbDisconnectedException, UsbException {
    List<UsbDevice> usbDeviceList = mUsbLinkJava.findDevices(Crazyradio.CRADIO_VID, Crazyradio.CRADIO_PID);
    if (usbDeviceList.isEmpty()) {
        fail("No Crazyradios found");
    } else {
        System.out.println("Found Crazyradio(s):");
        for (UsbDevice usbDevice : usbDeviceList) {
            System.out.print("  Crazyradio: " + UsbLinkJava.getSerialNumber(usbDevice));
            checkFirmwareVersion(usbDevice);
        }
    }
}
 
开发者ID:fredg02,项目名称:se.bitcraze.crazyflie.lib,代码行数:14,代码来源:UsbLinkJavaTest.java


示例8: writeEEPROMByte

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
/**
 * Writes a single byte to the 256-byte EEPROM using the specified offset.
 * 
 * Note: introduce a 5 millisecond delay between each successive write to
 * the EEPROM or subsequent writes may fail.
 */
public void writeEEPROMByte( DeviceHandle handle, byte offset, byte value ) 
	throws IllegalArgumentException, UsbDisconnectedException, UsbException
{
	if( offset < 0 || offset > 255 )
	{
		throw new IllegalArgumentException( "RTL2832 Tuner Controller - "
				+ "EEPROM offset must be within range of 0 - 255" );
	}
	
	int offsetAndValue = Integer.rotateLeft( ( 0xFF & offset ), 8 ) | 
							( 0xFF & value );
	
	writeRegister( handle, Block.I2C, EEPROM_ADDRESS, offsetAndValue, 2 );
}
 
开发者ID:ac2cz,项目名称:FoxTelem,代码行数:21,代码来源:RTL2832TunerController.java


示例9: close

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
public void close() {
	try {
		System.out.println("Releasing usb printer");
		usbInterface.release();
	} catch (UsbNotActiveException	| UsbDisconnectedException | UsbException e) {
		e.printStackTrace();
	}
}
 
开发者ID:pierre-muth,项目名称:selfpi,代码行数:9,代码来源:EpsonESCPOSPrinter.java


示例10: close

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
public void close() {
	try {
		usbInterface.release();
	} catch (UsbNotActiveException	| UsbDisconnectedException | UsbException e) {
		e.printStackTrace();
	}
}
 
开发者ID:pierre-muth,项目名称:selfpi,代码行数:8,代码来源:TMT20.java


示例11: deinitBaseband

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
protected void deinitBaseband(DeviceHandle handle)
    throws IllegalArgumentException, UsbDisconnectedException, UsbException
{
    writeRegister(handle, Block.SYS, Address.DEMOD_CTL.getAddress(), 0x20, 1);
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:6,代码来源:RTL2832TunerController.java


示例12: deinitBaseband

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
protected void deinitBaseband( DeviceHandle handle )
	throws IllegalArgumentException, UsbDisconnectedException, UsbException
{
	writeRegister( handle, Block.SYS, Address.DEMOD_CTL.getAddress(), 0x20, 1);
}
 
开发者ID:ac2cz,项目名称:FoxTelem,代码行数:6,代码来源:RTL2832TunerController.java


示例13: checkConnected

import javax.usb.UsbDisconnectedException; //导入依赖的package包/类
/**
 * Ensures the device is connected.
 * 
 * @throws UsbDisconnectedException
 *             When device is disconnected.
 */
final void checkConnected()
{
    if (this.port == null) throw new UsbDisconnectedException();
}
 
开发者ID:usb4java,项目名称:usb4java-javax,代码行数:11,代码来源:AbstractDevice.java



注:本文中的javax.usb.UsbDisconnectedException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TFloatObjectMap类代码示例发布时间:2022-05-22
下一篇:
Java GitCommand类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap