artoo-leapmotion 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +67 -0
- data/LICENSE +13 -0
- data/README.md +78 -0
- data/Rakefile +10 -0
- data/artoo-leapmotion.gemspec +27 -0
- data/examples/leap.rb +26 -0
- data/examples/leap_gesture.rb +22 -0
- data/lib/artoo-leapmotion.rb +3 -0
- data/lib/artoo-leapmotion/version.rb +5 -0
- data/lib/artoo/adaptors/leapmotion.rb +41 -0
- data/lib/artoo/drivers/leapmotion.rb +49 -0
- data/lib/artoo/drivers/leapmotion/frame.rb +24 -0
- data/lib/artoo/drivers/leapmotion/gesture.rb +67 -0
- data/lib/artoo/drivers/leapmotion/hand.rb +25 -0
- data/lib/artoo/drivers/leapmotion/pointable.rb +25 -0
- data/test/adaptors/leapmotion_adaptor_test.rb +6 -0
- data/test/drivers/leapmotion_driver_test.rb +50 -0
- data/test/test_helper.rb +6 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aedf45038f5032ebcb7bc5b37f4c9b6dc187c21c
|
4
|
+
data.tar.gz: 274954450e8dac24847a4cfd3343491ec0882fa4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2db5410b5f963a0b0b2a08a722dbf69c2bce39d1441e10bb7b3affa3ea8e1790e06c736df116a5d1a43ffcf659f4a7fadf1469b8d54d62180d4aa2c36c703eab
|
7
|
+
data.tar.gz: 1db64734a6e116c20b30c403dad080b27c591a26843b8d623160e600d8aae3643aa80574c96e8e0c6f2450db0d77e84452bf5bacf330a0d48163d24fb584c3ea
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
artoo-leapmotion (0.1.1)
|
5
|
+
artoo (~> 1.0.0.rc2)
|
6
|
+
hybridgroup-celluloid-websocket-client
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
artoo (1.0.0.rc3)
|
12
|
+
celluloid (~> 0.14.1)
|
13
|
+
celluloid-io (~> 0.14.1)
|
14
|
+
multi_json (~> 1.6)
|
15
|
+
pry (~> 0.9)
|
16
|
+
rake (~> 10.0)
|
17
|
+
reel (~> 0.4.0.pre)
|
18
|
+
thor (~> 0.18.1)
|
19
|
+
celluloid (0.14.1)
|
20
|
+
timers (>= 1.0.0)
|
21
|
+
celluloid-io (0.14.1)
|
22
|
+
celluloid (>= 0.14.1)
|
23
|
+
nio4r (>= 0.4.5)
|
24
|
+
certified (0.1.1)
|
25
|
+
coderay (1.0.9)
|
26
|
+
http (0.4.0)
|
27
|
+
certified
|
28
|
+
http_parser.rb
|
29
|
+
http_parser.rb (0.5.3)
|
30
|
+
hybridgroup-celluloid-websocket-client (0.0.3)
|
31
|
+
celluloid-io
|
32
|
+
websocket-driver
|
33
|
+
metaclass (0.0.1)
|
34
|
+
method_source (0.8.2)
|
35
|
+
minitest (5.0.6)
|
36
|
+
minitest-happy (1.0.0)
|
37
|
+
mocha (0.14.0)
|
38
|
+
metaclass (~> 0.0.1)
|
39
|
+
multi_json (1.7.7)
|
40
|
+
nio4r (0.4.6)
|
41
|
+
pry (0.9.12.2)
|
42
|
+
coderay (~> 1.0.5)
|
43
|
+
method_source (~> 0.8)
|
44
|
+
slop (~> 3.4)
|
45
|
+
rack (1.5.2)
|
46
|
+
rake (10.1.0)
|
47
|
+
reel (0.4.0.pre)
|
48
|
+
celluloid-io (>= 0.8.0)
|
49
|
+
http (>= 0.2.0)
|
50
|
+
http_parser.rb (>= 0.5.3)
|
51
|
+
rack (>= 1.4.0)
|
52
|
+
websocket_parser (>= 0.1.2)
|
53
|
+
slop (3.4.6)
|
54
|
+
thor (0.18.1)
|
55
|
+
timers (1.1.0)
|
56
|
+
websocket-driver (0.2.1)
|
57
|
+
websocket_parser (0.1.4)
|
58
|
+
http
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
ruby
|
62
|
+
|
63
|
+
DEPENDENCIES
|
64
|
+
artoo-leapmotion!
|
65
|
+
minitest (~> 5.0)
|
66
|
+
minitest-happy
|
67
|
+
mocha (~> 0.14.0)
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2013 The Hybrid Group
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# Artoo Adaptor For Leap Motion
|
2
|
+
|
3
|
+
This repository contains the Artoo (http://artoo.io/) adaptor for the Leap Motion controller (https://www.leapmotion.com/).
|
4
|
+
|
5
|
+
It borrows code from https://github.com/glejeune/ruby-leap-motion-ws, thanks @glejeune
|
6
|
+
|
7
|
+
Artoo is a open source micro-framework for robotics using Ruby.
|
8
|
+
|
9
|
+
For more information abut Artoo, check out our repo at https://github.com/hybridgroup/artoo
|
10
|
+
|
11
|
+
[![Code Climate](https://codeclimate.com/github/hybridgroup/artoo-leapmotion.png)](https://codeclimate.com/github/hybridgroup/artoo-leapmotion) [![Build Status](https://travis-ci.org/hybridgroup/artoo-leapmotion.png?branch=master)](https://travis-ci.org/hybridgroup/artoo-leapmotion)
|
12
|
+
|
13
|
+
## Installing
|
14
|
+
|
15
|
+
```
|
16
|
+
gem install artoo-leapmotion --pre
|
17
|
+
```
|
18
|
+
|
19
|
+
## Using
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'artoo'
|
23
|
+
|
24
|
+
connection :leapmotion, :adaptor => :leapmotion, :port => '127.0.0.1:6437'
|
25
|
+
device :leapmotion, :driver => :leapmotion
|
26
|
+
|
27
|
+
work do
|
28
|
+
on leapmotion, :open => :on_open
|
29
|
+
on leapmotion, :frame => :on_frame
|
30
|
+
on leapmotion, :close => :on_close
|
31
|
+
end
|
32
|
+
|
33
|
+
def on_open(*args)
|
34
|
+
puts args
|
35
|
+
end
|
36
|
+
|
37
|
+
def on_frame(*args)
|
38
|
+
frame = args[1]
|
39
|
+
puts frame
|
40
|
+
puts frame.hands
|
41
|
+
puts frame.gestures
|
42
|
+
puts frame.pointables
|
43
|
+
end
|
44
|
+
|
45
|
+
def on_close(*args)
|
46
|
+
puts args
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
## Connecting to Leap Motion
|
51
|
+
|
52
|
+
### OSX
|
53
|
+
|
54
|
+
The normal OSX download of the Leap Motion software from https://www.leapmotion.com/setup should work with Artoo.
|
55
|
+
|
56
|
+
More instructions need to go here...
|
57
|
+
|
58
|
+
### Ubuntu
|
59
|
+
|
60
|
+
The Linux download of the Leap Motion software can be obtained from https://developer.leapmotion.com/downloads (requires free signup)
|
61
|
+
|
62
|
+
The main steps are:
|
63
|
+
- Connect your computer and the Leap Motion controller
|
64
|
+
- Connect to the device via Artoo
|
65
|
+
|
66
|
+
You will need to run the `leapd` daemon in order to connect your Artoo code to your Leap Motion controller.
|
67
|
+
|
68
|
+
```
|
69
|
+
$ leapd
|
70
|
+
```
|
71
|
+
|
72
|
+
Once your computer is communcating with the Leap Motion controller, the `leapd` program exposes a websocket-based interface to receive data.
|
73
|
+
|
74
|
+
### Windows
|
75
|
+
|
76
|
+
The normal Windows download of the Leap Motion software from https://www.leapmotion.com/setup should work with Artoo.
|
77
|
+
|
78
|
+
More instructions need to go here...
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "artoo-leapmotion/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "artoo-leapmotion"
|
7
|
+
s.version = Artoo::Leapmotion::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Ron Evans"]
|
10
|
+
s.email = ["artoo@hybridgroup.com"]
|
11
|
+
s.homepage = "https://github.com/hybridgroup/artoo-"
|
12
|
+
s.summary = %q{Artoo adaptor and driver for Leap Motion}
|
13
|
+
s.description = %q{Artoo adaptor and driver for Leap Motion}
|
14
|
+
|
15
|
+
s.rubyforge_project = "artoo-leapmotion"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_runtime_dependency 'artoo', '~> 1.0.0.rc2'
|
23
|
+
s.add_runtime_dependency 'hybridgroup-celluloid-websocket-client'
|
24
|
+
s.add_development_dependency 'minitest', '~> 5.0'
|
25
|
+
s.add_development_dependency 'minitest-happy'
|
26
|
+
s.add_development_dependency 'mocha', '~> 0.14.0'
|
27
|
+
end
|
data/examples/leap.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
connection :leapmotion, :adaptor => :leapmotion, :port => '127.0.0.1:6437'
|
4
|
+
device :leapmotion, :driver => :leapmotion
|
5
|
+
|
6
|
+
work do
|
7
|
+
on leapmotion, :open => :on_open
|
8
|
+
on leapmotion, :frame => :on_frame
|
9
|
+
on leapmotion, :close => :on_close
|
10
|
+
end
|
11
|
+
|
12
|
+
def on_open(*args)
|
13
|
+
puts args
|
14
|
+
end
|
15
|
+
|
16
|
+
def on_frame(*args)
|
17
|
+
frame = args[1]
|
18
|
+
puts frame
|
19
|
+
puts frame.hands
|
20
|
+
puts frame.gestures
|
21
|
+
puts frame.pointables
|
22
|
+
end
|
23
|
+
|
24
|
+
def on_close(*args)
|
25
|
+
puts args
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
connection :leapmotion, :adaptor => :leapmotion, :port => '127.0.0.1:6437'
|
4
|
+
device :leapmotion, :driver => :leapmotion
|
5
|
+
|
6
|
+
work do
|
7
|
+
on leapmotion, :open => :on_open
|
8
|
+
on leapmotion, :gesture => :on_gesture
|
9
|
+
on leapmotion, :close => :on_close
|
10
|
+
end
|
11
|
+
|
12
|
+
def on_open(*args)
|
13
|
+
puts args
|
14
|
+
end
|
15
|
+
|
16
|
+
def on_gesture(*args)
|
17
|
+
puts args[1]
|
18
|
+
end
|
19
|
+
|
20
|
+
def on_close(*args)
|
21
|
+
puts args
|
22
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'artoo/adaptors/adaptor'
|
2
|
+
require 'celluloid/websocket/client'
|
3
|
+
|
4
|
+
module Artoo
|
5
|
+
module Adaptors
|
6
|
+
# Connect to a leapmotion device
|
7
|
+
# @see device documentation for more information
|
8
|
+
class Leapmotion < Adaptor
|
9
|
+
finalizer :finalize
|
10
|
+
attr_reader :leap
|
11
|
+
|
12
|
+
# Closes connection with device if connected
|
13
|
+
# @return [Boolean]
|
14
|
+
def finalize
|
15
|
+
disconnect if connected?
|
16
|
+
end
|
17
|
+
|
18
|
+
# Creates a connection with device
|
19
|
+
# @return [Boolean]
|
20
|
+
def connect
|
21
|
+
@leap = Celluloid::WebSocket::Client.new("ws://#{port.host}:#{port.port}/v3.json")
|
22
|
+
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
# Closes connection with device
|
27
|
+
# @return [Boolean]
|
28
|
+
def disconnect
|
29
|
+
leap.close
|
30
|
+
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
# Uses method missing to call device actions
|
35
|
+
# @see device documentation
|
36
|
+
def method_missing(method_name, *arguments, &block)
|
37
|
+
leap.send(method_name, *arguments, &block)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'artoo/drivers/driver'
|
2
|
+
require 'artoo/drivers/leapmotion/frame'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Artoo
|
6
|
+
module Drivers
|
7
|
+
# The leapmotion driver behaviors
|
8
|
+
class Leapmotion < Driver
|
9
|
+
|
10
|
+
# Start driver and any required connections
|
11
|
+
def start_driver
|
12
|
+
begin
|
13
|
+
connection.handler = current_actor
|
14
|
+
connection.start
|
15
|
+
|
16
|
+
super
|
17
|
+
rescue Exception => e
|
18
|
+
Logger.error "Error starting Leapmotion driver!"
|
19
|
+
Logger.error e.message
|
20
|
+
Logger.error e.backtrace.inspect
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def on_open
|
25
|
+
publish(event_topic_name("open"))
|
26
|
+
data = JSON.dump("enableGestures" => true)
|
27
|
+
connection.text(data)
|
28
|
+
end
|
29
|
+
|
30
|
+
def on_message(data)
|
31
|
+
message = JSON.parse(data)
|
32
|
+
if message.key?("id") and message.key?("timestamp")
|
33
|
+
frame = Artoo::Drivers::Leapmotion::Frame.new(message)
|
34
|
+
publish(event_topic_name("frame"), frame)
|
35
|
+
|
36
|
+
frame.gestures.each {|g| publish(event_topic_name("gesture"), g)}
|
37
|
+
else
|
38
|
+
publish(event_topic_name("error"), data)
|
39
|
+
end
|
40
|
+
rescue Exception => e
|
41
|
+
publish(event_topic_name("error"), data)
|
42
|
+
end
|
43
|
+
|
44
|
+
def on_close(code, reason)
|
45
|
+
publish(event_topic_name("close"), code, reason)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'artoo/drivers/leapmotion/gesture'
|
2
|
+
require 'artoo/drivers/leapmotion/pointable'
|
3
|
+
require 'artoo/drivers/leapmotion/hand'
|
4
|
+
|
5
|
+
module Artoo
|
6
|
+
module Drivers
|
7
|
+
# The leapmotion driver behaviors
|
8
|
+
class Leapmotion < Driver
|
9
|
+
class Frame
|
10
|
+
attr_reader :gestures, :pointables, :hands, :id, :timestamp, :r, :s, :t
|
11
|
+
def initialize(data)
|
12
|
+
@hands = Artoo::Drivers::Leapmotion::Hand.list(data)
|
13
|
+
@gestures = Artoo::Drivers::Leapmotion::Gesture.list(data)
|
14
|
+
@pointables = Artoo::Drivers::Leapmotion::Pointable.list(data)
|
15
|
+
@id = data["id"]
|
16
|
+
@timestamp = data["timestamp"]
|
17
|
+
@r = data["r"]
|
18
|
+
@s = data["s"]
|
19
|
+
@t = data["t"]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Artoo
|
2
|
+
module Drivers
|
3
|
+
# The leapmotion driver behaviors
|
4
|
+
class Leapmotion < Driver
|
5
|
+
# Recognized movement by the user
|
6
|
+
#
|
7
|
+
# There is 4 Gesture subclasses :
|
8
|
+
#
|
9
|
+
# Circle - A circular movement by a finger.
|
10
|
+
# Swipe - A straight line movement by the hand with fingers extended.
|
11
|
+
# KeyTap - A downward tapping movement by a finger.
|
12
|
+
# ScreenTap - A forward tapping movement by a finger.
|
13
|
+
class Gesture
|
14
|
+
class Error < StandardError; end
|
15
|
+
|
16
|
+
def self.list(data)
|
17
|
+
gestures = []
|
18
|
+
if data["gestures"]
|
19
|
+
data["gestures"].each do |gesture|
|
20
|
+
gestures << make_gesture(gesture)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
return gestures
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.make_gesture(data)
|
27
|
+
unless data.has_key? "type"
|
28
|
+
raise Error, "gesture type unknown"
|
29
|
+
end
|
30
|
+
name = data["type"][0].upcase << data["type"][1..-1]
|
31
|
+
unless class_exists?(name)
|
32
|
+
raise Error, "gesture class `#{self}::#{name}' invalid"
|
33
|
+
end
|
34
|
+
const_get(name).new(data)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def self.class_exists?(class_name)
|
40
|
+
klass = const_get(class_name)
|
41
|
+
return klass.is_a?(Class)
|
42
|
+
rescue NameError
|
43
|
+
return false
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.define_gesture *names
|
47
|
+
names.each do |n|
|
48
|
+
name = n.to_s
|
49
|
+
unless class_exists?(name)
|
50
|
+
c = Class.new(self) do
|
51
|
+
def initialize(data)
|
52
|
+
data.each do |k, v|
|
53
|
+
instance_variable_set("@#{k}", v)
|
54
|
+
self.class.send(:define_method, k.to_sym, lambda { instance_variable_get("@#{k}") })
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
const_set name, c
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
define_gesture :Circle, :KeyTap, :ScreenTap, :Swipe
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Artoo
|
2
|
+
module Drivers
|
3
|
+
# The leapmotion driver behaviors
|
4
|
+
class Leapmotion < Driver
|
5
|
+
class Hand
|
6
|
+
def self.list(data)
|
7
|
+
hands = []
|
8
|
+
if data["hands"]
|
9
|
+
data["hands"].each do |hand|
|
10
|
+
hands << Artoo::Drivers::Leapmotion::Hand.new(hand)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
return hands
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(data)
|
17
|
+
data.each do |k, v|
|
18
|
+
instance_variable_set("@#{k}", v)
|
19
|
+
self.class.send(:define_method, k.to_sym, lambda { instance_variable_get("@#{k}") })
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Artoo
|
2
|
+
module Drivers
|
3
|
+
# The leapmotion driver behaviors
|
4
|
+
class Leapmotion < Driver
|
5
|
+
class Pointable
|
6
|
+
def self.list(data)
|
7
|
+
pointables = []
|
8
|
+
if data["pointables"]
|
9
|
+
data["pointables"].each do |pointable|
|
10
|
+
pointables << Artoo::Drivers::Leapmotion::Pointable.new(pointable)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
return pointables
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(data)
|
17
|
+
data.each do |k, v|
|
18
|
+
instance_variable_set("@#{k}", v)
|
19
|
+
self.class.send(:define_method, k.to_sym, lambda { instance_variable_get("@#{k}") })
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
|
2
|
+
require 'artoo/drivers/leapmotion'
|
3
|
+
|
4
|
+
def valid_frame
|
5
|
+
{
|
6
|
+
id: '123',
|
7
|
+
timestamp: '123456789'
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
describe Artoo::Drivers::Leapmotion do
|
12
|
+
before do
|
13
|
+
@device = mock('device')
|
14
|
+
@driver = Artoo::Drivers::Leapmotion.new(:parent => @device)
|
15
|
+
@connection = mock('connection')
|
16
|
+
@device.stubs(:connection).returns(@connection)
|
17
|
+
@frame = mock('frame')
|
18
|
+
@frame.stubs(:gestures).returns([])
|
19
|
+
Artoo::Drivers::Leapmotion::Frame.stubs(:new).returns(@frame)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'Leapmotion#on_open' do
|
23
|
+
@device.expects(:event_topic_name).with("open").returns("hi_open")
|
24
|
+
@connection.expects(:text)
|
25
|
+
@driver.on_open
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'Leapmotion#on_message with a frame but no gesture' do
|
29
|
+
@device.expects(:event_topic_name).with("frame")
|
30
|
+
@device.expects(:event_topic_name).with("gesture").never
|
31
|
+
@driver.on_message(JSON.dump(valid_frame))
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'Leapmotion#on_message with a gesture' do
|
35
|
+
@device.expects(:event_topic_name).with("frame")
|
36
|
+
@device.expects(:event_topic_name).with("gesture")
|
37
|
+
@frame.stubs(:gestures).returns(['123'])
|
38
|
+
@driver.on_message(JSON.dump(valid_frame))
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'Leapmotion#error' do
|
42
|
+
@device.expects(:event_topic_name).with("error")
|
43
|
+
@driver.on_message("no good")
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'Leapmotion#on_close' do
|
47
|
+
@device.expects(:event_topic_name).with("close").returns("hi_bye")
|
48
|
+
@driver.on_close(2, "huh")
|
49
|
+
end
|
50
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: artoo-leapmotion
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ron Evans
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: artoo
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0.rc2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0.rc2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hybridgroup-celluloid-websocket-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
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: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-happy
|
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'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mocha
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.14.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.14.0
|
83
|
+
description: Artoo adaptor and driver for Leap Motion
|
84
|
+
email:
|
85
|
+
- artoo@hybridgroup.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- Gemfile
|
91
|
+
- Gemfile.lock
|
92
|
+
- LICENSE
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- artoo-leapmotion.gemspec
|
96
|
+
- examples/leap.rb
|
97
|
+
- examples/leap_gesture.rb
|
98
|
+
- lib/artoo-leapmotion.rb
|
99
|
+
- lib/artoo-leapmotion/version.rb
|
100
|
+
- lib/artoo/adaptors/leapmotion.rb
|
101
|
+
- lib/artoo/drivers/leapmotion.rb
|
102
|
+
- lib/artoo/drivers/leapmotion/frame.rb
|
103
|
+
- lib/artoo/drivers/leapmotion/gesture.rb
|
104
|
+
- lib/artoo/drivers/leapmotion/hand.rb
|
105
|
+
- lib/artoo/drivers/leapmotion/pointable.rb
|
106
|
+
- test/adaptors/leapmotion_adaptor_test.rb
|
107
|
+
- test/drivers/leapmotion_driver_test.rb
|
108
|
+
- test/test_helper.rb
|
109
|
+
homepage: https://github.com/hybridgroup/artoo-
|
110
|
+
licenses: []
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project: artoo-leapmotion
|
128
|
+
rubygems_version: 2.0.3
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Artoo adaptor and driver for Leap Motion
|
132
|
+
test_files: []
|