wiimote_sps 0.1.2 → 0.2.0
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
- checksums.yaml.gz.sig +0 -0
- data/lib/wiimote_sps.rb +41 -5
- data.tar.gz.sig +1 -2
- metadata +24 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09dcf0f07cd4c5f897ce97a605e00ac2feaae6b8
|
4
|
+
data.tar.gz: b89732f36ae450570914b99509745858bee3523d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e191d3cc1163a5965ef9c115285d6a3deceb8c5d0a0c74c342df25e06e026f8b52a7a84ec25b8b40c7ebe4384ee53d9b4608d7c740df5e5dd12e129456997227
|
7
|
+
data.tar.gz: 40e39c9ff17d1f640d5029ea84b89a64ece51a2fbe1273f5309a9c34b53ca9d825f3e5665b86d1db5602edad49b229d5af1f100c920d50f245a945b4cd3011ad
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/wiimote_sps.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# file: wiimote_sps.rb
|
4
4
|
|
5
5
|
require 'sps-pub'
|
6
|
+
require 'sps-sub'
|
6
7
|
require 'simple_wiimote'
|
7
8
|
|
8
9
|
|
@@ -14,14 +15,47 @@ class WiimoteSps < SimpleWiimote
|
|
14
15
|
super()
|
15
16
|
@device_id = device_id
|
16
17
|
@pub = SPSPub.new address: sps_address
|
18
|
+
@sub = SPSSub.new address: sps_address, callback: self
|
19
|
+
|
20
|
+
|
17
21
|
@pub.notice @device_id + '/info: wiimote initialized'
|
18
22
|
|
19
23
|
end
|
24
|
+
|
25
|
+
def activate
|
26
|
+
|
27
|
+
Thread.new do
|
28
|
+
@sub.subscribe topic: 'wiimote/output/#'
|
29
|
+
end
|
30
|
+
|
31
|
+
super()
|
20
32
|
|
21
|
-
def notify(m)
|
22
|
-
@pub.notice @device_id + '/input: ' + m
|
23
33
|
end
|
34
|
+
|
35
|
+
def ontopic(topic, msg)
|
24
36
|
|
37
|
+
case topic
|
38
|
+
when /rumble$/
|
39
|
+
|
40
|
+
case msg
|
41
|
+
when /^buzz/
|
42
|
+
self.rumble = true
|
43
|
+
sleep 0.3
|
44
|
+
self.rumble = false
|
45
|
+
end
|
46
|
+
|
47
|
+
when /led$/
|
48
|
+
case msg
|
49
|
+
when /(\d+)\s+(on|off)/
|
50
|
+
self.led = ($2) == 'on' ? 1 : 0
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def notify(m)
|
56
|
+
@pub.notice @device_id + '/input: ' + m
|
57
|
+
end
|
58
|
+
|
25
59
|
def on_btn_2_up(wm) notify 'button 2 pressed' end
|
26
60
|
def on_btn_1_up(wm) notify 'button 1 pressed' end
|
27
61
|
def on_btn_b_press(wm) notify 'button b pressed' end
|
@@ -29,14 +63,16 @@ class WiimoteSps < SimpleWiimote
|
|
29
63
|
def on_btn_b_down(wm) end
|
30
64
|
def on_btn_a_press(wm) notify 'button a pressed' end
|
31
65
|
def on_btn_minus_press(wm) notify 'button minus pressed' end
|
32
|
-
def on_btn_void1_press(wm) notify 'button void1 pressed' end
|
33
|
-
def on_btn_void2_press(wm) notify 'button void2 pressed' end
|
34
66
|
def on_btn_home_press(wm) notify 'button home pressed' end
|
35
67
|
def on_btn_left_press(wm) notify 'button left pressed' end
|
36
68
|
def on_btn_right_press(wm) notify 'button right pressed' end
|
37
69
|
def on_btn_down_press(wm) notify 'button down pressed' end
|
38
70
|
def on_btn_up_press(wm) notify 'button up pressed' end
|
39
71
|
def on_btn_plus_press(wm) notify 'button plus pressed' end
|
40
|
-
|
72
|
+
|
73
|
+
def on_deactivated()
|
74
|
+
EventMachine.stop
|
75
|
+
end
|
76
|
+
|
41
77
|
|
42
78
|
end
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
�Q����:|/��P�f�����\=kCƍ:Ť�*�ڞ�t�S��}�QZY�(��%�NM]��=aEy������G��fx�l���=�9��5
|
1
|
+
�،oـ*F��E��F�a49OhZgK9�m묦�=�$��-�����=wx�D;�*���������������ݭ6�/�ⳡ�u��x����^D�2~݆0�7��c����̚����:oD4v���m�I���w���b��Q�<3����`2���F����!up9� ީ4rՊ,���:Ȁ�q?*�4P -N�V%�7M�Sp+Y�NH��z�H����W�ʹ�"��C�1���
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wiimote_sps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
ZWXcw1o9dBZIIi2X/e1ZXyvEsO9MeL+7yRK80sfZ7oE58jUBaamzCmoVXuv+xLPL
|
32
32
|
yuu01H8kLkjz1w==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-06-
|
34
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sps-pub
|
@@ -53,6 +53,26 @@ dependencies:
|
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.4.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: sps-sub
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.2'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.2.0
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0.2'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.2.0
|
56
76
|
- !ruby/object:Gem::Dependency
|
57
77
|
name: simple_wiimote
|
58
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,7 +82,7 @@ dependencies:
|
|
62
82
|
version: '0.3'
|
63
83
|
- - ">="
|
64
84
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.3.
|
85
|
+
version: 0.3.3
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -72,7 +92,7 @@ dependencies:
|
|
72
92
|
version: '0.3'
|
73
93
|
- - ">="
|
74
94
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.3.
|
95
|
+
version: 0.3.3
|
76
96
|
description:
|
77
97
|
email: james@r0bertson.co.uk
|
78
98
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|