Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkTrackingDeviceConfigurationWidgetConnectionWorker.cpp
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 
18 
19 #include <mitkProgressBar.h>
20 #include <mitkNDITrackingDevice.h>
21 #include <mitkIGTException.h>
22 
24 {
25  MITK_INFO << "Testing Connection!";
26  QString output;
27  bool connected = false;
29  try
30  {
31  if (!m_TrackingDevice->IsDeviceInstalled())
32  {
33  output = "ERROR: Device is not installed!";
34  }
35  else
36  {
37  //test connection and start tracking, generate output
38  output = "<br>testing connection <br> ...";
39  m_TrackingDevice->OpenConnection();
40  output += "OK";
42 
43  //try start/stop tracking
44  output += "<br>testing tracking <br> ...";
45  m_TrackingDevice->StartTracking();
47  m_TrackingDevice->StopTracking();
49 
50  //try close connection
51  m_TrackingDevice->CloseConnection();
53  output += "OK";
54  connected = true;
55  }
56  }
57  catch (mitk::IGTException &e)
58  {
59  output += "ERROR!";
60  MITK_WARN << "Error while testing connection / start tracking of the device: " << e.GetDescription();
61  }
63  emit ConnectionTested(connected, output);
64 }
65 
67 {
68  m_TrackingDevice = t;
69 }
void Progress(unsigned int steps=1)
Sets the current amount of progress to current progress + steps.
itk::SmartPointer< Self > Pointer
#define MITK_INFO
Definition: mitkLogMacros.h:22
An object of this class represents an exception of the MITK-IGT module.
static ProgressBar * GetInstance()
static method to get the GUI dependent ProgressBar-instance so the methods for steps to do and progre...
void ConnectionTested(bool connected, QString output)
#define MITK_WARN
Definition: mitkLogMacros.h:23
void AddStepsToDo(unsigned int steps)
Adds steps to totalSteps.