diff --git a/src/mynteye/device/channel/channels.cc b/src/mynteye/device/channel/channels.cc index 7b70e9d..6619cd7 100644 --- a/src/mynteye/device/channel/channels.cc +++ b/src/mynteye/device/channel/channels.cc @@ -22,6 +22,7 @@ #include #include +#include "mynteye/device/config.h" #include "mynteye/logger.h" #include "mynteye/util/times.h" @@ -520,10 +521,31 @@ bool Channels::SetFiles( } } if (img_params != nullptr) { - auto n = file_channel_.SetImgParamsToData(img_params, data + 3 + size); - if (n > 0) { - header[1] = true; - size += n; + // remove not supported resolution + auto&& res = adapter_->GetResolutionSupports(); + for (auto it = img_params->begin(); it != img_params->end(); ) { + if (res.find(it->first) == res.end()) { + LOG(WARNING) << "Image params of resolution " + << it->first.width << "x" << it->first.height << " not supported"; + it = img_params->erase(it); + } else { + ++it; + } + } + + if (img_params->empty()) { + std::ostringstream os; + os << "Image params resolution must be "; + for (auto&& r : res) { + os << r.width << "x" << r.height << " "; + } + LOG(WARNING) << os.str(); + } else { + auto n = file_channel_.SetImgParamsToData(img_params, data + 3 + size); + if (n > 0) { + header[1] = true; + size += n; + } } } if (imu_params != nullptr) { @@ -719,4 +741,31 @@ Channels::control_info_t Channels::XuControlInfo(Option option) const { return {min, max, def}; } +// ChannelsAdapter + +ChannelsAdapter::ChannelsAdapter(const Model &model) + : model_(model) { +} + +ChannelsAdapter::~ChannelsAdapter() { +} + +std::set