serialclient 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/bin/serialclient +29 -3
  3. metadata +8 -8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/bin/serialclient CHANGED
@@ -1,5 +1,21 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
+ # This file is part of Serialclient.
4
+ #
5
+ # Serialclient is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # Serialclient is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with Serialclient. If not, see <http://www.gnu.org/licenses/>.
17
+ #
18
+
3
19
  require 'rubygems'
4
20
  require 'serialport'
5
21
  require 'rink'
@@ -26,15 +42,21 @@ class Serial_client < Rink::Console
26
42
  )
27
43
  @read_th = Thread.new {
28
44
  while 1 do
29
- puts @sp.gets
45
+ get = @sp.gets
46
+ if get.nil?
47
+ puts "HW disconnect detected"
48
+ Process.exit 255
49
+ else
50
+ puts get
51
+ end
30
52
  end
31
53
  }
32
54
  super()
33
55
  end
34
56
 
35
- def process_line (line_)
57
+ def process_line (line_) # process line is called by rink when user inputs something
36
58
  @sp.write(line_+ "\n")
37
- sleep 0.01
59
+ sleep 0.01 # if device respond to a request, it has time to display: this is only cosmetic
38
60
  end
39
61
 
40
62
  end
@@ -49,4 +71,8 @@ Signal.trap('INT') do
49
71
  Process.exit 0
50
72
  end
51
73
 
74
+ if options[:port] == ""
75
+ puts "Please specify a port with --port. See help for more information."
76
+ Process.exit 1
77
+ end
52
78
  Serial_client.new(options[:port], options[:speed].to_i, options[:data_bits], options[:stop_bits], SerialPort.const_get(options[:parity]))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serialclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-04 00:00:00.000000000 Z
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: serialport
16
- requirement: &69936850 !ruby/object:Gem::Requirement
16
+ requirement: &81605990 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *69936850
24
+ version_requirements: *81605990
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rink
27
- requirement: &69936460 !ruby/object:Gem::Requirement
27
+ requirement: &81605670 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *69936460
35
+ version_requirements: *81605670
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: micro-optparse
38
- requirement: &69936000 !ruby/object:Gem::Requirement
38
+ requirement: &81605420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *69936000
46
+ version_requirements: *81605420
47
47
  description: ! ' Need a terminal to communicate to a serial device like Hyperterminal,
48
48
  this gem has been done for you !
49
49