Make build on win
This commit is contained in:
parent
145046249d
commit
9cf58f6e70
|
@ -2,12 +2,19 @@ cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
project(mynteye VERSION 2.0.0 LANGUAGES C CXX)
|
project(mynteye VERSION 2.0.0 LANGUAGES C CXX)
|
||||||
|
|
||||||
|
include(cmake/Common.cmake)
|
||||||
|
|
||||||
# options
|
# options
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
if(OS_WIN)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||||
|
endif()
|
||||||
|
|
||||||
include(cmake/DetectCXX11.cmake)
|
include(cmake/DetectCXX11.cmake)
|
||||||
|
|
||||||
|
@ -41,7 +48,7 @@ configure_file(
|
||||||
|
|
||||||
# targets
|
# targets
|
||||||
|
|
||||||
include(cmake/Common.cmake)
|
add_definitions(-DMYNTEYE_EXPORTS)
|
||||||
|
|
||||||
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
|
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
|
||||||
set_outdir(
|
set_outdir(
|
||||||
|
|
12
Makefile
12
Makefile
|
@ -79,7 +79,15 @@ test: install
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
@$(call echo,Make $@)
|
@$(call echo,Make $@)
|
||||||
|
ifeq ($(HOST_OS),Win)
|
||||||
|
ifneq ($(HOST_NAME),MinGW)
|
||||||
|
@cd ./_build; msbuild.exe INSTALL.vcxproj /property:Configuration=Release
|
||||||
|
else
|
||||||
@cd ./_build; make install
|
@cd ./_build; make install
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
@cd ./_build; make install
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
|
|
||||||
|
@ -103,7 +111,11 @@ tools: install
|
||||||
|
|
||||||
ros: install
|
ros: install
|
||||||
@$(call echo,Make $@)
|
@$(call echo,Make $@)
|
||||||
|
ifeq ($(HOST_OS),Win)
|
||||||
|
$(error "Can't make ros on win")
|
||||||
|
else
|
||||||
@cd ./wrappers/ros && catkin_make
|
@cd ./wrappers/ros && catkin_make
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: ros
|
.PHONY: ros
|
||||||
|
|
||||||
|
|
|
@ -793,6 +793,7 @@ WARN_LOGFILE =
|
||||||
INPUT = mainpage.md \
|
INPUT = mainpage.md \
|
||||||
guides.md \
|
guides.md \
|
||||||
guide_build_linux.md \
|
guide_build_linux.md \
|
||||||
|
guide_build_win.md \
|
||||||
guide_samples.md \
|
guide_samples.md \
|
||||||
guide_tools.md \
|
guide_tools.md \
|
||||||
guide_log.md \
|
guide_log.md \
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# 编译 on Linux {#guide_build_linux}
|
# 编译 on Linux {#guide_build_linux}
|
||||||
|
|
||||||
|
> Ubuntu 16.04, Ubuntu 14.04
|
||||||
|
|
||||||
## 获取代码
|
## 获取代码
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
103
doc/zh-Hans/guide_build_win.md
Normal file
103
doc/zh-Hans/guide_build_win.md
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
# 编译 on Windows {#guide_build_win}
|
||||||
|
|
||||||
|
> Windows 10
|
||||||
|
|
||||||
|
## 前提条件
|
||||||
|
|
||||||
|
* [Git](https://git-scm.com/downloads),用于获取代码。
|
||||||
|
* [CMake](https://cmake.org/download/),用于构建编译。
|
||||||
|
* [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html),用于生成文档。
|
||||||
|
|
||||||
|
最终,命令提示符(Command Prompt, cmd)里可找到如下命令:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
>cmake --version
|
||||||
|
cmake version 3.10.1
|
||||||
|
|
||||||
|
>git --version
|
||||||
|
git version 2.11.1.windows.1
|
||||||
|
|
||||||
|
>doxygen --version
|
||||||
|
1.8.13
|
||||||
|
```
|
||||||
|
|
||||||
|
* [Visual Studio](https://www.visualstudio.com/)
|
||||||
|
* [Visual Studio 2015](https://my.visualstudio.com/Downloads?q=Visual Studio 2015)
|
||||||
|
* [Visual Studio 2017](https://my.visualstudio.com/Downloads?q=Visual Studio 2017)
|
||||||
|
* [Windows 10 SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk)
|
||||||
|
|
||||||
|
以 Visual Studio 2015 举例,请在系统环境变量 `PATH` 里添加上如下路径:
|
||||||
|
|
||||||
|
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
|
||||||
|
C:\Program Files (x86)\MSBuild\14.0\Bin
|
||||||
|
|
||||||
|
最终,命令提示符(Command Prompt, cmd)里可找到如下命令:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
>cl
|
||||||
|
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
|
||||||
|
|
||||||
|
>link
|
||||||
|
Microsoft (R) Incremental Linker Version 14.00.24215.1
|
||||||
|
|
||||||
|
>lib
|
||||||
|
Microsoft (R) Library Manager Version 14.00.24215.1
|
||||||
|
|
||||||
|
>msbuild
|
||||||
|
Microsoft (R) 生成引擎版本 14.0.25420.1
|
||||||
|
```
|
||||||
|
|
||||||
|
* [MSYS2](http://www.msys2.org/)
|
||||||
|
* [国内镜像](https://lug.ustc.edu.cn/wiki/mirrors/help/msys2)
|
||||||
|
* [pacman](https://wiki.archlinux.org/index.php/pacman)
|
||||||
|
|
||||||
|
打开 MSYS2 MSYS ,然后执行:
|
||||||
|
|
||||||
|
```msys
|
||||||
|
$ pacman -Syu
|
||||||
|
$ pacman -S make
|
||||||
|
```
|
||||||
|
|
||||||
|
并在系统环境变量 `PATH` 里添加上如下路径:
|
||||||
|
|
||||||
|
C:\msys64\usr\bin
|
||||||
|
|
||||||
|
最终,命令提示符(Command Prompt, cmd)里可找到如下命令:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
>make --version
|
||||||
|
GNU Make 4.2.1
|
||||||
|
```
|
||||||
|
|
||||||
|
## 获取代码
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
>git clone https://github.com/slightech/MYNT-EYE-SDK-2.git
|
||||||
|
```
|
||||||
|
|
||||||
|
## 准备依赖
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
>cd mynt-eye-sdk-2
|
||||||
|
>make init
|
||||||
|
Make init
|
||||||
|
Init deps
|
||||||
|
Install cmd: pacman -S
|
||||||
|
Install deps: git clang-format
|
||||||
|
pacman -S clang-format (not exists)
|
||||||
|
error: target not found: clang-format
|
||||||
|
pip install --upgrade autopep8 cpplint pylint requests
|
||||||
|
...
|
||||||
|
Init git hooks
|
||||||
|
ERROR: clang-format-diff is not installed!
|
||||||
|
Expect cmake version >= 3.0
|
||||||
|
cmake version 3.10.1
|
||||||
|
How to upgrade cmake in Ubuntu
|
||||||
|
https://askubuntu.com/questions/829310/how-to-upgrade-cmake-in-ubuntu
|
||||||
|
```
|
||||||
|
|
||||||
|
## 编译代码
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
>make install
|
||||||
|
```
|
|
@ -12,6 +12,12 @@
|
||||||
|
|
||||||
* [OpenCV](https://opencv.org/),用于显示图像。
|
* [OpenCV](https://opencv.org/),用于显示图像。
|
||||||
|
|
||||||
|
<!--
|
||||||
|
```cmd
|
||||||
|
>set OpenCV_DIR=C:\opencv
|
||||||
|
```
|
||||||
|
-->
|
||||||
|
|
||||||
## 编译
|
## 编译
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# SDK 指导 {#guides}
|
# SDK 指导 {#guides}
|
||||||
|
|
||||||
* @subpage guide_build_linux
|
* @subpage guide_build_linux
|
||||||
|
* @subpage guide_build_win
|
||||||
* @subpage guide_samples
|
* @subpage guide_samples
|
||||||
* @subpage guide_tools
|
* @subpage guide_tools
|
||||||
* @subpage guide_log
|
* @subpage guide_log
|
||||||
|
|
|
@ -16,7 +16,7 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace device {
|
namespace device {
|
||||||
|
|
||||||
class Frame {
|
class MYNTEYE_API Frame {
|
||||||
public:
|
public:
|
||||||
using data_t = std::vector<std::uint8_t>;
|
using data_t = std::vector<std::uint8_t>;
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ enum class Source : std::uint8_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MYNTEYE_ENUM_HELPERS(TYPE) \
|
#define MYNTEYE_ENUM_HELPERS(TYPE) \
|
||||||
const char *to_string(const TYPE &value); \
|
MYNTEYE_API const char *to_string(const TYPE &value); \
|
||||||
inline bool is_valid(const TYPE &value) { \
|
inline bool is_valid(const TYPE &value) { \
|
||||||
using utype = std::underlying_type<TYPE>::type; \
|
using utype = std::underlying_type<TYPE>::type; \
|
||||||
utype val = static_cast<utype>(value); \
|
utype val = static_cast<utype>(value); \
|
||||||
|
@ -209,13 +209,13 @@ enum class Format : std::uint32_t {
|
||||||
|
|
||||||
#undef MYNTEYE_FOURCC
|
#undef MYNTEYE_FOURCC
|
||||||
|
|
||||||
const char *to_string(const Format &value);
|
MYNTEYE_API const char *to_string(const Format &value);
|
||||||
|
|
||||||
inline std::ostream &operator<<(std::ostream &os, const Format &value) {
|
inline std::ostream &operator<<(std::ostream &os, const Format &value) {
|
||||||
return os << to_string(value);
|
return os << to_string(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t bytes_per_pixel(const Format &value);
|
MYNTEYE_API std::size_t bytes_per_pixel(const Format &value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stream request.
|
* Stream request.
|
||||||
|
@ -239,6 +239,7 @@ struct MYNTEYE_API StreamRequest {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MYNTEYE_API
|
||||||
std::ostream &operator<<(std::ostream &os, const StreamRequest &request);
|
std::ostream &operator<<(std::ostream &os, const StreamRequest &request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -269,6 +270,7 @@ struct MYNTEYE_API Intrinsics {
|
||||||
double coeffs[5];
|
double coeffs[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MYNTEYE_API
|
||||||
std::ostream &operator<<(std::ostream &os, const Intrinsics &in);
|
std::ostream &operator<<(std::ostream &os, const Intrinsics &in);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -291,6 +293,7 @@ struct MYNTEYE_API ImuIntrinsics {
|
||||||
double bias[3];
|
double bias[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MYNTEYE_API
|
||||||
std::ostream &operator<<(std::ostream &os, const ImuIntrinsics &in);
|
std::ostream &operator<<(std::ostream &os, const ImuIntrinsics &in);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -302,6 +305,7 @@ struct MYNTEYE_API MotionIntrinsics {
|
||||||
ImuIntrinsics gyro;
|
ImuIntrinsics gyro;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MYNTEYE_API
|
||||||
std::ostream &operator<<(std::ostream &os, const MotionIntrinsics &in);
|
std::ostream &operator<<(std::ostream &os, const MotionIntrinsics &in);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,6 +317,7 @@ struct MYNTEYE_API Extrinsics {
|
||||||
double translation[3]; /**< translation vector */
|
double translation[3]; /**< translation vector */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MYNTEYE_API
|
||||||
std::ostream &operator<<(std::ostream &os, const Extrinsics &ex);
|
std::ostream &operator<<(std::ostream &os, const Extrinsics &ex);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Device;
|
||||||
namespace device {
|
namespace device {
|
||||||
|
|
||||||
/** Detecting MYNT EYE devices and prompt user to select one */
|
/** Detecting MYNT EYE devices and prompt user to select one */
|
||||||
std::shared_ptr<Device> select();
|
MYNTEYE_API std::shared_ptr<Device> select();
|
||||||
|
|
||||||
} // namespace device
|
} // namespace device
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,17 @@ project(mynteye_samples VERSION 2.0.0 LANGUAGES C CXX)
|
||||||
|
|
||||||
get_filename_component(PRO_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
|
get_filename_component(PRO_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
|
||||||
|
|
||||||
|
include(${PRO_DIR}/cmake/Common.cmake)
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
if(OS_WIN)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||||
|
endif()
|
||||||
|
|
||||||
include(${PRO_DIR}/cmake/DetectCXX11.cmake)
|
include(${PRO_DIR}/cmake/DetectCXX11.cmake)
|
||||||
|
|
||||||
|
@ -36,8 +43,6 @@ message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
|
||||||
|
|
||||||
# targets
|
# targets
|
||||||
|
|
||||||
include(${PRO_DIR}/cmake/Common.cmake)
|
|
||||||
|
|
||||||
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
|
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
|
||||||
|
|
||||||
# samples above device layer
|
# samples above device layer
|
||||||
|
|
|
@ -17,7 +17,7 @@ struct context;
|
||||||
|
|
||||||
class Device;
|
class Device;
|
||||||
|
|
||||||
class Context {
|
class MYNTEYE_API Context {
|
||||||
public:
|
public:
|
||||||
Context();
|
Context();
|
||||||
~Context();
|
~Context();
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Channels;
|
||||||
class Motions;
|
class Motions;
|
||||||
class Streams;
|
class Streams;
|
||||||
|
|
||||||
class Device {
|
class MYNTEYE_API Device {
|
||||||
public:
|
public:
|
||||||
using stream_callback_t = device::StreamCallback;
|
using stream_callback_t = device::StreamCallback;
|
||||||
using motion_callback_t = device::MotionCallback;
|
using motion_callback_t = device::MotionCallback;
|
||||||
|
|
|
@ -21,7 +21,7 @@ struct xu;
|
||||||
|
|
||||||
} // namespace uvc
|
} // namespace uvc
|
||||||
|
|
||||||
class Channels {
|
class MYNTEYE_API Channels {
|
||||||
public:
|
public:
|
||||||
typedef enum Channel {
|
typedef enum Channel {
|
||||||
CHANNEL_CAM_CTRL = 0x0100,
|
CHANNEL_CAM_CTRL = 0x0100,
|
||||||
|
|
|
@ -10,7 +10,7 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace files {
|
namespace files {
|
||||||
|
|
||||||
bool mkdir(const std::string &path);
|
MYNTEYE_API bool mkdir(const std::string &path);
|
||||||
|
|
||||||
} // namespace files
|
} // namespace files
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
MYNTEYE_BEGIN_NAMESPACE
|
MYNTEYE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class strings_error : public std::runtime_error {
|
class MYNTEYE_API strings_error : public std::runtime_error {
|
||||||
public:
|
public:
|
||||||
explicit strings_error(const std::string &what_arg) noexcept
|
explicit strings_error(const std::string &what_arg) noexcept
|
||||||
: std::runtime_error(std::move(what_arg)) {}
|
: std::runtime_error(std::move(what_arg)) {}
|
||||||
|
@ -21,17 +21,21 @@ class strings_error : public std::runtime_error {
|
||||||
|
|
||||||
namespace strings {
|
namespace strings {
|
||||||
|
|
||||||
|
MYNTEYE_API
|
||||||
int hex2int(const std::string &text);
|
int hex2int(const std::string &text);
|
||||||
|
|
||||||
|
MYNTEYE_API
|
||||||
bool starts_with(const std::string &text, const std::string &prefix);
|
bool starts_with(const std::string &text, const std::string &prefix);
|
||||||
|
|
||||||
|
MYNTEYE_API
|
||||||
std::vector<std::string> split(
|
std::vector<std::string> split(
|
||||||
const std::string &text, const std::string &delimiters);
|
const std::string &text, const std::string &delimiters);
|
||||||
|
|
||||||
void ltrim(std::string &s); // NOLINT
|
MYNTEYE_API void ltrim(std::string &s); // NOLINT
|
||||||
void rtrim(std::string &s); // NOLINT
|
MYNTEYE_API void rtrim(std::string &s); // NOLINT
|
||||||
void trim(std::string &s); // NOLINT
|
MYNTEYE_API void trim(std::string &s); // NOLINT
|
||||||
|
|
||||||
|
MYNTEYE_API
|
||||||
std::string trim_copy(const std::string &text);
|
std::string trim_copy(const std::string &text);
|
||||||
|
|
||||||
} // namespace strings
|
} // namespace strings
|
||||||
|
|
|
@ -28,7 +28,7 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||||
/**
|
/**
|
||||||
* Version.
|
* Version.
|
||||||
*/
|
*/
|
||||||
class Version {
|
class MYNTEYE_API Version {
|
||||||
public:
|
public:
|
||||||
using size_t = std::size_t;
|
using size_t = std::size_t;
|
||||||
using value_t = std::uint8_t;
|
using value_t = std::uint8_t;
|
||||||
|
@ -77,7 +77,7 @@ class Version {
|
||||||
/**
|
/**
|
||||||
* Hardware version.
|
* Hardware version.
|
||||||
*/
|
*/
|
||||||
class HardwareVersion : public Version {
|
class MYNTEYE_API HardwareVersion : public Version {
|
||||||
public:
|
public:
|
||||||
using flag_t = std::bitset<8>;
|
using flag_t = std::bitset<8>;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class HardwareVersion : public Version {
|
||||||
/**
|
/**
|
||||||
* Type.
|
* Type.
|
||||||
*/
|
*/
|
||||||
class Type {
|
class MYNTEYE_API Type {
|
||||||
public:
|
public:
|
||||||
using size_t = std::size_t;
|
using size_t = std::size_t;
|
||||||
using value_t = std::uint16_t;
|
using value_t = std::uint16_t;
|
||||||
|
@ -115,7 +115,7 @@ class Type {
|
||||||
* @ingroup datatypes
|
* @ingroup datatypes
|
||||||
* Device infomation.
|
* Device infomation.
|
||||||
*/
|
*/
|
||||||
struct DeviceInfo {
|
struct MYNTEYE_API DeviceInfo {
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string serial_number;
|
std::string serial_number;
|
||||||
Version firmware_version;
|
Version firmware_version;
|
||||||
|
|
116
src/uvc/uvc-wmf.cc
Normal file
116
src/uvc/uvc-wmf.cc
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
#include "uvc/uvc.h" // NOLINT
|
||||||
|
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
MYNTEYE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
namespace uvc {
|
||||||
|
|
||||||
|
struct context {
|
||||||
|
context() {
|
||||||
|
VLOG(2) << __func__;
|
||||||
|
}
|
||||||
|
|
||||||
|
~context() {
|
||||||
|
VLOG(2) << __func__;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct device {
|
||||||
|
const std::shared_ptr<context> parent;
|
||||||
|
|
||||||
|
int vid, pid;
|
||||||
|
|
||||||
|
device(std::shared_ptr<context> parent) : parent(parent) {
|
||||||
|
VLOG(2) << __func__;
|
||||||
|
}
|
||||||
|
|
||||||
|
~device() {
|
||||||
|
VLOG(2) << __func__;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::shared_ptr<context> create_context() {
|
||||||
|
return std::make_shared<context>();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<device>> query_devices(
|
||||||
|
std::shared_ptr<context> context) {
|
||||||
|
std::vector<std::shared_ptr<device>> devices;
|
||||||
|
UNUSED(context)
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_vendor_id(const device &device) {
|
||||||
|
return device.vid;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_product_id(const device &device) {
|
||||||
|
return device.pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_name(const device &device) {
|
||||||
|
UNUSED(device)
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_video_name(const device &device) {
|
||||||
|
UNUSED(device)
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pu_control_range(
|
||||||
|
const device &device, Option option, int32_t *min, int32_t *max,
|
||||||
|
int32_t *def) {
|
||||||
|
UNUSED(device)
|
||||||
|
UNUSED(option)
|
||||||
|
UNUSED(min)
|
||||||
|
UNUSED(max)
|
||||||
|
UNUSED(def)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pu_control_query(
|
||||||
|
const device &device, Option option, pu_query query, int32_t *value) {
|
||||||
|
UNUSED(device)
|
||||||
|
UNUSED(option)
|
||||||
|
UNUSED(query)
|
||||||
|
UNUSED(value)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool xu_control_query(
|
||||||
|
const device &device, const xu &xu, uint8_t selector, xu_query query,
|
||||||
|
uint16_t size, uint8_t *data) {
|
||||||
|
UNUSED(device)
|
||||||
|
UNUSED(xu)
|
||||||
|
UNUSED(selector)
|
||||||
|
UNUSED(query)
|
||||||
|
UNUSED(size)
|
||||||
|
UNUSED(data)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_device_mode(
|
||||||
|
device &device, int width, int height, int fourcc, int fps, // NOLINT
|
||||||
|
video_channel_callback callback) {
|
||||||
|
UNUSED(device)
|
||||||
|
UNUSED(width)
|
||||||
|
UNUSED(height)
|
||||||
|
UNUSED(fourcc)
|
||||||
|
UNUSED(fps)
|
||||||
|
UNUSED(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
void start_streaming(device &device, int num_transfer_bufs) { // NOLINT
|
||||||
|
UNUSED(device)
|
||||||
|
UNUSED(num_transfer_bufs)
|
||||||
|
}
|
||||||
|
|
||||||
|
void stop_streaming(device &device) { // NOLINT
|
||||||
|
UNUSED(device)
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace uvc
|
||||||
|
|
||||||
|
MYNTEYE_END_NAMESPACE
|
|
@ -24,7 +24,7 @@ typedef enum pu_query {
|
||||||
} pu_query;
|
} pu_query;
|
||||||
|
|
||||||
// Extension Unit
|
// Extension Unit
|
||||||
struct xu {
|
struct MYNTEYE_API xu {
|
||||||
uint8_t unit;
|
uint8_t unit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,40 +42,40 @@ struct context; // Opaque type representing access to the underlying UVC
|
||||||
struct device; // Opaque type representing access to a specific UVC device
|
struct device; // Opaque type representing access to a specific UVC device
|
||||||
|
|
||||||
// Enumerate devices
|
// Enumerate devices
|
||||||
std::shared_ptr<context> create_context();
|
MYNTEYE_API std::shared_ptr<context> create_context();
|
||||||
std::vector<std::shared_ptr<device>> query_devices(
|
MYNTEYE_API std::vector<std::shared_ptr<device>> query_devices(
|
||||||
std::shared_ptr<context> context);
|
std::shared_ptr<context> context);
|
||||||
|
|
||||||
// Static device properties
|
// Static device properties
|
||||||
std::string get_name(const device &device);
|
MYNTEYE_API std::string get_name(const device &device);
|
||||||
int get_vendor_id(const device &device);
|
MYNTEYE_API int get_vendor_id(const device &device);
|
||||||
int get_product_id(const device &device);
|
MYNTEYE_API int get_product_id(const device &device);
|
||||||
|
|
||||||
std::string get_video_name(const device &device);
|
MYNTEYE_API std::string get_video_name(const device &device);
|
||||||
|
|
||||||
// Access PU (Processing Unit) controls
|
// Access PU (Processing Unit) controls
|
||||||
inline bool is_pu_control(Option option) {
|
inline bool is_pu_control(Option option) {
|
||||||
return option >= Option::GAIN && option <= Option::CONTRAST;
|
return option >= Option::GAIN && option <= Option::CONTRAST;
|
||||||
}
|
}
|
||||||
bool pu_control_range(
|
MYNTEYE_API bool pu_control_range(
|
||||||
const device &device, Option option, int32_t *min, int32_t *max,
|
const device &device, Option option, int32_t *min, int32_t *max,
|
||||||
int32_t *def);
|
int32_t *def);
|
||||||
bool pu_control_query(
|
MYNTEYE_API bool pu_control_query(
|
||||||
const device &device, Option option, pu_query query, int32_t *value);
|
const device &device, Option option, pu_query query, int32_t *value);
|
||||||
|
|
||||||
// Access XU (Extension Unit) controls
|
// Access XU (Extension Unit) controls
|
||||||
bool xu_control_query(
|
MYNTEYE_API bool xu_control_query(
|
||||||
const device &device, const xu &xu, uint8_t selector, xu_query query,
|
const device &device, const xu &xu, uint8_t selector, xu_query query,
|
||||||
uint16_t size, uint8_t *data);
|
uint16_t size, uint8_t *data);
|
||||||
|
|
||||||
// Control streaming
|
// Control streaming
|
||||||
typedef std::function<void(const void *frame)> video_channel_callback;
|
typedef std::function<void(const void *frame)> video_channel_callback;
|
||||||
|
|
||||||
void set_device_mode(
|
MYNTEYE_API void set_device_mode(
|
||||||
device &device, int width, int height, int fourcc, int fps, // NOLINT
|
device &device, int width, int height, int fourcc, int fps, // NOLINT
|
||||||
video_channel_callback callback);
|
video_channel_callback callback);
|
||||||
void start_streaming(device &device, int num_transfer_bufs); // NOLINT
|
MYNTEYE_API void start_streaming(device &device, int num_transfer_bufs); // NOLINT
|
||||||
void stop_streaming(device &device); // NOLINT
|
MYNTEYE_API void stop_streaming(device &device); // NOLINT
|
||||||
|
|
||||||
} // namespace uvc
|
} // namespace uvc
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,17 @@ project(mynteye_test VERSION 2.0.0 LANGUAGES C CXX)
|
||||||
|
|
||||||
get_filename_component(PRO_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
|
get_filename_component(PRO_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
|
||||||
|
|
||||||
|
include(${PRO_DIR}/cmake/Common.cmake)
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
if(OS_WIN)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||||
|
endif()
|
||||||
|
|
||||||
include(${PRO_DIR}/cmake/DetectCXX11.cmake)
|
include(${PRO_DIR}/cmake/DetectCXX11.cmake)
|
||||||
|
|
||||||
|
@ -51,8 +58,6 @@ message(STATUS "Found gtest libs: ${GTEST_LIBS}")
|
||||||
|
|
||||||
# targets
|
# targets
|
||||||
|
|
||||||
include(${PRO_DIR}/cmake/Common.cmake)
|
|
||||||
|
|
||||||
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
|
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
|
||||||
|
|
||||||
set_outdir(
|
set_outdir(
|
||||||
|
|
|
@ -4,10 +4,17 @@ project(mynteye_tools VERSION 2.0.0 LANGUAGES C CXX)
|
||||||
|
|
||||||
get_filename_component(PRO_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
|
get_filename_component(PRO_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
|
||||||
|
|
||||||
|
include(${PRO_DIR}/cmake/Common.cmake)
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
if(OS_WIN)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||||
|
endif()
|
||||||
|
|
||||||
include(${PRO_DIR}/cmake/DetectCXX11.cmake)
|
include(${PRO_DIR}/cmake/DetectCXX11.cmake)
|
||||||
|
|
||||||
|
@ -41,8 +48,6 @@ endif()
|
||||||
|
|
||||||
# targets
|
# targets
|
||||||
|
|
||||||
include(${PRO_DIR}/cmake/Common.cmake)
|
|
||||||
|
|
||||||
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
|
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user