00001 #ifndef __PHLABVIEW
00002 #define __PHLABVIEW
00003 #include "cphidget.h"
00004
00005 #ifndef EXTERNALPROTO
00006
00007 #ifdef _WINDOWS
00008 #include "windows/extcode.h"
00009 #elif _LINUX
00010 #include "extcode.h"
00011 #elif _MACOSX
00012 #include "macos/2010/extcode.h"
00013 #endif
00014
00015 #else
00016 typedef unsigned int LVUserEventRef;
00017 #endif
00018
00019 #ifdef _WINDOWS
00020
00021 #define LABVIEW_STRUCT_PACK 1
00022
00023 #define LABVIEW_EXPORT
00024
00025 #pragma pack(push)
00026 #pragma pack(show)
00027
00028 #else
00029
00030 #define LABVIEW_STRUCT_PACK 4
00031 #define LABVIEW_EXPORT
00032
00033 #endif
00034
00035 #define LV_CFHANDLE_BODY(pname,param,structtype, ...) \
00036 int CCONV CPhidget##pname##_On##param##_LaviewHandler(CPhidget##pname##Handle phid, __VA_ARGS__ ); \
00037 LABVIEW_EXPORT int CCONV CPhidget##pname##_set_On##param##_LabviewHandler(CPhidget##pname##Handle phidA, LVUserEventRef *lvEventRef) \
00038 { \
00039 CPhidget##pname##Handle phid = (CPhidget##pname##Handle)phidA; \
00040 TESTPTR(phid); \
00041 if(!lvEventRef || !*lvEventRef) \
00042 { \
00043 phid->fptr##param = NULL; \
00044 phid->fptr##param##ptr = NULL; \
00045 } \
00046 else \
00047 { \
00048 phid->fptr##param = CPhidget##pname##_On##param##_LaviewHandler; \
00049 phid->fptr##param##ptr = lvEventRef; \
00050 } \
00051 return EPHIDGET_OK; \
00052 } \
00053 int CCONV CPhidget##pname##_On##param##_LaviewHandler(CPhidget##pname##Handle phid, __VA_ARGS__ ) \
00054 { \
00055 LVUserEventRef ev = *(LVUserEventRef *)userPtr; \
00056 MgErr ret = 0; \
00057 structtype *data; \
00058 data = (structtype *)DSNewPtr(sizeof(structtype)); \
00059 data->nothing = (int32)phid; \
00060
00061 #define LV_CFHANDLE_END \
00062 ret = PostLVUserEvent(ev, data); \
00063 DSDisposePtr(data); \
00064 return EPHIDGET_OK; \
00065 }
00066
00067 #define LV_CFHANDLE_0(pname,param,structtype) \
00068 LV_CFHANDLE_BODY(pname,param,structtype,void *userPtr) \
00069 LV_CFHANDLE_END
00070
00071 #define LV_CFHANDLE_1(pname,param,structtype,datatype1) \
00072 LV_CFHANDLE_BODY(pname,param,structtype,void *userPtr,datatype1 val1) \
00073 data->val1 = val1; \
00074 LV_CFHANDLE_END
00075
00076 #define LV_CFHANDLE_2(pname,param,structtype,datatype1,datatype2) \
00077 LV_CFHANDLE_BODY(pname,param,structtype,void *userPtr,datatype1 val1,datatype2 val2) \
00078 data->val1 = val1; \
00079 data->val2 = val2; \
00080 LV_CFHANDLE_END
00081
00082 #define LV_CFHANDLE_3(pname,param,structtype,datatype1,datatype2,datatype3) \
00083 LV_CFHANDLE_BODY(pname,param,structtype,void *userPtr,datatype1 val1,datatype2 val2,datatype3 val3) \
00084 data->val1 = val1; \
00085 data->val2 = val2; \
00086 data->val3 = val3; \
00087 LV_CFHANDLE_END
00088
00089 #define LV_CFHANDLE_4(pname,param,structtype,datatype1,datatype2,datatype3,datatype4) \
00090 LV_CFHANDLE_BODY(pname,param,structtype,void *userPtr,datatype1 val1,datatype2 val2,datatype3 val3,datatype4 val4) \
00091 data->val1 = val1; \
00092 data->val2 = val2; \
00093 data->val3 = val3; \
00094 data->val4 = val4; \
00095 LV_CFHANDLE_END
00096
00097 #define LV_CHDREVENT(pname,param) LABVIEW_EXPORT int CCONV CPhidget##pname##_set_On##param##_LabviewHandler(CPhidget##pname##Handle phid, LVUserEventRef *lvEventRef);
00098
00107 typedef struct {
00108 int32 length;
00109 int32 data[1];
00110 } lvArrInt32, *lvArrInt32H, **lvArrInt32DH;
00111
00115 typedef struct {
00116 int32 length;
00117 uInt8 data[1];
00118 } lvArrUInt8, *lvArrUInt8H, **lvArrUInt8DH;
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 #ifdef _WINDOWS
00129 #pragma pack(LABVIEW_STRUCT_PACK)
00130 #pragma pack(show)
00131 #endif
00132
00136 typedef struct _lvNothing {
00137 int32 nothing;
00138 } lvNothing;
00139
00143 typedef struct _lvError {
00144 int32 nothing;
00145 int32 val1;
00146 LStrHandle val2;
00147 } lvError;
00148
00152 typedef struct _lvDouble {
00153
00154 #ifdef _WINDOWS
00155 size_t nothing;
00156 #else
00157 int32 nothing;
00158 #endif
00159 double val1;
00160 } lvDouble;
00161
00165 typedef struct _lvDoubleDoubleDouble {
00166
00167 #ifdef _WINDOWS
00168 size_t nothing;
00169 #else
00170 int32 nothing;
00171 #endif
00172 double val1;
00173 double val2;
00174 double val3;
00175 } lvDoubleDoubleDouble;
00176
00180 typedef struct _lvInt32 {
00181 int32 nothing;
00182 int32 val1;
00183 } lvInt32;
00184
00188 typedef struct _lvIndexedDouble {
00189 int32 nothing;
00190 int32 val1;
00191 double val2;
00192 } lvIndexedDouble;
00193
00197 typedef struct _lvIndexedInt32 {
00198 int32 nothing;
00199 int32 val1;
00200 int32 val2;
00201 } lvIndexedInt32;
00202
00206 typedef struct _lvIndexedInt32Int32 {
00207 int32 nothing;
00208 int32 val1;
00209 int32 val2;
00210 int32 val3;
00211 } lvIndexedInt32Int32;
00212
00216 typedef struct _lvIndexedInt64 {
00217 int32 nothing;
00218 int32 val1;
00219 int64 val2;
00220 } lvIndexedInt64;
00221
00225 typedef struct _lvInt32Array {
00226 lvArrInt32DH val1;
00227 int32 nothing;
00228 } lvInt32Array;
00229
00233 typedef struct _lvUInt8Array {
00234 lvArrUInt8DH val1;
00235 int32 nothing;
00236 } lvUInt8Array;
00237
00241 typedef struct _lvIRCode {
00242 lvArrUInt8DH val1;
00243 int32 val2;
00244 int32 val3;
00245 int32 nothing;
00246 } lvIRCode;
00247
00251 typedef struct _lvIRLearn {
00252 lvArrUInt8DH val1;
00253 CPhidgetIR_CodeInfo val2;
00254 int32 nothing;
00255 } lvIRLearn;
00256
00260 typedef struct _lvRFIDTag2 {
00261 LStrHandle val1;
00262 CPhidgetRFID_Protocol val2;
00263 int32 nothing;
00264 } lvRFIDTag2;
00265
00269 typedef struct _lvSpatialData {
00270
00271 #ifdef _WINDOWS
00272 size_t nothing;
00273 #else
00274 int32 nothing;
00275 #endif
00276 CPhidgetSpatial_SpatialEventData val1;
00277 } lvSpatialData;
00278
00279
00283 typedef struct _lvManager {
00284 __int64 val1;
00285 } lvManager;
00286
00290 typedef struct _lvDictionary {
00291 LStrHandle val1;
00292 LStrHandle val2;
00293 CPhidgetDictionary_keyChangeReason val3;
00294 } lvDictionary;
00295
00296
00297 #ifdef _WINDOWS
00298
00299 #pragma pack(pop)
00300 #pragma pack(show)
00301 #endif
00302
00309 LV_CHDREVENT(,Attach)
00316 LV_CHDREVENT(,Detach)
00323 LV_CHDREVENT(,ServerConnect)
00330 LV_CHDREVENT(,ServerDisconnect)
00337 LV_CHDREVENT(,Error)
00338
00345 LV_CHDREVENT(Accelerometer,AccelerationChange)
00346
00353 LV_CHDREVENT(AdvancedServo, PositionChange)
00360 LV_CHDREVENT(AdvancedServo, VelocityChange)
00367 LV_CHDREVENT(AdvancedServo, CurrentChange)
00368
00375 LV_CHDREVENT(Bridge, BridgeData)
00376
00383 LV_CHDREVENT(Encoder, InputChange)
00390 LV_CHDREVENT(Encoder, PositionChange)
00391
00398 LV_CHDREVENT(FrequencyCounter, Count)
00399
00406 LV_CHDREVENT(GPS, PositionChange)
00413 LV_CHDREVENT(GPS, PositionFixStatusChange)
00414
00421 LV_CHDREVENT(InterfaceKit, InputChange)
00428 LV_CHDREVENT(InterfaceKit, OutputChange)
00435 LV_CHDREVENT(InterfaceKit, SensorChange)
00436
00443 LV_CHDREVENT(IR, Code)
00450 LV_CHDREVENT(IR, RawData)
00457 LV_CHDREVENT(IR, Learn)
00458
00465 LV_CHDREVENT(MotorControl, InputChange)
00472 LV_CHDREVENT(MotorControl, VelocityChange)
00479 LV_CHDREVENT(MotorControl, CurrentChange)
00486 LV_CHDREVENT(MotorControl, EncoderPositionChange)
00493 LV_CHDREVENT(MotorControl, EncoderPositionUpdate)
00500 LV_CHDREVENT(MotorControl, BackEMFUpdate)
00507 LV_CHDREVENT(MotorControl, SensorUpdate)
00514 LV_CHDREVENT(MotorControl, CurrentUpdate)
00515
00522 LV_CHDREVENT(PHSensor, PHChange)
00523
00530 LV_CHDREVENT(RFID, OutputChange)
00537 LV_CHDREVENT(RFID, Tag)
00544 LV_CHDREVENT(RFID, TagLost)
00551 LV_CHDREVENT(RFID, RawData)
00558 LV_CHDREVENT(RFID, Tag2)
00565 LV_CHDREVENT(RFID, TagLost2)
00566
00573 LV_CHDREVENT(Servo, PositionChange)
00574
00581 LV_CHDREVENT(Spatial, SpatialData)
00582
00589 LV_CHDREVENT(Stepper, InputChange)
00596 LV_CHDREVENT(Stepper, PositionChange)
00597 LV_CHDREVENT(Stepper, PositionChange32)
00604 LV_CHDREVENT(Stepper, VelocityChange)
00611 LV_CHDREVENT(Stepper, CurrentChange)
00612
00619 LV_CHDREVENT(TemperatureSensor, TemperatureChange)
00620
00627 LV_CHDREVENT(WeightSensor, WeightChange)
00628
00629 LV_CHDREVENT(Manager,Attach)
00630 LV_CHDREVENT(Manager,Detach)
00631 LV_CHDREVENT(Manager,ServerConnect)
00632 LV_CHDREVENT(Manager,ServerDisconnect)
00633 LV_CHDREVENT(Manager,Error)
00634
00635 LABVIEW_EXPORT int CCONV CPhidgetDictionary_set_OnKeyChange_LabviewHandler(CPhidgetDictionaryHandle dict, CPhidgetDictionaryListenerHandle *listen, const char *pattern, LVUserEventRef *lvEventRef);
00636 LV_CHDREVENT(Dictionary,ServerConnect)
00637 LV_CHDREVENT(Dictionary,ServerDisconnect)
00638 LV_CHDREVENT(Dictionary,Error)
00639
00642 #endif