cwiid 0.1.3 → 0.1.4
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 +7 -0
- data/Rakefile +5 -88
- data/config.rb +23 -0
- data/ext/wiimote.cc +21 -4
- data/ext/wiimote.hh +3 -1
- metadata +33 -61
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6ab3d7f6da791942d6b8756c3881fdf0988c1997
|
4
|
+
data.tar.gz: 04c99b6c964449170edb726ec5b5ed5cb8a7f668
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6dcc63f0279e8cecdcd441fd3ddb9c3acd4f63cc32dccd4529cd94038b5370657058db49967d74ed9a2263c5fc61e2810f5c67ee57f41c0b430050148e22b599
|
7
|
+
data.tar.gz: 0c14e5090d3bb65f9310f27b5d387795862a893ca822967917319e2496895674abefe85c419042ec21f468d84fd4c7cc79acf8fffe44307443ec91068f532f73
|
data/Rakefile
CHANGED
@@ -5,32 +5,14 @@ require 'rake/testtask'
|
|
5
5
|
require 'rake/packagetask'
|
6
6
|
require 'rake/loaders/makefile'
|
7
7
|
require 'rbconfig'
|
8
|
-
|
9
|
-
PKG_NAME = 'cwiid'
|
10
|
-
PKG_VERSION = '0.1.3'
|
11
|
-
CFG = RbConfig::CONFIG
|
12
|
-
CXX = ENV[ 'CXX' ] || 'g++'
|
13
|
-
RB_FILES = FileList[ 'lib/**/*.rb' ]
|
14
|
-
CC_FILES = FileList[ 'ext/*.cc' ]
|
15
|
-
HH_FILES = FileList[ 'ext/*.hh' ] + FileList[ 'ext/*.tcc' ]
|
16
|
-
TC_FILES = FileList[ 'test/tc_*.rb' ]
|
17
|
-
TS_FILES = FileList[ 'test/ts_*.rb' ]
|
18
|
-
SO_FILE = "ext/cwiid.#{CFG[ 'DLEXT' ]}"
|
19
|
-
PKG_FILES = [ 'Rakefile', 'README.md', 'COPYING', '.document' ] +
|
20
|
-
RB_FILES + CC_FILES + HH_FILES + TS_FILES + TC_FILES
|
21
|
-
BIN_FILES = [ 'README.md', 'COPYING', '.document', SO_FILE ] +
|
22
|
-
RB_FILES + TS_FILES + TC_FILES
|
23
|
-
SUMMARY = %q{Using the Wii Remote with Ruby}
|
24
|
-
DESCRIPTION = %q{This Ruby extension provides an inerface to access a Wii Remote using the libcwiid library.}
|
25
|
-
AUTHOR = %q{Jan Wedekind}
|
26
|
-
EMAIL = %q{jan@wedesoft.de}
|
27
|
-
HOMEPAGE = %q{http://wedesoft.github.com/cwiid/}
|
8
|
+
require_relative 'config'
|
28
9
|
|
29
10
|
OBJ = CC_FILES.ext 'o'
|
30
11
|
$CXXFLAGS = "-DNDEBUG #{CFG[ 'CPPFLAGS' ]} #{CFG[ 'CFLAGS' ]}"
|
31
|
-
if CFG[
|
32
|
-
$CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[
|
33
|
-
|
12
|
+
if CFG['rubyarchhdrdir']
|
13
|
+
$CXXFLAGS = "#{$CXXFLAGS} -I#{CFG['rubyhdrdir']} -I#{CFG['rubyarchhdrdir']}"
|
14
|
+
elsif CFG['rubyhdrdir']
|
15
|
+
$CXXFLAGS = "#{$CXXFLAGS} -I#{CFG['rubyhdrdir' ]} -I#{CFG['rubyhdrdir']}/#{CFG['arch']}"
|
34
16
|
else
|
35
17
|
$CXXFLAGS = "#{$CXXFLAGS} -I#{CFG[ 'archdir' ]}"
|
36
18
|
end
|
@@ -92,71 +74,6 @@ Rake::PackageTask.new PKG_NAME, PKG_VERSION do |p|
|
|
92
74
|
p.package_files = PKG_FILES
|
93
75
|
end
|
94
76
|
|
95
|
-
begin
|
96
|
-
require 'rubygems'
|
97
|
-
require 'rubygems/builder'
|
98
|
-
$SPEC = Gem::Specification.new do |s|
|
99
|
-
s.name = PKG_NAME
|
100
|
-
s.version = PKG_VERSION
|
101
|
-
s.platform = Gem::Platform::RUBY
|
102
|
-
s.date = Date.today.to_s
|
103
|
-
s.summary = SUMMARY
|
104
|
-
s.description = DESCRIPTION
|
105
|
-
s.author = AUTHOR
|
106
|
-
s.email = EMAIL
|
107
|
-
s.homepage = HOMEPAGE
|
108
|
-
s.files = PKG_FILES
|
109
|
-
s.test_files = TC_FILES
|
110
|
-
s.require_paths = [ 'lib', 'ext' ]
|
111
|
-
s.extensions = %w{Rakefile}
|
112
|
-
s.has_rdoc = 'yard'
|
113
|
-
s.extra_rdoc_files = []
|
114
|
-
s.rdoc_options = %w{--no-private}
|
115
|
-
s.add_development_dependency %q{rake}
|
116
|
-
end
|
117
|
-
GEM_SOURCE = "#{PKG_NAME}-#{PKG_VERSION}.gem"
|
118
|
-
$BINSPEC = Gem::Specification.new do |s|
|
119
|
-
s.name = PKG_NAME
|
120
|
-
s.version = PKG_VERSION
|
121
|
-
s.platform = Gem::Platform::CURRENT
|
122
|
-
s.date = Date.today.to_s
|
123
|
-
s.summary = SUMMARY
|
124
|
-
s.description = DESCRIPTION
|
125
|
-
s.author = AUTHOR
|
126
|
-
s.email = EMAIL
|
127
|
-
s.homepage = HOMEPAGE
|
128
|
-
s.files = BIN_FILES
|
129
|
-
s.test_files = TC_FILES
|
130
|
-
s.require_paths = [ 'lib', 'ext' ]
|
131
|
-
s.has_rdoc = 'yard'
|
132
|
-
s.extra_rdoc_files = []
|
133
|
-
s.rdoc_options = %w{--no-private}
|
134
|
-
end
|
135
|
-
GEM_BINARY = "#{PKG_NAME}-#{PKG_VERSION}-#{$BINSPEC.platform}.gem"
|
136
|
-
desc "Build the gem file #{GEM_SOURCE}"
|
137
|
-
task :gem => [ "pkg/#{GEM_SOURCE}" ]
|
138
|
-
file "pkg/#{GEM_SOURCE}" => [ 'pkg' ] + $SPEC.files do
|
139
|
-
when_writing 'Creating GEM' do
|
140
|
-
Gem::Builder.new( $SPEC ).build
|
141
|
-
verbose true do
|
142
|
-
FileUtils.mv GEM_SOURCE, "pkg/#{GEM_SOURCE}"
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
desc "Build the gem file #{GEM_BINARY}"
|
147
|
-
task :gem_binary => [ "pkg/#{GEM_BINARY}" ]
|
148
|
-
file "pkg/#{GEM_BINARY}" => [ 'pkg' ] + $BINSPEC.files do
|
149
|
-
when_writing 'Creating binary GEM' do
|
150
|
-
Gem::Builder.new( $BINSPEC ).build
|
151
|
-
verbose true do
|
152
|
-
FileUtils.mv GEM_BINARY, "pkg/#{GEM_BINARY}"
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
rescue LoadError
|
157
|
-
STDERR.puts 'Please install \'rubygems\' if you want to create Gem packages'
|
158
|
-
end
|
159
|
-
|
160
77
|
rule '.o' => '.cc' do |t|
|
161
78
|
sh "#{CXX} #{$CXXFLAGS} -c -o #{t.name} #{t.source}"
|
162
79
|
end
|
data/config.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
PKG_NAME = 'cwiid'
|
4
|
+
PKG_VERSION = '0.1.4'
|
5
|
+
CFG = RbConfig::CONFIG
|
6
|
+
CXX = ENV[ 'CXX' ] || 'g++'
|
7
|
+
RB_FILES = ['config.rb'] + FileList[ 'lib/**/*.rb' ]
|
8
|
+
CC_FILES = FileList[ 'ext/*.cc' ]
|
9
|
+
HH_FILES = FileList[ 'ext/*.hh' ] + FileList[ 'ext/*.tcc' ]
|
10
|
+
TC_FILES = FileList[ 'test/tc_*.rb' ]
|
11
|
+
TS_FILES = FileList[ 'test/ts_*.rb' ]
|
12
|
+
SO_FILE = "ext/cwiid.#{CFG[ 'DLEXT' ]}"
|
13
|
+
PKG_FILES = [ 'Rakefile', 'README.md', 'COPYING', '.document' ] +
|
14
|
+
RB_FILES + CC_FILES + HH_FILES + TS_FILES + TC_FILES
|
15
|
+
BIN_FILES = [ 'README.md', 'COPYING', '.document', SO_FILE ] +
|
16
|
+
RB_FILES + TS_FILES + TC_FILES
|
17
|
+
SUMMARY = %q{Using the Wii Remote with Ruby}
|
18
|
+
DESCRIPTION = %q{This Ruby extension provides an inerface to access a Wii Remote using the libcwiid library.}
|
19
|
+
AUTHOR = %q{Jan Wedekind}
|
20
|
+
EMAIL = %q{jan@wedesoft.de}
|
21
|
+
HOMEPAGE = %q{http://wedesoft.github.com/cwiid/}
|
22
|
+
|
23
|
+
|
data/ext/wiimote.cc
CHANGED
@@ -53,13 +53,14 @@ void WiiMote::close(void)
|
|
53
53
|
};
|
54
54
|
}
|
55
55
|
|
56
|
-
|
56
|
+
int WiiMote::requestStatus(void) throw (Error)
|
57
57
|
{
|
58
58
|
ERRORMACRO( m_wiimote != NULL, Error, , "Wii Remote is closed. "
|
59
59
|
"Did you call \"close\" before?" );
|
60
60
|
m_error = false;
|
61
|
-
cwiid_request_status( m_wiimote );
|
61
|
+
int status = cwiid_request_status( m_wiimote );
|
62
62
|
ERRORMACRO( !m_error, Error, , "Status request error: " << m_errorMsg );
|
63
|
+
return status;
|
63
64
|
}
|
64
65
|
|
65
66
|
void WiiMote::getState(void) throw (Error)
|
@@ -151,6 +152,11 @@ char WiiMote::getIRSize( int i )
|
|
151
152
|
return m_state.ir_src[ i ].size;
|
152
153
|
}
|
153
154
|
|
155
|
+
unsigned short int WiiMote::getMotionPlus( int id )
|
156
|
+
{
|
157
|
+
return m_state.ext.motionplus.angle_rate[ id ];
|
158
|
+
}
|
159
|
+
|
154
160
|
void WiiMote::err( const char *s, va_list ap )
|
155
161
|
{
|
156
162
|
char buffer[4096];
|
@@ -214,6 +220,8 @@ VALUE WiiMote::registerRubyClass(void)
|
|
214
220
|
RUBY_METHOD_FUNC( wrapGetAcc ), 0 );
|
215
221
|
rb_define_method( cRubyClass, "ir",
|
216
222
|
RUBY_METHOD_FUNC( wrapGetIR ), 0 );
|
223
|
+
rb_define_method( cRubyClass, "motionplus",
|
224
|
+
RUBY_METHOD_FUNC( wrapGetMotionPlus ), 0 );
|
217
225
|
return cRubyClass;
|
218
226
|
}
|
219
227
|
|
@@ -244,13 +252,14 @@ VALUE WiiMote::wrapClose( VALUE rbSelf )
|
|
244
252
|
|
245
253
|
VALUE WiiMote::wrapRequestStatus( VALUE rbSelf )
|
246
254
|
{
|
255
|
+
VALUE rbRetVal = Qnil;
|
247
256
|
try {
|
248
257
|
WiiMotePtr *self; Data_Get_Struct( rbSelf, WiiMotePtr, self );
|
249
|
-
(*self)->requestStatus();
|
258
|
+
rbRetVal = INT2NUM( (*self)->requestStatus() );
|
250
259
|
} catch ( exception &e ) {
|
251
260
|
rb_raise( rb_eRuntimeError, "%s", e.what() );
|
252
261
|
};
|
253
|
-
return
|
262
|
+
return rbRetVal;
|
254
263
|
}
|
255
264
|
|
256
265
|
VALUE WiiMote::wrapGetState( VALUE rbSelf )
|
@@ -349,3 +358,11 @@ VALUE WiiMote::wrapGetIR( VALUE rbSelf )
|
|
349
358
|
return rbRetVal;
|
350
359
|
}
|
351
360
|
|
361
|
+
VALUE WiiMote::wrapGetMotionPlus( VALUE rbSelf )
|
362
|
+
{
|
363
|
+
WiiMotePtr *self; Data_Get_Struct( rbSelf, WiiMotePtr, self );
|
364
|
+
return rb_ary_new3( 3, INT2NUM( (*self)->getMotionPlus( 0 ) ),
|
365
|
+
INT2NUM( (*self)->getMotionPlus( 1 ) ),
|
366
|
+
INT2NUM( (*self)->getMotionPlus( 2 ) ) );
|
367
|
+
}
|
368
|
+
|
data/ext/wiimote.hh
CHANGED
@@ -27,7 +27,7 @@ public:
|
|
27
27
|
WiiMote(void) throw (Error);
|
28
28
|
virtual ~WiiMote(void);
|
29
29
|
void close(void);
|
30
|
-
|
30
|
+
int requestStatus(void) throw (Error);
|
31
31
|
void getState(void) throw (Error);
|
32
32
|
unsigned char getRptMode(void);
|
33
33
|
void setRptMode( unsigned char mode ) throw (Error);
|
@@ -42,6 +42,7 @@ public:
|
|
42
42
|
unsigned short int getIRX( int i );
|
43
43
|
unsigned short int getIRY( int i );
|
44
44
|
char getIRSize( int i );
|
45
|
+
unsigned short int getMotionPlus( int i );
|
45
46
|
void err( const char *s, va_list ap );
|
46
47
|
static VALUE cRubyClass;
|
47
48
|
static VALUE registerRubyClass(void);
|
@@ -60,6 +61,7 @@ public:
|
|
60
61
|
static VALUE wrapGetButtons( VALUE rbSelf );
|
61
62
|
static VALUE wrapGetAcc( VALUE rbSelf );
|
62
63
|
static VALUE wrapGetIR( VALUE rbSelf );
|
64
|
+
static VALUE wrapGetMotionPlus( VALUE rbSelf );
|
63
65
|
static WiiMote *current;
|
64
66
|
protected:
|
65
67
|
cwiid_wiimote_t *m_wiimote;
|
metadata
CHANGED
@@ -1,86 +1,58 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: cwiid
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 3
|
9
|
-
version: 0.1.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Jan Wedekind
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: rake
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
version: "0"
|
31
|
-
type: :development
|
32
|
-
version_requirements: *id001
|
33
|
-
description: This Ruby extension provides an inerface to access a Wii Remote using the libcwiid library.
|
11
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This Ruby extension provides an inerface to access a Wii Remote using
|
14
|
+
the libcwiid library.
|
34
15
|
email: jan@wedesoft.de
|
35
16
|
executables: []
|
36
|
-
|
37
|
-
extensions:
|
17
|
+
extensions:
|
38
18
|
- Rakefile
|
39
19
|
extra_rdoc_files: []
|
40
|
-
|
41
|
-
|
42
|
-
- Rakefile
|
43
|
-
- README.md
|
20
|
+
files:
|
21
|
+
- ".document"
|
44
22
|
- COPYING
|
45
|
-
- .
|
46
|
-
-
|
47
|
-
-
|
48
|
-
- ext/init.cc
|
49
|
-
- ext/wiimote.hh
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- config.rb
|
50
26
|
- ext/error.hh
|
27
|
+
- ext/init.cc
|
51
28
|
- ext/rubyinc.hh
|
52
|
-
|
29
|
+
- ext/wiimote.cc
|
30
|
+
- ext/wiimote.hh
|
31
|
+
- lib/cwiid_ext.rb
|
53
32
|
homepage: http://wedesoft.github.com/cwiid/
|
54
33
|
licenses: []
|
55
|
-
|
34
|
+
metadata: {}
|
56
35
|
post_install_message:
|
57
|
-
rdoc_options:
|
58
|
-
- --no-private
|
59
|
-
require_paths:
|
36
|
+
rdoc_options:
|
37
|
+
- "--no-private"
|
38
|
+
require_paths:
|
60
39
|
- lib
|
61
40
|
- ext
|
62
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
-
|
64
|
-
requirements:
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
65
43
|
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
|
-
requirements:
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
73
48
|
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
|
76
|
-
- 0
|
77
|
-
version: "0"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
78
51
|
requirements: []
|
79
|
-
|
80
52
|
rubyforge_project:
|
81
|
-
rubygems_version:
|
53
|
+
rubygems_version: 2.4.6
|
82
54
|
signing_key:
|
83
|
-
specification_version:
|
55
|
+
specification_version: 4
|
84
56
|
summary: Using the Wii Remote with Ruby
|
85
57
|
test_files: []
|
86
|
-
|
58
|
+
has_rdoc: yard
|