git-svn-id: svn://db.shs.com.ru/pip@510 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -143,7 +143,7 @@ public:
|
||||
/** \brief Set size of threaded read buffer
|
||||
* \details Default size is 4096 bytes. If your device can read at single read
|
||||
* more than 4096 bytes you should use this function to adjust buffer size */
|
||||
void setThreadedReadBufferSize(int new_size) {buffer_tr.resize(new_size);}
|
||||
void setThreadedReadBufferSize(int new_size) {buffer_tr.resize(new_size); threadedReadBufferSizeChanged();}
|
||||
|
||||
//! Return size of threaded read buffer
|
||||
int threadedReadBufferSize() const {return buffer_tr.size_s();}
|
||||
@@ -336,6 +336,9 @@ protected:
|
||||
//! Reimplement to apply new device options
|
||||
virtual void optionsChanged() {;}
|
||||
|
||||
//! Reimplement to apply new \a threadedReadBufferSize()
|
||||
virtual void threadedReadBufferSizeChanged() {;}
|
||||
|
||||
|
||||
void terminate();
|
||||
|
||||
|
||||
@@ -517,13 +517,6 @@ bool PISerial::openDevice() {
|
||||
}
|
||||
tcgetattr(fd, &PRIVATE->desc);
|
||||
PRIVATE->sdesc = PRIVATE->desc;
|
||||
serial_struct ss;
|
||||
ioctl(fd, TIOCGSERIAL, &ss);
|
||||
piCoutObj << "b" << ss.xmit_fifo_size;
|
||||
ss.xmit_fifo_size = threadedReadBufferSize();
|
||||
ioctl(fd, TIOCSSERIAL, &ss);
|
||||
ioctl(fd, TIOCGSERIAL, &ss);
|
||||
piCoutObj << "a" << ss.xmit_fifo_size;
|
||||
//piCoutObj << "Initialized " << path_;
|
||||
#endif
|
||||
applySettings();
|
||||
@@ -831,3 +824,17 @@ PIStringList PISerial::availableDevices(bool test) {
|
||||
void PISerial::optionsChanged() {
|
||||
if (isOpened()) setTimeouts();
|
||||
}
|
||||
|
||||
|
||||
void PISerial::threadedReadBufferSizeChanged() {
|
||||
if (!isOpened()) return;
|
||||
#ifndef WINDOWS
|
||||
serial_struct ss;
|
||||
ioctl(fd, TIOCGSERIAL, &ss);
|
||||
piCoutObj << "b" << ss.xmit_fifo_size;
|
||||
ss.xmit_fifo_size = threadedReadBufferSize();
|
||||
ioctl(fd, TIOCSSERIAL, &ss);
|
||||
ioctl(fd, TIOCGSERIAL, &ss);
|
||||
piCoutObj << "a" << ss.xmit_fifo_size;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -205,6 +205,7 @@ protected:
|
||||
void configureFromFullPathDevice(const PIString & full_path);
|
||||
bool configureDevice(const void * e_main, const void * e_parent = 0);
|
||||
void optionsChanged();
|
||||
void threadedReadBufferSizeChanged();
|
||||
int readDevice(void * read_to, int max_size);
|
||||
int writeDevice(const void * data, int max_size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user