Modify Hayes#messages to always return an array

develop
Guillaume DOTT 2013-09-10 15:56:37 +02:00
parent ff6dc617dc
commit 2f4f1f81f3
1 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ module Biju
sms = at_command('+CMGL', which) sms = at_command('+CMGL', which)
return sms[:status] if !sms.has_key?(:sms) || sms[:sms].empty? return [] unless sms.has_key?(:sms)
sms[:sms].map do |msg| sms[:sms].map do |msg|
Biju::Sms.from_pdu(msg[:message].chomp, msg[:infos][0]) Biju::Sms.from_pdu(msg[:message].chomp, msg[:infos][0])
end end
@ -103,9 +103,9 @@ module Biju
res = ATTransform.new.apply(ATParser.new.parse(str)) res = ATTransform.new.apply(ATParser.new.parse(str))
case res[:cmd] case res[:cmd]
when "+CMS ERROR" when '+CMS ERROR'
raise AT::CmsError.new(res[:result]) raise AT::CmsError.new(res[:result])
when "+CME ERROR" when '+CME ERROR'
raise AT::CmeError.new(res[:result]) raise AT::CmeError.new(res[:result])
end end