How to read line in gm862 serial port?

hi,

I need to read line, that is it will read the whole string when it will receive a ‘\n’.

But I couldn’t find out any solution using SER.receive() , SER.receivebyte() and SER.read(). When I use SER.receive(timeout) or SER.receivebyte(timeout) then after timeout or after receiving first character it goes to next prompt.

Close one is SER.read() with MOD.sleep(timeout). But say user enter data in the last moment of timeout or can not enter data within timeout period , then the data is scattered.

Anyone build readline() function? Any suggestion on how can I solve this ?

Thanks in advance.

Cant you just wait in a loop? Something like:

r = SER.receive(20)
while(r.find('\r\n')==-1):
      r = r+SER.receive(20)