Public Member Functions | Private Attributes | List of all members
FTDI_Scanner Class Reference

A Scanner class. More...

#include <scanner.hpp>

Public Member Functions

std::vector< struct usb_device * > find_devices (uint16_t vendor, uint16_t product)
 
int get_manufacturer (std::string &manufacturer)
 
int get_manufacturer (unsigned int index, std::string &manufacturer)
 
int get_product (std::string &product)
 
int get_product (unsigned int index, std::string &product)
 
int get_serial_id (std::string &serial_id)
 
int get_serial_id (unsigned int index, std::string &serial_id)
 
int reset ()
 
int retrieve ()
 
int scan ()
 

Private Attributes

std::vector< std::map< std::string, std::string > > descriptions
 
std::vector< struct usb_device * > devices
 
bool retrieved
 
bool scanned
 

Detailed Description

A Scanner class.

A Scanner class for FTDI device.

Definition at line 56 of file scanner.hpp.

Member Function Documentation

◆ find_devices()

std::vector<struct usb_device *> FTDI_Scanner::find_devices ( uint16_t  vendor,
uint16_t  product 
)
inline

find_devices with given vendor and device id by using libusb library

Parameters
[in]vendorvendor id of targeted usb device
[in]productproduct id of targeted usb device
Returns
vector of usb_device structure found.

Definition at line 68 of file scanner.hpp.

◆ get_manufacturer() [1/2]

int FTDI_Scanner::get_manufacturer ( std::string &  manufacturer)
inline
Parameters
[out]manufacturermanufacturer name of of ftdi device
Returns
0 on success
-1 on failure
See also
get_serial_id(unsigned int, std::string&), get_serial_id(std::string&) , get_manufacturer(unsigned int, std::string&), get_manufacturer(std::string&) , get_product(unsigned int, std::string&), get_product(std::string&)

Definition at line 200 of file scanner.hpp.

◆ get_manufacturer() [2/2]

int FTDI_Scanner::get_manufacturer ( unsigned int  index,
std::string &  manufacturer 
)
inline
Parameters
[in]indexindex of scanned device
[out]manufacturermanufacturer name of ftdi device
Returns
0 on success
-1 on failure
See also
get_serial_id(unsigned int, std::string&), get_serial_id(std::string&) , get_manufacturer(unsigned int, std::string&), get_manufacturer(std::string&) , get_product(unsigned int, std::string&), get_product(std::string&)

Definition at line 162 of file scanner.hpp.

◆ get_product() [1/2]

int FTDI_Scanner::get_product ( std::string &  product)
inline

◆ get_product() [2/2]

int FTDI_Scanner::get_product ( unsigned int  index,
std::string &  product 
)
inline
Parameters
[in]indexindex of scanned device
[out]productproduct name of ftdi device
Returns
0 on success
-1 on failure
See also
get_serial_id(unsigned int, std::string&), get_serial_id(std::string&) , get_manufacturer(unsigned int, std::string&), get_manufacturer(std::string&) , get_product(unsigned int, std::string&), get_product(std::string&)

Definition at line 177 of file scanner.hpp.

◆ get_serial_id() [1/2]

int FTDI_Scanner::get_serial_id ( std::string &  serial_id)
inline

◆ get_serial_id() [2/2]

int FTDI_Scanner::get_serial_id ( unsigned int  index,
std::string &  serial_id 
)
inline
Parameters
[in]indexindex of scanned device
[out]serial_idserial number of ftdi device
Returns
0 on success
-1 on failure
See also
get_serial_id(unsigned int, std::string&), get_serial_id(std::string&) , get_manufacturer(unsigned int, std::string&), get_manufacturer(std::string&) , get_product(unsigned int, std::string&), get_product(std::string&)

Definition at line 147 of file scanner.hpp.

◆ reset()

int FTDI_Scanner::reset ( )
inline

reset the connected usb device to recall it to standard tty interface

Returns
0 on success
-1 on failure

Definition at line 215 of file scanner.hpp.

◆ retrieve()

int FTDI_Scanner::retrieve ( )
inline

Retrieve descriptions of scanned devices. Retrived desctiptions are stored internally.

Returns
positive number of retrieved devices.
-1 on failure
See also
get_serial_id(unsigned int, std::string&), get_serial_id(std::string&) , get_manufacturer(unsigned int, std::string&), get_manufacturer(std::string&) , get_product(unsigned int, std::string&), get_product(std::string&)

Definition at line 110 of file scanner.hpp.

◆ scan()

int FTDI_Scanner::scan ( )
inline

Scan the usb device that have given vendor and product id.

Returns
positive number of devices connected.
-1 on failure

Definition at line 93 of file scanner.hpp.

Member Data Documentation

◆ descriptions

std::vector<std::map<std::string, std::string> > FTDI_Scanner::descriptions
private

Container for usb data of devices found. such as serial_number, product name, manufacture name

Definition at line 234 of file scanner.hpp.

◆ devices

std::vector<struct usb_device *> FTDI_Scanner::devices
private

Container for data structure of usb devices found

Definition at line 233 of file scanner.hpp.

◆ retrieved

bool FTDI_Scanner::retrieved
private

flags to indicated current status of calss

Definition at line 232 of file scanner.hpp.

◆ scanned

bool FTDI_Scanner::scanned
private

flags to indicated current status of calss

Definition at line 231 of file scanner.hpp.


The documentation for this class was generated from the following file:


kobuki_ftdi
Author(s): Younghun Ju
autogenerated on Wed Mar 2 2022 00:26:19