NorMIT-nav  22.09
An IGT application
cxTrackingSystemService.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
13 
14 namespace cx
15 {
16 
18  mState(Tool::tsNONE),
19  mConfigurationFilePath(""),
20  mLoggingFolder("")
21 {
22 }
23 
25 {
26  return mState;
27 }
28 
30 {
31  return mState>=Tool::tsCONFIGURED;
32 }
33 
35 {
37 }
38 
40 {
41  return mState>=Tool::tsTRACKING;
42 }
43 
44 void TrackingSystemService::setConfigurationFile(QString configurationFile)
45 {
46  if (configurationFile == mConfigurationFilePath)
47  return;
48 
49  if (this->isConfigured())
50  {
51  this->deconfigure();
52  }
53 
54  mConfigurationFilePath = configurationFile;
55 }
56 
57 void TrackingSystemService::setLoggingFolder(QString loggingFolder)
58 {
59  if (mLoggingFolder == loggingFolder)
60  return;
61 
62  if (this->isConfigured())
63  {
64  this->deconfigure();
65  }
66 
67  mLoggingFolder = loggingFolder;
68 }
69 
71 {
72  if (mState==val)
73  return;
74 
75  if (val > mState) // up
76  {
77  if (val == Tool::tsTRACKING)
78  this->startTracking();
79  else if (val == Tool::tsINITIALIZED)
80  this->initialize();
81  else if (val == Tool::tsCONFIGURED)
82  this->configure();
83  }
84  else // down
85  {
86  if (val == Tool::tsINITIALIZED)
87  this->stopTracking();
88  else if (val == Tool::tsCONFIGURED)
89  this->uninitialize();
90  else if (val == Tool::tsNONE)
91  this->deconfigure();
92  }
93 }
94 
96 {
97  if(!isConfigured())
98  this->configure();
99 }
100 
102 {
103 }
105 {
106  if(!isInitialized())
107  this->initialize();
108 }
109 
111 {
112 }
113 }//cx
cx::Tool
Interface to a tool, i.e. a pointer, US probe or similar.
Definition: cxTool.h:61
cx::TrackingSystemService::initialize
virtual void initialize()
connects to the hardware
Definition: cxTrackingSystemService.cpp:95
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::TrackingSystemService::setLoggingFolder
virtual void setLoggingFolder(QString loggingFolder)
Definition: cxTrackingSystemService.cpp:57
cx::TrackingSystemService::isInitialized
virtual bool isInitialized() const
Definition: cxTrackingSystemService.cpp:34
cx::TrackingSystemService::uninitialize
virtual void uninitialize()
disconnects from the hardware
Definition: cxTrackingSystemService.cpp:101
cx::TrackingSystemService::stopTracking
virtual void stopTracking()
stops tracking
Definition: cxTrackingSystemService.cpp:110
cx::TrackingSystemService::startTracking
virtual void startTracking()
starts tracking
Definition: cxTrackingSystemService.cpp:104
cx::TrackingSystemService::mConfigurationFilePath
QString mConfigurationFilePath
path to the configuration file
Definition: cxTrackingSystemService.h:68
cx::Tool::tsNONE
@ tsNONE
not available
Definition: cxTool.h:74
cx::TrackingSystemService::getState
virtual Tool::State getState() const
Definition: cxTrackingSystemService.cpp:24
cx::Tool::State
State
Definition: cxTool.h:72
cx::TrackingSystemService::TrackingSystemService
TrackingSystemService()
Definition: cxTrackingSystemService.cpp:17
cx::TrackingSystemService::isTracking
virtual bool isTracking() const
Definition: cxTrackingSystemService.cpp:39
cx::Tool::tsCONFIGURED
@ tsCONFIGURED
configured with basic info
Definition: cxTool.h:75
cx::TrackingSystemService::mLoggingFolder
QString mLoggingFolder
path to where logging should be saved
Definition: cxTrackingSystemService.h:69
cx::TrackingSystemService::mState
Tool::State mState
Definition: cxTrackingSystemService.h:67
cx::Tool::tsINITIALIZED
@ tsINITIALIZED
connected to hardware, if any, ready to use
Definition: cxTool.h:76
cxTrackingSystemService.h
cx::TrackingSystemService::internalSetState
void internalSetState(Tool::State val)
Definition: cxTrackingSystemService.cpp:70
cx::TrackingSystemService::isConfigured
virtual bool isConfigured() const
Definition: cxTrackingSystemService.cpp:29
cx::TrackingSystemService::setConfigurationFile
virtual void setConfigurationFile(QString configurationFile)
Definition: cxTrackingSystemService.cpp:44
cx::Tool::tsTRACKING
@ tsTRACKING
emitting tracking data
Definition: cxTool.h:77
tsNONE
tsNONE
Not specified.
Definition: cxDefinitions.h:112