wiiremote.h

Go to the documentation of this file.
00001 /************************************************************
00002 * Copyright (C) 2006-2008 Masahiko SAWAI All Rights Reserved. 
00003 ************************************************************/
00004 #ifndef WIIREMOTE_H
00005 #define WIIREMOTE_H
00006 
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019 
00020 #include <stdlib.h> /* size_t */
00021 
00022 
00023 #define WRMT_MAX_DEVICES 32
00024 
00025 #define WRMT_MASK_BUTTON_TWO    0x0001
00026 #define WRMT_MASK_BUTTON_ONE    0x0002
00027 #define WRMT_MASK_BUTTON_B      0x0004
00028 #define WRMT_MASK_BUTTON_A      0x0008
00029 #define WRMT_MASK_BUTTON_MINUS  0x0010
00030 #define WRMT_MASK_BUTTON_HOME   0x0080
00031 #define WRMT_MASK_BUTTON_LEFT   0x0100
00032 #define WRMT_MASK_BUTTON_RIGHT  0x0200
00033 #define WRMT_MASK_BUTTON_DOWN   0x0400
00034 #define WRMT_MASK_BUTTON_UP     0x0800
00035 #define WRMT_MASK_BUTTON_PLUS   0x1000
00036 #define WRMT_MASK_BUTTONS (\
00037     WRMT_MASK_BUTTON_TWO|WRMT_MASK_BUTTON_ONE| \
00038     WRMT_MASK_BUTTON_B|WRMT_MASK_BUTTON_A| \
00039     WRMT_MASK_BUTTON_MINUS|WRMT_MASK_BUTTON_HOME| \
00040     WRMT_MASK_BUTTON_LEFT|WRMT_MASK_BUTTON_RIGHT| \
00041     WRMT_MASK_BUTTON_DOWN|WRMT_MASK_BUTTON_UP| \
00042     WRMT_MASK_BUTTON_PLUS)
00043 
00044 #define WRMT_MASK_LED_1    0x0001
00045 #define WRMT_MASK_LED_2    0x0002
00046 #define WRMT_MASK_LED_3    0x0004
00047 #define WRMT_MASK_LED_4    0x0008
00048 #define WRMT_MASK_LEDS (\
00049     WRMT_MASK_LED_1|WRMT_MASK_LED_2|\
00050     WRMT_MASK_LED_3|WRMT_MASK_LED_4)
00051 
00060 #define WRMT_SPEAKER_SAMPLE_RATE_4200 0x0B
00061 #define WRMT_SPEAKER_SAMPLE_RATE_3920 0x0C
00062 #define WRMT_SPEAKER_SAMPLE_RATE_3640 0x0D
00063 #define WRMT_SPEAKER_SAMPLE_RATE_3360 0x0E
00064 #define WRMT_SPEAKER_SAMPLE_RATE_3080 0x0F
00065 
00066 
00076 typedef enum 
00077 {
00078     WRMT_FUNCTION_CONTINUOUS = 0,
00079     WRMT_FUNCTION_MOTION,
00080     WRMT_FUNCTION_IR,
00081     WRMT_FUNCTION_SPEAKER,
00082     WRMT_NUMBER_OF_FUNCTIONS,
00083 } WRMT_FunctionType;
00084 
00090 typedef enum 
00091 {
00092     /* read write data */
00093     WRMT_DATA_FORCE_FEEDBACK = 0,
00094     WRMT_DATA_LEDS,
00095     WRMT_DATA_SPEAKER_FORMAT,
00096     WRMT_DATA_SPEAKER_VOLUME,
00097     WRMT_DATA_SPEAKER_SAMPLE_RATE,
00098     /* read only data */
00099     WRMT_DATA_BUTTONS,
00100     WRMT_DATA_MOTION_X,
00101     WRMT_DATA_MOTION_Y,
00102     WRMT_DATA_MOTION_Z,
00103     WRMT_DATA_IR1_FOUND,
00104     WRMT_DATA_IR1_SIZE,
00105     WRMT_DATA_IR1_X,
00106     WRMT_DATA_IR1_Y,
00107     WRMT_DATA_IR2_FOUND,
00108     WRMT_DATA_IR2_SIZE,
00109     WRMT_DATA_IR2_X,
00110     WRMT_DATA_IR2_Y,
00111     WRMT_DATA_IR_FOUND,
00112     WRMT_DATA_IR_SIZE,
00113     WRMT_DATA_IR_X,
00114     WRMT_DATA_IR_Y,
00115     WRMT_DATA_BATTERY_LEVEL, /* 0 - 200(?) */
00116     WRMT_NUMBER_OF_DATA_TYPE,
00117 } WRMT_DataType;
00118 
00119 typedef enum 
00120 {
00121     WRMT_IO_TIMEOUT = -2,
00122     WRMT_IO_ERROR = -1,
00123     WRMT_IO_SUCCESS = 0,
00124 } WRMT_IOReturn;
00125 
00126 struct wrmt_wiiremote;
00127 typedef struct wrmt_wiiremote WRMT_WiiRemote;
00128 
00133 /* WRMT_DECLSPEC for win32 */
00134 #ifndef WRMT_DECLSPEC
00135 # if defined(WIN32) && (!defined(__GNUC__)) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
00136 #  ifdef LIBWIIREMOTE_EXPORTS
00137 #   define WRMT_DECLSPEC __declspec(dllexport)
00138 #  else
00139 #   define WRMT_DECLSPEC __declspec(dllimport)
00140 #  endif
00141 # endif
00142 #endif
00143 
00144 /* WRMT_DECLSPEC for others */
00145 #ifndef WRMT_DECLSPEC
00146 # define WRMT_DECLSPEC
00147 #endif
00148 
00149 
00153 extern
00154 WRMT_DECLSPEC
00155 void
00156 WRMT_SetError(const char *message);
00157 
00161 extern
00162 WRMT_DECLSPEC
00163 char *
00164 WRMT_GetError();
00165 
00171 extern
00172 WRMT_DECLSPEC
00173 int
00174 WRMT_Init();
00175 
00180 extern
00181 WRMT_DECLSPEC
00182 void
00183 WRMT_Quit();
00184 
00191 extern
00192 WRMT_DECLSPEC
00193 void
00194 WRMT_Sleep(int ms);
00195 
00202 extern
00203 WRMT_DECLSPEC
00204 int
00205 WRMT_UpdateAll();
00206 
00214 extern
00215 WRMT_DECLSPEC
00216 int
00217 WRMT_Poll();
00218 
00224 extern
00225 WRMT_DECLSPEC
00226 int
00227 WRMT_GetNumWiiRemote();
00228 
00238 extern
00239 WRMT_DECLSPEC
00240 WRMT_WiiRemote *
00241 WRMT_GetWiiRemoteAt(int device_index);
00242 
00249 extern
00250 WRMT_DECLSPEC
00251 WRMT_IOReturn
00252 WRMT_WiiRemote_Open(WRMT_WiiRemote *self);
00253 
00260 extern
00261 WRMT_DECLSPEC
00262 int
00263 WRMT_WiiRemote_IsOpened(WRMT_WiiRemote *self);
00264 
00270 extern
00271 WRMT_DECLSPEC
00272 void
00273 WRMT_WiiRemote_Close(WRMT_WiiRemote *self);
00274 
00284 extern
00285 WRMT_DECLSPEC
00286 int 
00287 WRMT_WiiRemote_IsEnabled(WRMT_WiiRemote *self,
00288     WRMT_FunctionType function_type);
00289 
00301 extern
00302 WRMT_DECLSPEC
00303 void
00304 WRMT_WiiRemote_SetEnabled(WRMT_WiiRemote *self,
00305     WRMT_FunctionType function_type, int value);
00306 
00316 extern
00317 WRMT_DECLSPEC
00318 int 
00319 WRMT_WiiRemote_GetState(WRMT_WiiRemote *self, WRMT_DataType data_type);
00320 
00333 extern
00334 WRMT_DECLSPEC
00335 void
00336 WRMT_WiiRemote_SetState(WRMT_WiiRemote *self, WRMT_DataType data_type,
00337     int value);
00338 
00347 extern
00348 WRMT_DECLSPEC
00349 WRMT_IOReturn
00350 WRMT_WiiRemote_Update(WRMT_WiiRemote *self);
00351 
00359 extern
00360 WRMT_DECLSPEC
00361 WRMT_IOReturn
00362 WRMT_WiiRemote_WriteDataToMemory(WRMT_WiiRemote *self,
00363     int address, const unsigned char *data, size_t data_size);
00364 
00371 extern
00372 WRMT_DECLSPEC
00373 WRMT_IOReturn
00374 WRMT_WiiRemote_PlaySound(WRMT_WiiRemote *self,
00375     const unsigned char *sound_data, size_t sound_data_size);
00376 
00377 #ifdef __cplusplus
00378 }
00379 #endif
00380 
00381 #endif /* WIIREMOTE_H */
00382 

Generated on Sat Feb 16 20:44:49 2008 for libwiiremote by  doxygen 1.5.1