serialport 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,47 +1,47 @@
1
- require 'serialport.so'
2
-
3
- class SerialPort
4
- private_class_method(:create)
5
-
6
- # Creates a serial port object.
7
- #
8
- # <tt>port</tt> may be a port number
9
- # or the file name of a defice.
10
- # The number is portable; so 0 is mapped to "COM1" on Windows,
11
- # "/dev/ttyS0" on Linux, "/dev/cuaa0" on Mac OS X, etc.
12
- #
13
- # <tt>params</tt> can be used to configure the serial port.
14
- # See SerialPort#set_modem_params for details
15
- def SerialPort::new(port, *params)
16
- sp = create(port)
17
- begin
18
- sp.set_modem_params(*params)
19
- rescue
20
- sp.close
21
- raise
22
- end
23
- return sp
24
- end
25
-
26
- # This behaves like SerialPort#new, except that you can pass a block
27
- # to which the new serial port object will be passed. In this case
28
- # the connection is automaticaly closed when the block has finished.
29
- def SerialPort::open(port, *params)
30
- sp = create(port)
31
- begin
32
- sp.set_modem_params(*params)
33
- rescue
34
- sp.close
35
- raise
36
- end
37
- if (block_given?)
38
- begin
39
- yield sp
40
- ensure
41
- sp.close
42
- end
43
- return nil
44
- end
45
- return sp
46
- end
47
- end
1
+ require 'serialport.so'
2
+
3
+ class SerialPort
4
+ private_class_method(:create)
5
+
6
+ # Creates a serial port object.
7
+ #
8
+ # <tt>port</tt> may be a port number
9
+ # or the file name of a defice.
10
+ # The number is portable; so 0 is mapped to "COM1" on Windows,
11
+ # "/dev/ttyS0" on Linux, "/dev/cuaa0" on Mac OS X, etc.
12
+ #
13
+ # <tt>params</tt> can be used to configure the serial port.
14
+ # See SerialPort#set_modem_params for details
15
+ def SerialPort::new(port, *params)
16
+ sp = create(port)
17
+ begin
18
+ sp.set_modem_params(*params)
19
+ rescue
20
+ sp.close
21
+ raise
22
+ end
23
+ return sp
24
+ end
25
+
26
+ # This behaves like SerialPort#new, except that you can pass a block
27
+ # to which the new serial port object will be passed. In this case
28
+ # the connection is automaticaly closed when the block has finished.
29
+ def SerialPort::open(port, *params)
30
+ sp = create(port)
31
+ begin
32
+ sp.set_modem_params(*params)
33
+ rescue
34
+ sp.close
35
+ raise
36
+ end
37
+ if (block_given?)
38
+ begin
39
+ yield sp
40
+ ensure
41
+ sp.close
42
+ end
43
+ return nil
44
+ end
45
+ return sp
46
+ end
47
+ end
@@ -1,59 +1,52 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{serialport}
8
- s.version = "1.0.4"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Guillaume Pierronnet", "Alan Stern", "Daniel E. Shipton", "Tobin Richard", "Hector Parra", "Ryan C. Payne"]
12
- s.date = %q{2010-07-17}
13
- s.description = %q{Ruby/SerialPort is a Ruby library that provides a class for using RS-232 serial ports.}
14
- s.email = %q{hector@hectorparra.com}
15
- s.extensions = ["ext/native/extconf.rb", "ext/native/extconf.rb"]
16
- s.extra_rdoc_files = [
17
- "CHANGELOG",
18
- "LICENSE",
19
- "README"
20
- ]
21
- s.files = [
22
- ".gitignore",
23
- "CHANGELOG",
24
- "LICENSE",
25
- "MANIFEST",
26
- "README",
27
- "Rakefile",
28
- "VERSION",
29
- "ext/native/extconf.rb",
30
- "ext/native/posix_serialport_impl.c",
31
- "ext/native/serialport.c",
32
- "ext/native/serialport.h",
33
- "ext/native/win_serialport_impl.c",
34
- "lib/serialport.rb",
35
- "serialport.gemspec",
36
- "test/miniterm.rb",
37
- "test/set_readtimeout.rb"
38
- ]
39
- s.homepage = %q{http://github.com/hparra/ruby-serialport/}
40
- s.rdoc_options = ["--charset=UTF-8"]
41
- s.require_paths = ["lib"]
42
- s.rubygems_version = %q{1.3.7}
43
- s.summary = %q{Library for using RS-232 serial ports.}
44
- s.test_files = [
45
- "test/miniterm.rb",
46
- "test/set_readtimeout.rb"
47
- ]
48
-
49
- if s.respond_to? :specification_version then
50
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
51
- s.specification_version = 3
52
-
53
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
- else
55
- end
56
- else
57
- end
58
- end
59
-
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "serialport"
8
+ s.version = "1.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Guillaume Pierronnet", "Alan Stern", "Daniel E. Shipton", "Tobin Richard", "Hector Parra", "Ryan C. Payne"]
12
+ s.date = "2012-05-26"
13
+ s.description = "Ruby/SerialPort is a Ruby library that provides a class for using RS-232 serial ports."
14
+ s.email = "hector@hectorparra.com"
15
+ s.extensions = ["ext/native/extconf.rb", "ext/native/extconf.rb"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README"
19
+ ]
20
+ s.files = [
21
+ "CHANGELOG",
22
+ "CHECKLIST",
23
+ "LICENSE",
24
+ "MANIFEST",
25
+ "README",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "ext/native/extconf.rb",
29
+ "ext/native/posix_serialport_impl.c",
30
+ "ext/native/serialport.c",
31
+ "ext/native/serialport.h",
32
+ "ext/native/win_serialport_impl.c",
33
+ "lib/serialport.rb",
34
+ "serialport.gemspec",
35
+ "test/miniterm.rb",
36
+ "test/set_readtimeout.rb"
37
+ ]
38
+ s.homepage = "http://github.com/hparra/ruby-serialport/"
39
+ s.require_paths = ["lib"]
40
+ s.rubygems_version = "1.8.24"
41
+ s.summary = "Library for using RS-232 serial ports."
42
+
43
+ if s.respond_to? :specification_version then
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
+ else
48
+ end
49
+ else
50
+ end
51
+ end
52
+
@@ -1,25 +1,25 @@
1
- require "../serialport.so"
2
-
3
-
4
- if ARGV.size < 4
5
- STDERR.print <<EOF
6
- Usage: ruby #{$0} num_port bps nbits stopb
7
- EOF
8
- exit(1)
9
- end
10
-
11
- sp = SerialPort.new(ARGV[0].to_i, ARGV[1].to_i, ARGV[2].to_i, ARGV[3].to_i, SerialPort::NONE)
12
-
13
- open("/dev/tty", "r+") { |tty|
14
- tty.sync = true
15
- Thread.new {
16
- while true do
17
- tty.printf("%c", sp.getc)
18
- end
19
- }
20
- while (l = tty.gets) do
21
- sp.write(l.sub("\n", "\r"))
22
- end
23
- }
24
-
25
- sp.close
1
+ require "../serialport.so"
2
+
3
+
4
+ if ARGV.size < 4
5
+ STDERR.print <<EOF
6
+ Usage: ruby #{$0} num_port bps nbits stopb
7
+ EOF
8
+ exit(1)
9
+ end
10
+
11
+ sp = SerialPort.new(ARGV[0].to_i, ARGV[1].to_i, ARGV[2].to_i, ARGV[3].to_i, SerialPort::NONE)
12
+
13
+ open("/dev/tty", "r+") { |tty|
14
+ tty.sync = true
15
+ Thread.new {
16
+ while true do
17
+ tty.printf("%c", sp.getc)
18
+ end
19
+ }
20
+ while (l = tty.gets) do
21
+ sp.write(l.sub("\n", "\r"))
22
+ end
23
+ }
24
+
25
+ sp.close
@@ -1,7 +1,7 @@
1
- #!/usr/bin/ruby
2
- require "rubygems"
3
- require "serialport"
4
-
5
- sp = SerialPort.new("/dev/tty.usbserial", "9600".to_i)
6
- sp.read_timeout = 100
7
- sp.close
1
+ #!/usr/bin/ruby
2
+ require "rubygems"
3
+ require "serialport"
4
+
5
+ sp = SerialPort.new("/dev/tty.usbserial", "9600".to_i)
6
+ sp.read_timeout = 100
7
+ sp.close
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serialport
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 4
10
- version: 1.0.4
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Guillaume Pierronnet
@@ -20,8 +20,7 @@ autorequire:
20
20
  bindir: bin
21
21
  cert_chain: []
22
22
 
23
- date: 2010-07-17 00:00:00 -07:00
24
- default_executable:
23
+ date: 2012-05-26 00:00:00 Z
25
24
  dependencies: []
26
25
 
27
26
  description: Ruby/SerialPort is a Ruby library that provides a class for using RS-232 serial ports.
@@ -30,14 +29,12 @@ executables: []
30
29
 
31
30
  extensions:
32
31
  - ext/native/extconf.rb
33
- - ext/native/extconf.rb
34
32
  extra_rdoc_files:
35
- - CHANGELOG
36
33
  - LICENSE
37
34
  - README
38
35
  files:
39
- - .gitignore
40
36
  - CHANGELOG
37
+ - CHECKLIST
41
38
  - LICENSE
42
39
  - MANIFEST
43
40
  - README
@@ -52,13 +49,12 @@ files:
52
49
  - serialport.gemspec
53
50
  - test/miniterm.rb
54
51
  - test/set_readtimeout.rb
55
- has_rdoc: true
56
52
  homepage: http://github.com/hparra/ruby-serialport/
57
53
  licenses: []
58
54
 
59
55
  post_install_message:
60
- rdoc_options:
61
- - --charset=UTF-8
56
+ rdoc_options: []
57
+
62
58
  require_paths:
63
59
  - lib
64
60
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -82,10 +78,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
78
  requirements: []
83
79
 
84
80
  rubyforge_project:
85
- rubygems_version: 1.3.7
81
+ rubygems_version: 1.8.24
86
82
  signing_key:
87
83
  specification_version: 3
88
84
  summary: Library for using RS-232 serial ports.
89
- test_files:
90
- - test/miniterm.rb
91
- - test/set_readtimeout.rb
85
+ test_files: []
86
+
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- .DS_Store
2
- /pkg
3
- /doc
4
- /ext/native/*.bundle
5
- /ext/native/*.log
6
- /ext/native/*.o
7
- /ext/native/*.so
8
- /ext/native/Makefile
9
- .*.swp
10
- tags