CustusX  18.04-rc1
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
virtual void deconfigure()
deconfigures the software
tsNONE
Not specified.
Interface to a tool, i.e. a pointer, US probe or similar.
Definition: cxTool.h:61
QString mConfigurationFilePath
path to the configuration file
virtual void setConfigurationFile(QString configurationFile)
configured with basic info
Definition: cxTool.h:75
virtual void stopTracking()
stops tracking
QString mLoggingFolder
path to where logging should be saved
virtual Tool::State getState() const
virtual void initialize()
connects to the hardware
not available
Definition: cxTool.h:74
virtual bool isInitialized() const
virtual void uninitialize()
disconnects from the hardware
connected to hardware, if any, ready to use
Definition: cxTool.h:76
virtual void startTracking()
starts tracking
virtual bool isConfigured() const
emitting tracking data
Definition: cxTool.h:77
void internalSetState(Tool::State val)
virtual void setLoggingFolder(QString loggingFolder)
virtual void configure()
sets up the software
Namespace for all CustusX production code.