jeffrafter-rubygsm 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rubygsm/core.rb +7 -6
- data/rubygsm.gemspec +3 -6
- metadata +4 -14
data/lib/rubygsm/core.rb
CHANGED
@@ -18,7 +18,7 @@ module Gsm
|
|
18
18
|
class Modem
|
19
19
|
include Timeout
|
20
20
|
|
21
|
-
attr_accessor :verbosity, :read_timeout, :keep_inbox_empty
|
21
|
+
attr_accessor :verbosity, :read_timeout, :keep_inbox_empty, :keep_alive, :read_unread_messages
|
22
22
|
attr_reader :device, :port
|
23
23
|
|
24
24
|
# call-seq:
|
@@ -845,19 +845,20 @@ class Modem
|
|
845
845
|
# enable new message notification mode every ten intevals, in case the
|
846
846
|
# modem "forgets" (power cycle, etc)
|
847
847
|
if (@polled % 10) == 0
|
848
|
-
try_command("AT+CNMI=2,2,0,0,0")
|
848
|
+
try_command("AT+CNMI=2,2,0,0,0") if @keep_alive
|
849
849
|
end
|
850
850
|
|
851
851
|
# check for messages in the default mailbox (wether read or not)
|
852
852
|
# read them and then delete them
|
853
853
|
if (@keep_inbox_empty)
|
854
|
+
log "Keeping the inbox empty========================================"
|
854
855
|
fetch_and_delete_stored_messages
|
855
856
|
end
|
856
857
|
|
857
858
|
# check for new messages lurking in the device's
|
858
859
|
# memory (in case we missed them (yes, it happens))
|
859
|
-
if (@polled % 4) == 0
|
860
|
-
|
860
|
+
if (@read_unread_messages && (@polled % 4) == 0)
|
861
|
+
fetch_unread_messages
|
861
862
|
end
|
862
863
|
|
863
864
|
# if there are any new incoming messages,
|
@@ -933,7 +934,7 @@ class Modem
|
|
933
934
|
# If there is no way to select a default mailbox we can't continue
|
934
935
|
return unless select_default_mailbox
|
935
936
|
|
936
|
-
# Try to read the first message from the box
|
937
|
+
# Try to read the first message from the box
|
937
938
|
begin
|
938
939
|
out = command("AT+CMGR=1")
|
939
940
|
rescue
|
@@ -963,7 +964,7 @@ class Modem
|
|
963
964
|
@incoming.push Gsm::Incoming.new(self, from, sent, msg)
|
964
965
|
end
|
965
966
|
|
966
|
-
def
|
967
|
+
def fetch_unread_messages
|
967
968
|
|
968
969
|
# fetch all/unread (see constant) messages
|
969
970
|
lines = command('AT+CMGL="%s"' % CMGL_STATUS)
|
data/rubygsm.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "rubygsm"
|
3
|
-
s.version = "0.5.
|
4
|
-
s.date = "2009-03-
|
3
|
+
s.version = "0.5.1"
|
4
|
+
s.date = "2009-03-17"
|
5
5
|
s.summary = "Send and receive SMS with a GSM modem"
|
6
6
|
s.email = "adam.mckaig@gmail.com"
|
7
7
|
s.homepage = "http://github.com/adammck/rubygsm"
|
@@ -17,14 +17,11 @@ Gem::Specification.new do |s|
|
|
17
17
|
"lib/rubygsm/log.rb",
|
18
18
|
"lib/rubygsm/msg/incoming.rb",
|
19
19
|
"lib/rubygsm/msg/outgoing.rb",
|
20
|
-
"bin/gsm-modem-band"
|
21
|
-
"bin/gsm-app-monitor"
|
20
|
+
"bin/gsm-modem-band"
|
22
21
|
]
|
23
22
|
|
24
23
|
s.executables = [
|
25
24
|
"gsm-modem-band",
|
26
25
|
"sms"
|
27
26
|
]
|
28
|
-
|
29
|
-
s.add_dependency("toholio-serialport", ["> 0.7.1"])
|
30
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jeffrafter-rubygsm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Mckaig
|
@@ -10,19 +10,10 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-03-
|
13
|
+
date: 2009-03-17 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
|
17
|
-
name: toholio-serialport
|
18
|
-
type: :runtime
|
19
|
-
version_requirement:
|
20
|
-
version_requirements: !ruby/object:Gem::Requirement
|
21
|
-
requirements:
|
22
|
-
- - ">"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 0.7.1
|
25
|
-
version:
|
15
|
+
dependencies: []
|
16
|
+
|
26
17
|
description:
|
27
18
|
email: adam.mckaig@gmail.com
|
28
19
|
executables:
|
@@ -42,7 +33,6 @@ files:
|
|
42
33
|
- lib/rubygsm/msg/incoming.rb
|
43
34
|
- lib/rubygsm/msg/outgoing.rb
|
44
35
|
- bin/gsm-modem-band
|
45
|
-
- bin/gsm-app-monitor
|
46
36
|
has_rdoc: true
|
47
37
|
homepage: http://github.com/adammck/rubygsm
|
48
38
|
post_install_message:
|