Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkNDIProtocol.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 #ifndef MITKNDIPROTOCOL_H_HEADER_INCLUDED_
19 #define MITKNDIPROTOCOL_H_HEADER_INCLUDED_
20 
21 #include <itkObject.h>
22 #include <itkObjectFactory.h>
23 
24 #include <MitkIGTExports.h>
26 #include "mitkNDIPassiveTool.h"
27 
28 namespace mitk
29 {
30  class NDITrackingDevice;
31 
36  {
37  NDIOKAY = 0,
38  NDIERROR = 1,
44  NDICRCERROR, // reply has crc error, local computer detected the error
48  NDICRCDOESNOTMATCH, // command had crc error, tracking device detected the error
82  };
83 
90  class MITKIGT_EXPORT NDIProtocol : public itk::Object
91  {
92  public:
94  itkFactorylessNewMacro(Self)
95  itkCloneMacro(Self)
96 
97  itkSetObjectMacro(TrackingDevice, NDITrackingDevice);
98 
106 
109  NDIErrorCode APIREV(std::string* revision);
110  NDIErrorCode PHINF(std::string portHandle, std::string* portInfo);
111  NDIErrorCode PSOUT(std::string portHandle, std::string state);
112  NDIErrorCode COMM(mitk::SerialCommunication::BaudRate baudRate, mitk::SerialCommunication::DataBits dataBits, mitk::SerialCommunication::Parity parity, mitk::SerialCommunication::StopBits stopBits, mitk::SerialCommunication::HardwareHandshake hardwareHandshake);
113  NDIErrorCode INIT();
114  NDIErrorCode DSTART();
115  NDIErrorCode DSTOP();
116  NDIErrorCode IRINIT();
117  NDIErrorCode IRCHK(bool* IRdetected);
118  NDIErrorCode PHSR(PHSRQueryType queryType, std::string* portHandles);
119  NDIErrorCode PHF(std::string* portHandle);
120  NDIErrorCode PHRQ(std::string* portHandle);
121  NDIErrorCode PVWR(std::string* portHandle, const unsigned char* sromData, unsigned int sromDataLength);
122  NDIErrorCode PINIT(std::string* portHandle);
123  NDIErrorCode PENA(std::string* portHandle, TrackingPriority prio);
124  NDIErrorCode PDIS(std::string* portHandle);
126  NDIErrorCode BEEP(unsigned char count);
127  NDIErrorCode SFLIST(std::string* info);
128  NDIErrorCode TSTART(bool resetFrameCounter = false);
129  NDIErrorCode TSTOP();
130  NDIErrorCode TX(bool trackIndividualMarkers = false, MarkerPointContainerType* markerPositions = nullptr);
131  NDIErrorCode BX();
132  NDIErrorCode POS3D(MarkerPointContainerType* markerPositions);
134  NDIErrorCode VSEL(mitk::TrackingDeviceData deviceData);
135  NDIErrorCode TX1000(MarkerPointContainerType* markerPositions);
136  unsigned int ByteToNbBitsOn(char& c) const;
137  itkGetConstMacro(UseCRC, bool);
138  itkSetMacro(UseCRC, bool);
139  itkBooleanMacro(UseCRC);
140  protected:
141  NDIProtocol();
142  virtual ~NDIProtocol();
143 
149  NDIErrorCode ParseOkayError();
150 
156  NDIErrorCode GenericCommand(const std::string command, const std::string* parameter = nullptr);
157 
161  NDIErrorCode GetErrorCode(const std::string* input);
162 
163  NDITrackingDevice* m_TrackingDevice;
164  bool m_UseCRC;
165  };
166 } // namespace mitk
167 #endif /* MITKNDIPROTOCOL_H_HEADER_INCLUDED_ */
IlluminationActivationRate
activation rate of IR illuminator for NDI Polaris tracking device
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
PHSRQueryType
Query mode for NDI tracking devices.
static void info(const char *fmt,...)
Definition: svm.cpp:100
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
Interface for all Tracking Devices.
std::vector< MarkerPointType > MarkerPointContainerType
serial communication interface
Implementation of a passive NDI optical tool.
std::string TrackingDeviceType
superclass for specific NDI tracking Devices that use serial communication.
TrackingPriority
tracking priority for NDI tracking devices
NDIErrorCode
Error codes of NDI tracking devices.
The NDI Protocol class provides building and parsing of command strings and answers to and from a NDI...