em-serialport 0.0.1 → 0.0.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.
- data/bin/serial-monitor +26 -0
- data/em-serialport.gemspec +1 -1
- data/lib/em-serialport/version.rb +1 -1
- data/readme.md +19 -3
- metadata +13 -12
data/bin/serial-monitor
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'em-serialport'
|
6
|
+
|
7
|
+
EM.run do
|
8
|
+
if ARGV.size < 1
|
9
|
+
STDERR.print "Usage: #{$0} /dev/tty.usbserial-ABCDEFGH\n"
|
10
|
+
exit(1)
|
11
|
+
end
|
12
|
+
|
13
|
+
serial = EventMachine.open_serial(ARGV[0], 9600, 8, 1, SerialPort::NONE)
|
14
|
+
serial.on_data do |data|
|
15
|
+
puts "received: " + data.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
Thread.new do
|
19
|
+
while TRUE do
|
20
|
+
serial.send_data STDIN.gets.chomp
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
puts "Serial monitor initialized. Enter data followed by a newline character."
|
25
|
+
puts "Ctrl-C to stop"
|
26
|
+
end
|
data/em-serialport.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
-
s.executables =
|
18
|
+
s.executables = ['serial-monitor']
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
s.add_dependency "eventmachine", "0.12.10"
|
data/readme.md
CHANGED
@@ -4,9 +4,7 @@ Eventmachine compatible asynchronous, ruby-serialport library.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
gem 'em-serialport', :git => 'git@github.com:railsbob/em-serialport.git'
|
7
|
+
gem install em-serialport
|
10
8
|
|
11
9
|
## Usage
|
12
10
|
|
@@ -21,3 +19,21 @@ If you are on Mac, you need to set up a virtual USB serial port by installing a
|
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
22
|
+
## Serial Monitor
|
23
|
+
|
24
|
+
The gem comes with a simple command line Serial Monitor. Launch it as:
|
25
|
+
|
26
|
+
bundle exec serial-monitor /dev/tty.usbserial-xxxxxxxx
|
27
|
+
|
28
|
+
Here is a working example, tested with an [https://github.com/railsbob/arduino-examples/tree/master/echo_server](arduino echo server). It simply reads and writes data to serial port from command line.
|
29
|
+
|
30
|
+
Serial monitor initialized. Enter data followed by a newline character.
|
31
|
+
Ctrl-C to stop
|
32
|
+
hello
|
33
|
+
received: hello
|
34
|
+
A very long sentence
|
35
|
+
received: A v
|
36
|
+
received: ery long
|
37
|
+
received: sentence
|
38
|
+
|
39
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-serialport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Anup Narkhede
|
@@ -15,12 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-02-
|
18
|
+
date: 2012-02-09 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
prerelease: false
|
22
|
+
type: :runtime
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
@@ -32,11 +31,11 @@ dependencies:
|
|
32
31
|
- 12
|
33
32
|
- 10
|
34
33
|
version: 0.12.10
|
35
|
-
|
34
|
+
name: eventmachine
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
39
|
-
prerelease: false
|
38
|
+
type: :runtime
|
40
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
42
41
|
requirements:
|
@@ -46,13 +45,14 @@ dependencies:
|
|
46
45
|
segments:
|
47
46
|
- 0
|
48
47
|
version: "0"
|
49
|
-
|
48
|
+
name: serialport
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: *id002
|
51
51
|
description: ""
|
52
52
|
email:
|
53
53
|
- anup@infinitypulse.com
|
54
|
-
executables:
|
55
|
-
|
54
|
+
executables:
|
55
|
+
- serial-monitor
|
56
56
|
extensions: []
|
57
57
|
|
58
58
|
extra_rdoc_files: []
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- .gitignore
|
62
62
|
- Gemfile
|
63
63
|
- Rakefile
|
64
|
+
- bin/serial-monitor
|
64
65
|
- em-serialport.gemspec
|
65
66
|
- lib/em-serialport.rb
|
66
67
|
- lib/em-serialport/connection.rb
|