Reading from Serial
Hi guys,
I have the following code:
byte[] inpContent;
String strBuffer =new String();
this.objDialer =new Dialer(this.objSerialPort);
this.objDialer.send(ATCommands.MODEM_STATE);
this.objDialer.pause(1000);
inpContent =newbyte[this.objSerialPort.getInputStream().available()];
this.objSerialPort.getInputStream().read(inpContent);
while(!(strBuffer.indexOf("\r\n") > 2))
{
inpContent =newbyte[this.objSerialPort.getInputStream().available()];
this.objSerialPort.getInputStream().read(inpContent);
strBuffer =new String(inpContent);
this.objDialer.pause(2000);
}
What it does is reading the modem response after sending in some AT commands... but for some reason the while loop never ends. The response from the modem should always finish with "\r\n". It seems that the loop is blocking the input stream whatsoever, this because if I print the byte[] it comes empty. Have you guys have any idea?
Many thanks,
MeTitus

