Documente Academic
Documente Profesional
Documente Cultură
L4.2
serialPort1->DiscardInBuffer();
serialPort1->Write(sStr + "\r");
tmo = 1000;
tmof = false;
ComTimer = 0;
tmp = serialPort1->ReadExisting();
do
{
Application::DoEvents();
tmp += serialPort1->ReadExisting();
if(ComTimer > tmo)
tmof = true;
}while(!tmp->Contains(wStr) && !tmof);
if(tmof)
{
if(serialPort1->IsOpen)
serialPort1->Close();
// Inchide PORT-ul
return 2;
}//end if
// Semnaleaza time-out
*rStr = tmp;
if(serialPort1->IsOpen)
serialPort1->Close();
// Salveaza raspunsul
return 0;
}//end SendCmd
// Inchide PORT-ul
// Semnaleaza fara eroare
L4.4
L4.5