16#include <mitkSurface.h>
18#include <mitkDataStorage.h>
22#include <qfiledialog.h>
23#include <qinputdialog.h>
24#include <qmessagebox.h>
25#include <qscrollbar.h>
28#include <igtlStringMessage.h>
29#include <igtlBindMessage.h>
30#include <igtlQuaternionTrackingDataMessage.h>
31#include <igtlTrackingDataMessage.h>
37 "org.mitk.views.igtldevicesourcemanagementwidget";
40 QWidget* parent, Qt::WindowFlags f)
41 : QWidget(parent, f), m_IsClient(false), m_MessageReceivedObserverTag(0), m_CommandReceivedObserverTag(0), m_LostConnectionObserverTag(0), m_NewConnectionObserverTag(0), m_StateModifiedObserverTag(0)
63 m_Controls =
new Ui::QmitkIGTLDeviceCommandWidgetControls;
77 connect(
m_Controls->butSendCommand, SIGNAL(clicked()),
80 SIGNAL(currentIndexChanged(
const QString &)),
104 this->
m_Controls->commandsComboBox->setEnabled(
false);
105 this->
m_Controls->butSendCommand->setEnabled(
false);
106 this->
m_Controls->fpsSpinBox->setEnabled(
false);
109 this->
m_Controls->commandsComboBox->setEnabled(
true);
110 this->
m_Controls->butSendCommand->setEnabled(
true);
111 this->
m_Controls->fpsSpinBox->setEnabled(
false);
114 if ( this->
m_IGTLDevice->GetNumberOfConnections() == 0 )
117 this->
m_Controls->butSendCommand->setEnabled(
false);
118 this->
m_Controls->fpsSpinBox->setEnabled(
false);
119 this->
m_Controls->commandsComboBox->setEnabled(
false);
123 this->
m_Controls->commandsComboBox->setEnabled(
true);
124 this->
m_Controls->butSendCommand->setEnabled(
true);
129 mitkThrow() <<
"Invalid Device State";
153 if(device.IsNotNull())
169 typedef itk::SimpleMemberCommand< QmitkIGTLDeviceCommandWidget > CurCommandType;
182 CurCommandType::Pointer connectionLostCommand = CurCommandType::New();
183 connectionLostCommand->SetCallbackFunction(
186 mitk::LostConnectionEvent(), connectionLostCommand);
188 CurCommandType::Pointer newConnectionCommand = CurCommandType::New();
189 newConnectionCommand->SetCallbackFunction(
192 mitk::NewClientConnectionEvent(), newConnectionCommand);
194 CurCommandType::Pointer stateModifiedCommand = CurCommandType::New();
195 stateModifiedCommand->SetCallbackFunction(
198 itk::ModifiedEvent(), stateModifiedCommand);
213 this->
m_Controls->commandsComboBox->setEnabled(
false);
214 this->
m_Controls->butSendCommand->setEnabled(
false);
215 this->
m_Controls->fpsSpinBox->setEnabled(
false);
227 SetResolution(this->
m_Controls->fpsSpinBox->value());
229 else if ( std::strcmp(
m_CurrentCommand->GetDeviceType(),
"STT_QTDATA" ) == 0 )
231 ((igtl::StartQuaternionTrackingDataMessage*)
m_CurrentCommand.GetPointer())->
232 SetResolution(this->
m_Controls->fpsSpinBox->value());
234 else if ( std::strcmp(
m_CurrentCommand->GetDeviceType(),
"STT_TDATA" ) == 0 )
237 SetResolution(this->
m_Controls->fpsSpinBox->value());
244 const QString & curCommand)
246 if ( curCommand.isEmpty() )
249 mitk::IGTLMessageFactory::Pointer msgFactory =
252 this->
m_CurrentCommand = msgFactory->CreateInstance( curCommand.toStdString());
254 this->
m_Controls->fpsSpinBox->setEnabled(curCommand.contains(
"STT_"));
275 mitk::IGTLMessageFactory::Pointer msgFactory =
278 std::list<std::string> commandsList_ =
279 msgFactory->GetAvailableMessageRequestTypes();
282 while ( commandsList_.size() )
286 QString::fromStdString(commandsList_.front()));
287 commandsList_.pop_front();
Superclass for OpenIGTLink clients.
IGTLDeviceState
Type for state variable. The IGTLDevice is always in one of these states.