Page MenuHomePhabricator

Enabling wired Aurora tools produces errors
Closed, ResolvedPublic

Description

Since your last commits of NDIProtocol/NDITrackingDevice, an error message appears, if you connect to an Aurora to which two or more tools are connected. It seems that the receive buffer still contains bytes from the previous command.

Event Timeline

[SVN revision 20937]
FIX (#3197): Fixed bug by separating initialization of aurora tools and readout of serial numbers.

now adding passive tools to the polaris leads to a crash in your code:

bool mitk::NDITrackingDevice::DiscoverWiredTools()
...

for (unsigned int i = 0; i < this->GetToolCount(); i += 2)
  {
  ph = portHandle.substr(occupiedPorts.at(i), 2);
  std::string portInfo;
  NDIErrorCode returnvaluePort = m_DeviceProtocol->PHINF(ph, &portInfo);
  if ((returnvaluePort==NDIOKAY) && (portInfo.size()>31)) dynamic_cast<mitk::NDIPassiveTool*>(this->GetTool(i))->SetSerialNumber(portInfo.substr(23,8));
  }

--> portHandle might be empty while GetToolCount returns a positive number of tools, if only passive tools are present. This leads to a crash at ph = portHandle.substr(occupiedPorts.at(i), 2);

I wonder why the method DiscoverWiredTools() was called when no wired tools where connected. But you're right the code should not produce errors anyway. I'll try to fix this as soon as possible.

I already commented out the defect code parts. Therefore, tool handling should work without crashes, but reading the serial number of wired tools does not work with this version (but this is not an important feature for the release). Reading wired tool information should be refactored in the future, but I think, it is not release relevant.

I fixed this bug. You can now read out serial numbers of wired aurora tools with the method GetSerialNumber() of NDIPassiveTool. I also did a lot of tests with different tool configurations and with the polaris system to make sure that everything work stable.

[SVN revision 29079]
FIX (#3197): Reading out serial numbers of aurora tools now works without errors. The polaris system should not be affected by this change.