From 154646323bc9930b448aab5c0b25dff96c9f605d Mon Sep 17 00:00:00 2001 From: Tomtom Date: Wed, 20 Jun 2012 23:08:43 +0200 Subject: [PATCH] added send command --- lib/biju/modem.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/biju/modem.rb b/lib/biju/modem.rb index 03950fe..6dfda41 100644 --- a/lib/biju/modem.rb +++ b/lib/biju/modem.rb @@ -35,6 +35,17 @@ module Biju cmd("AT+CMGD=#{id}") end + def send(sms, options = {}) + # initiate the sms, and wait for either + # the text prompt or an error message + cmd("AT+CMGS=\"#{sms.phone_number}\"") + + # send the sms, and wait until + # it is accepted or rejected + cmd("#{sms.message}#{26.chr}") + # ... check reception + end + private def connection(options) port = options.delete(:port)