Go to the documentation of this file.00001
00011 #include <iostream>
00012
00013 #include "kobuki_ftdi/scanner.hpp"
00014
00015 int main(int argc, char** argv)
00016 {
00017 int ret_val;
00018 FTDI_Scanner scanner;
00019
00020 ret_val = scanner.scan();
00021 if (ret_val <= 0) {
00022 std::cout << "FTDI device not found!!!" << std::endl;
00023 return -1;
00024 }
00025
00026 unsigned int no_devices = (unsigned int)ret_val;
00027 std::cout << no_devices << " device(s) found." << std::endl;
00028
00029 std::string serial_number, manufacturer, product;
00030 for( unsigned int i=0; i<no_devices; i++ )
00031 {
00032 ret_val = scanner.get_serial_id(i, serial_number);
00033 if (ret_val < 0) break;
00034
00035 ret_val = scanner.get_manufacturer(i, manufacturer);
00036 if (ret_val < 0) break;
00037
00038 ret_val = scanner.get_product(i, product);
00039 if (ret_val < 0) break;
00040
00041 std::cout << std::endl;
00042 std::cout << "Device #" << i << std::endl;
00043 std::cout << " Manufacturer : " << manufacturer << std::endl;
00044 std::cout << " Product : " << product << std::endl;
00045 std::cout << " Serial Number: " << serial_number << std::endl;
00046 ret_val = 0;
00047 }
00048
00049 if (ret_val < 0) std::cerr << "Something went wrong. Did you run with sudo." << std::endl;
00050 return ret_val;
00051 }