示例#1
0
void mitk::USDevice::Deactivate()
{
  m_IsActive= false;

  ServiceProperties props = ConstructServiceProperties();
  this->m_ServiceRegistration.SetProperties(props);
  OnDeactivation();
}
示例#2
0
bool mitk::USDevice::Activate()
{
  if (! this->GetIsConnected()) return false;
  m_IsActive = true; // <- Necessary to safely allow Subclasses to start threading based on activity state
  m_IsActive = OnActivation();

  ServiceProperties props = ConstructServiceProperties();
  this->m_ServiceRegistration.SetProperties(props);
  return m_IsActive;
}
示例#3
0
bool mitk::USDevice::Connect()
{
  if (GetIsConnected())
  {
    MITK_WARN << "Tried to connect an ultrasound device that was already connected. Ignoring call...";
    return false;
  }
  // Prepare connection, fail if this fails.
  if (! this->OnConnection()) return false;

  // Get Context and Module
  mitk::ModuleContext* context = GetModuleContext();
  ServiceProperties props = ConstructServiceProperties();

  m_ServiceRegistration = context->RegisterService<mitk::USDevice>(this, props);

  // This makes sure that the SmartPointer to this device does not invalidate while the device is connected
  this->Register();

  return true;
}