Software Archive
Read-only legacy content
17060 Discussions

Cannot get Device Instance

John_M_9
Beginner
1,366 Views

Hi All,

I have seen numerous examples of getting the device instance; looks simple enough.  However, I am getting a null return from QueryDevice().  I have tried (using c++):

	// Create a PXCSenseManager instance
	PXCSenseManager *sm = PXCSenseManager::CreateInstance();
	if (!sm)
		return 1;

	// find Device Instance
	PXCCapture::Device *cp = sm->QueryCaptureManager()->QueryDevice();
	if (!cp)
	{
		sm->Release();
		return 3;
	}

and

	// Create a PXCSenseManager instance
	PXCSenseManager *sm = PXCSenseManager::CreateInstance();
	if (!sm)
		return 1;

	// find Capture Manager Instance
	PXCCaptureManager *cm = sm->QueryCaptureManager();
	if (!cm)
	{
		sm->Release();
		return 2;
	}

	// find Device Instance
	PXCCapture::Device *cp = cm->QueryDevice();
	if (!cp)
	{
		sm->Release();
		return 3;
	}

QueryCaptureManager() returns a non-NULL cm, but QueryDevice() returns a NULL for cp.

Any help would be greatly appreciated.  Thanks!

John

.

0 Kudos
1 Solution
Xusheng_L_Intel
Employee
1,366 Views

You need add sm->init() before PXCCaptureManager *cm = sm->QueryCaptureManager(); Thanks!

View solution in original post

0 Kudos
5 Replies
John_M_9
Beginner
1,366 Views

Probably should have mentioned:  Using R200 camera with latest SDK

0 Kudos
Xusheng_L_Intel
Employee
1,367 Views

You need add sm->init() before PXCCaptureManager *cm = sm->QueryCaptureManager(); Thanks!

0 Kudos
John_M_9
Beginner
1,366 Views

That did it, David!  Thank you very much!

0 Kudos
Aaron_S_4
Beginner
1,366 Views

Is it possible to get a PXCMCapture::Device without initializing SenseManager?

I want to be able to enumerate allowed stream configurations (e.g. which configurations of color+depth are possible) before calling SenseManager::init()

The "Enumerating Streams" and "Enumerating Stream Configurations" sections of the SDK Documentation assume that we already have a reference to the device, but as best I can tell, the only way to get the actual Device (and not just DeviceInfo) is to initialize SenseManager, but that seems so round-about.

0 Kudos
Henning_J_
New Contributor I
1,366 Views

Yes, there is another option: create a PXCMCapture (by using PXCSession::CreateImpl()), then use PXCCapture::CreateDevice().

Something like this:

PXCSession::ImplDesc desc={};
desc.group=PXCSession::IMPL_GROUP_SENSOR;
desc.subgroup=PXCSession::IMPL_SUBGROUP_VIDEO_CAPTURE;

for (int i=0;;i++) {
   PXCSession::ImplDesc desc1;
   if (session->QueryImpl(&desc,i,&desc1)<PXC_STATUS_NO_ERROR) break;

   PXCCapture *capture;
   session->CreateImpl<PXCCapture>(&desc1,&capture);

   for (int d=0;;d++) {
       PXCCapture::DeviceInfo dinfo;
       if (capture->QueryDevice(d,&dinfo)<PXC_STATUS_NO_ERROR) break;
       
	   PXCCapture::Device *device = capture->CreateDevice(d);
	   break;
   }
   capture->Release();
}

 

0 Kudos
Reply