Ignore PDU message lines in response when sending SMS

Tested with TP-LINK MA180.
It returns the PDU message when sending a message with a length greater
than 56 (i don't really know why for now). These lines are ignored and
only the last one with the status is parsed.
develop
Guillaume DOTT 2013-10-03 11:07:45 +02:00
parent 9475bdfb5c
commit 77105b180a
1 changed files with 6 additions and 1 deletions

View File

@ -113,7 +113,12 @@ module Biju
if result[:prompt]
modem.write("#{sms.to_pdu}#{26.chr}")
hayes_to_obj(modem.wait(length: 8).lstrip)
res = ''
loop do
res = modem.wait(length: 8)
break unless res.match(/\A[0-9A-Fa-f]+\r\n\z/)
end
hayes_to_obj(res.lstrip)
end
end