int read733(VolInfo* volInfo, unsigned* value) { int rc; unsigned char both[8]; rc = readRead(volInfo, both, 8); if(rc != 8) return rc; read733FromCharArray(both, value); return rc; }
int read721(VolInfo* volInfo, unsigned short* value) { int rc; unsigned char array[2]; rc = readRead(volInfo, array, 2); if(rc != 2) return rc; *value = array[1]; *value <<= 8; *value |= array[0]; return rc; }
//! //! \brief HandShakeTask::run //! void HandShakeTask::run(){ socket = new QTcpSocket(); //set the ID if(!socket->setSocketDescriptor(this->socketDescriptor)){ emit error (socket->error()); return; } qDebug()<<"HandShakeTask Thread Start"; connect(socket,SIGNAL(readyRead()),this,SLOT(readRead()),Qt::DirectConnection); connect(socket,SIGNAL(disconnected()),this,SLOT(disconnected())); exec(); }
int read731(VolInfo* volInfo, unsigned* value) { int rc; unsigned char array[4]; rc = readRead(volInfo, array, 4); if(rc != 4) return rc; *value = array[3]; *value <<= 8; *value |= array[2]; *value <<= 8; *value |= array[1]; *value <<= 8; *value |= array[0]; return rc; }
int MyTcpSocket::doConnect(QString regMsg) { this->regMsg = regMsg; socket = new QTcpSocket(this); connect(socket,SIGNAL(connected()),this,SLOT(connected())); connect(socket,SIGNAL(disconnected()),this,SLOT(disconnected())); connect(socket,SIGNAL(readyRead()),this,SLOT(readRead())); // this is not blocking call socket->connectToHost("127.0.0.1",12345); // we need to wait... if(!socket->waitForConnected(5000)) { qDebug()<<"Error: "<<socket->errorString(); return 1; } else{ return 0; } }
int read711(VolInfo* volInfo, unsigned char* value) { return readRead(volInfo, value, 1); }