NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Macros | Typedefs | Functions
polaris.h File Reference
Include dependency graph for polaris.h:

Go to the source code of this file.

Macros

#define POLARIS_MAJOR_VERSION   3
 
#define POLARIS_MINOR_VERSION   2
 
#define plRESET(p)   plCommand((p),NULL)
 
#define plINIT(p)   plCommand((p),"INIT:")
 
#define plCOMM(p, baud, dps, h)   plCommand((p),"COMM:%d%03d%d",(baud),(dps),(h))
 
#define plPVWR(p, port, a, x)   plCommand((p),"PVWR:%c%04X%.128s",(port),(a),(x))
 
#define plPVCLR(p, port)   plCommand((p),"PVCLR:%c",(port))
 
#define plPINIT(p, port)   plCommand((p),"PINIT:%c",(port))
 
#define plPENA(p, port, mode)   plCommand((p),"PENA:%c%c",(port),(mode))
 
#define plPDIS(p, port)   plCommand((p),"PDIS:%c",(port))
 
#define plTSTART(p)   plCommand((p),"TSTART:")
 
#define plTSTOP(p)   plCommand((p),"TSTOP:")
 
#define plGX(p, mode)   plCommand((p),"GX:%04X",(mode))
 
#define plLED(p, port, led, s)   plCommand((p),"LED:%c%d%c",(port),(led),(s))
 
#define plBEEP(p, n)   plCommand((p),"BEEP:%i",(n))
 
#define plVER(p, n)   plCommand((p),"VER:%d",(n))
 
#define plSFLIST(p, mode)   plCommand((p),"SFLIST:%02X",(mode))
 
#define plVSEL(p, n)   plCommand((p),"VSEL:%d",(n))
 
#define plPSTAT(p, format)   plCommand((p),"PSTAT:%04X",(format))
 
#define plSSTAT(p, format)   plCommand((p),"SSTAT:%04X",(format))
 
#define plPPRD(p, port, addr)   plCommand((p),"PPRD:%c%04X",(port),(addr))
 
#define plPPWR(p, port, a, x)   plCommand((p),"PPWR:%c%04X%.128s",(port),(a),(x))
 
#define plPURD(p, port, addr)   plCommand((p),"PURD:%c%04X",(port),(addr))
 
#define plPUWR(p, port, a, x)   plCommand((p),"PPWR:%c%04X%.128s",(port),(a),(x))
 
#define plPSEL(p, port, id)   plCommand((p),"PSEL:%c%s",(port),(id))
 
#define plPSRCH(p, port)   plCommand((p),"PSRCH:%c",(port))
 
#define plPVTIP(p, port, tip, np)   plCommand((p),"PVTIP:%c%d%d",(port),(tip),(np))
 
#define plTTCFG(p, port)   plCommand((p),"TTCFG:%c",(port))
 
#define plTCTST(p, port)   plCommand((p),"TCTST:%c",(port))
 
#define plDSTART(p)   plCommand((p),"DSTART:")
 
#define plDSTOP(p)   plCommand((p),"DSTOP:")
 
#define plIRINIT(p)   plCommand((p),"IRINIT:")
 
#define plIRCHK(p, mode)   plCommand((p),"IRCHK:%04X",(mode))
 
#define plIRED(p, port, sig)   plCommand((p),"IRED:%c%08X",(port),(sig))
 
#define pl3D(p, port, mode)   plCommand((p),"3D:%c%d",(port),(mode))
 
#define PL_OKAY   0x00
 No error. More...
 
#define PL_INVALID   0x01
 Invalid command. More...
 
#define PL_TOO_LONG   0x02
 Command too long. More...
 
#define PL_TOO_SHORT   0x03
 Command too short. More...
 
#define PL_BAD_COMMAND_CRC   0x04
 Bad CRC calculated for command. More...
 
#define PL_INTERN_TIMEOUT   0x05
 Timeout on command execution. More...
 
#define PL_COMM_FAIL   0x06
 New communication parameters failed. More...
 
#define PL_PARAMETERS   0x07
 Incorrect number of command parameters. More...
 
#define PL_INVALID_PORT   0x08
 Invalid port selected. More...
 
#define PL_INVALID_MODE   0x09
 Invalid mode selected. More...
 
#define PL_INVALID_LED   0x0a
 Invalid LED selected. More...
 
#define PL_LED_STATE   0x0b
 Invalid LED state selected. More...
 
#define PL_BAD_MODE   0x0c
 Command invalid for current mode. More...
 
#define PL_NO_TOOL   0x0d
 No tool plugged in selected port. More...
 
#define PL_PORT_NOT_INIT   0x0e
 Selected port not initialized. More...
 
#define PL_PORT_DISABLED   0x0f
 Selected port not enabled. More...
 
#define PL_INITIALIZATION   0x10
 System not initialized. More...
 
#define PL_TSTOP_FAIL   0x11
 Failure to stop tracking. More...
 
#define PL_TSTART_FAIL   0x12
 Failure to start tracking. More...
 
#define PL_PINIT_FAIL   0x13
 Failure to initialize tool in port. More...
 
#define PL_CAMERA   0x14
 Invalid camera parameters. More...
 
#define PL_INIT_FAIL   0x15
 Failure to initialize POLARIS. More...
 
#define PL_DSTART_FAIL   0x16
 Failure to start diagnostic mode. More...
 
#define PL_DSTOP_FAIL   0x17
 Failure to stop diagnostic mode. More...
 
#define PL_IRCHK_FAIL   0x18
 Failure to determine environmental IR. More...
 
#define PL_FIRMWARE   0x19
 Failure to read firmware version. More...
 
#define PL_INTERNAL   0x1a
 Internal POLARIS error. More...
 
#define PL_IRINIT_FAIL   0x1b
 Failure to initialize for IR diagnostics. More...
 
#define PL_IRED_FAIL   0x1c
 Failure to set marker firing signature. More...
 
#define PL_SROM_FAIL   0x1d
 Failure to search for SROM IDs. More...
 
#define PL_SROM_READ   0x1e
 Failure to read SROM data. More...
 
#define PL_SROM_WRITE   0x1f
 Failure to write SROM data. More...
 
#define PL_SROM_SELECT   0x20
 Failure to select SROM. More...
 
#define PL_PORT_CURRENT   0x21
 Failure to perform tool current test. More...
 
#define PL_WAVELENGTH   0x22
 No camera parameters for this wavelength. More...
 
#define PL_PARAMETER_RANGE   0x23
 Command parameter out of range. More...
 
#define PL_VOLUME   0x24
 No camera parameters for this volume. More...
 
#define PL_FEATURES   0x25
 Failure to determine supported features. More...
 
#define PL_ENVIRONMENT   0xf1
 Too much environmental infrared. More...
 
#define PL_EPROM_READ   0xf6
 Failure to read Flash EPROM. More...
 
#define PL_EPROM_WRITE   0xf5
 Failure to write Flash EPROM. More...
 
#define PL_EPROM_ERASE   0xf4
 Failure to erase Flash EPROM. More...
 
#define PL_BAD_CRC   0x0100
 Bad CRC received from POLARIS. More...
 
#define PL_OPEN_ERROR   0x0200
 Error opening serial device. More...
 
#define PL_BAD_COMM   0x0300
 Bad communication parameters for host. More...
 
#define PL_TIMEOUT   0x0400
 POLARIS took >5 secs to reply. More...
 
#define PL_WRITE_ERROR   0x0500
 Device write error. More...
 
#define PL_READ_ERROR   0x0600
 Device read error. More...
 
#define PL_RESET_FAIL   0x0700
 POLARIS failed to reset on break. More...
 
#define PL_PROBE_FAIL   0x0800
 POLARIS not found on specified port. More...
 
#define PL_9600   0
 
#define PL_14400   1
 
#define PL_19200   2
 
#define PL_38400   3
 
#define PL_57600   4
 
#define PL_115200   5
 
#define PL_8N1   0 /* 8 data bits, no parity, 1 stop bit */
 
#define PL_8N2   1 /* etc. */
 
#define PL_8O1   10
 
#define PL_8O2   11
 
#define PL_8E1   20
 
#define PL_8E2   21
 
#define PL_7N1   100
 
#define PL_7N2   101
 
#define PL_7O1   110
 
#define PL_7O2   111
 
#define PL_7E1   120
 
#define PL_7E2   121
 
#define PL_NOHANDSHAKE   0
 
#define PL_HANDSHAKE   1
 
#define PL_STATIC   'S' /* relatively immobile tool */
 
#define PL_DYNAMIC   'D' /* dynamic tool (e.g. probe) */
 
#define PL_BUTTON_BOX   'B' /* tool with no IREDs */
 
#define PL_XFORMS_AND_STATUS   0x0001 /* transforms and status */
 
#define PL_ADDITIONAL_INFO   0x0002 /* additional tool transform info */
 
#define PL_SINGLE_STRAY   0x0004 /* stray active marker reporting */
 
#define PL_FRAME_NUMBER   0x0008 /* frame number for each tool */
 
#define PL_PASSIVE   0x8000 /* report passive tool information */
 
#define PL_PASSIVE_EXTRA   0x2000 /* add 6 extra passive tools */
 
#define PL_PASSIVE_STRAY   0x1000 /* stray passive marker reporting */
 
#define PL_DISABLED   1
 
#define PL_MISSING   2
 
#define PL_UNOCCUPIED   3
 
#define PL_TOOL_IN_PORT   0x01
 
#define PL_SWITCH_1_ON   0x02
 
#define PL_SWITCH_2_ON   0x04
 
#define PL_SWITCH_3_ON   0x08
 
#define PL_INITIALIZED   0x10
 
#define PL_ENABLED   0x20
 
#define PL_OUT_OF_VOLUME   0x40 /* only for plGetGXPortStatus() */
 
#define PL_PARTIALLY_IN_VOLUME   0x80 /* only for plGetGXPortStatus() */
 
#define PL_CURRENT_DETECT   0x80 /* only for plGetPSTATPortStatus() */
 
#define PL_COMM_SYNC_ERROR   0x01
 
#define PL_TOO_MUCH_EXTERNAL_INFRARED   0x02
 
#define PL_COMM_CRC_ERROR   0x04
 
#define PL_BAD_TRANSFORM_FIT   0x01
 
#define PL_NOT_ENOUGH_MARKERS   0x02
 
#define PL_TOOL_FACE_USED   0x70
 
#define PL_MARKER_MISSING   0
 
#define PL_MARKER_EXCEEDED_MAX_ANGLE   1
 
#define PL_MARKER_EXCEEDED_MAX_ERROR   2
 
#define PL_MARKER_USED   3
 
#define PL_BLANK   'B' /* off */
 
#define PL_FLASH   'F' /* flashing */
 
#define PL_SOLID   'S' /* on */
 
#define PL_BASIC   0x0001
 
#define PL_TESTING   0x0002
 
#define PL_PART_NUMBER   0x0004
 
#define PL_ACCESSORIES   0x0008
 
#define PL_MARKER_TYPE   0x0010
 
#define PL_TOOL_IN_PORT_SWITCH   0x01 /* tool has tool-in-port switch */
 
#define PL_SWITCH_1   0x02 /* tool has button #1 */
 
#define PL_SWITCH_2   0x04 /* tool has button #2 */
 
#define PL_SWITCH_3   0x08 /* tool has button #3 */
 
#define PL_TOOL_TRACKING_LED   0x10 /* tool has tracking LED */
 
#define PL_LED_1   0x20 /* tool has LED #1 */
 
#define PL_LED_2   0x40 /* tool has LED #2 */
 
#define PL_LED_3   0x80 /* tool has LED #3 */
 
#define PL_950NM   0x00
 
#define PL_850NM   0x01
 
#define PL_NDI_ACTIVE   0x08
 
#define PL_NDI_CERAMIC   0x10
 
#define PL_PASSIVE_ANY   0x20
 
#define PL_PASSIVE_SPHERE   0x28
 
#define PL_PASSIVE_DISC   0x30
 
#define PL_CONTROL   0x0001 /* control processor information */
 
#define PL_SENSORS   0x0002 /* sensor processors */
 
#define PL_TIU   0x0004 /* TIU processor */
 
#define PL_EPROM_CODE_CHECKSUM   0x01
 
#define PL_EPROM_SYSTEM_CHECKSUM   0x02
 
#define PL_LEFT_ROM_CHECKSUM   0x01
 
#define PL_LEFT_SYNC_TYPE_1   0x02
 
#define PL_LEFT_SYNC_TYPE_2   0x04
 
#define PL_RIGHT_ROM_CHECKSUM   0x10
 
#define PL_RIGHT_SYNC_TYPE_1   0x20
 
#define PL_RIGHT_SYNC_TYPE_2   0x40
 
#define PL_ROM_CHECKSUM   0x01
 
#define PL_OPERATING_VOLTAGES   0x02
 
#define PL_MARKER_SEQUENCING   0x04
 
#define PL_SYNC   0x08
 
#define PL_COOLING_FAN   0x10
 
#define PL_INTERNAL_ERROR   0x20
 
#define PL_DETECTED   0x0001 /* simple yes/no whether IR detected */
 
#define PL_SOURCES   0x0002 /* locations of up to 20 sources per camera */
 
#define PL_LEFT   0 /* left sensor */
 
#define PL_RIGHT   1 /* right sensor */
 

Typedefs

typedef struct ndicapi polaris
 
typedef NDIErrorCallback PLErrorCallback
 
typedef NDIFileHandle PLFileHandle
 

Functions

static char * plDeviceName (int i)
 
static int plProbe (const char *device)
 
static polarisplOpen (const char *device)
 
static void plClose (polaris *pol)
 
static void plSetThreadMode (polaris *pol, int mode)
 
static char * plCommand (polaris *pol, const char *format,...)
 
static char * plCommandVA (polaris *pol, const char *format, va_list ap)
 
static void plSetErrorCallback (polaris *pol, PLErrorCallback callback, void *userdata)
 
static int plPVWRFromFile (polaris *pol, int port, char *filename)
 
static int plGetError (polaris *pol)
 
static char * plGetDeviceName (polaris *pol)
 
static PLFileHandle plGetDeviceHandle (polaris *pol)
 
static int plGetThreadMode (polaris *pol)
 
static int plGetGXTransform (polaris *pol, int port, double transform[8])
 
static int plGetGXPortStatus (polaris *pol, int port)
 
static int plGetGXSystemStatus (polaris *pol)
 
static int plGetGXToolInfo (polaris *pol, int port)
 
static int plGetGXMarkerInfo (polaris *pol, int port, int marker)
 
static int plGetGXSingleStray (polaris *pol, int port, double coord[3])
 
static unsigned long plGetGXFrame (polaris *pol, int port)
 
static int plGetGXNumberOfPassiveStrays (polaris *pol)
 
static int plGetGXPassiveStray (polaris *pol, int i, double coord[3])
 
static int plGetPSTATPortStatus (polaris *pol, int port)
 
static int plGetPSTATToolInfo (polaris *pol, int port, char information[30])
 
static unsigned long plGetPSTATCurrentTest (polaris *pol, int port)
 
static int plGetPSTATPartNumber (polaris *pol, int port, char part[20])
 
static int plGetPSTATAccessories (polaris *pol, int port)
 
static int plGetPSTATMarkerType (polaris *pol, int port)
 
static int plGetSSTATControl (polaris *pol)
 
static int plGetSSTATSensors (polaris *pol)
 
static int plGetSSTATTIU (polaris *pol)
 
static int plGetIRCHKDetected (polaris *pol)
 
static int plGetIRCHKNumberOfSources (polaris *pol, int side)
 
static int plGetIRCHKSourceXY (polaris *pol, int side, int i, double xy[2])
 
static char * plErrorString (int errnum)
 
static unsigned long plHexToUnsignedLong (const char *cp, int n)
 
static long plSignedToLong (const char *cp, int n)
 
static char * plHexEncode (char *cp, const void *data, int n)
 
static voidplHexDecode (void *data, const char *cp, int n)
 

Detailed Description

This file contains a complete C interface to the POLARIS API.

Macro Definition Documentation

#define POLARIS_MAJOR_VERSION   3
#define POLARIS_MINOR_VERSION   2

Typedef Documentation

typedef NDIFileHandle PLFileHandle
typedef struct ndicapi polaris