ftdi_stream.c File Reference
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <sys/time.h>`
`#include <libusb.h>`
`#include "ftdi.h"`

Go to the source code of this file.

## Classes

struct | FTDIStreamState

## Functions

int | ftdi_readstream (struct ftdi_context *ftdi, FTDIStreamCallback *callback, void *userdata, int packetsPerTransfer, int numTransfers)

## Function Documentation

## ftdi_readstream()

int ftdi_readstream | ( | struct ftdi_context * | ftdi,
|  | FTDIStreamCallback * | callback,
|  | void * | userdata,
|  | int | packetsPerTransfer,
|  | int | numTransfers
| ) |  |

Streaming reading of data from the device

Use asynchronous transfers in libusb-1.0 for high-performance streaming of data from a device interface back to the PC. This function continuously transfers data until either an error occurs or the callback returns a nonzero value. This function returns a libusb error code or the callback's return value.

For every contiguous block of received data, the callback will be invoked.

Parameters

  ftdi | pointer to ftdi_context
  callback | to user supplied function for one block of data
  userdata |
  packetsPerTransfer | number of packets per transfer
  numTransfers | Number of transfers per callback

Definition at line 151 of file ftdi_stream.c.

References FTDIStreamState::activity, BITMODE_RESET, BITMODE_SYNCFF, FTDIStreamState::callback, FTDIProgressInfo::current, FTDIProgressInfo::currentRate, FTDIProgressInfo::first, ftdi_get_error_string(), ftdi_set_bitmode(), ftdi_tcioflush(), ftdi_context::max_packet_size, ftdi_context::out_ep, FTDIProgressInfo::prev, FTDIStreamState::progress, FTDIStreamState::result, size_and_time::time, size_and_time::totalBytes, FTDIProgressInfo::totalRate, FTDIProgressInfo::totalTime, ftdi_context::type, TYPE_2232H, TYPE_232H, ftdi_context::usb_ctx, ftdi_context::usb_dev, ftdi_context::usb_read_timeout, and FTDIStreamState::userdata.