Class: Utel::SMS
- Inherits:
-
Object
- Object
- Utel::SMS
- Defined in:
- lib/utel/sms.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.send(*args) ⇒ Object
3 4 5 |
# File 'lib/utel/sms.rb', line 3 def self.send *args new.send(*args) end |
Instance Method Details
#send(number, message) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/utel/sms.rb', line 7 def send number, out = '' File.open(Utel::DEVICE, "w+") do |f| f.write "AT+CMGF=1\r\n" f.write "AT+CMGS=\"#{number}\"\r\n" f.write "#{}\x1A" while(s = f.gets) do if s.slice(0, 2) == "OK" out << s break if out.scan(/OK/).count == 2 else if (s.slice(0, 10) == "+CMS ERROR") out << s break end end end end parse_response(out) end |