git-svn-id: svn://db.shs.com.ru/pip@244 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -153,6 +153,7 @@ PISerial::PISerial(const PIString & device_, PISerial::Speed speed_, PIFlags<PIS
|
||||
|
||||
|
||||
PISerial::~PISerial() {
|
||||
closeDevice();
|
||||
piMonitor.serials--;
|
||||
}
|
||||
|
||||
@@ -523,8 +524,8 @@ void PISerial::applySettings() {
|
||||
times.ReadIntervalTimeout = block_read ? vtime : MAXDWORD;
|
||||
times.ReadTotalTimeoutConstant = block_read ? 0 : 1;
|
||||
times.ReadTotalTimeoutMultiplier = block_read ? 0 : MAXDWORD;
|
||||
times.WriteTotalTimeoutConstant = 0;
|
||||
times.WriteTotalTimeoutMultiplier = block_write ? 0 : 1;
|
||||
times.WriteTotalTimeoutConstant = 10;
|
||||
times.WriteTotalTimeoutMultiplier = 1;// block_write ? 0 : 1;
|
||||
if (SetCommTimeouts(PRIVATE->hCom, ×) == -1)
|
||||
piCoutObj << "Unable to set timeouts for \"" << path() << "\"";
|
||||
GetCommMask(PRIVATE->hCom, &PRIVATE->mask);
|
||||
@@ -591,8 +592,8 @@ void PISerial::setReadIsBlocking(bool yes) {
|
||||
times.ReadIntervalTimeout = block_read ? vtime : MAXDWORD;
|
||||
times.ReadTotalTimeoutConstant = block_read ? 0 : 1;
|
||||
times.ReadTotalTimeoutMultiplier = block_read ? 0 : MAXDWORD;
|
||||
times.WriteTotalTimeoutConstant = 0;
|
||||
times.WriteTotalTimeoutMultiplier = block_write ? 0 : 1;
|
||||
times.WriteTotalTimeoutConstant = 10;
|
||||
times.WriteTotalTimeoutMultiplier = 1;//block_write ? 0 : 1;
|
||||
if (isOpened()) SetCommTimeouts(PRIVATE->hCom, ×);
|
||||
#else
|
||||
if (isOpened()) fcntl(fd, F_SETFL, yes ? 0 : O_NONBLOCK);
|
||||
@@ -619,7 +620,7 @@ int PISerial::read(void * read_to, int max_size) {
|
||||
|
||||
|
||||
int PISerial::write(const void * data, int max_size, bool wait) {
|
||||
// piCoutObj << "send " << max_size;// << ": " << PIString((char*)data, max_size);
|
||||
piCoutObj << "send " << max_size;// << ": " << PIString((char*)data, max_size);
|
||||
if (fd == -1 || !canWrite()) {
|
||||
//piCoutObj << "Can`t write to uninitialized COM";
|
||||
return -1;
|
||||
@@ -636,9 +637,9 @@ int PISerial::write(const void * data, int max_size, bool wait) {
|
||||
wrote = ::write(fd, data, max_size);
|
||||
if (wait) tcdrain(fd);
|
||||
#endif
|
||||
piCoutObj << "Wrote " << wrote << " bytes in " << path();
|
||||
return (int)wrote;
|
||||
//piCoutObj << "Error while sending";
|
||||
//piCoutObj << "Wrote " << wrote << " bytes in " << path_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user