00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef THINKGEAR_H_
00010 #define THINKGEAR_H_
00011
00069
00070 #ifdef __cplusplus
00071 extern "C" {
00072 #endif
00073
00074
00075
00076
00077
00078
00079 #ifdef NO_DLL_MODIFIERS
00080 #define THINKGEAR_API
00081 #else
00082 #if defined(_WIN32)
00083 #if defined(THINKGEAR_DLL_COMPILE)
00084 #define THINKGEAR_API __declspec( dllexport )
00085 #else
00086 #define THINKGEAR_API __declspec( dllimport )
00087 #endif
00088 #else
00089 #define THINKGEAR_API extern
00090 #endif
00091 #endif
00092
00093 #if !defined(WINVER)
00094 #define WINVER 0x0501
00095 #endif
00096
00101 #define TG_MAX_CONNECTION_HANDLES 128
00102
00106 #define TG_BAUD_1200 1200
00107 #define TG_BAUD_2400 2400
00108 #define TG_BAUD_4800 4800
00109 #define TG_BAUD_9600 9600
00110 #define TG_BAUD_57600 57600
00111 #define TG_BAUD_115200 115200
00112
00116 #define TG_STREAM_PACKETS 0
00117 #define TG_STREAM_5VRAW 1
00118 #define TG_STREAM_FILE_PACKETS 2
00119
00127 #define TG_DATA_BATTERY 0
00128 #define TG_DATA_POOR_SIGNAL 1
00129 #define TG_DATA_ATTENTION 2
00130 #define TG_DATA_MEDITATION 3
00131 #define TG_DATA_RAW 4
00132 #define TG_DATA_DELTA 5
00133 #define TG_DATA_THETA 6
00134 #define TG_DATA_ALPHA1 7
00135 #define TG_DATA_ALPHA2 8
00136 #define TG_DATA_BETA1 9
00137 #define TG_DATA_BETA2 10
00138 #define TG_DATA_GAMMA1 11
00139 #define TG_DATA_GAMMA2 12
00140 #define TG_DATA_BLINK_STRENGTH 37
00141
00142
00150 THINKGEAR_API int
00151 TG_GetDriverVersion();
00152
00153
00173 THINKGEAR_API int
00174 TG_GetNewConnectionId();
00175
00176
00201 THINKGEAR_API int
00202 TG_SetStreamLog( int connectionId, const char *filename );
00203
00204
00229 THINKGEAR_API int
00230 TG_SetDataLog( int connectionId, const char *filename );
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 THINKGEAR_API int
00263 TG_WriteStreamLog( int connectionId, int insertTimestamp, const char *msg );
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295 THINKGEAR_API int
00296 TG_WriteDataLog( int connectionId, int insertTimestamp, const char *msg );
00297
00298
00337 THINKGEAR_API int
00338 TG_EnableLowPassFilter( int connectionId, int rawSamplingRate );
00339
00340
00360 THINKGEAR_API int
00361 TG_EnableBlinkDetection( int connectionId, int enable );
00362
00363
00406 THINKGEAR_API int
00407 TG_Connect( int connectionId, const char *serialPortName, int serialBaudrate,
00408 int serialDataFormat );
00409
00410
00448 THINKGEAR_API int
00449 TG_ReadPackets( int connectionId, int numPackets );
00450
00451
00468 THINKGEAR_API int
00469 TG_GetValueStatus( int connectionId, int dataType );
00470
00471
00499 THINKGEAR_API float
00500 TG_GetValue( int connectionId, int dataType );
00501
00502
00540 THINKGEAR_API int
00541 TG_SendByte( int connectionId, int b );
00542
00543
00572 THINKGEAR_API int
00573 TG_SetBaudrate( int connectionId, int serialBaudrate );
00574
00575
00598 THINKGEAR_API int
00599 TG_SetDataFormat( int connectionId, int serialDataFormat );
00600
00601
00644 THINKGEAR_API int
00645 TG_EnableAutoRead( int connectionId, int enable );
00646
00647
00663 THINKGEAR_API void
00664 TG_Disconnect( int connectionId );
00665
00666
00679 THINKGEAR_API void
00680 TG_FreeConnection( int connectionId );
00681
00682
00683
00684
00685 #if defined(COMPILE_FOR_JNI)
00686
00687 #include <jni.h>
00688
00689
00690
00691
00692
00693
00694 JNIEXPORT jint JNICALL
00695 Java_ThinkGear_GetDriverVersion( JNIEnv *, jclass );
00696
00697
00698
00699
00700
00701
00702 JNIEXPORT jint JNICALL
00703 Java_ThinkGear_GetNewConnectionId( JNIEnv *, jclass );
00704
00705
00706
00707
00708
00709
00710 JNIEXPORT jint JNICALL
00711 Java_ThinkGear_SetStreamLog( JNIEnv *, jclass, jint, jstring );
00712
00713
00714
00715
00716
00717
00718 JNIEXPORT jint JNICALL
00719 Java_ThinkGear_SetDataLog( JNIEnv *, jclass, jint, jstring );
00720
00721
00722
00723
00724
00725
00726 JNIEXPORT jint JNICALL
00727 Java_ThinkGear_WriteStreamLog( JNIEnv *, jclass, jint, jint, jstring );
00728
00729
00730
00731
00732
00733
00734 JNIEXPORT jint JNICALL
00735 Java_ThinkGear_WriteDataLog( JNIEnv *, jclass, jint, jint, jstring );
00736
00737
00738
00739
00740
00741
00742 JNIEXPORT jint JNICALL
00743 Java_ThinkGear_Connect( JNIEnv *, jclass, jint, jstring, jint, jint );
00744
00745
00746
00747
00748
00749
00750 JNIEXPORT jint JNICALL
00751 Java_ThinkGear_ReadPackets( JNIEnv *, jclass, jint, jint );
00752
00753
00754
00755
00756
00757
00758 JNIEXPORT jdouble JNICALL
00759 Java_ThinkGear_GetValue( JNIEnv *, jclass, jint, jint );
00760
00761
00762
00763
00764
00765
00766 JNIEXPORT jint JNICALL
00767 Java_ThinkGear_GetValueStatus( JNIEnv *, jclass, jint, jint );
00768
00769
00770
00771
00772
00773
00774 JNIEXPORT jint JNICALL
00775 Java_ThinkGear_SendByte( JNIEnv *, jclass, jint, jint );
00776
00777
00778
00779
00780
00781
00782 JNIEXPORT jint JNICALL
00783 Java_ThinkGear_SetBaudrate( JNIEnv *, jclass, jint, jint );
00784
00785
00786
00787
00788
00789
00790 JNIEXPORT jint JNICALL
00791 Java_ThinkGear_SetDataFormat( JNIEnv *, jclass, jint, jint );
00792
00793
00794
00795
00796
00797
00798 JNIEXPORT void JNICALL
00799 Java_ThinkGear_Disconnect( JNIEnv *, jclass, jint );
00800
00801
00802
00803
00804
00805
00806 JNIEXPORT void JNICALL
00807 Java_ThinkGear_FreeInstance( JNIEnv *, jclass, jint );
00808
00809 #endif
00810
00811
00812
00813 #ifdef __cplusplus
00814 }
00815 #endif
00816
00817 #endif