serialclient 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -0
- data/bin/serialclient +44 -0
- data/serialclient.gemspec +23 -0
- metadata +74 -0
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1
|
data/bin/serialclient
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'serialport'
|
5
|
+
require 'rink'
|
6
|
+
require 'micro-optparse'
|
7
|
+
|
8
|
+
|
9
|
+
options = Parser.new do |p|
|
10
|
+
p.banner = "Serial terminal client"
|
11
|
+
p.option :port, "path to serial device, ex: /dev/ttyUSB0", :default => ""
|
12
|
+
p.option :speed, "speed in baups", :default => 115200
|
13
|
+
end.process!
|
14
|
+
|
15
|
+
class Serial_client < Rink::Console
|
16
|
+
option :allow_ruby => false
|
17
|
+
|
18
|
+
def initialize (port_, baup_)
|
19
|
+
@sp = SerialPort.new port_, baup_
|
20
|
+
@read_th = Thread.new {
|
21
|
+
while 1 do
|
22
|
+
puts @sp.gets
|
23
|
+
end
|
24
|
+
}
|
25
|
+
super()
|
26
|
+
end
|
27
|
+
|
28
|
+
def process_line (line_)
|
29
|
+
@sp.write(line_+ "\n")
|
30
|
+
sleep 0.01
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
Signal.trap('TERM') do
|
36
|
+
Process.exit 0
|
37
|
+
end
|
38
|
+
|
39
|
+
Signal.trap('INT') do
|
40
|
+
Process.exit 0
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
Serial_client.new(options[:port], options[:speed])
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
require "rubygems"
|
3
|
+
require "rake"
|
4
|
+
|
5
|
+
GEMSPEC = Gem::Specification.new do |s|
|
6
|
+
s.name = "serialclient"
|
7
|
+
s.summary = "Provides a client terminal to connect to a serial device"
|
8
|
+
s.description = <<-EOF
|
9
|
+
Need a terminal to communicate to a serial device like Hyperterminal, this gem has been done for you !
|
10
|
+
EOF
|
11
|
+
s.version = File.read("VERSION").strip
|
12
|
+
s.license = 'GPL-3'
|
13
|
+
s.author = "flagos"
|
14
|
+
s.email = "flagospub@gmail.com"
|
15
|
+
s.homepage = "https://github.com/flagos/serialclient"
|
16
|
+
s.files = FileList["{bin}/*", "serialclient.gemspec", "VERSION"].to_a.sort
|
17
|
+
s.bindir = 'bin'
|
18
|
+
s.executables << 'serialclient'
|
19
|
+
s.has_rdoc = false
|
20
|
+
s.add_dependency('serialport')
|
21
|
+
s.add_dependency('rink')
|
22
|
+
s.require_path ='bin'
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: serialclient
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- flagos
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: serialport
|
16
|
+
requirement: &84725230 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *84725230
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rink
|
27
|
+
requirement: &84724820 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *84724820
|
36
|
+
description: ! ' Need a terminal to communicate to a serial device like Hyperterminal,
|
37
|
+
this gem has been done for you !
|
38
|
+
|
39
|
+
'
|
40
|
+
email: flagospub@gmail.com
|
41
|
+
executables:
|
42
|
+
- serialclient
|
43
|
+
extensions: []
|
44
|
+
extra_rdoc_files: []
|
45
|
+
files:
|
46
|
+
- VERSION
|
47
|
+
- bin/serialclient
|
48
|
+
- serialclient.gemspec
|
49
|
+
homepage: https://github.com/flagos/serialclient
|
50
|
+
licenses:
|
51
|
+
- GPL-3
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- bin
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
requirements: []
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 1.8.11
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: Provides a client terminal to connect to a serial device
|
74
|
+
test_files: []
|