lego_ev3 0.9.0 → 0.9.1
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.
- checksums.yaml +4 -4
- data/README.md +112 -29
- data/bin/lego-ev3 +66 -13
- data/bin/lego-ev3-tcp-server +19 -0
- data/lib/brick.rb +8 -1
- data/lib/commands/builder.rb +10 -13
- data/lib/commands/lego_sensor.rb +2 -0
- data/lib/commands/tacho_motor.rb +1 -1
- data/lib/connection/base.rb +11 -14
- data/lib/connection/connection.rb +16 -18
- data/lib/connection/local.rb +48 -3
- data/lib/connection/ssh.rb +84 -0
- data/lib/connection/ssh_command.rb +44 -0
- data/lib/connection/tcp_client.rb +64 -0
- data/lib/connection/tcp_server.rb +63 -0
- data/lib/connection/upload.rb +34 -24
- data/lib/exceptions.rb +35 -1
- data/lib/lego_ev3.rb +7 -0
- data/lib/sensors/base.rb +19 -12
- data/lib/sensors/color.rb +76 -0
- data/lib/sensors/infrared.rb +142 -0
- data/lib/sensors/touch.rb +1 -2
- data/lib/tacho_motor.rb +49 -28
- data/lib/utilities.rb +38 -2
- metadata +10 -3
- data/lib/connection/remote.rb +0 -39
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lego_ev3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jodi Giordano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh-simple
|
@@ -29,12 +29,14 @@ description: Uses the amazing ev3dev.org stuff to interface with the Lego EV3 st
|
|
29
29
|
email: giordano.jodi@gmail.com
|
30
30
|
executables:
|
31
31
|
- lego-ev3
|
32
|
+
- lego-ev3-tcp-server
|
32
33
|
extensions: []
|
33
34
|
extra_rdoc_files: []
|
34
35
|
files:
|
35
36
|
- Gemfile
|
36
37
|
- README.md
|
37
38
|
- bin/lego-ev3
|
39
|
+
- bin/lego-ev3-tcp-server
|
38
40
|
- lib/brick.rb
|
39
41
|
- lib/commands/builder.rb
|
40
42
|
- lib/commands/lego_port.rb
|
@@ -43,11 +45,16 @@ files:
|
|
43
45
|
- lib/connection/base.rb
|
44
46
|
- lib/connection/connection.rb
|
45
47
|
- lib/connection/local.rb
|
46
|
-
- lib/connection/
|
48
|
+
- lib/connection/ssh.rb
|
49
|
+
- lib/connection/ssh_command.rb
|
50
|
+
- lib/connection/tcp_client.rb
|
51
|
+
- lib/connection/tcp_server.rb
|
47
52
|
- lib/connection/upload.rb
|
48
53
|
- lib/exceptions.rb
|
49
54
|
- lib/lego_ev3.rb
|
50
55
|
- lib/sensors/base.rb
|
56
|
+
- lib/sensors/color.rb
|
57
|
+
- lib/sensors/infrared.rb
|
51
58
|
- lib/sensors/touch.rb
|
52
59
|
- lib/tacho_motor.rb
|
53
60
|
- lib/utilities.rb
|
data/lib/connection/remote.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'net/ssh/simple'
|
2
|
-
|
3
|
-
module LegoEv3
|
4
|
-
class RemoteConnection < BaseConnection
|
5
|
-
attr_accessor :timeout
|
6
|
-
|
7
|
-
def initialize(host, user, password)
|
8
|
-
super()
|
9
|
-
|
10
|
-
@host = host
|
11
|
-
@user = user
|
12
|
-
@password = password
|
13
|
-
@timeout = 10
|
14
|
-
end
|
15
|
-
|
16
|
-
def close
|
17
|
-
@connection.close if @connection
|
18
|
-
@connection = nil
|
19
|
-
end
|
20
|
-
|
21
|
-
protected
|
22
|
-
|
23
|
-
def create_connection
|
24
|
-
Net::SSH::Simple.new(host_name: @host, user: @user, password: @password, timeout: @timeout)
|
25
|
-
end
|
26
|
-
|
27
|
-
def call_connection(command)
|
28
|
-
begin
|
29
|
-
@connection.ssh(@host, command).stdout
|
30
|
-
rescue => e
|
31
|
-
if e.wrapped.kind_of?(Timeout::Error)
|
32
|
-
raise RemoteConnectionException.new(@host, @user, @password)
|
33
|
-
else
|
34
|
-
raise e
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|