int main(int argc, char *argv[]) try { PXCSession *pSession; PXCSession::ImplDesc *pDesc; PXCCapture *pCapture; PXCSenseManager *pSenseManager; // Initialize pSession = PXCSession::CreateInstance(); pDesc = new PXCSession::ImplDesc(); pDesc->group = PXCSession::ImplGroup::IMPL_GROUP_SENSOR; pDesc->subgroup = PXCSession::ImplSubgroup::IMPL_SUBGROUP_VIDEO_CAPTURE;
// Enumerate Devices std::string temp; // iterating over the present modules for (int m = 0; ; m++) { PXCSession::ImplDesc desc2; if (pSession->QueryImpl(pDesc, m, &desc2) < pxcStatus::PXC_STATUS_NO_ERROR) { break; } //temp = format("Module[%d]: %d", m, desc2.friendlyName); wstring ws(desc2.friendlyName); string str(ws.begin(), ws.end()); std::cout << "Module[" << m << "]: " << str.c_str() << std::endl; PXCCapture *pCap; pSession->CreateImpl<PXCCapture>(&desc2, &pCap); // interating over the devices for (int d = 0; ; d++) { PXCCapture::DeviceInfo dinfo; if (pCap->QueryDeviceInfo(d, &dinfo) < pxcStatus::PXC_STATUS_NO_ERROR) { break; }; wstring ws(dinfo.name); string str(ws.begin(), ws.end()); std::cout << "Device[" << d << "]: " << str.c_str() << std::endl; /*wstring ws(dinfo.orientation); string str(ws.begin(), ws.end()); std::cout << "Device[" << d << "]: " << str.c_str() << std::endl; wstring ws(dinfo.model); string str(ws.begin(), ws.end()); std::cout << "Device[" << d << "]: " << str.c_str() << std::endl;*/ } }
#include <windows.h> #include <iostream> #include <string> #include <cstdio> // #include "pxcbase.h" #include "pxcsensemanager.h" #include "pxcmetadata.h" #include "service/pxcsessionservice.h" #include "pxccapture.h" #include "pxccapturemanager.h" using namespace std; int main(int argc, char *argv[]) try { PXCSession *pSession; PXCSession::ImplDesc *pDesc; PXCCapture *pCapture; PXCSenseManager *pSenseManager; // Initialize pSession = PXCSession::CreateInstance(); pDesc = new PXCSession::ImplDesc(); pDesc->group = PXCSession::ImplGroup::IMPL_GROUP_SENSOR; pDesc->subgroup = PXCSession::ImplSubgroup::IMPL_SUBGROUP_VIDEO_CAPTURE; // Enumerate Devices std::string temp; for (int m = 0; ; m++) { PXCSession::ImplDesc desc2; if (pSession->QueryImpl(pDesc, m, &desc2) < pxcStatus::PXC_STATUS_NO_ERROR) { break; } //temp = format("Module[%d]: %d", m, desc2.friendlyName); wstring ws(desc2.friendlyName); string str(ws.begin(), ws.end()); std::cout << "Module[" << m << "]: " << str.c_str() << std::endl; PXCCapture *pCap; pSession->CreateImpl<PXCCapture>(&desc2, &pCap); // print out all device information for (int d = 0; ; d++) { PXCCapture::DeviceInfo dinfo; if (pCap->QueryDeviceInfo(d, &dinfo) < pxcStatus::PXC_STATUS_NO_ERROR) { break; }; wstring ws(dinfo.name); string str(ws.begin(), ws.end()); std::cout << "Device[" << d << "]: " << str.c_str() << std::endl; /*wstring ws(dinfo.orientation); string str(ws.begin(), ws.end()); std::cout << "Device[" << d << "]: " << str.c_str() << std::endl; wstring ws(dinfo.model); string str(ws.begin(), ws.end()); std::cout << "Device[" << d << "]: " << str.c_str() << std::endl;*/ } } cin.clear(); cout << endl << "Press any key to continue..."; cin.ignore(); return 0; } catch (const char *c) { std::cerr << "Program aborted: " << c << "\n"; MessageBox(GetActiveWindow(), (LPCWSTR)c, L"FAIL", 0); } catch (std::exception e) { std::cerr << "Program aborted: " << e.what() << "\n"; MessageBox(GetActiveWindow(), (LPCWSTR)e.what(), L"FAIL", 0); }
Source: https://habr.com/ru/post/313290/
All Articles