serialport-server 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/History.txt +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +23 -0
- data/Rakefile +1 -32
- data/bin/serialport-server +4 -137
- data/lib/serialport-server.rb +11 -3
- data/lib/serialport-server/application.rb +126 -0
- data/lib/serialport-server/http_server.rb +23 -0
- data/lib/serialport-server/socket_server.rb +22 -0
- data/lib/serialport-server/version.rb +3 -0
- data/serialport-server.gemspec +29 -0
- metadata +137 -175
- data/.gemtest +0 -0
- data/Manifest.txt +0 -19
- data/README.rdoc +0 -46
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d7d590e373d175e5375e58cca8f7960baa86ffe9
|
4
|
+
data.tar.gz: 2b030249ef0f2823b7d5890c52ee6a07eedd4eb9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5cc3987c53e68129a8275a880cb50127fe942508aae540f3cb6f5fcf3f8a9dc7815bb37aee2f0ca1da7fdc76d7a06274598d8aaa884d41760358ca532b553f66
|
7
|
+
data.tar.gz: 9d25cbcb3521c5cccddb583c2b1800aabe4367144fe304504d088eccfb9c07a9686dd9c0d9812bce5afcb728a4209161581e35fdccf767924b068e99df186e75
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/History.txt
CHANGED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Sho Hashimoto
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
SerialPort Server
|
2
|
+
=================
|
3
|
+
SerialPort Server makes your Device (Arduino, mbed...) WebServer. You can access SerialPort via HTTP, WebSocket and TCP Socket.
|
4
|
+
|
5
|
+
- http://shokai.github.io/serialport-server
|
6
|
+
|
7
|
+
|
8
|
+
Requirements
|
9
|
+
------------
|
10
|
+
- USB Device (Arduino, mbed ...)
|
11
|
+
|
12
|
+
|
13
|
+
Install
|
14
|
+
-------
|
15
|
+
|
16
|
+
% gem install serialport-server
|
17
|
+
|
18
|
+
|
19
|
+
Usage
|
20
|
+
-----
|
21
|
+
|
22
|
+
% serialport-server --help
|
23
|
+
% serialport-server /dev/tty.usb-device -http_port 8783 -websocket_prot 8784 -socket_port 8785
|
data/Rakefile
CHANGED
@@ -1,32 +1 @@
|
|
1
|
-
require '
|
2
|
-
gem 'hoe', '>= 2.1.0'
|
3
|
-
require 'hoe'
|
4
|
-
require 'fileutils'
|
5
|
-
require './lib/serialport-server'
|
6
|
-
|
7
|
-
Hoe.plugin :newgem
|
8
|
-
# Hoe.plugin :website
|
9
|
-
# Hoe.plugin :cucumberfeatures
|
10
|
-
|
11
|
-
# Generate all the Rake tasks
|
12
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
|
-
$hoe = Hoe.spec 'serialport-server' do
|
14
|
-
self.developer 'Sho Hashimoto', 'hashimoto@shokai.org'
|
15
|
-
self.post_install_message = '!! For more information on serialport-server, see http://shokai.github.com/serialport-server'
|
16
|
-
self.rubyforge_name = self.name # TODO this is default value
|
17
|
-
self.extra_deps = [['serialport','>= 1.0.4'],
|
18
|
-
['eventmachine'],
|
19
|
-
['eventmachine_httpserver'],
|
20
|
-
['em-websocket'],
|
21
|
-
['args_parser'],
|
22
|
-
['json']
|
23
|
-
]
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
require 'newgem/tasks'
|
28
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
29
|
-
|
30
|
-
# TODO - want other tests/tasks run by default? Add them to the list
|
31
|
-
# remove_task :default
|
32
|
-
# task :default => [:spec, :features]
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/serialport-server
CHANGED
@@ -1,140 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
-
|
4
|
-
require 'serialport'
|
5
|
-
require 'eventmachine'
|
6
|
-
require 'evma_httpserver'
|
7
|
-
require 'em-websocket'
|
8
|
-
require 'args_parser'
|
9
|
-
require 'json'
|
3
|
+
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
|
4
|
+
require 'serialport-server'
|
10
5
|
|
11
|
-
|
12
|
-
|
13
|
-
arg :bps, 'bit per second', :default => 9600
|
14
|
-
arg :bit, 'bit(7-9)', :default => 8
|
15
|
-
arg :stopbit, 'stopbit', :default => 1
|
16
|
-
arg :parity, 'parity bit', :default => 0
|
17
|
-
arg :http_port, 'HTTP port', :alias => :hp, :default => 8783
|
18
|
-
arg :websocket_port, 'WebSocket port', :alias => :wp, :default => 8784
|
19
|
-
arg :socket_port, 'TCP Socket port', :alias => :sp, :default => 8785
|
20
|
-
end
|
21
|
-
|
22
|
-
if !parser.first or parser.has_option? :help
|
23
|
-
puts parser.help
|
24
|
-
app_name = $0.split(/\//).last
|
25
|
-
if RUBY_PLATFORM =~ /mswin|mingw|cygwin|bccwin/
|
26
|
-
puts "e.g. #{app_name} COM1"
|
27
|
-
puts " #{app_name} COM1 -hp 8783 -wp 8784 -sp 8785"
|
28
|
-
else
|
29
|
-
puts "e.g. #{app_name} /dev/tty.your-device"
|
30
|
-
puts " #{app_name} /dev/tty.your-device -hp 8783 -wp 8784 -sp 8785"
|
31
|
-
end
|
32
|
-
exit 1
|
33
|
-
end
|
34
|
-
|
35
|
-
begin
|
36
|
-
@@sp = SerialPort.new(parser.first, parser[:bps].to_i, parser[:bit].to_i, parser[:stopbit].to_i, parser[:parity].to_i) # 9600bps, 8bit, stopbit 1, parity none
|
37
|
-
rescue => e
|
38
|
-
STDERR.puts 'cannot open serialport!!'
|
39
|
-
STDERR.puts e.to_s
|
40
|
-
exit 1
|
41
|
-
end
|
42
|
-
|
43
|
-
@@recvs = Array.new
|
44
|
-
@@channel = EM::Channel.new
|
45
|
-
@@channel.subscribe do |data|
|
46
|
-
now = Time.now.to_i*1000+(Time.now.usec/1000.0).round
|
47
|
-
@@recvs.unshift({:time => now, :data => data})
|
48
|
-
while @@recvs.size > 100 do
|
49
|
-
@@recvs.pop
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
class SerialHttpServer < EM::Connection
|
54
|
-
include EM::HttpServer
|
55
|
-
|
56
|
-
def process_http_request
|
57
|
-
res = EM::DelegatedHttpResponse.new(self)
|
58
|
-
puts "[http] #{@http_request_method} #{@http_path_info} #{@http_query_string} #{@http_post_content}"
|
59
|
-
res.headers['Access-Control-Allow-Origin'] = '*'
|
60
|
-
res.headers['Access-Control-Allow-Headers'] = 'Content-Type'
|
61
|
-
res.headers['Access-Control-Allow-Methods'] = 'PUT,DELETE,POST,GET,OPTIONS'
|
62
|
-
if @http_request_method == 'GET'
|
63
|
-
res.status = 200
|
64
|
-
res.content = @@recvs.to_json
|
65
|
-
res.send_response
|
66
|
-
elsif @http_request_method == 'POST'
|
67
|
-
res.status = 200
|
68
|
-
@@sp.puts @http_post_content
|
69
|
-
res.content = @@recvs.to_json
|
70
|
-
res.send_response
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
class SerialSocketServer < EM::Connection
|
76
|
-
def post_init
|
77
|
-
@sid = @@channel.subscribe do |data|
|
78
|
-
send_data "#{data}\n"
|
79
|
-
end
|
80
|
-
puts "* new socket client <#{@sid}>"
|
81
|
-
|
82
|
-
def receive_data data
|
83
|
-
data = data.to_s.strip
|
84
|
-
return if data.size < 1
|
85
|
-
puts "* socket client <#{@sid}> : #{data}"
|
86
|
-
@@sp.puts data
|
87
|
-
end
|
88
|
-
|
89
|
-
def unbind
|
90
|
-
@@channel.unsubscribe @sid
|
91
|
-
puts "* socket client <#{@sid}> closed"
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
EM::run do
|
97
|
-
EM::start_server("0.0.0.0", parser[:http_port].to_i, SerialHttpServer)
|
98
|
-
puts "start HTTP server - port #{parser[:http_port].to_i}"
|
99
|
-
|
100
|
-
EM::start_server('0.0.0.0', parser[:socket_port].to_i, SerialSocketServer)
|
101
|
-
puts "start TCP Socket server - port #{parser[:socket_port].to_i}"
|
102
|
-
|
103
|
-
EM::WebSocket.start(:host => '0.0.0.0', :port => parser[:websocket_port].to_i) do |ws|
|
104
|
-
ws.onopen do
|
105
|
-
sid = @@channel.subscribe do |mes|
|
106
|
-
ws.send mes.to_s
|
107
|
-
end
|
108
|
-
puts "* new websocket client <#{sid}> connected"
|
109
|
-
ws.onmessage do |mes|
|
110
|
-
puts "* websocket client <#{sid}> : #{mes}"
|
111
|
-
@@sp.puts mes.strip
|
112
|
-
end
|
113
|
-
|
114
|
-
ws.onclose do
|
115
|
-
@@channel.unsubscribe sid
|
116
|
-
puts "* websocket client <#{sid}> closed"
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
puts "start WebSocket server - port #{parser[:websocket_port].to_i}"
|
121
|
-
|
122
|
-
EM::defer do
|
123
|
-
loop do
|
124
|
-
data = @@sp.gets.gsub(/[\r\n]/,'')
|
125
|
-
data = data.to_i if data =~ /^\d+$/
|
126
|
-
next if !data or data.to_s.size < 1
|
127
|
-
@@channel.push data
|
128
|
-
puts data
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
EM::defer do
|
133
|
-
loop do
|
134
|
-
line = STDIN.gets.gsub(/[\r\n]/,'')
|
135
|
-
next if !line or line.to_s.size < 1
|
136
|
-
@@sp.puts line
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
end
|
6
|
+
app = SerialportServer::Application.new ARGV
|
7
|
+
app.start
|
data/lib/serialport-server.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'eventmachine'
|
2
|
+
require 'evma_httpserver'
|
3
|
+
require 'em-websocket'
|
4
|
+
require 'json'
|
5
|
+
require 'serialport'
|
6
|
+
require 'args_parser'
|
7
|
+
|
8
|
+
require 'serialport-server/version'
|
9
|
+
require 'serialport-server/socket_server'
|
10
|
+
require 'serialport-server/http_server'
|
11
|
+
require 'serialport-server/application'
|
3
12
|
|
4
13
|
module SerialportServer
|
5
|
-
VERSION = '0.0.3'
|
6
14
|
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
module SerialportServer
|
2
|
+
|
3
|
+
def self.application
|
4
|
+
@@application
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
def self.application=(app)
|
9
|
+
@@application = app
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
class Application
|
15
|
+
|
16
|
+
def app_name
|
17
|
+
'serialport-server'
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_reader :args, :serialport, :channel, :recvs
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
SerialportServer.application = self
|
24
|
+
@args = ArgsParser.parse argv do
|
25
|
+
arg :bps, 'bit per second', :default => 9600
|
26
|
+
arg :bit, 'bit(7-9)', :default => 8
|
27
|
+
arg :stopbit, 'stopbit', :default => 1
|
28
|
+
arg :parity, 'parity bit', :default => 0
|
29
|
+
arg :http_port, 'HTTP port', :alias => :hp, :default => 8783
|
30
|
+
arg :websocket_port, 'WebSocket port', :alias => :wp, :default => 8784
|
31
|
+
arg :socket_port, 'TCP Socket port', :alias => :sp, :default => 8785
|
32
|
+
arg :version, 'show version', :alias => :v
|
33
|
+
arg :help, 'show help', :alias => :h
|
34
|
+
|
35
|
+
on :version do
|
36
|
+
STDERR.puts "SerialportServer v#{SerialportServer::VERSION}"
|
37
|
+
STDERR.puts "http://shokai.github.io/serialport-server"
|
38
|
+
exit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
if !@args.first or @args.has_option? :help
|
43
|
+
STDERR.puts @args.help
|
44
|
+
if RUBY_PLATFORM =~ /mswin|mingw|cygwin|bccwin/
|
45
|
+
STDERR.puts "e.g. #{app_name} COM1"
|
46
|
+
STDERR.puts " #{app_name} COM1 -hp 8783 -wp 8784 -sp 8785"
|
47
|
+
else
|
48
|
+
STDERR.puts "e.g. #{app_name} /dev/tty.your-device"
|
49
|
+
STDERR.puts " #{app_name} /dev/tty.your-device -hp 8783 -wp 8784 -sp 8785"
|
50
|
+
end
|
51
|
+
exit 1
|
52
|
+
end
|
53
|
+
|
54
|
+
begin
|
55
|
+
@serialport = SerialPort.new(@args.first,
|
56
|
+
@args[:bps].to_i,
|
57
|
+
@args[:bit].to_i,
|
58
|
+
@args[:stopbit].to_i,
|
59
|
+
@args[:parity].to_i)
|
60
|
+
rescue => e
|
61
|
+
STDERR.puts 'cannot open serialport!!'
|
62
|
+
STDERR.puts e.to_s
|
63
|
+
exit 1
|
64
|
+
end
|
65
|
+
|
66
|
+
@recvs = Array.new
|
67
|
+
@channel = EM::Channel.new
|
68
|
+
@channel.subscribe do |data|
|
69
|
+
now = Time.now.to_i*1000+(Time.now.usec/1000.0).round
|
70
|
+
@recvs.unshift({:time => now, :data => data})
|
71
|
+
while @recvs.size > 100 do
|
72
|
+
@recvs.pop
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def start
|
78
|
+
EM::run do
|
79
|
+
EM::start_server("0.0.0.0", @args[:http_port].to_i, SerialportServer::HttpServer)
|
80
|
+
puts "start HTTP server - port #{@args[:http_port].to_i}"
|
81
|
+
|
82
|
+
EM::start_server('0.0.0.0', @args[:socket_port].to_i, SerialportServer::SocketServer)
|
83
|
+
puts "start TCP Socket server - port #{@args[:socket_port].to_i}"
|
84
|
+
|
85
|
+
EM::WebSocket.start(:host => '0.0.0.0', :port => @args[:websocket_port].to_i) do |ws|
|
86
|
+
ws.onopen do
|
87
|
+
sid = @channel.subscribe do |mes|
|
88
|
+
ws.send mes.to_s
|
89
|
+
end
|
90
|
+
puts "* new websocket client <#{sid}> connected"
|
91
|
+
ws.onmessage do |mes|
|
92
|
+
puts "* websocket client <#{sid}> : #{mes}"
|
93
|
+
@serialport.puts mes.strip
|
94
|
+
end
|
95
|
+
|
96
|
+
ws.onclose do
|
97
|
+
@channel.unsubscribe sid
|
98
|
+
puts "* websocket client <#{sid}> closed"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
puts "start WebSocket server - port #{@args[:websocket_port].to_i}"
|
103
|
+
|
104
|
+
EM::defer do
|
105
|
+
loop do
|
106
|
+
data = @serialport.gets.gsub(/[\r\n]/,'') rescue next
|
107
|
+
data = data.to_i if data =~ /^\d+$/
|
108
|
+
next if !data or data.to_s.empty?
|
109
|
+
@channel.push data
|
110
|
+
puts data
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
EM::defer do
|
115
|
+
loop do
|
116
|
+
line = STDIN.gets.gsub(/[\r\n]/,'')
|
117
|
+
next if !line or line.to_s.empty?
|
118
|
+
@serialport.puts line rescue next
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module SerialportServer
|
2
|
+
class HttpServer < EM::Connection
|
3
|
+
include EM::HttpServer
|
4
|
+
|
5
|
+
def process_http_request
|
6
|
+
res = EM::DelegatedHttpResponse.new(self)
|
7
|
+
puts "[http] #{@http_request_method} #{@http_path_info} #{@http_query_string} #{@http_post_content}"
|
8
|
+
res.headers['Access-Control-Allow-Origin'] = '*'
|
9
|
+
res.headers['Access-Control-Allow-Headers'] = 'Content-Type'
|
10
|
+
res.headers['Access-Control-Allow-Methods'] = 'PUT,DELETE,POST,GET,OPTIONS'
|
11
|
+
if @http_request_method == 'GET'
|
12
|
+
res.status = 200
|
13
|
+
res.content = SerialportServer.application.recvs.to_json
|
14
|
+
res.send_response
|
15
|
+
elsif @http_request_method == 'POST'
|
16
|
+
res.status = 200
|
17
|
+
SerialportServer.application.serialport.puts @http_post_content
|
18
|
+
res.content = SerialportServer.application.recvs.to_json
|
19
|
+
res.send_response
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module SerialportServer
|
2
|
+
class SocketServer < EM::Connection
|
3
|
+
def post_init
|
4
|
+
@sid = SerialportServer.application.channel.subscribe do |data|
|
5
|
+
send_data "#{data}\n"
|
6
|
+
end
|
7
|
+
puts "* new socket client <#{@sid}>"
|
8
|
+
|
9
|
+
def receive_data data
|
10
|
+
data = data.to_s.strip
|
11
|
+
return if data.size < 1
|
12
|
+
puts "* socket client <#{@sid}> : #{data}"
|
13
|
+
SerialportServer.application.serialport.puts data
|
14
|
+
end
|
15
|
+
|
16
|
+
def unbind
|
17
|
+
SerialportServer.application.channel.unsubscribe @sid
|
18
|
+
puts "* socket client <#{@sid}> closed"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'serialport-server/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "serialport-server"
|
7
|
+
spec.version = SerialportServer::VERSION
|
8
|
+
spec.authors = "Sho Hashimoto"
|
9
|
+
spec.email = ["hashimoto@shokai.org"]
|
10
|
+
spec.summary = "SerialPort Server makes your Device (Arduino, mbed...) WebServer."
|
11
|
+
spec.description = spec.summary
|
12
|
+
spec.homepage = "http://shokai.github.io/serialport-server"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/).reject{|i| i == "Gemfile.lock" }
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency 'serialport', '>= 1.0.4'
|
21
|
+
spec.add_dependency 'eventmachine'
|
22
|
+
spec.add_dependency 'eventmachine_httpserver'
|
23
|
+
spec.add_dependency 'em-websocket'
|
24
|
+
spec.add_dependency 'args_parser', "~> 0.2"
|
25
|
+
spec.add_dependency 'json'
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
28
|
+
spec.add_development_dependency "rake"
|
29
|
+
end
|
metadata
CHANGED
@@ -1,177 +1,147 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: serialport-server
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Sho Hashimoto
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-08-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: serialport
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 31
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
- 4
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
33
19
|
version: 1.0.4
|
34
20
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: eventmachine
|
38
21
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: eventmachine
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
48
34
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: eventmachine_httpserver
|
52
35
|
prerelease: false
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: eventmachine_httpserver
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
62
48
|
type: :runtime
|
63
|
-
version_requirements: *id003
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: em-websocket
|
66
49
|
prerelease: false
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: em-websocket
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
76
62
|
type: :runtime
|
77
|
-
version_requirements: *id004
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: args_parser
|
80
63
|
prerelease: false
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: args_parser
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.2'
|
90
76
|
type: :runtime
|
91
|
-
version_requirements: *id005
|
92
|
-
- !ruby/object:Gem::Dependency
|
93
|
-
name: json
|
94
77
|
prerelease: false
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: json
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
104
90
|
type: :runtime
|
105
|
-
version_requirements: *id006
|
106
|
-
- !ruby/object:Gem::Dependency
|
107
|
-
name: rdoc
|
108
91
|
prerelease: false
|
109
|
-
|
110
|
-
|
111
|
-
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bundler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
112
101
|
- - ~>
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
segments:
|
116
|
-
- 3
|
117
|
-
- 10
|
118
|
-
version: "3.10"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.3'
|
119
104
|
type: :development
|
120
|
-
version_requirements: *id007
|
121
|
-
- !ruby/object:Gem::Dependency
|
122
|
-
name: newgem
|
123
105
|
prerelease: false
|
124
|
-
|
125
|
-
|
126
|
-
requirements:
|
127
|
-
- - ">="
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
hash: 5
|
130
|
-
segments:
|
131
|
-
- 1
|
132
|
-
- 5
|
133
|
-
- 3
|
134
|
-
version: 1.5.3
|
135
|
-
type: :development
|
136
|
-
version_requirements: *id008
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
name: hoe
|
139
|
-
prerelease: false
|
140
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
141
|
-
none: false
|
142
|
-
requirements:
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
143
108
|
- - ~>
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
150
118
|
type: :development
|
151
|
-
|
152
|
-
|
153
|
-
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: SerialPort Server makes your Device (Arduino, mbed...) WebServer.
|
126
|
+
email:
|
154
127
|
- hashimoto@shokai.org
|
155
|
-
executables:
|
128
|
+
executables:
|
156
129
|
- serialport-server
|
157
130
|
extensions: []
|
158
|
-
|
159
|
-
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- .gitignore
|
134
|
+
- Gemfile
|
160
135
|
- History.txt
|
161
|
-
-
|
162
|
-
- README.
|
163
|
-
files:
|
164
|
-
- History.txt
|
165
|
-
- Manifest.txt
|
166
|
-
- README.rdoc
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
167
138
|
- Rakefile
|
168
|
-
- script/console
|
169
|
-
- script/destroy
|
170
|
-
- script/generate
|
171
|
-
- test/test_helper.rb
|
172
|
-
- test/test_serialport-server.rb
|
173
139
|
- bin/serialport-server
|
174
140
|
- lib/serialport-server.rb
|
141
|
+
- lib/serialport-server/application.rb
|
142
|
+
- lib/serialport-server/http_server.rb
|
143
|
+
- lib/serialport-server/socket_server.rb
|
144
|
+
- lib/serialport-server/version.rb
|
175
145
|
- sample/README.md
|
176
146
|
- sample/ajax/index.html
|
177
147
|
- sample/ajax/jquery.js
|
@@ -180,41 +150,33 @@ files:
|
|
180
150
|
- sample/websocket/index.html
|
181
151
|
- sample/websocket/jquery.js
|
182
152
|
- sample/websocket/main.js
|
183
|
-
- .
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
153
|
+
- serialport-server.gemspec
|
154
|
+
- test/test_helper.rb
|
155
|
+
- test/test_serialport-server.rb
|
156
|
+
homepage: http://shokai.github.io/serialport-server
|
157
|
+
licenses:
|
158
|
+
- MIT
|
159
|
+
metadata: {}
|
160
|
+
post_install_message:
|
161
|
+
rdoc_options: []
|
162
|
+
require_paths:
|
192
163
|
- lib
|
193
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
none: false
|
204
|
-
requirements:
|
205
|
-
- - ">="
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
hash: 3
|
208
|
-
segments:
|
209
|
-
- 0
|
210
|
-
version: "0"
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
211
174
|
requirements: []
|
212
|
-
|
213
|
-
|
214
|
-
rubygems_version: 1.8.17
|
175
|
+
rubyforge_project:
|
176
|
+
rubygems_version: 2.0.5
|
215
177
|
signing_key:
|
216
|
-
specification_version:
|
217
|
-
summary: SerialPort Server makes your Device (Arduino, mbed...) WebServer
|
218
|
-
test_files:
|
178
|
+
specification_version: 4
|
179
|
+
summary: SerialPort Server makes your Device (Arduino, mbed...) WebServer.
|
180
|
+
test_files:
|
219
181
|
- test/test_helper.rb
|
220
182
|
- test/test_serialport-server.rb
|
data/.gemtest
DELETED
File without changes
|
data/Manifest.txt
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest.txt
|
3
|
-
README.rdoc
|
4
|
-
Rakefile
|
5
|
-
script/console
|
6
|
-
script/destroy
|
7
|
-
script/generate
|
8
|
-
test/test_helper.rb
|
9
|
-
test/test_serialport-server.rb
|
10
|
-
bin/serialport-server
|
11
|
-
lib/serialport-server.rb
|
12
|
-
sample/README.md
|
13
|
-
sample/ajax/index.html
|
14
|
-
sample/ajax/jquery.js
|
15
|
-
sample/ajax/main.js
|
16
|
-
sample/arduino/arduino.ino
|
17
|
-
sample/websocket/index.html
|
18
|
-
sample/websocket/jquery.js
|
19
|
-
sample/websocket/main.js
|
data/README.rdoc
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
= serialport-server
|
2
|
-
|
3
|
-
* http://shokai.github.com/serialport-server
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
SerialPort Server makes your Device (Arduino, mbed...) WebServer. You can access SerialPort via HTTP, WebSocket and TCP Socket.
|
8
|
-
|
9
|
-
|
10
|
-
== SYNOPSIS:
|
11
|
-
|
12
|
-
% serialport-server --help
|
13
|
-
% serialport-server /dev/tty.usb-device -http_port 8783 -websocket_prot 8784 -socket_port 8785
|
14
|
-
|
15
|
-
== REQUIREMENTS:
|
16
|
-
|
17
|
-
* USB Device (Arduino, mbed ...)
|
18
|
-
|
19
|
-
== INSTALL:
|
20
|
-
|
21
|
-
* gem install serialport-server
|
22
|
-
|
23
|
-
== LICENSE:
|
24
|
-
|
25
|
-
(The MIT License)
|
26
|
-
|
27
|
-
Copyright (c) 2012 Sho Hashimoto
|
28
|
-
|
29
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
30
|
-
a copy of this software and associated documentation files (the
|
31
|
-
'Software'), to deal in the Software without restriction, including
|
32
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
33
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
34
|
-
permit persons to whom the Software is furnished to do so, subject to
|
35
|
-
the following conditions:
|
36
|
-
|
37
|
-
The above copyright notice and this permission notice shall be
|
38
|
-
included in all copies or substantial portions of the Software.
|
39
|
-
|
40
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
41
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
42
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
43
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
44
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
45
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
46
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/serialport-server.rb'}"
|
9
|
-
puts "Loading serialport-server gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|