wiiremote.h

Go to the documentation of this file.
00001 /************************************************************
00002 * Copyright (C) 2006-2007 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 
00037 #define WRMT_MASK_LED_1   0x0001
00038 #define WRMT_MASK_LED_2   0x0002
00039 #define WRMT_MASK_LED_3   0x0004
00040 #define WRMT_MASK_LED_4   0x0008
00041 
00051 typedef enum 
00052 {
00053     WRMT_FUNCTION_CONTINUOUS = 0,
00054     WRMT_FUNCTION_MOTION,
00055     WRMT_FUNCTION_IR,
00056     WRMT_FUNCTION_SPEAKER,
00057     WRMT_NUMBER_OF_FUNCTIONS,
00058 } WRMT_FunctionType;
00059 
00065 typedef enum 
00066 {
00067     /* read write data */
00068     WRMT_DATA_FORCE_FEEDBACK = 0,
00069     WRMT_DATA_LEDS,
00070     WRMT_DATA_SPEAKER_FORMAT,
00071     WRMT_DATA_SPEAKER_VOLUME,
00072     WRMT_DATA_SPEAKER_SAMPLE_RATE,
00073     /* read only data */
00074     WRMT_DATA_BUTTONS,
00075     WRMT_DATA_MOTION_X,
00076     WRMT_DATA_MOTION_Y,
00077     WRMT_DATA_MOTION_Z,
00078     WRMT_DATA_IR1_FOUND,
00079     WRMT_DATA_IR1_SIZE,
00080     WRMT_DATA_IR1_X,
00081     WRMT_DATA_IR1_Y,
00082     WRMT_DATA_IR2_FOUND,
00083     WRMT_DATA_IR2_SIZE,
00084     WRMT_DATA_IR2_X,
00085     WRMT_DATA_IR2_Y,
00086     WRMT_DATA_IR_FOUND,
00087     WRMT_DATA_IR_SIZE,
00088     WRMT_DATA_IR_X,
00089     WRMT_DATA_IR_Y,
00090     WRMT_DATA_BATTERY_LEVEL, /* 0 - 200(?) */
00091     WRMT_NUMBER_OF_DATA_TYPE,
00092 } WRMT_DataType;
00093 
00094 typedef enum 
00095 {
00096     WRMT_IO_ERROR = -1,
00097     WRMT_IO_SUCCESS = 0,
00098     WRMT_IO_TIMEOUT = 1,
00099 } WRMT_IOReturn;
00100 
00101 struct wrmt_wiiremote;
00102 typedef struct wrmt_wiiremote WRMT_WiiRemote;
00103 
00108 /* WRMT_DECLSPEC for win32 */
00109 #ifndef WRMT_DECLSPEC
00110 # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
00111 #  ifdef LIBWIIREMOTE_EXPORTS
00112 #   define WRMT_DECLSPEC __declspec(dllexport)
00113 #  else
00114 #   define WRMT_DECLSPEC __declspec(dllimport)
00115 #  endif
00116 # endif
00117 #endif
00118 
00119 /* WRMT_DECLSPEC for others */
00120 #ifndef WRMT_DECLSPEC
00121 # define WRMT_DECLSPEC
00122 #endif
00123 
00124 
00128 extern
00129 WRMT_DECLSPEC
00130 void
00131 WRMT_SetError(const char *message);
00132 
00136 extern
00137 WRMT_DECLSPEC
00138 char *
00139 WRMT_GetError();
00140 
00146 extern
00147 WRMT_DECLSPEC
00148 int
00149 WRMT_Init();
00150 
00154 extern
00155 WRMT_DECLSPEC
00156 void
00157 WRMT_Quit();
00158 
00162 extern
00163 WRMT_DECLSPEC
00164 void
00165 WRMT_Sleep(int ms);
00166 
00170 extern
00171 WRMT_DECLSPEC
00172 void
00173 WRMT_Update();
00174 
00179 extern
00180 WRMT_DECLSPEC
00181 WRMT_IOReturn
00182 WRMT_Poll(int *updated_device_index_pointer);
00183 
00187 extern
00188 WRMT_DECLSPEC
00189 int
00190 WRMT_GetNumWiiRemote();
00191 
00195 extern
00196 WRMT_DECLSPEC
00197 WRMT_WiiRemote *
00198 WRMT_GetWiiRemoteAt(int device_index);
00199 
00203 extern
00204 WRMT_DECLSPEC
00205 WRMT_IOReturn
00206 WRMT_WiiRemote_Open(WRMT_WiiRemote *self);
00207 
00211 extern
00212 WRMT_DECLSPEC
00213 int
00214 WRMT_WiiRemote_IsOpened(WRMT_WiiRemote *self);
00215 
00219 extern
00220 WRMT_DECLSPEC
00221 void
00222 WRMT_WiiRemote_Close(WRMT_WiiRemote *self);
00223 
00227 extern
00228 WRMT_DECLSPEC
00229 int 
00230 WRMT_WiiRemote_IsEnabled(WRMT_WiiRemote *self, WRMT_FunctionType type);
00231 
00235 extern
00236 WRMT_DECLSPEC
00237 void
00238 WRMT_WiiRemote_SetEnabled(WRMT_WiiRemote *self, WRMT_FunctionType type, int value);
00239 
00243 extern
00244 WRMT_DECLSPEC
00245 int 
00246 WRMT_WiiRemote_GetState(WRMT_WiiRemote *self, WRMT_DataType type);
00247 
00251 extern
00252 WRMT_DECLSPEC
00253 void
00254 WRMT_WiiRemote_SetState(WRMT_WiiRemote *self, WRMT_DataType type, int value);
00255 
00259 extern
00260 WRMT_DECLSPEC
00261 int
00262 WRMT_WiiRemote_WriteDataToMemory(WRMT_WiiRemote *self,
00263     int address, const unsigned char *data, size_t data_size);
00264 
00265 
00266 #ifdef __cplusplus
00267 }
00268 #endif
00269 
00270 #endif /* WIIREMOTE_H */
00271 

Generated on Mon Jan 7 15:49:11 2008 for libwiiremote by  doxygen 1.5.1