FilezillaAdminConnection::FilezillaAdminConnection(QObject *parent) : QObject(parent) { mSocket = new QTcpSocket(); connect(mSocket, SIGNAL(readyRead()), this, SLOT(bytesToRead())); connect(mSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); }
/* -------------------------------------------------------------------- */ char Tserial::getChar(void) { char c; if(v==true) { int n1=bytesToRead(); // printf("\nbytesToRead %d ",n1); } int i=read(fd_serialport, &c, sizeof(char)); if(v==true) { if(i==-1)printf(" read failed with status %d ",i); else printf(" read succesfull with status %d ",i); } return(c); }
int SerialPort::getArray(unsigned char *buffer, int len) { int n = 0; for (int i = 0; i < 1000; i++) //tempo to wait data in the buffer { n = bytesToRead(); if (n >= len) break; else { usleep(10); } } n = read(fileDescriptor, buffer, len); return n; }
int HostSerialBus::getArray(unsigned char *buffer, int len) { int n = 0; int readOk = false; for (int i = 0; i < 200; i++) //tempo to wait data in the buffer { n = bytesToRead(); if (n >= len) { readOk = true; if (n > len) { std::cout << "HostSerialBus::getArray warning by to read " << n << " instead of " << len << std::endl; } break; } else { usleep(10); } } if (!readOk) { std::cout << "HostSerialBus::getArray giving up " << n << " instead of " << len << std::endl; } n = read(fileDescriptor_, buffer, len); return n; }
int SerialPort::getArray (unsigned char *buffer, int len) { int n1=bytesToRead(); int n=read(fileDescriptor, buffer, len); return n; }