arduino_firmata 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +0 -2
- data/History.txt +6 -0
- data/LICENSE.txt +2 -2
- data/arduino_firmata.gemspec +6 -0
- data/lib/arduino_firmata/arduino.rb +11 -19
- data/lib/arduino_firmata/version.rb +1 -1
- data/test/test_helper.rb +1 -2
- metadata +60 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d68b7048e7a2ee534ed8316df91d9a9f9a54257c
|
4
|
+
data.tar.gz: 34544b4a01613ef1367d751170edb216d1064c39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 706ff76370523d0ece421d5f501e92c395d4d9f35498ba4adbcfd77f07d4fa1341e42aad529d0e29451714268409fdbe5b3fdeb8b0b09c5cb5d03171b6bf1b7b
|
7
|
+
data.tar.gz: 31a9715f5760ed4a82070fe49dc6cffe71064da6186df152db2554f124f23f5fae85aa9cc85a6aa10aaac90b5f790463a8468ec2e261e70b2dcf7e433b338c2d
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/History.txt
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2012 Sho Hashimoto
|
1
|
+
Copyright (c) 2012-2013 Sho Hashimoto
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
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.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/arduino_firmata.gemspec
CHANGED
@@ -10,12 +10,18 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.description = %q{Arduino Firmata protocol (http://firmata.org) implementation on Ruby.}
|
11
11
|
gem.summary = gem.description
|
12
12
|
gem.homepage = "http://shokai.github.com/arduino_firmata"
|
13
|
+
gem.license = "MIT"
|
13
14
|
|
14
15
|
gem.files = `git ls-files`.split($/).reject{|i| i=="Gemfile.lock" }
|
15
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
18
|
gem.require_paths = ["lib"]
|
18
19
|
|
20
|
+
gem.add_development_dependency 'rake'
|
21
|
+
gem.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
gem.add_development_dependency 'minitest'
|
23
|
+
gem.add_development_dependency 'backports'
|
24
|
+
|
19
25
|
gem.add_dependency 'serialport', '>= 1.1.0'
|
20
26
|
gem.add_dependency 'args_parser', '>= 0.1.4'
|
21
27
|
gem.add_dependency 'event_emitter', '>= 0.2.4'
|
@@ -5,7 +5,8 @@ module ArduinoFirmata
|
|
5
5
|
|
6
6
|
attr_reader :version, :status, :nonblock_io, :eventmachine
|
7
7
|
|
8
|
-
def initialize(
|
8
|
+
def initialize(serialport_name, params)
|
9
|
+
@serialport_name = serialport_name
|
9
10
|
@nonblock_io = !!params[:nonblock_io]
|
10
11
|
@eventmachine = !!params[:eventmachine]
|
11
12
|
@read_byte_size = eventmachine ? 256 : 9600
|
@@ -24,26 +25,13 @@ module ArduinoFirmata
|
|
24
25
|
|
25
26
|
@version = nil
|
26
27
|
|
27
|
-
@serial = SerialPort.new(
|
28
|
-
@serial.read_timeout =
|
29
|
-
sleep 3
|
28
|
+
@serial = SerialPort.new(@serialport_name, params[:bps], params[:bit], params[:stopbit], params[:parity])
|
29
|
+
@serial.read_timeout = 10
|
30
|
+
sleep 3 if old_arduino_device?
|
30
31
|
@status = Status::OPEN
|
31
32
|
|
32
|
-
|
33
|
+
at_exit do
|
33
34
|
close
|
34
|
-
exit
|
35
|
-
end
|
36
|
-
trap 'SIGINT' do
|
37
|
-
close
|
38
|
-
exit
|
39
|
-
end
|
40
|
-
trap 'SIGKILL' do
|
41
|
-
close
|
42
|
-
exit
|
43
|
-
end
|
44
|
-
trap 'SIGTERM' do
|
45
|
-
close
|
46
|
-
exit
|
47
35
|
end
|
48
36
|
|
49
37
|
@thread_status = false
|
@@ -70,7 +58,7 @@ module ArduinoFirmata
|
|
70
58
|
sleep 0.5
|
71
59
|
break if @version
|
72
60
|
end
|
73
|
-
sleep 0.5
|
61
|
+
sleep 0.5 if old_arduino_device?
|
74
62
|
end
|
75
63
|
|
76
64
|
def run(&block)
|
@@ -82,6 +70,10 @@ module ArduinoFirmata
|
|
82
70
|
end
|
83
71
|
end
|
84
72
|
|
73
|
+
def old_arduino_device?
|
74
|
+
File.basename(@serialport_name) !~ /^tty\.usbmodem/
|
75
|
+
end
|
76
|
+
|
85
77
|
def close
|
86
78
|
return if status == Status::CLOSE
|
87
79
|
@status = Status::CLOSE
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arduino_firmata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
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: backports
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
13
69
|
- !ruby/object:Gem::Dependency
|
14
70
|
name: serialport
|
15
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +154,8 @@ files:
|
|
98
154
|
- test/test_helper.rb
|
99
155
|
- test/test_sysex.rb
|
100
156
|
homepage: http://shokai.github.com/arduino_firmata
|
101
|
-
licenses:
|
157
|
+
licenses:
|
158
|
+
- MIT
|
102
159
|
metadata: {}
|
103
160
|
post_install_message:
|
104
161
|
rdoc_options: []
|