Correct termination of Camera SDK

Post Reply
rprueckl
Posts: 4
Joined: Wed Jan 15, 2020 3:28 am

Correct termination of Camera SDK

Post by rprueckl » Wed Apr 01, 2020 11:09 am

Using Prime13 with CameraSDK 2.0.2.

We are using the Camera SDK in our object-oriented C++ using the Qt framework.
The object that manages the camera SDK has a function as follows:

Code: Select all

void CXCameraManager::terminateCameras()
{
  if (camerasInitialized)
  {
    if (syncListener)
    {
      syncListener->stopRetrievingSynchronousFrames();
      syncListener.clear();
    }

    if (syncModule)
    {
      syncModule->RemoveAllCameras();
      CameraLibrary::cModuleSync::Destroy(syncModule);
      syncModule = 0;
    }

    CameraLibrary::CameraList list;
    for (int cam = 0; cam < list.Count(); cam++)
    {
      CameraLibrary::Camera *camera = CameraLibrary::CameraManager::X().GetCamera(list[cam].UID());
      if (camera)
      {
        camera->SetNumeric(false, 0);
        camera->Release();
      }
    }

    CameraLibrary::CameraManager::X().Shutdown();
    CameraLibrary::CameraManager::X().DestroyInstance();

    clearValidCameraInformationVector();
    validSerialsForList.clear();

    camerasInitialized = false;
  }

  signalCameraTerminationDone();
}
Scenario 1:
The function is called from a slot in response to a signal of a button. Some time after (seconds), the program is closed. Now, the front LEDs of the cameras are not blinking and the hibernation status LED ring appears after some seconds.

Scenario 2:
The program is about to be ended and the method is called from the destructor of the mamaging object. Immediately afterwards, the program ends. Now, the front LEDs on the cameras are blinking and no hibernation status LED ring appears.

What could be the difference here? Is it related to the dll of the camera SDK being unloaded by the program? Or the immediate end of program after the calls to Shutdown() and DestroyInstance()? Or the fact that in the first scenario, the event loop of the program (and all background threads) are still processing?

I would really like to have the same behavior of the system in any case after calling the terminateCameras() function. Can anybody help me to achieve that?

Actually, after ending my program, I don't want the hibernation LED effect to appear. Can this be achieved somehow?

Post Reply