MYNT-EYE-S-SDK/src/device/context.cc

36 lines
875 B
C++
Raw Normal View History

2018-04-04 05:50:27 +03:00
#include "device/context.h"
#include <glog/logging.h>
#include "device/device.h"
#include "uvc/uvc.h"
MYNTEYE_BEGIN_NAMESPACE
Context::Context() : context_(uvc::create_context()) {
VLOG(2) << __func__;
for (auto &&device : uvc::query_devices(context_)) {
auto name = uvc::get_name(*device);
auto vid = uvc::get_vendor_id(*device);
auto pid = uvc::get_product_id(*device);
// auto video_name = uvc::get_video_name(*device);
2018-04-04 06:38:36 +03:00
LOG(INFO) << "UVC device detected, name: " << name << ", vid: 0x"
<< std::hex << vid << ", pid: 0x" << std::hex << pid;
2018-04-04 05:50:27 +03:00
if (vid == MYNTEYE_VID) {
2018-04-04 06:38:36 +03:00
auto d = Device::Create(name, device);
if (d) {
devices_.push_back(d);
} else {
LOG(ERROR) << "Device is not supported by MYNT EYE.";
}
2018-04-04 05:50:27 +03:00
}
}
}
Context::~Context() {
VLOG(2) << __func__;
}
MYNTEYE_END_NAMESPACE