MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
QmitkTrackingDeviceConfigurationWidgetConnectionWorker.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
14
15#include <mitkProgressBar.h>
17#include <mitkIGTException.h>
18
20{
21 MITK_INFO << "Testing Connection!";
22 QString output;
23 bool connected = false;
24 mitk::ProgressBar::GetInstance()->AddStepsToDo(4);
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";
37 mitk::ProgressBar::GetInstance()->Progress();
38
39 //try start/stop tracking
40 output += "<br>testing tracking <br> ...";
41 m_TrackingDevice->StartTracking();
42 mitk::ProgressBar::GetInstance()->Progress();
43 m_TrackingDevice->StopTracking();
44 mitk::ProgressBar::GetInstance()->Progress();
45
46 //try close connection
47 m_TrackingDevice->CloseConnection();
48 mitk::ProgressBar::GetInstance()->Progress();
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 }
58 mitk::ProgressBar::GetInstance()->Progress(4);
59 emit ConnectionTested(connected, output);
60}
61
void ConnectionTested(bool connected, QString output)
An object of this class represents an exception of the MITK-IGT module.