当前位置: 首页>>代码示例>>Java>>正文


Java LibUsb.ERROR_NO_MEM属性代码示例

本文整理汇总了Java中org.usb4java.LibUsb.ERROR_NO_MEM属性的典型用法代码示例。如果您正苦于以下问题:Java LibUsb.ERROR_NO_MEM属性的具体用法?Java LibUsb.ERROR_NO_MEM怎么用?Java LibUsb.ERROR_NO_MEM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.usb4java.LibUsb的用法示例。


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

示例1: prepareTransfers

/**
 * Prepares (allocates) a set of transfer buffers for use in transferring data from the USB device via the bulk
 * interface.  Since we're using direct allocation (native), buffers are retained and reused across multiple
 * start/stop cycles.
 */
private void prepareTransfers() throws LibUsbException
{
    while(mAvailableTransfers.size() < TRANSFER_BUFFER_POOL_SIZE)
    {
        Transfer transfer = LibUsb.allocTransfer();

        if(transfer == null)
        {
            throw new LibUsbException("Couldn't allocate USB transfer buffer", LibUsb.ERROR_NO_MEM);
        }

        final ByteBuffer buffer = ByteBuffer.allocateDirect(mBufferSize);

        LibUsb.fillBulkTransfer(transfer, mDeviceHandle, USB_BULK_TRANSFER_ENDPOINT, buffer, this,
            "Buffer", USB_TIMEOUT_MS);

        mAvailableTransfers.add(transfer);
    }
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:24,代码来源:USBTransferProcessor.java

示例2: prepareTransfers

/**
 * Prepares (allocates) a set of transfer buffers for use in 
 * transferring data from the tuner via the bulk interface
 */
private void prepareTransfers() throws LibUsbException
{
	if( mAvailableTransfers == null )
	{
		mAvailableTransfers = new LinkedTransferQueue<>();
		
 	for( int x = 0; x < TRANSFER_BUFFER_POOL_SIZE; x++ )
 	{
 		Transfer transfer = LibUsb.allocTransfer();

 		if( transfer == null )
 		{
 			throw new LibUsbException( "couldn't allocate transfer", 
 						LibUsb.ERROR_NO_MEM );
 		}
 		
 		final ByteBuffer buffer = 
 				ByteBuffer.allocateDirect( mBufferSize );
 		
 		LibUsb.fillBulkTransfer( transfer, mDeviceHandle, USB_BULK_ENDPOINT, 
 				buffer, BufferProcessor.this, "Buffer", TIMEOUT_US );

 		mAvailableTransfers.add( transfer );
 	}
	}
}
 
开发者ID:ac2cz,项目名称:FoxTelem,代码行数:30,代码来源:RTL2832TunerController.java

示例3: prepareTransfers

/**
 * Prepares (allocates) a set of transfer buffers for use in 
 * transferring data from the tuner via the bulk interface
 */
private void prepareTransfers() throws LibUsbException
{
	if( mAvailableTransfers == null )
	{
		mAvailableTransfers = new LinkedTransferQueue<Transfer>();
		
 	for( int x = 0; x < TRANSFER_BUFFER_POOL_SIZE; x++ )
 	{
 		Transfer transfer = LibUsb.allocTransfer();

 		if( transfer == null )
 		{
 			throw new LibUsbException( "couldn't allocate transfer", 
 						LibUsb.ERROR_NO_MEM );
 		}
 		
 		final ByteBuffer buffer = 
 				ByteBuffer.allocateDirect( mBufferSize );
 		
 		LibUsb.fillBulkTransfer( transfer, mDeviceHandle, USB_ENDPOINT, 
				buffer, BufferProcessor.this, "Buffer", USB_TIMEOUT_MS );

 		mAvailableTransfers.add( transfer );
 	}
	}
}
 
开发者ID:ac2cz,项目名称:FoxTelem,代码行数:30,代码来源:AirspyDevice.java


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