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
parent
9475bdfb5c
commit
77105b180a
|
@ -113,7 +113,12 @@ module Biju
|
||||||
|
|
||||||
if result[:prompt]
|
if result[:prompt]
|
||||||
modem.write("#{sms.to_pdu}#{26.chr}")
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue