2018-05-10 09:46:34 +03:00
|
|
|
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2018-04-21 10:45:33 +03:00
|
|
|
#ifndef MYNTEYE_TOOLS_DEVICE_WRITER_H_ // NOLINT
|
|
|
|
#define MYNTEYE_TOOLS_DEVICE_WRITER_H_
|
|
|
|
#pragma once
|
|
|
|
|
2018-12-26 13:58:37 +02:00
|
|
|
#include <map>
|
2018-04-21 10:45:33 +03:00
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "mynteye/mynteye.h"
|
2019-01-05 14:02:08 +02:00
|
|
|
#include "mynteye/device/channel/channels.h"
|
2018-10-27 16:24:04 +03:00
|
|
|
#include "mynteye/device/types.h"
|
2018-04-21 10:45:33 +03:00
|
|
|
|
|
|
|
MYNTEYE_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
class Device;
|
|
|
|
|
|
|
|
namespace tools {
|
|
|
|
|
|
|
|
class DeviceWriter {
|
|
|
|
public:
|
|
|
|
using dev_info_t = DeviceInfo;
|
2018-11-27 08:50:12 +02:00
|
|
|
using imu_params_t = device::imu_params_t;
|
2018-12-26 13:58:37 +02:00
|
|
|
using img_params_t = device::img_params_t;
|
|
|
|
using img_params_map_t = std::map<Resolution, device::img_params_t>;
|
2018-04-21 10:45:33 +03:00
|
|
|
|
|
|
|
explicit DeviceWriter(std::shared_ptr<Device> device);
|
|
|
|
~DeviceWriter();
|
|
|
|
|
|
|
|
bool WriteDeviceInfo(const dev_info_t &info);
|
|
|
|
bool WriteDeviceInfo(const std::string &filepath);
|
|
|
|
|
2018-12-26 13:58:37 +02:00
|
|
|
bool WriteImgParams(const img_params_map_t &img_params_map);
|
2018-04-21 10:45:33 +03:00
|
|
|
bool WriteImgParams(const std::string &filepath);
|
|
|
|
|
|
|
|
bool WriteImuParams(const imu_params_t ¶ms);
|
|
|
|
bool WriteImuParams(const std::string &filepath);
|
|
|
|
|
|
|
|
bool SaveDeviceInfo(const dev_info_t &info, const std::string &filepath);
|
2018-09-20 11:52:08 +03:00
|
|
|
bool SaveImgParams(
|
2018-12-26 13:58:37 +02:00
|
|
|
const dev_info_t &info, const img_params_map_t &img_params_map,
|
2018-09-20 11:52:08 +03:00
|
|
|
const std::string &filepath);
|
2018-04-21 10:45:33 +03:00
|
|
|
bool SaveImuParams(const imu_params_t ¶ms, const std::string &filepath);
|
|
|
|
|
|
|
|
/** Save all infos of this device */
|
|
|
|
void SaveAllInfos(const std::string &dir);
|
|
|
|
|
|
|
|
private:
|
|
|
|
dev_info_t LoadDeviceInfo(const std::string &filepath);
|
2018-12-26 13:58:37 +02:00
|
|
|
img_params_map_t LoadImgParams(const std::string &filepath);
|
2018-04-21 10:45:33 +03:00
|
|
|
imu_params_t LoadImuParams(const std::string &filepath);
|
|
|
|
|
|
|
|
std::shared_ptr<Device> device_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace tools
|
|
|
|
|
|
|
|
MYNTEYE_END_NAMESPACE
|
|
|
|
|
|
|
|
#endif // MYNTEYE_TOOLS_DEVICE_WRITER_H_ NOLINT
|