X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=ftdipp%2Fftdi.hpp;h=a5ede3c4d296dd2380071ec335c9f256a4fcc95b;hp=3a5d9939c1acd8ce8d8d6859850986a7fa57871c;hb=ed46f09c1ccd1351e003a200ba50e3e4778ac478;hpb=f276fe667f966ba9e39ec67c64443e91aec479f0 diff --git a/ftdipp/ftdi.hpp b/ftdipp/ftdi.hpp index 3a5d993..a5ede3c 100644 --- a/ftdipp/ftdi.hpp +++ b/ftdipp/ftdi.hpp @@ -2,11 +2,11 @@ ftdi.hpp - C++ wrapper for libftdi ------------------- begin : Mon Oct 13 2008 - copyright : (C) 2008 by Marek Vavruša + copyright : (C) 2008-2017 by Marek Vavruša and libftdi developers email : opensource@intra2net.com and marek@vavrusa.com ***************************************************************************/ /* -Copyright (C) 2008 by Marek Vavruša +Copyright (C) 2008-2017 by Marek Vavruša and libftdi developers The software in this package is distributed under the GNU General Public License version 2 (with a special exception described below). @@ -55,16 +55,16 @@ public: */ enum Direction { - Input, - Output + Input = 0x2, + Output = 0x1, }; /*! \brief Modem control flags. */ enum ModemCtl { - Dtr, - Rts + Dtr = 0x2, + Rts = 0x1, }; /* Constructor, Destructor */ @@ -85,7 +85,8 @@ public: int open(const std::string& description); int close(); int reset(); - int flush(int mask = Input|Output); + int DEPRECATED(flush)(int mask = Input|Output); + int tcflush(int mask = Input|Output); int set_interface(enum ftdi_interface interface); void set_usb_device(struct libusb_device_handle *dev); @@ -93,10 +94,14 @@ public: int set_baud_rate(int baudrate); int set_line_property(enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity); int set_line_property(enum ftdi_bits_type bits, enum ftdi_stopbits_type sbit, enum ftdi_parity_type parity, enum ftdi_break_type break_type); + int get_usb_read_timeout() const; + void set_usb_read_timeout(int usb_read_timeout); + int get_usb_write_timeout() const; + void set_usb_write_timeout(int usb_write_timeout); /* I/O */ int read(unsigned char *buf, int size); - int write(unsigned char *buf, int size); + int write(const unsigned char *buf, int size); int set_read_chunk_size(unsigned int chunksize); int set_write_chunk_size(unsigned int chunksize); int read_chunk_size(); @@ -104,7 +109,7 @@ public: /* Async IO TODO: should wrap? - int writeAsync(unsigned char *buf, int size); + int writeAsync(const unsigned char *buf, int size); void asyncComplete(int wait_for_more); */ @@ -123,16 +128,15 @@ public: /* BitBang mode */ int set_bitmode(unsigned char bitmask, unsigned char mode); int set_bitmode(unsigned char bitmask, enum ftdi_mpsse_mode mode); - int DEPRECATED(bitbang_enable(unsigned char bitmask)); int bitbang_disable(); int read_pins(unsigned char *pins); /* Misc */ - char* error_string(); + const char* error_string(); protected: - int get_strings(); - int get_strings_and_reopen(); + int get_strings(bool vendor=true, bool description=true, bool serial=true); + int get_strings_and_reopen(bool vendor=true, bool description=true, bool serial=true); /* Properties */ struct ftdi_context* context(); @@ -175,7 +179,7 @@ public: List(struct ftdi_device_list* devlist = 0); ~List(); - static List* find_all(int vendor, int product); + static List* find_all(Context &context, int vendor, int product); /// List type storing "Context" objects typedef std::list ListType;