2018-03-22 06:57:35 +02:00
|
|
|
#ifndef MYNTEYE_UVC_H_ // NOLINT
|
|
|
|
#define MYNTEYE_UVC_H_
|
|
|
|
#pragma once
|
|
|
|
|
2018-03-25 18:03:04 +03:00
|
|
|
#include <functional>
|
2018-03-22 06:57:35 +02:00
|
|
|
#include <memory>
|
2018-03-25 18:03:04 +03:00
|
|
|
#include <string>
|
2018-03-22 06:57:35 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "mynteye/mynteye.h"
|
2018-04-09 17:24:34 +03:00
|
|
|
#include "mynteye/types.h"
|
2018-03-22 06:57:35 +02:00
|
|
|
|
|
|
|
#define MYNTEYE_VID 0x04B4
|
|
|
|
#define MYNTEYE_PID 0x00F9
|
|
|
|
|
|
|
|
MYNTEYE_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
namespace uvc {
|
|
|
|
|
2018-04-09 17:24:34 +03:00
|
|
|
typedef enum pu_query {
|
|
|
|
PU_QUERY_SET, // Set the value of a control
|
|
|
|
PU_QUERY_GET, // Get the value of a control
|
|
|
|
PU_QUERY_LAST
|
|
|
|
} pu_query;
|
2018-04-09 10:54:14 +03:00
|
|
|
|
2018-04-09 17:24:34 +03:00
|
|
|
// Extension Unit
|
2018-04-09 10:54:14 +03:00
|
|
|
struct xu {
|
2018-04-09 17:24:34 +03:00
|
|
|
uint8_t unit;
|
2018-03-25 18:03:04 +03:00
|
|
|
};
|
|
|
|
|
2018-04-09 10:54:14 +03:00
|
|
|
typedef enum xu_query {
|
2018-04-09 17:24:34 +03:00
|
|
|
XU_QUERY_SET, // Set current value of the control
|
|
|
|
XU_QUERY_GET, // Get current value of the control
|
|
|
|
XU_QUERY_MIN, // Get min value of the control
|
|
|
|
XU_QUERY_MAX, // Get max value of the control
|
|
|
|
XU_QUERY_DEF, // Get default value of the control
|
|
|
|
XU_QUERY_LAST
|
2018-04-09 10:54:14 +03:00
|
|
|
} xu_query;
|
|
|
|
|
2018-03-22 06:57:35 +02:00
|
|
|
struct context; // Opaque type representing access to the underlying UVC
|
|
|
|
// implementation
|
|
|
|
struct device; // Opaque type representing access to a specific UVC device
|
|
|
|
|
|
|
|
// Enumerate devices
|
|
|
|
std::shared_ptr<context> create_context();
|
|
|
|
std::vector<std::shared_ptr<device>> query_devices(
|
|
|
|
std::shared_ptr<context> context);
|
|
|
|
|
|
|
|
// Static device properties
|
2018-04-04 05:50:27 +03:00
|
|
|
std::string get_name(const device &device);
|
2018-03-22 06:57:35 +02:00
|
|
|
int get_vendor_id(const device &device);
|
|
|
|
int get_product_id(const device &device);
|
|
|
|
|
2018-03-30 11:39:35 +03:00
|
|
|
std::string get_video_name(const device &device);
|
|
|
|
|
2018-04-09 17:24:34 +03:00
|
|
|
// Access PU (Processing Unit) controls
|
|
|
|
inline bool is_pu_control(Option option) {
|
|
|
|
return option >= Option::GAIN && option <= Option::CONTRAST;
|
|
|
|
}
|
|
|
|
bool pu_control_range(
|
|
|
|
const device &device, Option option, int32_t *min, int32_t *max,
|
|
|
|
int32_t *def);
|
|
|
|
bool pu_control_query(
|
|
|
|
const device &device, Option option, pu_query query, int32_t *value);
|
|
|
|
|
|
|
|
// Access XU (Extension Unit) controls
|
2018-04-09 10:54:14 +03:00
|
|
|
bool xu_control_query(
|
|
|
|
const device &device, const xu &xu, uint8_t selector, xu_query query,
|
|
|
|
uint16_t size, uint8_t *data);
|
2018-03-25 18:03:04 +03:00
|
|
|
|
|
|
|
// Control streaming
|
|
|
|
typedef std::function<void(const void *frame)> video_channel_callback;
|
|
|
|
|
|
|
|
void set_device_mode(
|
2018-03-31 10:54:37 +03:00
|
|
|
device &device, int width, int height, int fourcc, int fps, // NOLINT
|
2018-03-25 18:03:04 +03:00
|
|
|
video_channel_callback callback);
|
|
|
|
void start_streaming(device &device, int num_transfer_bufs); // NOLINT
|
|
|
|
void stop_streaming(device &device); // NOLINT
|
|
|
|
|
2018-03-22 06:57:35 +02:00
|
|
|
} // namespace uvc
|
|
|
|
|
|
|
|
MYNTEYE_END_NAMESPACE
|
|
|
|
|
|
|
|
#endif // MYNTEYE_UVC_H_ NOLINT
|