2018-04-09 10:54:14 +03:00
|
|
|
#ifndef MYNTEYE_INTERNAL_CHANNELS_H_ // NOLINT
|
|
|
|
#define MYNTEYE_INTERNAL_CHANNELS_H_
|
|
|
|
#pragma once
|
|
|
|
|
2018-04-09 17:24:34 +03:00
|
|
|
#include <map>
|
2018-04-09 10:54:14 +03:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "mynteye/mynteye.h"
|
2018-04-09 17:24:34 +03:00
|
|
|
#include "uvc/uvc.h"
|
2018-04-09 10:54:14 +03:00
|
|
|
|
|
|
|
MYNTEYE_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
namespace uvc {
|
|
|
|
|
|
|
|
struct device;
|
|
|
|
struct xu;
|
|
|
|
|
|
|
|
} // namespace uvc
|
|
|
|
|
|
|
|
class Channels {
|
|
|
|
public:
|
2018-04-09 17:24:34 +03:00
|
|
|
typedef enum Channel {
|
|
|
|
CHANNEL_CAM_CTRL = 0x0100,
|
|
|
|
CHANNEL_HALF_DUPLEX = 0x0200,
|
|
|
|
CHANNEL_IMU_WRITE = 0x0300,
|
|
|
|
CHANNEL_IMU_READ = 0x0400,
|
|
|
|
CHANNEL_FILE = 0x0500,
|
|
|
|
CHANNEL_LAST
|
|
|
|
} channel_t;
|
|
|
|
|
|
|
|
typedef struct ControlInfo {
|
|
|
|
std::int32_t min;
|
|
|
|
std::int32_t max;
|
|
|
|
std::int32_t def;
|
|
|
|
} control_info_t;
|
2018-04-09 10:54:14 +03:00
|
|
|
|
|
|
|
explicit Channels(std::shared_ptr<uvc::device> device);
|
|
|
|
~Channels();
|
|
|
|
|
2018-04-09 19:26:22 +03:00
|
|
|
void LogControlInfos() const;
|
|
|
|
|
|
|
|
control_info_t GetControlInfo(const Option &option) const;
|
|
|
|
std::int32_t GetControlValue(const Option &option) const;
|
|
|
|
void SetControlValue(const Option &option, std::int32_t value);
|
|
|
|
|
2018-04-09 10:54:14 +03:00
|
|
|
private:
|
2018-04-09 19:26:22 +03:00
|
|
|
bool PuControlRange(
|
|
|
|
Option option, int32_t *min, int32_t *max, int32_t *def) const;
|
|
|
|
bool PuControlQuery(Option option, uvc::pu_query query, int32_t *value) const;
|
|
|
|
|
2018-04-09 17:24:34 +03:00
|
|
|
bool XuControlQuery(
|
2018-04-09 19:26:22 +03:00
|
|
|
uint8_t selector, uvc::xu_query query, uint16_t size,
|
|
|
|
uint8_t *data) const;
|
2018-04-09 17:24:34 +03:00
|
|
|
bool XuControlQuery(
|
|
|
|
const uvc::xu &xu, uint8_t selector, uvc::xu_query query, uint16_t size,
|
2018-04-09 19:26:22 +03:00
|
|
|
uint8_t *data) const;
|
|
|
|
|
|
|
|
bool XuCamCtrlQuery(uvc::xu_query query, uint16_t size, uint8_t *data) const;
|
|
|
|
std::int32_t XuCamCtrlGet(Option option) const;
|
|
|
|
|
|
|
|
control_info_t PuControlInfo(Option option) const;
|
|
|
|
control_info_t XuControlInfo(Option option) const;
|
2018-04-09 10:54:14 +03:00
|
|
|
|
|
|
|
std::shared_ptr<uvc::device> device_;
|
2018-04-09 17:24:34 +03:00
|
|
|
|
2018-04-09 19:26:22 +03:00
|
|
|
std::map<Option, control_info_t> control_infos_;
|
2018-04-09 10:54:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
MYNTEYE_END_NAMESPACE
|
|
|
|
|
|
|
|
#endif // MYNTEYE_INTERNAL_CHANNELS_H_ NOLINT
|