Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
15 #include <mitkProgressBar.h>
16 #include <mitkNDITrackingDevice.h>
17 #include <mitkIGTException.h>
18 
20 {
21  MITK_INFO << "Testing Connection!";
22  QString output;
23  bool connected = false;
25  try
26  {
27  if (!m_TrackingDevice->IsDeviceInstalled())
28  {
29  output = "ERROR: Device is not installed!";
30  }
31  else
32  {
33  //test connection and start tracking, generate output
34  output = "<br>testing connection <br> ...";
35  m_TrackingDevice->OpenConnection();
36  output += "OK";
38 
39  //try start/stop tracking
40  output += "<br>testing tracking <br> ...";
41  m_TrackingDevice->StartTracking();
43  m_TrackingDevice->StopTracking();
45 
46  //try close connection
47  m_TrackingDevice->CloseConnection();
49  output += "OK";
50  connected = true;
51  }
52  }
53  catch (mitk::IGTException &e)
54  {
55  output += "ERROR!";
56  MITK_WARN << "Error while testing connection / start tracking of the device: " << e.GetDescription();
57  }
59  emit ConnectionTested(connected, output);
60 }
61 
63 {
64  m_TrackingDevice = t;
65 }
void Progress(unsigned int steps=1)
Sets the current amount of progress to current progress + steps.
#define MITK_INFO
Definition: mitkLogMacros.h:18
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:19
void AddStepsToDo(unsigned int steps)
Adds steps to totalSteps.