git-svn-id: svn://db.shs.com.ru/pip@699 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2019-02-06 20:20:23 +00:00
parent b31352ffb1
commit b2c76a0e1b
14 changed files with 41 additions and 39 deletions

View File

@@ -372,7 +372,7 @@ bool PISerial::read(void * data, int size, double timeout_ms) {
while (all < size && tm_.elapsed_m() < timeout_ms) {
ret = readDevice(&((uchar * )data)[all], size - all);
if (ret > 0) all += ret;
else msleep(1);
else msleep(PIP_MIN_MSLEEP);
}
setOption(BlockingRead, br);
received(data, all);
@@ -411,13 +411,13 @@ PIString PISerial::read(int size, double timeout_ms) {
if (size <= 0) {
while (tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, 1024);
if (ret <= 0) msleep(1);
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
else str << PIString((char*)td, ret);
}
} else {
while (all < size && tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, size - all);
if (ret <= 0) msleep(1);
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
else {
str << PIString((char*)td, ret);
all += ret;
@@ -431,7 +431,7 @@ PIString PISerial::read(int size, double timeout_ms) {
str << PIString((char*)td, all);
while (all < size) {
ret = readDevice(td, size - all);
if (ret <= 0) msleep(1);
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
else {
str << PIString((char*)td, ret);
all += ret;
@@ -463,13 +463,13 @@ PIByteArray PISerial::readData(int size, double timeout_ms) {
if (size <= 0) {
while (tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, 1024);
if (ret <= 0) msleep(1);
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
else str.append(td, ret);
}
} else {
while (all < size && tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, size - all);
if (ret <= 0) msleep(1);
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
else {
str.append(td, ret);
all += ret;
@@ -483,7 +483,7 @@ PIByteArray PISerial::readData(int size, double timeout_ms) {
str.append(td, all);
while (all < size) {
ret = readDevice(td, size - all);
if (ret <= 0) msleep(1);
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
else {
str.append(td, ret);
all += ret;