• R/O
  • SSH
  • HTTPS

libwiiremote: Commit


Commit MetaInfo

Revision113 (tree)
Time2008-02-20 17:52:11
Authorsay

Log Message

* wiiremote-ruby.c: Added some comments for RDoc.
* doc/Makefile: Added API document build rules.

Change Summary

Incremental Difference

--- libwiiremote-ruby/wiiremote-ruby.c (revision 112)
+++ libwiiremote-ruby/wiiremote-ruby.c (revision 113)
@@ -45,10 +45,15 @@
4545 return button_mask;
4646 }
4747
48+/************************************************************
49+* WRMT module
50+************************************************************/
51+
4852 /**
49-* WRMT module
53+* Initialize the library system.
54+* It is necessary to call this function before
55+* the call of any other functions.
5056 **/
51-
5257 static
5358 VALUE
5459 WRMT_init(VALUE klass)
@@ -82,6 +87,10 @@
8287 return Qnil;
8388 }
8489
90+/**
91+* Quit the library system.
92+* You should call this function before stop the program.
93+**/
8594 static
8695 VALUE
8796 WRMT_quit(VALUE klass)
@@ -90,6 +99,9 @@
9099 return Qnil;
91100 }
92101
102+/**
103+* Update all opened Wii Remote devices.
104+**/
93105 static
94106 VALUE
95107 WRMT_update_all(VALUE klass)
@@ -98,6 +110,12 @@
98110 return Qnil;
99111 }
100112
113+/**
114+* Checks whether there is input data from the Wii Remote device.
115+* The state is updated if there is data.
116+*
117+* return:: IO_ERROR, IO_TIMEOUT, or updated device index.
118+**/
101119 static
102120 VALUE
103121 WRMT_poll(VALUE klass)
@@ -105,6 +123,11 @@
105123 return INT2NUM(WRMT_Poll());
106124 }
107125
126+/**
127+* Get the number of Wii Remote devices.
128+*
129+* return:: the number of Wii Remote devices.
130+**/
108131 static
109132 VALUE
110133 WRMT_num_wiiremote(VALUE klass)
@@ -112,6 +135,15 @@
112135 return INT2NUM(WRMT_GetNumWiiRemote());
113136 }
114137
138+/**
139+* Get the Wii Remote device at specified index.
140+* If an illegal value is passed to <code>device_index</code>,
141+* the result is undefined.
142+*
143+* device_index_value:: the index of device.
144+* a valid range is 0 to WiiRemote#num_wiiremote-1.
145+* return:: the reference of WiiRemote.
146+**/
115147 static
116148 VALUE
117149 WRMT_wiiremote_at(VALUE klass, VALUE device_index_value)
@@ -123,6 +155,11 @@
123155 return result;
124156 }
125157
158+/**
159+* Get all wiiremote devices as array
160+*
161+* return:: An array of WiiRemote object.
162+**/
126163 static
127164 VALUE
128165 WRMT_wiiremotes(VALUE klass)
@@ -130,6 +167,14 @@
130167 return wiiremotes;
131168 }
132169
170+/**
171+* Check button state utility.
172+*
173+* button_state_value: the button state
174+* button_mask_value: the button mask
175+* return:: true if any button specified by button_mask_value is pressed,
176+* or false.
177+**/
133178 static
134179 VALUE
135180 WRMT_check_button_any(VALUE klass,
@@ -149,6 +194,14 @@
149194 return result;
150195 }
151196
197+/**
198+* Check button state utility.
199+*
200+* button_state_value: the button state
201+* button_mask_value: the button mask
202+* return:: true if all button specified by button_mask_value is pressed,
203+* or false.
204+**/
152205 static
153206 VALUE
154207 WRMT_check_button_all(VALUE klass,
@@ -169,9 +222,9 @@
169222 }
170223
171224
172-/**
225+/************************************************************
173226 * WRMT::WiiRemote class
174-**/
227+************************************************************/
175228
176229 static
177230 VALUE
@@ -181,6 +234,10 @@
181234 return rdata;
182235 }
183236
237+/**
238+* Initialize WiiRemote object.
239+* This is private method, so you can't call from your program.
240+**/
184241 static
185242 VALUE
186243 WiiRemote_initialize(VALUE self, VALUE device_index_value)
@@ -201,6 +258,11 @@
201258 return Qnil;
202259 }
203260
261+/**
262+* Open connection to Wii Remote
263+*
264+* return:: true if success.
265+**/
204266 static
205267 VALUE
206268 WiiRemote_open(VALUE self)
@@ -220,6 +282,11 @@
220282 return result;
221283 }
222284
285+/**
286+* Checks whether the connection to Wii Remote has opened.
287+*
288+* return:: true if the device is opened, or false.
289+**/
223290 static
224291 VALUE
225292 WiiRemote_opened_p(VALUE self)
@@ -236,6 +303,9 @@
236303 return result;
237304 }
238305
306+/**
307+* Close connection to Wii Remote.
308+**/
239309 static
240310 VALUE
241311 WiiRemote_close(VALUE self)
@@ -248,6 +318,9 @@
248318 return Qnil;
249319 }
250320
321+/**
322+* Update the state of the Wii Remote device.
323+**/
251324 static
252325 VALUE
253326 WiiRemote_update(VALUE self)
@@ -266,6 +339,16 @@
266339 return Qnil;
267340 }
268341
342+/**
343+* Checks whether the specified function is enabled.
344+*
345+* function_type_value:: the type of function.
346+* - WRMT::FUNCTION_CONTINUOUS
347+* - WRMT::FUNCTION_MOTION
348+* - WRMT::FUNCTION_IR
349+* - WRMT::FUNCTION_SPEAKER
350+* return:: enable : true, disable : false
351+**/
269352 static
270353 VALUE
271354 WiiRemote_enabled_p(VALUE self, VALUE function_type_value)
@@ -290,6 +373,12 @@
290373 return result;
291374 }
292375
376+/**
377+* Checks whether the continuous mode is enabled.
378+* Same as WiiRemote#enabled?(FUNCTION_CONTINUOUS)
379+*
380+* return:: enable : true, disable : false
381+**/
293382 static
294383 VALUE
295384 WiiRemote_continuous(VALUE self)
@@ -297,6 +386,12 @@
297386 return WiiRemote_enabled_p(self, INT2FIX(WRMT_FUNCTION_CONTINUOUS));
298387 }
299388
389+/**
390+* Checks whether the motion sensor is enabled.
391+* Same as WiiRemote#enabled?(FUNCTION_MOTION)
392+*
393+* return:: enable : true, disable : false
394+**/
300395 static
301396 VALUE
302397 WiiRemote_motion(VALUE self)
@@ -304,6 +399,12 @@
304399 return WiiRemote_enabled_p(self, INT2FIX(WRMT_FUNCTION_MOTION));
305400 }
306401
402+/**
403+* Checks whether the IR sensor is enabled.
404+* Same as WiiRemote#enabled?(FUNCTION_IR)
405+*
406+* return:: enable : true, disable : false
407+**/
307408 static
308409 VALUE
309410 WiiRemote_ir(VALUE self)
@@ -311,6 +412,12 @@
311412 return WiiRemote_enabled_p(self, INT2FIX(WRMT_FUNCTION_IR));
312413 }
313414
415+/**
416+* Checks whether the speaker is enabled.
417+* Same as WiiRemote#enabled?(FUNCTION_SPEAKER)
418+*
419+* return:: enable : true, disable : false
420+**/
314421 static
315422 VALUE
316423 WiiRemote_speaker(VALUE self)
@@ -318,6 +425,17 @@
318425 return WiiRemote_enabled_p(self, INT2FIX(WRMT_FUNCTION_SPEAKER));
319426 }
320427
428+/**
429+* Enable or disable the specified function.
430+* When WiiRemote#update() is called, the function is actually enabled.
431+*
432+* function_type_value:: the type of function.
433+* - WRMT::FUNCTION_CONTINUOUS
434+* - WRMT::FUNCTION_MOTION
435+* - WRMT::FUNCTION_IR
436+* - WRMT::FUNCTION_SPEAKER
437+* value_value:: true or false
438+**/
321439 static
322440 VALUE
323441 WiiRemote_set_enabled(VALUE self, VALUE function_type_value, VALUE value_value)
@@ -355,6 +473,12 @@
355473 return Qnil;
356474 }
357475
476+/**
477+* Enable or disable the continuous mode.
478+* When WiiRemote#update() is called, the mode is actually enabled.
479+*
480+* value_value:: true or false
481+**/
358482 static
359483 VALUE
360484 WiiRemote_set_continuous(VALUE self, VALUE value_value)
@@ -364,6 +488,12 @@
364488 value_value);
365489 }
366490
491+/**
492+* Enable or disable the motion sensor.
493+* When WiiRemote#update() is called, the mode is actually enabled.
494+*
495+* value_value:: true or false
496+**/
367497 static
368498 VALUE
369499 WiiRemote_set_motion(VALUE self, VALUE value_value)
@@ -373,6 +503,12 @@
373503 value_value);
374504 }
375505
506+/**
507+* Enable or disable the ir sensor.
508+* When WiiRemote#update() is called, the mode is actually enabled.
509+*
510+* value_value:: true or false
511+**/
376512 static
377513 VALUE
378514 WiiRemote_set_ir(VALUE self, VALUE value_value)
@@ -382,6 +518,12 @@
382518 value_value);
383519 }
384520
521+/**
522+* Enable or disable the speaker.
523+* When WiiRemote#update() is called, the mode is actually enabled.
524+*
525+* value_value:: true or false
526+**/
385527 static
386528 VALUE
387529 WiiRemote_set_speaker(VALUE self, VALUE value_value)
@@ -413,6 +555,32 @@
413555 return result;
414556 }
415557
558+/**
559+* Get the device state.
560+*
561+* data_type_value::
562+* - WRMT::DATA_FORCE_FEEDBACK
563+* - WRMT::DATA_LEDS
564+* - WRMT::DATA_SPEAKER_FORMAT
565+* - WRMT::DATA_SPEAKER_VOLUME
566+* - WRMT::DATA_SPEAKER_SAMPLE_RATE
567+* - WRMT::DATA_BUTTONS
568+* - WRMT::DATA_MOTION_X
569+* - WRMT::DATA_MOTION_Y
570+* - WRMT::DATA_MOTION_Z
571+* - WRMT::DATA_IR1_FOUND
572+* - WRMT::DATA_IR1_SIZE
573+* - WRMT::DATA_IR1_X
574+* - WRMT::DATA_IR1_Y
575+* - WRMT::DATA_IR2_FOUND
576+* - WRMT::DATA_IR2_SIZE
577+* - WRMT::DATA_IR2_X
578+* - WRMT::DATA_IR2_Y
579+* - WRMT::DATA_IR_FOUND
580+* - WRMT::DATA_IR_SIZE
581+* - WRMT::DATA_IR_X
582+* - WRMT::DATA_IR_Y
583+**/
416584 static
417585 VALUE
418586 WiiRemote_state(VALUE self, VALUE data_type_value)
@@ -420,6 +588,11 @@
420588 return WiiRemote_state_impl(self, NUM2INT(data_type_value));
421589 }
422590
591+/**
592+* Get button state.
593+*
594+* return:: the button state
595+**/
423596 static
424597 VALUE
425598 WiiRemote_buttons(VALUE self)
@@ -427,6 +600,11 @@
427600 return WiiRemote_state_impl(self, WRMT_DATA_BUTTONS);
428601 }
429602
603+/**
604+* Get x axis value of motion sensor.
605+*
606+* return:: motion
607+**/
430608 static
431609 VALUE
432610 WiiRemote_motion_x(VALUE self)
@@ -434,6 +612,11 @@
434612 return WiiRemote_state_impl(self, WRMT_DATA_MOTION_X);
435613 }
436614
615+/**
616+* Get y axis value of motion sensor.
617+*
618+* return:: motion
619+**/
437620 static
438621 VALUE
439622 WiiRemote_motion_y(VALUE self)
@@ -441,6 +624,11 @@
441624 return WiiRemote_state_impl(self, WRMT_DATA_MOTION_Y);
442625 }
443626
627+/**
628+* Get z axis value of motion sensor.
629+*
630+* return:: motion
631+**/
444632 static
445633 VALUE
446634 WiiRemote_motion_z(VALUE self)
@@ -448,6 +636,11 @@
448636 return WiiRemote_state_impl(self, WRMT_DATA_MOTION_Z);
449637 }
450638
639+/**
640+* Get sensor bar state.
641+*
642+* return:: true if sensor bar is found, or false
643+**/
451644 static
452645 VALUE
453646 WiiRemote_ir_found(VALUE self)
@@ -456,6 +649,11 @@
456649 return (NUM2INT(found_value) == 0) ? Qfalse : Qtrue;
457650 }
458651
652+/**
653+* Get the size of IR sensor bar.
654+*
655+* return:: 1-5
656+**/
459657 static
460658 VALUE
461659 WiiRemote_ir_size(VALUE self)
@@ -463,6 +661,11 @@
463661 return WiiRemote_state_impl(self, WRMT_DATA_IR_SIZE);
464662 }
465663
664+/**
665+* Get the X coordinate which a IR sensor detected.
666+*
667+* return:: 0-1023(?)
668+**/
466669 static
467670 VALUE
468671 WiiRemote_ir_x(VALUE self)
@@ -470,6 +673,11 @@
470673 return WiiRemote_state_impl(self, WRMT_DATA_IR_X);
471674 }
472675
676+/**
677+* Get the Y coordinate which a IR sensor detected.
678+*
679+* return:: 0-768(?)
680+**/
473681 static
474682 VALUE
475683 WiiRemote_ir_y(VALUE self)
@@ -477,6 +685,16 @@
477685 return WiiRemote_state_impl(self, WRMT_DATA_IR_Y);
478686 }
479687
688+/**
689+* Set the device state.
690+*
691+* data_type_value::
692+* - WRMT::DATA_FORCE_FEEDBACK
693+* - WRMT::DATA_LEDS
694+* - WRMT::DATA_SPEAKER_FORMAT
695+* - WRMT::DATA_SPEAKER_VOLUME
696+* - WRMT::DATA_SPEAKER_SAMPLE_RATE
697+**/
480698 static
481699 VALUE
482700 WiiRemote_set_state(VALUE self, VALUE data_type_value, VALUE data_value)
@@ -500,6 +718,9 @@
500718 return Qnil;
501719 }
502720
721+/**
722+* Play sound.
723+**/
503724 static
504725 VALUE
505726 WiiRemote_play_sound(VALUE self, VALUE data_value,
@@ -560,7 +781,13 @@
560781 return Qnil;
561782 }
562783
563-
784+/**
785+* Check button state utility.
786+*
787+* button_mask_value: the button mask
788+* return:: true if any button specified by button_mask_value is pressed,
789+* or false.
790+**/
564791 static
565792 VALUE
566793 WiiRemote_check_button_any(VALUE self, VALUE button_mask_value)
@@ -580,6 +807,13 @@
580807 return result;
581808 }
582809
810+/**
811+* Check button state utility.
812+*
813+* button_mask_value: the button mask
814+* return:: true if all button specified by button_mask_value is pressed,
815+* or false.
816+**/
583817 static
584818 VALUE
585819 WiiRemote_check_button_all(VALUE self, VALUE button_mask_value)
--- libwiiremote-ruby/doc/Makefile (nonexistent)
+++ libwiiremote-ruby/doc/Makefile (revision 113)
@@ -0,0 +1,80 @@
1+############################################################
2+# Copyright (C) 2008-2008 Masahiko SAWAI All Rights Reserved.
3+############################################################
4+
5+############################################################
6+# Configuration
7+############################################################
8+
9+# package name
10+package = libwiiremote-ruby
11+version = 0.1.7
12+
13+#
14+top_srcdir = ..
15+RDOC = rdoc
16+
17+############################################################
18+# Files
19+############################################################
20+# for packaging
21+DISTDIR = $(package)-$(version)-doc
22+
23+DIST_SUBDIRS = api/
24+EXTRA_DIST = \
25+ ../README \
26+ ../COPYING \
27+
28+ALL_DIST_FILES = \
29+ $(DIST_SUBDIRS) \
30+ $(EXTRA_DIST) \
31+
32+############################################################
33+# rules
34+############################################################
35+all : apidoc dist
36+
37+
38+## generate api document
39+apidoc :
40+ $(RDOC) -o api ../wiiremote-ruby.c
41+
42+## distribution rules
43+dist : dist-targz
44+
45+dist-dir :
46+ if [ -x $(DISTDIR) ] ; then \
47+ rm -rf $(DISTDIR) ;\
48+ fi;
49+ mkdir $(DISTDIR)
50+ cp -pLR $(ALL_DIST_FILES) $(DISTDIR)
51+ rm -rf `find $(DISTDIR) -name .svn`
52+
53+dist-targz : dist-dir
54+ if [ -f $(top_srcdir)/$(DISTDIR).tar.gz ] ; then \
55+ rm $(top_srcdir)/$(DISTDIR).tar.gz ;\
56+ fi;
57+ if [ -f $(top_srcdir)/$(DISTDIR).tar ] ; then \
58+ rm $(top_srcdir)/$(DISTDIR).tar ;\
59+ fi;
60+ tar cvf $(top_srcdir)/$(DISTDIR).tar $(DISTDIR)
61+ gzip -9 $(top_srcdir)/$(DISTDIR).tar
62+ rm -rf $(DISTDIR)
63+
64+dist-bzip2 : dist-dir
65+ if [ -f $(top_srcdir)/$(DISTDIR).tar.bz2 ] ; then \
66+ rm $(top_srcdir)/$(DISTDIR).tar.bz2 ;\
67+ fi;
68+ if [ -f $(top_srcdir)/$(DISTDIR).tar ] ; then \
69+ rm $(top_srcdir)/$(DISTDIR).tar ;\
70+ fi;
71+ tar cvf $(top_srcdir)/$(DISTDIR).tar $(DISTDIR)
72+ bzip2 -9 $(top_srcdir)/$(DISTDIR).tar
73+ rm -rf $(DISTDIR)
74+
75+distclean : clean
76+
77+clean :
78+ -rm -rf api
79+
80+
Show on old repository browser