52 #define POLARIS_MAJOR_VERSION 3
53 #define POLARIS_MINOR_VERSION 2
55 #include "PlusConfigure.h"
194 char *reply; va_list ap; va_start(ap,format);
195 reply =
ndiCommandVA(pol, format, ap); va_end(ap);
return reply; }
219 PLErrorCallback callback,
240 #define plRESET(p) plCommand((p),NULL)
246 #define plINIT(p) plCommand((p),"INIT:")
260 #define plCOMM(p,baud,dps,h) plCommand((p),"COMM:%d%03d%d",(baud),(dps),(h))
274 #define plPVWR(p,port,a,x) plCommand((p),"PVWR:%c%04X%.128s",(port),(a),(x))
282 #define plPVCLR(p,port) plCommand((p),"PVCLR:%c",(port))
289 #define plPINIT(p,port) plCommand((p),"PINIT:%c",(port))
297 #define plPENA(p,port,mode) plCommand((p),"PENA:%c%c",(port),(mode))
304 #define plPDIS(p,port) plCommand((p),"PDIS:%c",(port))
309 #define plTSTART(p) plCommand((p),"TSTART:")
314 #define plTSTOP(p) plCommand((p),"TSTOP:")
341 #define plGX(p,mode) plCommand((p),"GX:%04X",(mode))
352 #define plLED(p,port,led,s) plCommand((p),"LED:%c%d%c",(port),(led),(s))
364 #define plBEEP(p,n) plCommand((p),"BEEP:%i",(n))
376 #define plVER(p,n) plCommand((p),"VER:%d",(n))
394 #define plSFLIST(p,mode) plCommand((p),"SFLIST:%02X",(mode))
402 #define plVSEL(p,n) plCommand((p),"VSEL:%d",(n))
427 #define plPSTAT(p,format) plCommand((p),"PSTAT:%04X",(format))
445 #define plSSTAT(p,format) plCommand((p),"SSTAT:%04X",(format))
448 #define plPPRD(p,port,addr) plCommand((p),"PPRD:%c%04X",(port),(addr))
451 #define plPPWR(p,port,a,x) plCommand((p),"PPWR:%c%04X%.128s",(port),(a),(x))
454 #define plPURD(p,port,addr) plCommand((p),"PURD:%c%04X",(port),(addr))
457 #define plPUWR(p,port,a,x) plCommand((p),"PPWR:%c%04X%.128s",(port),(a),(x))
460 #define plPSEL(p,port,id) plCommand((p),"PSEL:%c%s",(port),(id))
463 #define plPSRCH(p,port) plCommand((p),"PSRCH:%c",(port))
466 #define plPVTIP(p,port,tip,np) plCommand((p),"PVTIP:%c%d%d",(port),(tip),(np))
469 #define plTTCFG(p,port) plCommand((p),"TTCFG:%c",(port))
472 #define plTCTST(p,port) plCommand((p),"TCTST:%c",(port))
477 #define plDSTART(p) plCommand((p),"DSTART:")
482 #define plDSTOP(p) plCommand((p),"DSTOP:")
488 #define plIRINIT(p) plCommand((p),"IRINIT:")
501 #define plIRCHK(p,mode) plCommand((p),"IRCHK:%04X",(mode))
510 #define plIRED(p,port,sig) plCommand((p),"IRED:%c%08X",(port),(sig))
523 #define pl3D(p,port,mode) plCommand((p),"3D:%c%d",(port),(mode))
543 unsigned char buffer[1024];
548 errno_t err = fopen_s (&file,filename,
"rb");
551 LOG_ERROR(
"Error opening file: " << filename <<
" Error No.: " << err);
555 memset(buffer, 0, 1024);
556 fread(buffer, 1, 1024, file);
563 for (addr = 0; addr < 1024; addr += 64) {
1116 #define PL_OKAY 0x00
1117 #define PL_INVALID 0x01
1118 #define PL_TOO_LONG 0x02
1119 #define PL_TOO_SHORT 0x03
1120 #define PL_BAD_COMMAND_CRC 0x04
1121 #define PL_INTERN_TIMEOUT 0x05
1122 #define PL_COMM_FAIL 0x06
1123 #define PL_PARAMETERS 0x07
1124 #define PL_INVALID_PORT 0x08
1125 #define PL_INVALID_MODE 0x09
1126 #define PL_INVALID_LED 0x0a
1127 #define PL_LED_STATE 0x0b
1128 #define PL_BAD_MODE 0x0c
1129 #define PL_NO_TOOL 0x0d
1130 #define PL_PORT_NOT_INIT 0x0e
1131 #define PL_PORT_DISABLED 0x0f
1132 #define PL_INITIALIZATION 0x10
1133 #define PL_TSTOP_FAIL 0x11
1134 #define PL_TSTART_FAIL 0x12
1135 #define PL_PINIT_FAIL 0x13
1136 #define PL_CAMERA 0x14
1137 #define PL_INIT_FAIL 0x15
1138 #define PL_DSTART_FAIL 0x16
1139 #define PL_DSTOP_FAIL 0x17
1140 #define PL_IRCHK_FAIL 0x18
1141 #define PL_FIRMWARE 0x19
1142 #define PL_INTERNAL 0x1a
1143 #define PL_IRINIT_FAIL 0x1b
1144 #define PL_IRED_FAIL 0x1c
1145 #define PL_SROM_FAIL 0x1d
1146 #define PL_SROM_READ 0x1e
1147 #define PL_SROM_WRITE 0x1f
1148 #define PL_SROM_SELECT 0x20
1149 #define PL_PORT_CURRENT 0x21
1150 #define PL_WAVELENGTH 0x22
1151 #define PL_PARAMETER_RANGE 0x23
1152 #define PL_VOLUME 0x24
1153 #define PL_FEATURES 0x25
1155 #define PL_ENVIRONMENT 0xf1
1157 #define PL_EPROM_READ 0xf6
1158 #define PL_EPROM_WRITE 0xf5
1159 #define PL_EPROM_ERASE 0xf4
1163 #define PL_BAD_CRC 0x0100
1164 #define PL_OPEN_ERROR 0x0200
1165 #define PL_BAD_COMM 0x0300
1166 #define PL_TIMEOUT 0x0400
1167 #define PL_WRITE_ERROR 0x0500
1168 #define PL_READ_ERROR 0x0600
1169 #define PL_RESET_FAIL 0x0700
1170 #define PL_PROBE_FAIL 0x0800
1202 #define PL_NOHANDSHAKE 0
1203 #define PL_HANDSHAKE 1
1208 #define PL_STATIC 'S'
1209 #define PL_DYNAMIC 'D'
1210 #define PL_BUTTON_BOX 'B'
1215 #define PL_XFORMS_AND_STATUS 0x0001
1216 #define PL_ADDITIONAL_INFO 0x0002
1217 #define PL_SINGLE_STRAY 0x0004
1218 #define PL_FRAME_NUMBER 0x0008
1219 #define PL_PASSIVE 0x8000
1220 #define PL_PASSIVE_EXTRA 0x2000
1221 #define PL_PASSIVE_STRAY 0x1000
1226 #define PL_DISABLED 1
1227 #define PL_MISSING 2
1228 #define PL_UNOCCUPIED 3
1233 #define PL_TOOL_IN_PORT 0x01
1234 #define PL_SWITCH_1_ON 0x02
1235 #define PL_SWITCH_2_ON 0x04
1236 #define PL_SWITCH_3_ON 0x08
1237 #define PL_INITIALIZED 0x10
1238 #define PL_ENABLED 0x20
1239 #define PL_OUT_OF_VOLUME 0x40
1240 #define PL_PARTIALLY_IN_VOLUME 0x80
1241 #define PL_CURRENT_DETECT 0x80
1246 #define PL_COMM_SYNC_ERROR 0x01
1247 #define PL_TOO_MUCH_EXTERNAL_INFRARED 0x02
1248 #define PL_COMM_CRC_ERROR 0x04
1253 #define PL_BAD_TRANSFORM_FIT 0x01
1254 #define PL_NOT_ENOUGH_MARKERS 0x02
1255 #define PL_TOOL_FACE_USED 0x70
1260 #define PL_MARKER_MISSING 0
1261 #define PL_MARKER_EXCEEDED_MAX_ANGLE 1
1262 #define PL_MARKER_EXCEEDED_MAX_ERROR 2
1263 #define PL_MARKER_USED 3
1268 #define PL_BLANK 'B'
1269 #define PL_FLASH 'F'
1270 #define PL_SOLID 'S'
1275 #define PL_BASIC 0x0001
1276 #define PL_TESTING 0x0002
1277 #define PL_PART_NUMBER 0x0004
1278 #define PL_ACCESSORIES 0x0008
1279 #define PL_MARKER_TYPE 0x0010
1284 #define PL_TOOL_IN_PORT_SWITCH 0x01
1285 #define PL_SWITCH_1 0x02
1286 #define PL_SWITCH_2 0x04
1287 #define PL_SWITCH_3 0x08
1288 #define PL_TOOL_TRACKING_LED 0x10
1289 #define PL_LED_1 0x20
1290 #define PL_LED_2 0x40
1291 #define PL_LED_3 0x80
1296 #define PL_950NM 0x00
1297 #define PL_850NM 0x01
1302 #define PL_NDI_ACTIVE 0x08
1303 #define PL_NDI_CERAMIC 0x10
1304 #define PL_PASSIVE_ANY 0x20
1305 #define PL_PASSIVE_SPHERE 0x28
1306 #define PL_PASSIVE_DISC 0x30
1311 #define PL_CONTROL 0x0001
1312 #define PL_SENSORS 0x0002
1313 #define PL_TIU 0x0004
1318 #define PL_EPROM_CODE_CHECKSUM 0x01
1319 #define PL_EPROM_SYSTEM_CHECKSUM 0x02
1324 #define PL_LEFT_ROM_CHECKSUM 0x01
1325 #define PL_LEFT_SYNC_TYPE_1 0x02
1326 #define PL_LEFT_SYNC_TYPE_2 0x04
1327 #define PL_RIGHT_ROM_CHECKSUM 0x10
1328 #define PL_RIGHT_SYNC_TYPE_1 0x20
1329 #define PL_RIGHT_SYNC_TYPE_2 0x40
1334 #define PL_ROM_CHECKSUM 0x01
1335 #define PL_OPERATING_VOLTAGES 0x02
1336 #define PL_MARKER_SEQUENCING 0x04
1337 #define PL_SYNC 0x08
1338 #define PL_COOLING_FAN 0x10
1339 #define PL_INTERNAL_ERROR 0x20
1344 #define PL_DETECTED 0x0001
1345 #define PL_SOURCES 0x0002
void ndiSetThreadMode(ndicapi *pol, int mode)
static unsigned long plGetGXFrame(polaris *pol, int port)
Definition: polaris.h:760
static int plGetGXMarkerInfo(polaris *pol, int port, int marker)
Definition: polaris.h:725
unsigned long ndiHexToUnsignedLong(const char *cp, int n)
void(* NDIErrorCallback)(int errnum, char *description, void *userdata)
Definition: ndicapi.h:218
GLuint coord
Definition: glew.h:7061
static int plGetThreadMode(polaris *pol)
Definition: polaris.h:617
NDIErrorCallback PLErrorCallback
Definition: polaris.h:208
unsigned long ndiGetPSTATCurrentTest(ndicapi *pol, int port)
static char * plDeviceName(int i)
Definition: polaris.h:86
static int plGetPSTATMarkerType(polaris *pol, int port)
Definition: polaris.h:935
static void * plHexDecode(void *data, const char *cp, int n)
Definition: polaris.h:1099
char * ndiCommandVA(ndicapi *pol, const char *format, va_list ap)
static int plGetGXPortStatus(polaris *pol, int port)
Definition: polaris.h:670
char * ndiHexEncode(char *cp, const void *data, int n)
static int plGetIRCHKSourceXY(polaris *pol, int side, int i, double xy[2])
Definition: polaris.h:1036
static void plSetErrorCallback(polaris *pol, PLErrorCallback callback, void *userdata)
Definition: polaris.h:218
static char * plGetDeviceName(polaris *pol)
Definition: polaris.h:603
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
Definition: glew.h:1363
static int plGetPSTATPortStatus(polaris *pol, int port)
Definition: polaris.h:822
GLenum mode
Definition: glew.h:2404
void ndiClose(ndicapi *pol)
static int plGetPSTATPartNumber(polaris *pol, int port, char part[20])
Definition: polaris.h:881
int ndiGetPSTATToolInfo(ndicapi *pol, int port, char information[30])
static int plGetPSTATAccessories(polaris *pol, int port)
Definition: polaris.h:907
int ndiGetSSTATTIU(ndicapi *pol)
static char * plCommand(polaris *pol, const char *format,...)
Definition: polaris.h:193
GLuint GLenum GLenum transform
Definition: glew.h:12775
int ndiGetIRCHKNumberOfSources(ndicapi *pol, int side)
int ndiGetThreadMode(ndicapi *pol)
char * ndiGetDeviceName(ndicapi *pol)
static int plPVWRFromFile(polaris *pol, int port, char *filename)
Definition: polaris.h:542
NDIFileHandle ndiGetDeviceHandle(ndicapi *pol)
static unsigned long plHexToUnsignedLong(const char *cp, int n)
Definition: polaris.h:1061
GLenum GLvoid * addr
Definition: glew.h:10215
int ndiGetError(ndicapi *pol)
int ndiGetGXNumberOfPassiveStrays(ndicapi *pol)
int ndiGetGXSystemStatus(ndicapi *pol)
struct ndicapi ndicapi
Definition: ndicapi.h:65
NDIFileHandle PLFileHandle
Definition: polaris.h:605
int ndiProbe(const char *device)
static char * plErrorString(int errnum)
Definition: polaris.h:1051
static polaris * plOpen(const char *device)
Definition: polaris.h:120
int ndiGetGXPassiveStray(ndicapi *pol, int i, double coord[3])
static int plGetGXSystemStatus(polaris *pol)
Definition: polaris.h:686
int ndiGetGXToolInfo(ndicapi *pol, int port)
int ndiGetPSTATPartNumber(ndicapi *pol, int port, char part[20])
int ndiGetPSTATMarkerType(ndicapi *pol, int port)
char * ndiDeviceName(int i)
static int plGetGXToolInfo(polaris *pol, int port)
Definition: polaris.h:704
static void plClose(polaris *pol)
Definition: polaris.h:128
#define NDI_OKAY
No error.
Definition: ndicapi.h:1572
int ndiGetIRCHKDetected(ndicapi *pol)
static int plGetGXNumberOfPassiveStrays(polaris *pol)
Definition: polaris.h:776
void * ndiHexDecode(void *data, const char *cp, int n)
int ndiGetSSTATControl(ndicapi *pol)
static int plGetError(polaris *pol)
Definition: polaris.h:598
GLuint buffer
Definition: glew.h:1664
int ndiGetPSTATPortStatus(ndicapi *pol, int port)
static char * plCommandVA(polaris *pol, const char *format, va_list ap)
Definition: polaris.h:202
const GLchar * marker
Definition: glew.h:7764
int ndiGetGXSingleStray(ndicapi *pol, int port, double coord[3])
static long plSignedToLong(const char *cp, int n)
Definition: polaris.h:1072
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glew.h:1238
unsigned long ndiGetGXFrame(ndicapi *pol, int port)
static int plProbe(const char *device)
Definition: polaris.h:109
static PLFileHandle plGetDeviceHandle(polaris *pol)
Definition: polaris.h:612
int ndiGetIRCHKSourceXY(ndicapi *pol, int side, int i, double xy[2])
static int plGetGXSingleStray(polaris *pol, int port, double coord[3])
Definition: polaris.h:745
static int plGetSSTATControl(polaris *pol)
Definition: polaris.h:950
#define plPVWR(p, port, a, x)
Definition: polaris.h:274
int ndiGetSSTATSensors(ndicapi *pol)
struct ndicapi polaris
Definition: polaris.h:67
static int plGetIRCHKNumberOfSources(polaris *pol, int side)
Definition: polaris.h:1016
GLclampd n
Definition: glew.h:6789
void ndiSetErrorCallback(ndicapi *pol, NDIErrorCallback callback, void *userdata)
static void plSetThreadMode(polaris *pol, int mode)
Definition: polaris.h:155
static unsigned long plGetPSTATCurrentTest(polaris *pol, int port)
Definition: polaris.h:860
int ndiGetGXTransform(ndicapi *pol, int port, double transform[8])
static char * plHexEncode(char *cp, const void *data, int n)
Definition: polaris.h:1087
ndicapi * ndiOpen(const char *device)
static int plGetPSTATToolInfo(polaris *pol, int port, char information[30])
Definition: polaris.h:845
static int plGetGXPassiveStray(polaris *pol, int i, double coord[3])
Definition: polaris.h:799
char * ndiErrorString(int errnum)
int ndiGetGXPortStatus(ndicapi *pol, int port)
int ndiGetGXMarkerInfo(ndicapi *pol, int port, int marker)
long ndiSignedToLong(const char *cp, int n)
static int plGetGXTransform(polaris *pol, int port, double transform[8])
Definition: polaris.h:648
static int plGetIRCHKDetected(polaris *pol)
Definition: polaris.h:1001
static int plGetSSTATSensors(polaris *pol)
Definition: polaris.h:969
static int plGetSSTATTIU(polaris *pol)
Definition: polaris.h:988