Change log fatal
This commit is contained in:
parent
b4f73dfa0b
commit
240b18270b
|
@ -163,7 +163,7 @@ void API::Start(const Source &source) {
|
||||||
Start(Source::VIDEO_STREAMING);
|
Start(Source::VIDEO_STREAMING);
|
||||||
Start(Source::MOTION_TRACKING);
|
Start(Source::MOTION_TRACKING);
|
||||||
} else {
|
} else {
|
||||||
LOG(FATAL) << "Unsupported source :(";
|
LOG(ERROR) << "Unsupported source :(";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void API::Stop(const Source &source) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
Stop(Source::VIDEO_STREAMING);
|
Stop(Source::VIDEO_STREAMING);
|
||||||
} else {
|
} else {
|
||||||
LOG(FATAL) << "Unsupported source :(";
|
LOG(ERROR) << "Unsupported source :(";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,9 @@ bool Device::Supports(const AddOns &addon) const {
|
||||||
return hw_flag[0];
|
return hw_flag[0];
|
||||||
case AddOns::INFRARED2:
|
case AddOns::INFRARED2:
|
||||||
return hw_flag[1];
|
return hw_flag[1];
|
||||||
default: { LOG(FATAL) << "Unknown add-on"; }
|
default:
|
||||||
|
LOG(WARNING) << "Unknown add-on";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,8 +137,9 @@ void Device::ConfigStreamRequest(
|
||||||
auto &&requests = GetStreamRequests(capability);
|
auto &&requests = GetStreamRequests(capability);
|
||||||
if (std::find(requests.cbegin(), requests.cend(), request) ==
|
if (std::find(requests.cbegin(), requests.cend(), request) ==
|
||||||
requests.cend()) {
|
requests.cend()) {
|
||||||
LOG(FATAL) << "Config stream request of " << capability
|
LOG(WARNING) << "Config stream request of " << capability
|
||||||
<< " is not accpected";
|
<< " is not accpected";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
stream_config_requests_[capability] = request;
|
stream_config_requests_[capability] = request;
|
||||||
}
|
}
|
||||||
|
@ -148,31 +151,25 @@ std::shared_ptr<DeviceInfo> Device::GetInfo() const {
|
||||||
std::string Device::GetInfo(const Info &info) const {
|
std::string Device::GetInfo(const Info &info) const {
|
||||||
CHECK_NOTNULL(device_info_);
|
CHECK_NOTNULL(device_info_);
|
||||||
switch (info) {
|
switch (info) {
|
||||||
case Info::DEVICE_NAME: {
|
case Info::DEVICE_NAME:
|
||||||
return device_info_->name;
|
return device_info_->name;
|
||||||
} break;
|
case Info::SERIAL_NUMBER:
|
||||||
case Info::SERIAL_NUMBER: {
|
|
||||||
return device_info_->serial_number;
|
return device_info_->serial_number;
|
||||||
} break;
|
case Info::FIRMWARE_VERSION:
|
||||||
case Info::FIRMWARE_VERSION: {
|
|
||||||
return device_info_->firmware_version.to_string();
|
return device_info_->firmware_version.to_string();
|
||||||
} break;
|
case Info::HARDWARE_VERSION:
|
||||||
case Info::HARDWARE_VERSION: {
|
|
||||||
return device_info_->hardware_version.to_string();
|
return device_info_->hardware_version.to_string();
|
||||||
} break;
|
case Info::SPEC_VERSION:
|
||||||
case Info::SPEC_VERSION: {
|
|
||||||
return device_info_->spec_version.to_string();
|
return device_info_->spec_version.to_string();
|
||||||
} break;
|
case Info::LENS_TYPE:
|
||||||
case Info::LENS_TYPE: {
|
|
||||||
return device_info_->lens_type.to_string();
|
return device_info_->lens_type.to_string();
|
||||||
} break;
|
case Info::IMU_TYPE:
|
||||||
case Info::IMU_TYPE: {
|
|
||||||
return device_info_->imu_type.to_string();
|
return device_info_->imu_type.to_string();
|
||||||
} break;
|
case Info::NOMINAL_BASELINE:
|
||||||
case Info::NOMINAL_BASELINE: {
|
|
||||||
return std::to_string(device_info_->nominal_baseline);
|
return std::to_string(device_info_->nominal_baseline);
|
||||||
} break;
|
default:
|
||||||
default: { LOG(FATAL) << "Unknown device info"; }
|
LOG(WARNING) << "Unknown device info";
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +309,7 @@ void Device::Start(const Source &source) {
|
||||||
Start(Source::VIDEO_STREAMING);
|
Start(Source::VIDEO_STREAMING);
|
||||||
Start(Source::MOTION_TRACKING);
|
Start(Source::MOTION_TRACKING);
|
||||||
} else {
|
} else {
|
||||||
LOG(FATAL) << "Unsupported source :(";
|
LOG(ERROR) << "Unsupported source :(";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +324,7 @@ void Device::Stop(const Source &source) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
Stop(Source::VIDEO_STREAMING);
|
Stop(Source::VIDEO_STREAMING);
|
||||||
} else {
|
} else {
|
||||||
LOG(FATAL) << "Unsupported source :(";
|
LOG(ERROR) << "Unsupported source :(";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,8 +364,8 @@ const StreamRequest &Device::GetStreamRequest(const Capabilities &capability) {
|
||||||
return stream_config_requests_.at(capability);
|
return stream_config_requests_.at(capability);
|
||||||
} catch (const std::out_of_range &e) {
|
} catch (const std::out_of_range &e) {
|
||||||
auto &&requests = GetStreamRequests(capability);
|
auto &&requests = GetStreamRequests(capability);
|
||||||
if (requests.size() == 1) {
|
if (requests.size() >= 1) {
|
||||||
VLOG(2) << "Get the only one stream request of " << capability;
|
VLOG(2) << "Select the first one stream request of " << capability;
|
||||||
return requests[0];
|
return requests[0];
|
||||||
} else {
|
} else {
|
||||||
LOG(FATAL) << "Please config the stream request of " << capability;
|
LOG(FATAL) << "Please config the stream request of " << capability;
|
||||||
|
@ -478,7 +475,8 @@ void Device::ReadAllInfos() {
|
||||||
Channels::img_params_t img_params;
|
Channels::img_params_t img_params;
|
||||||
Channels::imu_params_t imu_params;
|
Channels::imu_params_t imu_params;
|
||||||
if (!channels_->GetFiles(device_info_.get(), &img_params, &imu_params)) {
|
if (!channels_->GetFiles(device_info_.get(), &img_params, &imu_params)) {
|
||||||
LOG(FATAL) << "Read device infos failed :(";
|
LOG(FATAL) << "Read device infos failed. Please upgrade your firmware to "
|
||||||
|
"the latest version.";
|
||||||
}
|
}
|
||||||
VLOG(2) << "Device info: {name: " << device_info_->name
|
VLOG(2) << "Device info: {name: " << device_info_->name
|
||||||
<< ", serial_number: " << device_info_->serial_number
|
<< ", serial_number: " << device_info_->serial_number
|
||||||
|
|
|
@ -177,7 +177,7 @@ std::int32_t Channels::GetControlValue(const Option &option) const {
|
||||||
LOG(WARNING) << option << " get value useless";
|
LOG(WARNING) << option << " get value useless";
|
||||||
return -1;
|
return -1;
|
||||||
default:
|
default:
|
||||||
LOG(FATAL) << "Unsupported option " << option;
|
LOG(ERROR) << "Unsupported option " << option;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ void Channels::SetControlValue(const Option &option, std::int32_t value) {
|
||||||
LOG(WARNING) << option << " set value useless";
|
LOG(WARNING) << option << " set value useless";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(FATAL) << "Unsupported option " << option;
|
LOG(ERROR) << "Unsupported option " << option;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,8 @@ bool Channels::RunControlAction(const Option &option) const {
|
||||||
LOG(WARNING) << option << " run action useless";
|
LOG(WARNING) << option << " run action useless";
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
LOG(FATAL) << "Unsupported option " << option;
|
LOG(ERROR) << "Unsupported option " << option;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,8 @@ Streams::~Streams() {
|
||||||
void Streams::ConfigStream(
|
void Streams::ConfigStream(
|
||||||
const Capabilities &capability, const StreamRequest &request) {
|
const Capabilities &capability, const StreamRequest &request) {
|
||||||
if (!IsStreamCapability(capability)) {
|
if (!IsStreamCapability(capability)) {
|
||||||
LOG(FATAL) << "Cannot config stream without stream capability";
|
LOG(ERROR) << "Cannot config stream without stream capability";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
VLOG(2) << "Config stream request of " << capability << ", " << request;
|
VLOG(2) << "Config stream request of " << capability << ", " << request;
|
||||||
stream_config_requests_[capability] = request;
|
stream_config_requests_[capability] = request;
|
||||||
|
@ -171,7 +172,8 @@ void Streams::WaitForStreams() {
|
||||||
std::unique_lock<std::mutex> lock(mtx_);
|
std::unique_lock<std::mutex> lock(mtx_);
|
||||||
auto ready = std::bind(&Streams::HasKeyStreamDatas, this);
|
auto ready = std::bind(&Streams::HasKeyStreamDatas, this);
|
||||||
if (!ready() && !cv_.wait_for(lock, std::chrono::seconds(2), ready)) {
|
if (!ready() && !cv_.wait_for(lock, std::chrono::seconds(2), ready)) {
|
||||||
LOG(FATAL) << "Timeout waiting for key frames";
|
LOG(FATAL) << "Timeout waiting for key frames. Please use USB 3.0, and not "
|
||||||
|
"in virtual machine.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user