void Sim_Ab::readIN(){ QTime time = QTime::currentTime(); QString strTime = time.toString("hh.mm.ss.zzz"); recIN.append(srlIN->readAll()); //вывожу в консоль, что мне пришло qDebug()<<"priem IN" << strTime << "data =" << recIN.toHex(); while (recIN.size()>0){ if (recIN[0]==0xD){ recIN.remove(0,1); if (numIn==1) sendIN(1); else sendIN(2); if (numIn==1) numIn = 2; else numIn = 1; } else{ recIN.remove(0, 1); } }}
priem IN "16.19.04.909" data = "0d"priem IN "16.19.04.920" data = "f3"priem IN "16.19.05.409" data = "0d"priem IN "16.19.05.422" data = "fd"priem IN "16.19.05.909" data = "0d"priem IN "16.19.05.919" data = "6d"priem IN "16.19.06.409" data = "0d"priem IN "16.19.06.420" data = "fe"priem IN "16.19.06.909" data = "0d"priem IN "16.19.06.919" data = "9d"
void byteRez::receive(){ QString str1, str2; recDat.append(serial->readAll()); str1.append(recDat.toHex()); for (i=0;i<str1.size(); i+= 2) str2.append(QString("%1%2 ").arg(str1[i]).arg(str1[i+1])); ui->readEdit->insertPlainText(str2); recDat.clear();}
recIN.append(srlIN->readAll()); if (recIN.size()<2) return;