Compare commits

..

4 Commits

Author SHA1 Message Date
gaozixi ad7fd7e64f fix: 更新电脑IP地址为192.168.89.6以确保正确连接
12 months ago
gaozixi 674609f154 Merge branch 'gaojunzhe' of https://bdgit.educoder.net/pshwqe2nc/gold_eyes into gaojunzhe
1 year ago
gaozixi 5e48445274 feat: 重构并恢复Flask应用,添加TCP监听功能和实时数据接口
1 year ago
gaozixi 0b397554d2 增强无人机控制系统的用户界面和功能- 将主窗口标题更新为 "无人机控制系统"。
1 year ago

Binary file not shown.

@ -3,45 +3,60 @@ title 声源定位功能顺序图
actor 用户 as User
participant "应用系统" as Application
participant "阵列麦克风设备" as MicArray
participant "信号处理模块" as SignalProcessing
participant "声源识别模块" as SoundRecognition
participant "声源定位模块" as Localization
activate User
User -> Application: 打开音频监听
activate Application
Application -> MicArray: 发送监听指令
Application -> MicArray: 发送实时采集战场声学信号命令
activate MicArray
MicArray --> Application: 监听就绪确认
Application --> User: 显示监听状态
MicArray -> MicArray: 枪声传播
MicArray -> MicArray: 检测到枪声
MicArray -> SignalProcessing: 原始音频数据
deactivate MicArray
activate SignalProcessing
SignalProcessing -> SignalProcessing: 预处理(滤波去噪)
SignalProcessing -> Localization: 处理后的音频信号
SignalProcessing -> SignalProcessing: 模数转换
SignalProcessing -> SignalProcessing: 滤波去噪预处理
SignalProcessing -> SoundRecognition: 处理后的音频信号
deactivate SignalProcessing
activate Localization
Localization -> Localization: 时间延迟估计(TDOA)
Localization -> Localization: 声源方位角计算(DOA)
Localization -> Application: 返回音频定位结果
deactivate Localization
activate SoundRecognition
SoundRecognition -> SoundRecognition: CAMPPlus声音分类模型
SoundRecognition -> SoundRecognition: 声纹识别处理
SoundRecognition -> SoundRecognition: 计算枪声识别置信度
alt 置信度高 (>阈值)
SoundRecognition -> Localization: 确认声源信号 + 置信度
activate Localization
Localization -> Localization: 时间延迟估计(TDOA)
Localization -> Localization: 声源方位角计算(DOA)
Localization -> Application: 返回音频定位结果 + 置信度
deactivate Localization
Application -> Application: 处理定位信息
Application --> User: 显示定位信息及置信度
else 置信度低 (≤阈值)
SoundRecognition --> Application: 识别置信度不足,忽略信号
end
deactivate SoundRecognition
Application -> Application: 处理定位信息
User -> Application: 查看定位信息
Application --> User: 显示定位信息
Application --> User: 显示详细定位信息
User -> Application: 关闭音频监听
deactivate Application
deactivate User
@enduml

@ -0,0 +1,55 @@
MAKEFILE = Makefile
####### Compiler, tools and options
CC = aarch64-linux-gnu-gcc
CXX = aarch64-linux-gnu-g++
DEFINES = -DQT_QML_DEBUG
CFLAGS = -pipe -g -Wall -W -fPIC $(DEFINES)
CXXFLAGS = -pipe -g -std=gnu++11 -Wall -W -fPIC $(DEFINES)
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
LINK = aarch64-linux-gnu-g++
LFLAGS =
LIBS = $(SUBLIBS) -L./bin/linux-aarch64 -lViewLink
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
####### Files
SOURCES = ./main.cpp
OBJECTS = main.o
DESTDIR = ./bin/linux-aarch64/
TARGET = ./bin/linux-aarch64/demo_for_linux
####### Build rules
$(TARGET): $(OBJECTS)
@test -d ./bin/linux-aarch64/ || mkdir -p ./bin/linux-aarch64/
cp -f ../../bin/linux-aarch64/*.so ./bin/linux-aarch64
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
clean:
rm -rf ./bin
rm -f *.o
####### Compile
main.o: ./main.cpp ../../inc/ViewLink.h \
./cmdline.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ./main.cpp

@ -0,0 +1,26 @@
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.0.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][75][VLK_Connect]VLK_Connect
debug:[TCPConnection.cpp][161][SocketCallback]TCP Gimbal Connected !!!!!!!!!!!!
debug:[DeviceConnection.cpp][1419][ProcSayHelloResponse]current connected device type: Q30T, 36T
debug:[DeviceConnection.cpp][1489][ProcSayHelloResponse]hand shake success! enjoy !!!
debug:[DeviceConnection.cpp][1419][ProcSayHelloResponse]current connected device type: Q30T, 36T
debug:[DeviceConnection.cpp][1489][ProcSayHelloResponse]hand shake success! enjoy !!!
debug:[DeviceConnection.cpp][1419][ProcSayHelloResponse]current connected device type: Q30T, 36T
debug:[DeviceConnection.cpp][1489][ProcSayHelloResponse]hand shake success! enjoy !!!
error:[DeviceConnection.cpp][1365][ProcReceivedFrame]bad frame CheckSum, it should be 0x80, but frame[46] = 0x6e
debug:[DeviceConnection.cpp][1368][ProcReceivedFrame]================begin frame==================
debug:[DeviceConnection.cpp][39][PrintHexData]frame size = 47, data: 55 aa dc ac 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f3 50 ef 00 00 00 00 00 00 00 0f 0a 18 e2 00 0a 98 55 aa dc 04 12 78 6e
debug:[DeviceConnection.cpp][1370][ProcReceivedFrame]================end frame==================
error:[DeviceConnection.cpp][1365][ProcReceivedFrame]bad frame CheckSum, it should be 0xa8, but frame[46] = 0xc6
debug:[DeviceConnection.cpp][1368][ProcReceivedFrame]================begin frame==================
debug:[DeviceConnection.cpp][39][PrintHexData]frame size = 47, data: 55 aa dc 6c 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f3 60 e2 5c 00 00 00 00 00 00 0f 0a 18 e2 00 0a b9 55 aa dc 84 12 50 c6
debug:[DeviceConnection.cpp][1370][ProcReceivedFrame]================end frame==================
error:[DeviceConnection.cpp][1365][ProcReceivedFrame]bad frame CheckSum, it should be 0x1d, but frame[46] = 0x73
debug:[DeviceConnection.cpp][1368][ProcReceivedFrame]================begin frame==================
debug:[DeviceConnection.cpp][39][PrintHexData]frame size = 47, data: 55 aa dc ec 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f3 40 df fc 00 00 00 00 00 00 0f 0a 18 e2 00 0a 84 55 aa dc c4 12 a5 73
debug:[DeviceConnection.cpp][1370][ProcReceivedFrame]================end frame==================
error:[DeviceConnection.cpp][1365][ProcReceivedFrame]bad frame CheckSum, it should be 0x50, but frame[46] = 0x00
debug:[DeviceConnection.cpp][1368][ProcReceivedFrame]================begin frame==================
debug:[DeviceConnection.cpp][39][PrintHexData]frame size = 47, data: 55 aa dc ec 40 00 00 55 aa dc ec 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 15 e0 a0 f2 cc 00 00 00 00 00 00
debug:[DeviceConnection.cpp][1370][ProcReceivedFrame]================end frame==================

@ -0,0 +1,820 @@
/*
Copyright (c) 2009, Hideyuki Tanaka
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <string>
#include <stdexcept>
#include <typeinfo>
#include <cstring>
#include <algorithm>
//当编译器非gcc时,不包含cxxabi.h头文件
#ifdef __GNUC__
#include <cxxabi.h>
#endif
#include <cstdlib>
namespace cmdline{
namespace detail{
template <typename Target, typename Source, bool Same>
class lexical_cast_t{
public:
static Target cast(const Source &arg){
Target ret;
std::stringstream ss;
if (!(ss<<arg && ss>>ret && ss.eof()))
throw std::bad_cast();
return ret;
}
};
template <typename Target, typename Source>
class lexical_cast_t<Target, Source, true>{
public:
static Target cast(const Source &arg){
return arg;
}
};
template <typename Source>
class lexical_cast_t<std::string, Source, false>{
public:
static std::string cast(const Source &arg){
std::ostringstream ss;
ss<<arg;
return ss.str();
}
};
template <typename Target>
class lexical_cast_t<Target, std::string, false>{
public:
static Target cast(const std::string &arg){
Target ret;
std::istringstream ss(arg);
if (!(ss>>ret && ss.eof()))
throw std::bad_cast();
return ret;
}
};
template <typename T1, typename T2>
struct is_same {
static const bool value = false;
};
template <typename T>
struct is_same<T, T>{
static const bool value = true;
};
template<typename Target, typename Source>
Target lexical_cast(const Source &arg)
{
return lexical_cast_t<Target, Source, detail::is_same<Target, Source>::value>::cast(arg);
}
static inline std::string demangle(const std::string &name)
{
#ifdef _MSC_VER
return name; // 为MSVC编译器时直接返回name
#elif defined(__GNUC__)
// 为gcc编译器时还调用原来的代码
int status = 0;
char *p = abi::__cxa_demangle(name.c_str(), 0, 0, &status);
std::string ret(p);
free(p);
return ret;
#else
// 其他不支持的编译器需要自己实现这个方法
#error unexpected c complier (msc/gcc), Need to implement this method for demangle
#endif
}
template <class T>
std::string readable_typename()
{
return demangle(typeid(T).name());
}
template <class T>
std::string default_value(T def)
{
return detail::lexical_cast<std::string>(def);
}
template <>
inline std::string readable_typename<std::string>()
{
return "string";
}
} // detail
//-----
class cmdline_error : public std::exception {
public:
cmdline_error(const std::string &msg): msg(msg){}
~cmdline_error() throw() {}
const char *what() const throw() { return msg.c_str(); }
private:
std::string msg;
};
template <class T>
struct default_reader{
T operator()(const std::string &str){
return detail::lexical_cast<T>(str);
}
};
template <class T>
struct range_reader{
range_reader(const T &low, const T &high): low(low), high(high) {}
T operator()(const std::string &s) const {
T ret=default_reader<T>()(s);
if (!(ret>=low && ret<=high)) throw cmdline::cmdline_error("range_error");
return ret;
}
private:
T low, high;
};
template <class T>
range_reader<T> range(const T &low, const T &high)
{
return range_reader<T>(low, high);
}
template <class T>
struct oneof_reader{
T operator()(const std::string &s){
T ret=default_reader<T>()(s);
if (std::find(alt.begin(), alt.end(), ret)==alt.end())
throw cmdline_error("");
return ret;
}
void add(const T &v){ alt.push_back(v); }
private:
std::vector<T> alt;
};
template <class T>
oneof_reader<T> oneof(T a1)
{
oneof_reader<T> ret;
ret.add(a1);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
ret.add(a7);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
ret.add(a7);
ret.add(a8);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8, T a9)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
ret.add(a7);
ret.add(a8);
ret.add(a9);
return ret;
}
template <class T>
oneof_reader<T> oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8, T a9, T a10)
{
oneof_reader<T> ret;
ret.add(a1);
ret.add(a2);
ret.add(a3);
ret.add(a4);
ret.add(a5);
ret.add(a6);
ret.add(a7);
ret.add(a8);
ret.add(a9);
ret.add(a10);
return ret;
}
//-----
class parser{
public:
parser(){
}
~parser(){
for (std::map<std::string, option_base*>::iterator p=options.begin();
p!=options.end(); p++)
delete p->second;
}
void add(const std::string &name,
char short_name=0,
const std::string &desc=""){
if (options.count(name)) throw cmdline_error("multiple definition: "+name);
options[name]=new option_without_value(name, short_name, desc);
ordered.push_back(options[name]);
}
template <class T>
void add(const std::string &name,
char short_name=0,
const std::string &desc="",
bool need=true,
const T def=T()){
add(name, short_name, desc, need, def, default_reader<T>());
}
template <class T, class F>
void add(const std::string &name,
char short_name=0,
const std::string &desc="",
bool need=true,
const T def=T(),
F reader=F()){
if (options.count(name)) throw cmdline_error("multiple definition: "+name);
options[name]=new option_with_value_with_reader<T, F>(name, short_name, need, def, desc, reader);
ordered.push_back(options[name]);
}
void footer(const std::string &f){
ftr=f;
}
void set_program_name(const std::string &name){
prog_name=name;
}
bool exist(const std::string &name) const {
if (options.count(name)==0) throw cmdline_error("there is no flag: --"+name);
return options.find(name)->second->has_set();
}
template <class T>
const T &get(const std::string &name) const {
if (options.count(name)==0) throw cmdline_error("there is no flag: --"+name);
const option_with_value<T> *p=dynamic_cast<const option_with_value<T>*>(options.find(name)->second);
if (p==NULL) throw cmdline_error("type mismatch flag '"+name+"'");
return p->get();
}
const std::vector<std::string> &rest() const {
return others;
}
bool parse(const std::string &arg){
std::vector<std::string> args;
std::string buf;
bool in_quote=false;
for (std::string::size_type i=0; i<arg.length(); i++){
if (arg[i]=='\"'){
in_quote=!in_quote;
continue;
}
if (arg[i]==' ' && !in_quote){
args.push_back(buf);
buf="";
continue;
}
if (arg[i]=='\\'){
i++;
if (i>=arg.length()){
errors.push_back("unexpected occurrence of '\\' at end of string");
return false;
}
}
buf+=arg[i];
}
if (in_quote){
errors.push_back("quote is not closed");
return false;
}
if (buf.length()>0)
args.push_back(buf);
for (size_t i=0; i<args.size(); i++)
std::cout<<"\""<<args[i]<<"\""<<std::endl;
return parse(args);
}
bool parse(const std::vector<std::string> &args){
int argc=static_cast<int>(args.size());
std::vector<const char*> argv(argc);
for (int i=0; i<argc; i++)
argv[i]=args[i].c_str();
return parse(argc, &argv[0]);
}
bool parse(int argc, const char * const argv[]){
errors.clear();
others.clear();
if (argc<1){
errors.push_back("argument number must be longer than 0");
return false;
}
if (prog_name=="")
prog_name=argv[0];
std::map<char, std::string> lookup;
for (std::map<std::string, option_base*>::iterator p=options.begin();
p!=options.end(); p++){
if (p->first.length()==0) continue;
char initial=p->second->short_name();
if (initial){
if (lookup.count(initial)>0){
lookup[initial]="";
errors.push_back(std::string("short option '")+initial+"' is ambiguous");
return false;
}
else lookup[initial]=p->first;
}
}
for (int i=1; i<argc; i++){
if (strncmp(argv[i], "--", 2)==0){
const char *p=strchr(argv[i]+2, '=');
if (p){
std::string name(argv[i]+2, p);
std::string val(p+1);
set_option(name, val);
}
else{
std::string name(argv[i]+2);
if (options.count(name)==0){
errors.push_back("undefined option: --"+name);
continue;
}
if (options[name]->has_value()){
if (i+1>=argc){
errors.push_back("option needs value: --"+name);
continue;
}
else{
i++;
set_option(name, argv[i]);
}
}
else{
set_option(name);
}
}
}
else if (strncmp(argv[i], "-", 1)==0){
if (!argv[i][1]) continue;
char last=argv[i][1];
for (int j=2; argv[i][j]; j++){
last=argv[i][j];
if (lookup.count(argv[i][j-1])==0){
errors.push_back(std::string("undefined short option: -")+argv[i][j-1]);
continue;
}
if (lookup[argv[i][j-1]]==""){
errors.push_back(std::string("ambiguous short option: -")+argv[i][j-1]);
continue;
}
set_option(lookup[argv[i][j-1]]);
}
if (lookup.count(last)==0){
errors.push_back(std::string("undefined short option: -")+last);
continue;
}
if (lookup[last]==""){
errors.push_back(std::string("ambiguous short option: -")+last);
continue;
}
if (i+1<argc && options[lookup[last]]->has_value()){
set_option(lookup[last], argv[i+1]);
i++;
}
else{
set_option(lookup[last]);
}
}
else{
others.push_back(argv[i]);
}
}
for (std::map<std::string, option_base*>::iterator p=options.begin();
p!=options.end(); p++)
if (!p->second->valid())
errors.push_back("need option: --"+std::string(p->first));
return errors.size()==0;
}
void parse_check(const std::string &arg){
if (!options.count("help"))
add("help", '?', "print this message");
check(0, parse(arg));
}
void parse_check(const std::vector<std::string> &args){
if (!options.count("help"))
add("help", '?', "print this message");
check(args.size(), parse(args));
}
void parse_check(int argc, char *argv[]){
if (!options.count("help"))
add("help", '?', "print this message");
check(argc, parse(argc, argv));
}
std::string error() const{
return errors.size()>0?errors[0]:"";
}
std::string error_full() const{
std::ostringstream oss;
for (size_t i=0; i<errors.size(); i++)
oss<<errors[i]<<std::endl;
return oss.str();
}
std::string usage() const {
std::ostringstream oss;
oss<<"usage: "<<prog_name<<" ";
for (size_t i=0; i<ordered.size(); i++){
if (ordered[i]->must())
oss<<ordered[i]->short_description()<<" ";
}
oss<<"[options] ... "<<ftr<<std::endl;
oss<<"options:"<<std::endl;
size_t max_width=0;
for (size_t i=0; i<ordered.size(); i++){
max_width=std::max(max_width, ordered[i]->name().length());
}
for (size_t i=0; i<ordered.size(); i++){
if (ordered[i]->short_name()){
oss<<" -"<<ordered[i]->short_name()<<", ";
}
else{
oss<<" ";
}
oss<<"--"<<ordered[i]->name();
for (size_t j=ordered[i]->name().length(); j<max_width+4; j++)
oss<<' ';
oss<<ordered[i]->description()<<std::endl;
}
return oss.str();
}
private:
void check(int argc, bool ok){
if ((argc==1 && !ok) || exist("help")){
std::cerr<<usage();
exit(0);
}
if (!ok){
std::cerr<<error()<<std::endl<<usage();
exit(1);
}
}
void set_option(const std::string &name){
if (options.count(name)==0){
errors.push_back("undefined option: --"+name);
return;
}
if (!options[name]->set()){
errors.push_back("option needs value: --"+name);
return;
}
}
void set_option(const std::string &name, const std::string &value){
if (options.count(name)==0){
errors.push_back("undefined option: --"+name);
return;
}
if (!options[name]->set(value)){
errors.push_back("option value is invalid: --"+name+"="+value);
return;
}
}
class option_base{
public:
virtual ~option_base(){}
virtual bool has_value() const=0;
virtual bool set()=0;
virtual bool set(const std::string &value)=0;
virtual bool has_set() const=0;
virtual bool valid() const=0;
virtual bool must() const=0;
virtual const std::string &name() const=0;
virtual char short_name() const=0;
virtual const std::string &description() const=0;
virtual std::string short_description() const=0;
};
class option_without_value : public option_base {
public:
option_without_value(const std::string &name,
char short_name,
const std::string &desc)
:nam(name), snam(short_name), desc(desc), has(false){
}
~option_without_value(){}
bool has_value() const { return false; }
bool set(){
has=true;
return true;
}
bool set(const std::string &){
return false;
}
bool has_set() const {
return has;
}
bool valid() const{
return true;
}
bool must() const{
return false;
}
const std::string &name() const{
return nam;
}
char short_name() const{
return snam;
}
const std::string &description() const {
return desc;
}
std::string short_description() const{
return "--"+nam;
}
private:
std::string nam;
char snam;
std::string desc;
bool has;
};
template <class T>
class option_with_value : public option_base {
public:
option_with_value(const std::string &name,
char short_name,
bool need,
const T &def,
const std::string &desc)
: nam(name), snam(short_name), need(need), has(false)
, def(def), actual(def) {
this->desc=full_description(desc);
}
~option_with_value(){}
const T &get() const {
return actual;
}
bool has_value() const { return true; }
bool set(){
return false;
}
bool set(const std::string &value){
try{
actual=read(value);
has=true;
}
catch(const std::exception &e){
return false;
}
return true;
}
bool has_set() const{
return has;
}
bool valid() const{
if (need && !has) return false;
return true;
}
bool must() const{
return need;
}
const std::string &name() const{
return nam;
}
char short_name() const{
return snam;
}
const std::string &description() const {
return desc;
}
std::string short_description() const{
return "--"+nam+"="+detail::readable_typename<T>();
}
protected:
std::string full_description(const std::string &desc){
return
desc+" ("+detail::readable_typename<T>()+
(need?"":" [="+detail::default_value<T>(def)+"]")
+")";
}
virtual T read(const std::string &s)=0;
std::string nam;
char snam;
bool need;
std::string desc;
bool has;
T def;
T actual;
};
template <class T, class F>
class option_with_value_with_reader : public option_with_value<T> {
public:
option_with_value_with_reader(const std::string &name,
char short_name,
bool need,
const T def,
const std::string &desc,
F reader)
: option_with_value<T>(name, short_name, need, def, desc), reader(reader){
}
private:
T read(const std::string &s){
return reader(s);
}
F reader;
};
std::map<std::string, option_base*> options;
std::vector<option_base*> ordered;
std::string ftr;
std::string prog_name;
std::vector<std::string> others;
std::vector<std::string> errors;
};
} // cmdline

@ -0,0 +1,44 @@
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
HEADERS += cmdline.h
win32{
contains(QT_ARCH, x86_64){
LIBS += -L$$PWD/../../lib/win64 -lViewLink
DESTDIR = $$PWD/bin/win64
DllSrc = $$PWD/../../bin/win64/*.dll
DllSrc = $$replace(DllSrc, /, \\)
DllDst = $$replace(DESTDIR, /, \\)
QMAKE_PRE_LINK += $$QMAKE_COPY $$DllSrc $$DllDst
}else{
LIBS += -L$$PWD/../../lib/win32 -lViewLink
DESTDIR =$$PWD/bin/win32
DllSrc = $$PWD/../../bin/win32/*.dll
DllSrc = $$replace(DllSrc, /, \\)
DllDst = $$replace(DESTDIR, /, \\)
QMAKE_PRE_LINK += $$QMAKE_COPY $$DllSrc $$DllDst
}
}
linux{
contains(QT_ARCH, x86_64){
DESTDIR =$$PWD/bin/linux-x86_64
LIBS += -L$$DESTDIR -lViewLink
QMAKE_PRE_LINK += $$QMAKE_COPY $$PWD/../../bin/linux-x86_64/*.so $$DESTDIR
}
contains(QT_ARCH, aarch64){
DESTDIR =$$PWD/bin/linux-aarch64
LIBS += -L$$DESTDIR -lViewLink
QMAKE_PRE_LINK += $$QMAKE_COPY $$PWD/../../bin/linux-aarch64/*.so $$DESTDIR
}
}

@ -0,0 +1,314 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.0, 2021-12-20T17:29:42. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{6881d35e-0f46-4e0e-ba9d-4d4c39001271}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.9.9 GCC 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.9.9 GCC 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.599.gcc_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dreamsky/SourceCode/SDK/demo/build-demo_for_linux-Cal-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dreamsky/SourceCode/SDK/demo/build-demo_for_linux-Cal-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/dreamsky/SourceCode/SDK/demo/build-demo_for_linux-Cal-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/dreamsky/SourceCode/SDK/demo/demo_for_linux/demo_for_linux.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/dreamsky/SourceCode/SDK/demo/demo_for_linux/demo_for_linux.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/dreamsky/SourceCode/SDK/demo/demo_for_linux/bin/linux-x86_64</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

@ -0,0 +1,226 @@
#include <iostream>
#include <string>
#include <mutex>
#include <chrono>
#include <thread>
using namespace std;
#include "../../inc/ViewLink.h"
#include "cmdline.h"
bool g_bConnected = false;
int VLK_ConnStatusCallback(int iConnStatus, const char* szMessage, int iMsgLen, void* pUserParam)
{
if (VLK_CONN_STATUS_TCP_CONNECTED == iConnStatus)
{
cout << "TCP Gimbal connected !!!" << endl;
g_bConnected = true;
}
else if (VLK_CONN_STATUS_TCP_DISCONNECTED == iConnStatus)
{
cout << "TCP Gimbal disconnected !!!" << endl;
g_bConnected = false;
}
else if (VLK_CONN_STATUS_SERIAL_PORT_CONNECTED == iConnStatus)
{
cout << "serial port connected !!!" << endl;
g_bConnected = true;
}
else if (VLK_CONN_STATUS_SERIAL_PORT_DISCONNECTED == iConnStatus)
{
cout << "serial port disconnected !!!" << endl;
g_bConnected = false;
}
else
{
cout << "unknown connection stauts: " << iConnStatus << endl;
g_bConnected = false;
}
return 0;
}
int VLK_DevStatusCallback(int iType, const char* szBuffer, int iBufLen, void* pUserParam)
{
if (VLK_DEV_STATUS_TYPE_MODEL == iType)
{
VLK_DEV_MODEL* pModel = (VLK_DEV_MODEL*)szBuffer;
cout << "model code: " << pModel->cModelCode << ", model name: " << pModel->szModelName << endl;
}
else if (VLK_DEV_STATUS_TYPE_CONFIG == iType)
{
VLK_DEV_CONFIG* pDevConfig = (VLK_DEV_CONFIG*)szBuffer;
cout << "VersionNO: " << pDevConfig->cVersionNO << ", DeviceID: " << pDevConfig->cDeviceID << ", SerialNO: " << pDevConfig->cSerialNO << endl;
}
else if (VLK_DEV_STATUS_TYPE_TELEMETRY == iType)
{
/*
* once device is connected, telemetry information will keep updating,
* in order to avoid disturbing user input, comment out printing telemetry information
*/
// VLK_DEV_TELEMETRY* pTelemetry = (VLK_DEV_TELEMETRY*)szBuffer;
// cout << "Yaw: " << pTelemetry->dYaw << ", Pitch: " << pTelemetry->dPitch << ", sensor type: " << pTelemetry->emSensorType << ", Zoom mag times: " << pTelemetry->sZoomMagTimes << endl;
}
else
{
cout << "error: unknown status type: " << iType << endl;
}
return 0;
}
int main(int argc, char *argv[])
{
// parse cmd line
cmdline::parser a;
a.add<string>("type", 't', "connection type", true, "tcp", cmdline::oneof<string>("serial", "tcp"));
a.add<string>("ip", 'i', "gimbal tcp ip", false, "192.168.2.119");
a.add<int>("port", 'p', "gimbal tcp port", false, 2000);
a.add<string>("serial", 's', "serial port name", false, "/dev/ttyS0");
a.add<int>("baudrate", 'b', "serial port baudrate", false, 115200);
a.parse_check(argc, argv);
// print sdk version
cout << "ViewLink SDK version: " << GetSDKVersion() << endl;
// initialize sdk
int iRet = VLK_Init();
if (VLK_ERROR_NO_ERROR != iRet)
{
cout << "VLK_Init failed, error: " << iRet << endl;
return -1;
}
// register device status callback
VLK_RegisterDevStatusCB(VLK_DevStatusCallback, NULL);
// connect device
if (0 == a.get<string>("type").compare("tcp"))
{
VLK_CONN_PARAM param;
memset(&param, 0, sizeof(param));
param.emType = VLK_CONN_TYPE_TCP;
strncpy(param.ConnParam.IPAddr.szIPV4, a.get<string>("ip").c_str(), sizeof(param.ConnParam.IPAddr.szIPV4) - 1);
param.ConnParam.IPAddr.iPort = a.get<int>("port");
cout << "connecting gimbal ip: " << a.get<string>("ip") << ", port: " << a.get<int>("port") << "..." << endl;
iRet = VLK_Connect(&param, VLK_ConnStatusCallback, NULL);
if (VLK_ERROR_NO_ERROR != iRet)
{
cout << "VLK_Connect failed, error: " << iRet << endl;
goto quit;
}
}
else if (0 == a.get<string>("type").compare("serial"))
{
VLK_CONN_PARAM param;
memset(&param, 0, sizeof(param));
param.emType = VLK_CONN_TYPE_SERIAL_PORT;
strncpy(param.ConnParam.SerialPort.szSerialPortName, a.get<string>("serial").c_str(), sizeof(param.ConnParam.SerialPort.szSerialPortName) - 1);
param.ConnParam.SerialPort.iBaudRate = a.get<int>("baudrate");
cout << "connecting gimbal serial: " << a.get<string>("serial") << ", baudrate: " << a.get<int>("baudrate") << "..." << endl;
iRet = VLK_Connect(&param, VLK_ConnStatusCallback, NULL);
if (VLK_ERROR_NO_ERROR != iRet)
{
cout << "VLK_Connect failed, error: " << iRet << endl;
goto quit;
}
}
else
{
cout << "unknown conntion type !!!" << endl;
goto quit;
}
cout << "wait device connected..." << endl;
while (1)
{
if (g_bConnected)
{
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
while (1)
{
cout << "press \'w\' move up \n";
cout << "press \'s\' move down \n";
cout << "press \'a\' move left \n";
cout << "press \'d\' move right \n";
cout << "press \'h\' move to home posiion \n";
cout << "press \'1\' zoom in, \'2\' zoom out\n";
cout << "press \'3\' begin track, \'4\' stop track\n";
cout << "press \'c\' exit"<< endl;
char input;
cin >> input;
if (input == 'w' || input == 'W')
{
VLK_Move(0, 1000);
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
VLK_Stop();
}
else if (input == 's' || input == 'S')
{
VLK_Move(0, -1000);
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
VLK_Stop();
}
else if (input == 'a' || input == 'A')
{
VLK_Move(-1000, 0);
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
VLK_Stop();
}
else if (input == 'd' || input == 'D')
{
VLK_Move(1000, 0);
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
VLK_Stop();
}
else if (input == 'h' || input == 'H')
{
VLK_Home();
}
else if (input == '1')
{
VLK_ZoomIn(4);
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
VLK_StopZoom();
}
else if (input == '2')
{
VLK_ZoomOut(4);
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
VLK_StopZoom();
}
else if (input == '3')
{
VLK_TRACK_MODE_PARAM param;
memset(&param, 0, sizeof(param));
param.emTrackSensor = VLK_SENSOR_VISIBLE1;
param.emTrackTempSize = VLK_TRACK_TEMPLATE_SIZE_AUTO;
VLK_TrackTargetPositionEx(&param, 100, 100, 1280, 720);
}
else if (input == '4')
{
VLK_DisableTrackMode();
}
else if (input == 'c' || input == 'C')
{
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
quit:
// uninitial sdk
VLK_UnInit();
system("PAUSE");
return 0;
}

@ -0,0 +1,135 @@
#include "FFVideoFormatConvert.h"
#include "VideoObjNetwork.h"
CFFVideoFormatConvert::CFFVideoFormatConvert(void)
: m_img_convert_ctx(NULL)
, m_pFrame(NULL)
, m_pBuffer(NULL), m_uBufferSize(0)
, m_iWidth(0), m_iHeight(0)
, m_pImage(NULL)
{
}
CFFVideoFormatConvert::~CFFVideoFormatConvert(void)
{
Close();
}
void CFFVideoFormatConvert::Close()
{
if (m_img_convert_ctx)
{
sws_freeContext(m_img_convert_ctx);
m_img_convert_ctx = NULL;
}
if (m_pFrame)
{
av_frame_free(&m_pFrame);
m_pFrame = NULL;
}
if (m_pBuffer)
{
av_free(m_pBuffer);
m_pBuffer = NULL;
m_uBufferSize = 0;
}
if (m_pImage != NULL)
{
delete m_pImage;
m_pImage = NULL;
}
m_iWidth = 0;
m_iHeight = 0;
}
bool CFFVideoFormatConvert::RGB32toYUV420P(const QImage* pIn, AVFrame** pOut)
{
// reinitialize object if image width or height changed
if (pIn->width() != m_iWidth || pIn->height() != m_iHeight)
{
Close();
}
if (m_pBuffer == NULL)
{
m_iWidth = pIn->width();
m_iHeight = pIn->height();
m_uBufferSize = av_image_get_buffer_size(AV_PIX_FMT_YUV420P, pIn->width(), pIn->height(), 1);
m_pBuffer = (uint8_t *) av_malloc(m_uBufferSize);
}
if (m_pFrame == NULL)
{
m_pFrame = av_frame_alloc();
m_pFrame->width = pIn->width();
m_pFrame->height = pIn->height();
av_image_fill_arrays(m_pFrame->data, m_pFrame->linesize,
m_pBuffer, AV_PIX_FMT_YUV420P, pIn->width(), pIn->height(), 1);
}
if (m_img_convert_ctx == NULL)
{
m_img_convert_ctx = sws_getContext(pIn->width(), pIn->height(),
AV_PIX_FMT_RGB32,
pIn->width(), pIn->height(),
AV_PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL);
}
const uint8_t *const srcSlice[] = { pIn->bits() };
const int srcStride[] = { pIn->bytesPerLine()};
sws_scale(m_img_convert_ctx,
srcSlice,
srcStride, 0, pIn->height(),
m_pFrame->data,
m_pFrame->linesize);
*pOut = m_pFrame;
return true;
}
bool CFFVideoFormatConvert::YUV420P2RGB32(const AVFrame* pIn, QImage** pOut)
{
// reinitialize object if image width or height changed
if (pIn->width != m_iWidth || pIn->height != m_iHeight)
{
Close();
}
if (m_pBuffer == NULL)
{
m_iWidth = pIn->width;
m_iHeight = pIn->height;
m_uBufferSize = av_image_get_buffer_size(AV_PIX_FMT_RGB32, pIn->width, pIn->height, 1);
m_pBuffer = (uint8_t *)av_malloc(m_uBufferSize);
}
if (m_pFrame == NULL)
{
m_pFrame = av_frame_alloc();
av_image_fill_arrays(m_pFrame->data, m_pFrame->linesize,
m_pBuffer, AV_PIX_FMT_RGB32, pIn->width, pIn->height, 1);
}
if (m_img_convert_ctx == NULL)
{
m_img_convert_ctx = sws_getContext(pIn->width, pIn->height,
AV_PIX_FMT_YUV420P,
pIn->width, pIn->height,
AV_PIX_FMT_RGB32, SWS_BICUBIC, NULL, NULL, NULL);
}
sws_scale(m_img_convert_ctx,
(uint8_t const * const *)pIn->data,
pIn->linesize, 0, pIn->height,
m_pFrame->data,
m_pFrame->linesize);
*pOut = new QImage((uchar *)m_pFrame->data[0], m_iWidth, m_iHeight, QImage::Format_RGB32);
return true;
}

@ -0,0 +1,28 @@
#pragma once
#include <QImage>
struct AVFrame;
struct SwsContext;
class CFFVideoFormatConvert
{
public:
CFFVideoFormatConvert(void);
~CFFVideoFormatConvert(void);
bool RGB32toYUV420P(const QImage* pIn, AVFrame** pOut);
bool YUV420P2RGB32(const AVFrame* pIn, QImage** pOut);
private:
void Close();
private:
SwsContext* m_img_convert_ctx;
AVFrame* m_pFrame;
uint8_t* m_pBuffer;
uint m_uBufferSize;
int m_iWidth;
int m_iHeight;
QImage* m_pImage;
};

@ -1,30 +1,10 @@
#include "QtCameraCapture.h"
/**
* @brief QtCameraCapture
* @param parent
*
* QAbstractVideoSurface
*
*/
QtCameraCapture::QtCameraCapture(QObject *parent) : QAbstractVideoSurface(parent)
{
}
/**
* @brief
* @param handleType 使
* @return
*
*
* - ARGB32
* - RGB322432
* - BGROpenCV
* - YUV
* - Y8Y16
* - JPEGRAW
*/
QList<QVideoFrame::PixelFormat> QtCameraCapture::supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const
{
Q_UNUSED(handleType);
@ -63,35 +43,16 @@ QList<QVideoFrame::PixelFormat> QtCameraCapture::supportedPixelFormats(QAbstract
<< QVideoFrame::Format_AdobeDng;
}
/**
* @brief
* @param frame
* @return truefalse
*
*
*
* 1.
* 2.
* 3.
* 4. QImage
* 5. frameAvailable
* 6.
*/
bool QtCameraCapture::present(const QVideoFrame &frame)
{
if (frame.isValid()) {
// 克隆帧数据以避免数据竞争问题
QVideoFrame cloneFrame(frame);
// 将帧数据映射到内存,以只读方式访问
cloneFrame.map(QAbstractVideoBuffer::ReadOnly);
// 将视频帧转换为QImage格式
const QImage image(cloneFrame.bits(),
cloneFrame.width(),
cloneFrame.height(),
QVideoFrame::imageFormatFromPixelFormat(cloneFrame.pixelFormat()));
// 发送信号通知其他组件有新帧可用
emit frameAvailable(image);
// 解除内存映射
cloneFrame.unmap();
return true;
}

@ -0,0 +1,70 @@
#ifndef QTCAMERACAPTURE_H
#define QTCAMERACAPTURE_H
#include <QObject>
#include <QAbstractVideoSurface>
#include <QDebug>
class QtCameraCapture : public QAbstractVideoSurface
{
Q_OBJECT
public:
enum PixelFormat {
Format_Invalid,
Format_ARGB32,
Format_ARGB32_Premultiplied,
Format_RGB32,
Format_RGB24,
Format_RGB565,
Format_RGB555,
Format_ARGB8565_Premultiplied,
Format_BGRA32,
Format_BGRA32_Premultiplied,
Format_BGR32,
Format_BGR24,
Format_BGR565,
Format_BGR555,
Format_BGRA5658_Premultiplied,
Format_AYUV444,
Format_AYUV444_Premultiplied,
Format_YUV444,
Format_YUV420P,
Format_YV12,
Format_UYVY,
Format_YUYV,
Format_NV12,
Format_NV21,
Format_IMC1,
Format_IMC2,
Format_IMC3,
Format_IMC4,
Format_Y8,
Format_Y16,
Format_Jpeg,
Format_CameraRaw,
Format_AdobeDng,
#ifndef Q_QDOC
NPixelFormats,
#endif
Format_User = 1000
};
Q_ENUM(PixelFormat)
explicit QtCameraCapture(QObject *parent = 0);
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
bool present(const QVideoFrame &frame) override;
signals:
void frameAvailable(QImage frame);
};
#endif // QTCAMERACAPTURE_H

@ -0,0 +1,36 @@
#pragma once
#define GET_STR(x) #x
#define A_VER 3
#define T_VER 4
// vertex shader
const char *vString = GET_STR(
attribute vec4 vertexIn;
attribute vec2 textureIn;
varying vec2 textureOut;
void main(void)
{
gl_Position = vertexIn;
textureOut = textureIn;
}
);
// texture shader
const char *tString = GET_STR(
varying vec2 textureOut;
uniform sampler2D tex_y;
uniform sampler2D tex_u;
uniform sampler2D tex_v;
void main(void)
{
vec3 yuv;
vec3 rgb;
yuv.x = texture2D(tex_y, textureOut).r;
yuv.y = texture2D(tex_u, textureOut).r - 0.5;
yuv.z = texture2D(tex_v, textureOut).r - 0.5;
rgb = mat3(1.0, 1.0, 1.0,
0.0, -0.39465, 2.03211,
1.13983, -0.58060, 0.0) * yuv;
gl_FragColor = vec4(rgb, 1.0);
}
);

@ -12,12 +12,6 @@ extern "C" {
#define LOCAL_RECORD_FLASH_ELAPSE 500
/**
* @brief OpenGL
*
* YUV
* 44
*/
static const GLfloat vertices[] = {
// vertex coordinate
-1.0f, -1.0f,
@ -31,12 +25,6 @@ static const GLfloat vertices[] = {
1.0f, 0.0f
};
/**
* @brief VLKVideoWidget
*
* OpenGLUI
*
*/
VLKVideoWidget::VLKVideoWidget(QWidget *parent)
: QOpenGLWidget(parent)
, m_textureUniformY(0), m_textureUniformU(0), m_textureUniformV(0)
@ -51,8 +39,6 @@ VLKVideoWidget::VLKVideoWidget(QWidget *parent)
, m_iCheckDragDistanceTimer(0)
, m_bIsRendering(false)
, m_iLocalRecordingFlashTimer(0), m_bFlashFlag(false)
, m_keepAspectRatio(true)
, m_targetAspectRatio(16.0f / 9.0f) // 初始化为1920:1080的比例
{
setAcceptDrops(true);
connect(this, SIGNAL(SignalEndOfFile()), this, SLOT(onSlotEndOfFile()));
@ -78,11 +64,6 @@ VLKVideoWidget::VLKVideoWidget(QWidget *parent)
m_fontNoSignal.setLetterSpacing(QFont::AbsoluteSpacing, 0);
}
/**
* @brief VLKVideoWidget
*
* OpenGL
*/
VLKVideoWidget::~VLKVideoWidget()
{
makeCurrent();
@ -109,11 +90,6 @@ VLKVideoWidget::~VLKVideoWidget()
}
}
/**
* @brief OpenGL
*
*
*/
void VLKVideoWidget::initializeGL()
{
m_mutex.lock();
@ -124,12 +100,6 @@ void VLKVideoWidget::initializeGL()
m_mutex.unlock();
}
/**
* @brief
*
*
* uniform
*/
bool VLKVideoWidget::InitShader()
{
// intialize openGL (function of QOpenGLFunctions)
@ -175,11 +145,6 @@ bool VLKVideoWidget::InitShader()
return true;
}
/**
* @brief
*
* YUV
*/
bool VLKVideoWidget::InitTexture()
{
if (m_TextureIDY != 0)
@ -218,11 +183,6 @@ bool VLKVideoWidget::InitTexture()
return 0;
}
/**
* @brief OpenGL
*
* YUVUI
*/
void VLKVideoWidget::paintGL()
{
QPainter painter;
@ -262,75 +222,49 @@ void VLKVideoWidget::paintGL()
painter.end();
}
/**
* @brief YUV
*
* 使OpenGLYUV420P
*
*/
void VLKVideoWidget::RenderYUV()
{
if (m_iPixelW <= 0 || m_iPixelH <= 0) {
m_mutex.lock();
if (!m_pYData)
{
m_mutex.unlock();
return;
}
m_mutex.lock();
// 计算实际显示区域
QRect displayRect = m_keepAspectRatio ? m_displayRect : rect();
// 设置视口
glViewport(displayRect.x(), displayRect.y(), displayRect.width(), displayRect.height());
// 启用着色器程序
m_ShaderProgram.bind();
// 设置Y纹理
m_ShaderProgram.enableAttributeArray(m_vertexInAttr);
m_ShaderProgram.enableAttributeArray(m_textureInAttr);
m_vbo.bind();
m_ShaderProgram.setAttributeBuffer(m_vertexInAttr, GL_FLOAT, 0, 2, 2 * sizeof(GLfloat));
m_ShaderProgram.setAttributeBuffer(m_textureInAttr, GL_FLOAT, 8 * sizeof(GLfloat), 2, 2 * sizeof(GLfloat));
m_vbo.release();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_TextureIDY);
glBindTexture(GL_TEXTURE_2D, m_TextureIDY); // bind 0 layer to Y texture
// copy Y data to texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, m_iPixelW, m_iPixelH, 0, GL_RED, GL_UNSIGNED_BYTE, m_pYData);
glUniform1i(m_textureUniformY, 0);
// 设置U纹理
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, m_TextureIDU);
glBindTexture(GL_TEXTURE_2D, m_TextureIDU); // bind 1 layer to U texture
// copy U data to texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, m_iPixelW / 2, m_iPixelH / 2, 0, GL_RED, GL_UNSIGNED_BYTE, m_pUData);
glUniform1i(m_textureUniformU, 1);
// 设置V纹理
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, m_TextureIDV);
glBindTexture(GL_TEXTURE_2D, m_TextureIDV); // bind 2 layer to V texture
// copy V data to texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, m_iPixelW / 2, m_iPixelH / 2, 0, GL_RED, GL_UNSIGNED_BYTE, m_pVData);
glUniform1i(m_textureUniformV, 2);
// 顶点数据
m_vbo.bind();
m_ShaderProgram.enableAttributeArray(m_vertexInAttr);
m_ShaderProgram.setAttributeBuffer(m_vertexInAttr, GL_FLOAT, 0, 2, 2 * sizeof(float));
// 纹理坐标
m_ShaderProgram.enableAttributeArray(m_textureInAttr);
m_ShaderProgram.setAttributeBuffer(m_textureInAttr, GL_FLOAT, 8 * sizeof(float), 2, 2 * sizeof(float));
// 绘制
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
// 禁用顶点数组
// disable attribute array to make the QPainter available
m_ShaderProgram.disableAttributeArray(m_vertexInAttr);
m_ShaderProgram.disableAttributeArray(m_textureInAttr);
m_vbo.release();
// 禁用着色器程序
m_ShaderProgram.release();
m_mutex.unlock();
}
/**
* @brief
*
*
*/
void VLKVideoWidget::DrawDirectionOperateImg(QPainter& painter)
{
if (!m_bLButtonPressed || m_ptBegin == m_ptEnd)
@ -352,11 +286,6 @@ void VLKVideoWidget::DrawDirectionOperateImg(QPainter& painter)
painter.restore();
}
/**
* @brief
*
*
*/
void VLKVideoWidget::DrawLocalRecordFlash(QPainter& painter)
{
if (m_iLocalRecordingFlashTimer != 0 && m_bFlashFlag)
@ -367,11 +296,6 @@ void VLKVideoWidget::DrawLocalRecordFlash(QPainter& painter)
}
}
/**
* @brief
*
*
*/
void VLKVideoWidget::DrawTelemetryInfo(QPainter& painter)
{
painter.save();
@ -383,11 +307,6 @@ void VLKVideoWidget::DrawTelemetryInfo(QPainter& painter)
painter.restore();
}
/**
* @brief
*
* "No signal"
*/
void VLKVideoWidget::DrawVideoStatus(QPainter& painter)
{
painter.save();
@ -403,39 +322,21 @@ void VLKVideoWidget::DrawVideoStatus(QPainter& painter)
painter.restore();
}
/**
* @brief
*
*
*/
void VLKVideoWidget::resizeGL(int width, int height)
{
Q_UNUSED(width);
Q_UNUSED(height);
if (m_keepAspectRatio) {
m_displayRect = calculateAspectRatioRect();
} else {
m_displayRect = rect();
}
// m_mutex.lock();
// qDebug() << "resizeGL " << width << " : " << height;
// m_mutex.unlock();
}
/**
* @brief
*
* 使
*/
void VLKVideoWidget::Init(int width, int height)
{
Q_UNUSED(width);
Q_UNUSED(height);
}
/**
* @brief
*
* FFmpegAVFrameYUV
*/
void VLKVideoWidget::Repaint(const AVFrame *frame)
{
if (!frame)
@ -488,21 +389,11 @@ void VLKVideoWidget::Repaint(const AVFrame *frame)
update();
}
/**
* @brief
*
*
*/
void VLKVideoWidget::EndOfFile()
{
emit SignalEndOfFile();
}
/**
* @brief
*
*
*/
void VLKVideoWidget::onSlotEndOfFile()
{
Clear();
@ -510,11 +401,6 @@ void VLKVideoWidget::onSlotEndOfFile()
ShowLocalRecordFlash(false);
}
/**
* @brief
*
* YUVOpenGL
*/
void VLKVideoWidget::Clear()
{
m_mutex.lock();
@ -536,11 +422,6 @@ void VLKVideoWidget::Clear()
update();
}
/**
* @brief
*
*
*/
void VLKVideoWidget::dragEnterEvent(QDragEnterEvent *event)
{
if (event->source() == this)
@ -549,11 +430,6 @@ void VLKVideoWidget::dragEnterEvent(QDragEnterEvent *event)
event->accept();
}
/**
* @brief
*
*
*/
void VLKVideoWidget::dropEvent(QDropEvent *event)
{
Q_UNUSED(event);
@ -564,11 +440,6 @@ void VLKVideoWidget::dropEvent(QDropEvent *event)
*/
}
/**
* @brief
*
*
*/
void VLKVideoWidget::contextMenuEvent(QContextMenuEvent * event)
{
Q_UNUSED(event);
@ -576,21 +447,11 @@ void VLKVideoWidget::contextMenuEvent(QContextMenuEvent * event)
// m_menu->show();
}
/**
* @brief
*
*
*/
void VLKVideoWidget::on_SlotContextMenu(QAction* action)
{
Q_UNUSED(action);
}
/**
* @brief
*
*
*/
void VLKVideoWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
// check if the device has track capability
@ -608,11 +469,6 @@ void VLKVideoWidget::mouseDoubleClickEvent(QMouseEvent *event)
VLK_TrackTargetPositionEx(&param, iImgPosX, iImgPosY, m_iPixelW, m_iPixelH);
}
/**
* @brief
*
*
*/
void VLKVideoWidget::wheelEvent(QWheelEvent* event)
{
if (event->delta() > 0) // wheel is moving forward
@ -639,11 +495,6 @@ void VLKVideoWidget::wheelEvent(QWheelEvent* event)
}
}
/**
* @brief
*
*
*/
void VLKVideoWidget::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
@ -664,11 +515,6 @@ void VLKVideoWidget::mousePressEvent(QMouseEvent *event)
}
}
/**
* @brief
*
*
*/
void VLKVideoWidget::mouseMoveEvent(QMouseEvent *event)
{
if (m_bLButtonPressed)
@ -678,11 +524,6 @@ void VLKVideoWidget::mouseMoveEvent(QMouseEvent *event)
}
}
/**
* @brief
*
*
*/
void VLKVideoWidget::mouseReleaseEvent(QMouseEvent *event)
{
Q_UNUSED(event);
@ -707,11 +548,6 @@ void VLKVideoWidget::mouseReleaseEvent(QMouseEvent *event)
update();
}
/**
* @brief
*
*
*/
void VLKVideoWidget::timerEvent(QTimerEvent *event)
{
if (event->timerId() == m_nStopZoomTimerID)
@ -752,11 +588,6 @@ void VLKVideoWidget::timerEvent(QTimerEvent *event)
}
}
/**
* @brief
*
*
*/
void VLKVideoWidget::ShowLocalRecordFlash(bool bShow)
{
if (bShow)
@ -774,53 +605,3 @@ void VLKVideoWidget::ShowLocalRecordFlash(bool bShow)
}
}
}
/**
* @brief
*
*
*/
void VLKVideoWidget::setStandardSize(int width, int height)
{
if (width > 0 && height > 0) {
m_targetAspectRatio = static_cast<float>(width) / static_cast<float>(height);
update();
}
}
/**
* @brief
*
*
*/
QRect VLKVideoWidget::calculateAspectRatioRect() const
{
QRect result = rect();
if (m_targetAspectRatio <= 0) {
return result;
}
float currentRatio = static_cast<float>(result.width()) / static_cast<float>(result.height());
if (qAbs(currentRatio - m_targetAspectRatio) < 0.001f) {
// 比例已经正确,不需要调整
return result;
}
if (currentRatio > m_targetAspectRatio) {
// 当前区域太宽,需要减小宽度
int newWidth = qRound(result.height() * m_targetAspectRatio);
int offsetX = (result.width() - newWidth) / 2;
result.setLeft(result.left() + offsetX);
result.setRight(result.right() - offsetX);
} else {
// 当前区域太高,需要减小高度
int newHeight = qRound(result.width() / m_targetAspectRatio);
int offsetY = (result.height() - newHeight) / 2;
result.setTop(result.top() + offsetY);
result.setBottom(result.bottom() - offsetY);
}
return result;
}

@ -11,24 +11,6 @@
struct AVFrame;
class Widget;
/**
* @brief VLK
*
* OpenGLYUV420P
* QOpenGLWidgetQOpenGLFunctions
*
*
* - 使OpenGLYUV420P
* -
* -
* - UI
* -
* -
* - 线
*
*
*/
class VLKVideoWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
Q_OBJECT
@ -41,14 +23,6 @@ public:
VLKVideoWidget(QWidget *parent);
~VLKVideoWidget();
void ShowLocalRecordFlash(bool bShow);
// 设置是否保持宽高比
void setKeepAspectRatio(bool keep) { m_keepAspectRatio = keep; update(); }
// 设置目标宽高比
void setTargetAspectRatio(float ratio) { m_targetAspectRatio = ratio; update(); }
// 设置标准尺寸
void setStandardSize(int width, int height);
signals:
void RecieveFirstFrame();
void SignalEndOfFile();
@ -77,10 +51,6 @@ private:
void DrawTelemetryInfo(QPainter& painter);
void DrawVideoStatus(QPainter& painter);
void DrawLocalRecordFlash(QPainter& painter);
// 计算保持宽高比的实际显示区域
QRect calculateAspectRatioRect() const;
private:
QGLShaderProgram m_ShaderProgram;
QOpenGLBuffer m_vbo;
@ -125,13 +95,6 @@ private:
QPixmap m_pixmapLocalRecord;
int m_iLocalRecordingFlashTimer;
bool m_bFlashFlag;
// 是否保持宽高比
bool m_keepAspectRatio;
// 目标宽高比 (宽/高)
float m_targetAspectRatio;
// 实际显示区域
QRect m_displayRect;
};
#endif // VLKVIDEOWIDGET_H

@ -2,64 +2,33 @@
#include "VLKVideoWidget.h"
#include <chrono>
/**
* @brief
*
* FFmpeg
*/
bool CVideoObjNetwork::m_bInit = false;
/**
* @brief
* @param r AVRational
* @return
*
* FFmpeg
*/
static double r2d(AVRational r)
{
return r.den == 0 ? 0 : (double)r.num / (double)r.den;
}
/**
* @brief CVideoObjNetwork
*
*
*/
CVideoObjNetwork::CVideoObjNetwork()
: m_pAVFmtContext(NULL) // FFmpeg格式上下文
, m_iVideoStreamIndex(-1) // 视频流索引
, m_iAudioStreamIndex(-1) // 音频流索引
, m_iWidth(0), m_iHeight(0) // 视频宽度和高度
, m_pThread(NULL) // 解码线程指针
, m_cbFunc(NULL) // 回调函数指针
, m_lUserParam(0) // 用户参数
, m_bExit(false) // 退出标志
, m_pCodecContext(NULL) // 解码器上下文
, m_pVideoWidget(NULL) // 视频显示组件
: m_pAVFmtContext(NULL)
, m_iVideoStreamIndex(-1)
, m_iAudioStreamIndex(-1)
, m_iWidth(0), m_iHeight(0)
, m_pThread(NULL)
, m_cbFunc(NULL)
, m_lUserParam(0)
, m_bExit(false)
, m_pCodecContext(NULL)
, m_pVideoWidget(NULL)
{
}
/**
* @brief CVideoObjNetwork
*
*
*/
CVideoObjNetwork::~CVideoObjNetwork()
{
Close();
}
/**
* @brief FFmpeg
* @param ptr
* @param level
* @param fmt
* @param vl
*
* FFmpegQt
*/
void ffmpeg_log_callback(void* ptr, int level, const char* fmt, va_list vl)
{
// va_start(vl, fmt);
@ -69,14 +38,6 @@ void ffmpeg_log_callback(void* ptr, int level, const char* fmt, va_list vl)
qDebug() << strResult;
}
/**
* @brief
* @param strURL URL
* @param pVideoWidget
* @return truefalse
*
* FFmpeg线
*/
bool CVideoObjNetwork::Open(const std::string& strURL, VLKVideoWidget* pVideoWidget)
{
if (!m_bInit)
@ -101,35 +62,17 @@ bool CVideoObjNetwork::Open(const std::string& strURL, VLKVideoWidget* pVideoWid
return true;
}
/**
* @brief
* @return truefalse
*
* 线
*/
bool CVideoObjNetwork::IsOpen()
{
return m_pThread != NULL;
}
/**
* @brief
* @param pVideoDataCB
* @param lUserParam
*
*
*/
void CVideoObjNetwork::SetDataCallback(VideoDataCallback pVideoDataCB, long lUserParam)
{
m_cbFunc = pVideoDataCB;
m_lUserParam = lUserParam;
}
/**
* @brief
*
* 线
*/
void CVideoObjNetwork::Close()
{
if (m_pThread != NULL)
@ -145,14 +88,6 @@ void CVideoObjNetwork::Close()
CloseDecoder();
}
/**
* @brief
* @param strURL URL
* @return truefalse
*
* 使FFmpeg
* 退
*/
bool CVideoObjNetwork::OpenDemux(const std::string& strURL)
{
AVDictionary *opts = NULL;
@ -218,11 +153,6 @@ bool CVideoObjNetwork::OpenDemux(const std::string& strURL)
return true;
}
/**
* @brief
*
* FFmpeg
*/
void CVideoObjNetwork::CloseDemux()
{
StopLocalRecord();
@ -235,14 +165,6 @@ void CVideoObjNetwork::CloseDemux()
m_iAudioStreamIndex = -1;
}
/**
* @brief FFmpeg
* @param para CVideoObjNetwork
* @return 10
*
* FFmpeg
* m_bExittrue1
*/
int CVideoObjNetwork::interrupt_callback(void* para)
{
// qDebug() << __FUNCTION__;
@ -260,12 +182,6 @@ int CVideoObjNetwork::interrupt_callback(void* para)
return 0;
}
/**
* @brief 线
* @param pThis CVideoObjNetwork
*
* 线OnThreadFunc
*/
void CVideoObjNetwork::ThreadFunc(CVideoObjNetwork* pThis)
{
if (pThis != NULL)
@ -274,15 +190,6 @@ void CVideoObjNetwork::ThreadFunc(CVideoObjNetwork* pThis)
}
}
/**
* @brief 线
*
*
* 1.
* 2.
* 3.
* 4.
*/
void CVideoObjNetwork::OnThreadFunc()
{
while (!m_bExit)
@ -310,12 +217,6 @@ void CVideoObjNetwork::OnThreadFunc()
}
}
/**
* @brief
*
*
*
*/
void CVideoObjNetwork::ReadPacketLoop()
{
while (!m_bExit)
@ -354,22 +255,11 @@ void CVideoObjNetwork::ReadPacketLoop()
}
}
/**
* @brief
* @param pkt
*
*
*/
void CVideoObjNetwork::WriteLocalRecord(const AVPacket* pkt)
{
Q_UNUSED(pkt);
}
/**
* @brief
*
* FFmpeg
*/
void CVideoObjNetwork::Clear()
{
m_mutex.lock();
@ -380,45 +270,21 @@ void CVideoObjNetwork::Clear()
m_mutex.unlock();
}
/**
* @brief
* @return true
*
*
*/
bool CVideoObjNetwork::StartLocalRecord()
{
return true;
}
/**
* @brief
*
*
*/
void CVideoObjNetwork::StopLocalRecord()
{
}
/**
* @brief
*
*
*/
void CVideoObjNetwork::Capture()
{
}
/**
* @brief
* @param para
* @return truefalse
*
*
* 线
*/
bool CVideoObjNetwork::OpenDecoder(const AVCodecParameters *para)
{
AVCodec *vcodec = avcodec_find_decoder(para->codec_id);
@ -445,11 +311,6 @@ bool CVideoObjNetwork::OpenDecoder(const AVCodecParameters *para)
return true;
}
/**
* @brief
*
*
*/
void CVideoObjNetwork::CloseDecoder()
{
if (m_pCodecContext)
@ -459,13 +320,6 @@ void CVideoObjNetwork::CloseDecoder()
}
}
/**
* @brief
* @param pkt
*
*
*
*/
void CVideoObjNetwork::Send2Decode(const AVPacket *pkt)
{
if (!pkt || pkt->size <= 0 || !pkt->data || !m_pCodecContext)
@ -498,12 +352,6 @@ void CVideoObjNetwork::Send2Decode(const AVPacket *pkt)
}
}
/**
* @brief
* @param frame
*
*
*/
void CVideoObjNetwork::Send2Display(const AVFrame* frame)
{
if (!frame || frame->data[0] == NULL || frame->linesize[0] == 0)

@ -0,0 +1,66 @@
#pragma once
#include <string>
#include <mutex>
#include <thread>
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavutil/avutil.h"
#include "libswscale/swscale.h"
#include "libavutil/imgutils.h"
};
typedef void (*VideoDataCallback)(int iEncode, int iWidth, int iHeight, const char* pData, long lLen, long lPTS, void* pUserParam);
class VLKVideoWidget;
class CVideoObjNetwork
{
public:
CVideoObjNetwork();
virtual ~CVideoObjNetwork();
virtual bool Open(const std::string& strURL, VLKVideoWidget* pVideoWidget);
virtual bool IsOpen();
void SetDataCallback(VideoDataCallback pVideoDataCB, long lUserParam);
virtual void Clear();
virtual void Close();
virtual bool StartLocalRecord();
virtual void StopLocalRecord();
virtual void Capture();
private:
static void ThreadFunc(CVideoObjNetwork* pThis);
virtual void OnThreadFunc();
bool OpenDemux(const std::string& strURL);
void CloseDemux();
void WriteLocalRecord(const AVPacket* pkt);
static int interrupt_callback(void* para);
void ReadPacketLoop();
bool OpenDecoder(const AVCodecParameters *para);
void Send2Decode(const AVPacket* pkt);
void Send2Display(const AVFrame* frame);
void CloseDecoder();
private:
static bool m_bInit;
std::mutex m_mutex;
std::string m_strURL;
VLKVideoWidget* m_pVideoWidget;
AVFormatContext* m_pAVFmtContext;
int m_iVideoStreamIndex;
int m_iAudioStreamIndex;
int m_iWidth;
int m_iHeight;
std::thread* m_pThread;
bool m_bExit;
VideoDataCallback m_cbFunc;
long m_lUserParam;
AVCodecContext* m_pCodecContext;
};

@ -2,45 +2,19 @@
#include "VLKVideoWidget.h"
#include "VideoObjNetwork.h"
/**
* @brief CVideoObjUSBCamera
*
* USB
*
*/
CVideoObjUSBCamera::CVideoObjUSBCamera()
: m_pWidget(NULL) // 视频显示组件指针
, m_camera(NULL) // 摄像头对象指针
: m_pWidget(NULL)
, m_camera(NULL)
{
/**
*
*
*/
m_cameraCapture = new QtCameraCapture;
/**
*
* grabImage
*/
connect(m_cameraCapture, SIGNAL(frameAvailable(QImage)), this, SLOT(grabImage(QImage)));
}
/**
* @brief CVideoObjUSBCamera
*
*
*/
CVideoObjUSBCamera::~CVideoObjUSBCamera()
{
/**
*
*/
Close();
/**
*
*/
if (m_cameraCapture != NULL)
{
delete m_cameraCapture;
@ -48,40 +22,19 @@ CVideoObjUSBCamera::~CVideoObjUSBCamera()
}
}
/**
* @brief USB
* @param strCameraDescription
* @param pVideoWidget
* @return truefalse
*
* USB
*
*/
bool CVideoObjUSBCamera::Open(const QString& strCameraDescription, VLKVideoWidget* pVideoWidget)
{
/**
*
*/
Close();
/**
*
*/
m_strCameraDescription = strCameraDescription;
m_pWidget = pVideoWidget;
/**
*
*
*/
// find Camera by description
QByteArray byteCameraName;
QList<QByteArray> listAvailableCamera = QCamera::availableDevices();
for (QList<QByteArray>::const_iterator it = listAvailableCamera.begin();
it != listAvailableCamera.end(); ++it)
{
/**
*
*/
if (0 == m_strCameraDescription.compare(QCamera::deviceDescription(*it)))
{
byteCameraName = *it;
@ -89,65 +42,34 @@ bool CVideoObjUSBCamera::Open(const QString& strCameraDescription, VLKVideoWidge
}
}
/**
*
*/
if (byteCameraName.isEmpty())
{
qCritical() << "could not find camera which description is " << m_strCameraDescription;
return false;
}
/**
*
*/
m_camera = new QCamera(byteCameraName);
m_camera->setViewfinder(m_cameraCapture);
m_camera->start();
/**
*
*/
DumpCameraCapability(m_camera);
return true;
}
/**
* @brief
* @return truefalse
*
*
*/
bool CVideoObjUSBCamera::IsOpen()
{
return m_camera != NULL;
}
/**
* @brief
*
*
*/
void CVideoObjUSBCamera::Clear()
{
}
/**
* @brief
*
*
*/
void CVideoObjUSBCamera::Close()
{
/**
*
*/
StopLocalRecord();
/**
*
*/
if (m_camera != NULL)
{
m_camera->stop();
@ -156,23 +78,8 @@ void CVideoObjUSBCamera::Close()
}
}
/**
* @brief
* @param image QImage
*
*
*
* 1. 使
* 2. RGB32YUV420P
* 3.
* 4.
*/
void CVideoObjUSBCamera::grabImage(QImage image)
{
/**
*
*
*/
static ulong ulPTS = 0;
// static QTime time = QTime::currentTime();
// qDebug () << "=============== frame duration: " << time.msecsTo(QTime::currentTime());
@ -180,29 +87,19 @@ void CVideoObjUSBCamera::grabImage(QImage image)
// qDebug() << " width: " << image.width() << ", height: " << image.height() << ", byteCount: " << image.byteCount()
// << ", depth: " << image.depth() << ", format: " << image.format();
/**
*
* 使
*
*/
// the default configuration makes image upside down
// we need to correct it
int* pRGBData = (int*)image.bits();
for (int i = 0; i < image.height()>>1; ++i)
{
for (int j = 0; j < image.width(); ++j)
{
/**
*
*/
int uVal = pRGBData[i * image.width() + j];
pRGBData[i * image.width() + j] = pRGBData[(image.height() - 1 - i) * image.width() + j];
pRGBData[(image.height() - 1 - i) * image.width() + j] = uVal;
}
}
/**
*
* RGB32YUV420P
*/
AVFrame *frame = NULL;
m_Converter.RGB32toYUV420P(&image, &frame);
frame->pts = ulPTS;
@ -213,26 +110,13 @@ void CVideoObjUSBCamera::grabImage(QImage image)
}
}
/**
* @brief
* @param pCamera
*
*
*
*/
void CVideoObjUSBCamera::DumpCameraCapability(const QCamera* pCamera)
{
/**
*
*/
if (NULL == pCamera)
{
return;
}
/**
*
*/
QList<QSize> listResolutions = pCamera->supportedViewfinderResolutions();
qDebug() << "################ supported resulution: ################";
for (QList<QSize>::iterator it = listResolutions.begin(); it != listResolutions.end(); ++it)
@ -240,9 +124,6 @@ void CVideoObjUSBCamera::DumpCameraCapability(const QCamera* pCamera)
qDebug() << " width: " << it->width() << ", height: " << it->height();
}
/**
*
*/
QList<QVideoFrame::PixelFormat> listPixelFormat = pCamera->supportedViewfinderPixelFormats();
qDebug() << "################ supported pixel format: ################";
for (QList<QVideoFrame::PixelFormat>::iterator it = listPixelFormat.begin(); it != listPixelFormat.end(); ++it)
@ -250,9 +131,6 @@ void CVideoObjUSBCamera::DumpCameraCapability(const QCamera* pCamera)
qDebug() << "pixel format: " << *it;
}
/**
*
*/
QCameraViewfinderSettings settings = pCamera->viewfinderSettings();
qDebug() << "################ current camera video width:" << settings.resolution().width() << ", height: " << settings.resolution().height();
qDebug() << "################ current camera video pixelFormat:" << settings.pixelFormat() << ", minimum frame rate: " << settings.minimumFrameRate();
@ -261,31 +139,15 @@ void CVideoObjUSBCamera::DumpCameraCapability(const QCamera* pCamera)
// m_sFrameDuration = 100;
}
/**
* @brief
* @return true
*
*
*/
bool CVideoObjUSBCamera::StartLocalRecord()
{
return true;
}
/**
* @brief
*
*
*/
void CVideoObjUSBCamera::StopLocalRecord()
{
}
/**
* @brief
*
*
*/
void CVideoObjUSBCamera::Capture()
{
}

@ -5,19 +5,6 @@
#include "FFVideoFormatConvert.h"
class VLKVideoWidget;
/**
* @brief USB
*
* USB
* QObject使Qt
*
* - USB
* -
* -
* -
* -
*/
class CVideoObjUSBCamera : public QObject
{
Q_OBJECT

@ -0,0 +1,122 @@
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][113][VLK_IsSerialPortConnected]VLK_IsSerialPortConnected
debug:[ViewLink.cpp][107][VLK_IsTCPConnected]VLK_IsTCPConnected
debug:[ViewLink.cpp][75][VLK_Connect]VLK_Connect
debug:[TCPConnection.cpp][161][SocketCallback]TCP Gimbal Connected !!!!!!!!!!!!
debug:[DeviceConnection.cpp][1454][ProcSayHelloResponse]current connected device type: TIR
debug:[DeviceConnection.cpp][1514][ProcSayHelloResponse]hand shake success! enjoy !!!
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][196][VLK_StopZoom]VLK_StopZoom
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][64][VLK_UnInit]########### ViewLink SDK 3.4.7 uninitialized ###########
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][113][VLK_IsSerialPortConnected]VLK_IsSerialPortConnected
debug:[ViewLink.cpp][107][VLK_IsTCPConnected]VLK_IsTCPConnected
debug:[ViewLink.cpp][75][VLK_Connect]VLK_Connect
debug:[TCPConnection.cpp][161][SocketCallback]TCP Gimbal Connected !!!!!!!!!!!!
debug:[DeviceConnection.cpp][1454][ProcSayHelloResponse]current connected device type: TIR
debug:[DeviceConnection.cpp][1514][ProcSayHelloResponse]hand shake success! enjoy !!!
debug:[ViewLink.cpp][302][VLK_Home]VLK_Home
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][64][VLK_UnInit]########### ViewLink SDK 3.4.7 uninitialized ###########
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][113][VLK_IsSerialPortConnected]VLK_IsSerialPortConnected
debug:[ViewLink.cpp][107][VLK_IsTCPConnected]VLK_IsTCPConnected
debug:[ViewLink.cpp][75][VLK_Connect]VLK_Connect
debug:[TCPConnection.cpp][161][SocketCallback]TCP Gimbal Connected !!!!!!!!!!!!
debug:[DeviceConnection.cpp][1454][ProcSayHelloResponse]current connected device type: TIR
debug:[DeviceConnection.cpp][1514][ProcSayHelloResponse]hand shake success! enjoy !!!
debug:[ViewLink.cpp][248][VLK_TrackTargetPositionEx]VLK_TrackTargetPositionEx
debug:[ViewLink.cpp][248][VLK_TrackTargetPositionEx]VLK_TrackTargetPositionEx
debug:[ViewLink.cpp][248][VLK_TrackTargetPositionEx]VLK_TrackTargetPositionEx
debug:[ViewLink.cpp][302][VLK_Home]VLK_Home
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][302][VLK_Home]VLK_Home
debug:[ViewLink.cpp][248][VLK_TrackTargetPositionEx]VLK_TrackTargetPositionEx
debug:[ViewLink.cpp][248][VLK_TrackTargetPositionEx]VLK_TrackTargetPositionEx
debug:[ViewLink.cpp][248][VLK_TrackTargetPositionEx]VLK_TrackTargetPositionEx
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][107][VLK_IsTCPConnected]VLK_IsTCPConnected
debug:[ViewLink.cpp][113][VLK_IsSerialPortConnected]VLK_IsSerialPortConnected
debug:[ViewLink.cpp][75][VLK_Connect]VLK_Connect
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][113][VLK_IsSerialPortConnected]VLK_IsSerialPortConnected
debug:[ViewLink.cpp][107][VLK_IsTCPConnected]VLK_IsTCPConnected
debug:[ViewLink.cpp][75][VLK_Connect]VLK_Connect
debug:[TCPConnection.cpp][171][SocketCallback]YEK_CONNECT_RESPONSE event->status() == 110
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][408][VLK_SetImageColor]VLK_SetImageColor
debug:[ViewLink.cpp][302][VLK_Home]VLK_Home
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][64][VLK_UnInit]########### ViewLink SDK 3.4.7 uninitialized ###########
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][64][VLK_UnInit]########### ViewLink SDK 3.4.7 uninitialized ###########
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][64][VLK_UnInit]########### ViewLink SDK 3.4.7 uninitialized ###########
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][64][VLK_UnInit]########### ViewLink SDK 3.4.7 uninitialized ###########
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][302][VLK_Home]VLK_Home
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][186][VLK_ZoomOut]VLK_ZoomOut
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][176][VLK_ZoomIn]VLK_ZoomIn
debug:[ViewLink.cpp][196][VLK_StopZoom]VLK_StopZoom
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][64][VLK_UnInit]########### ViewLink SDK 3.4.7 uninitialized ###########
debug:[ViewLink.cpp][57][VLK_Init]########### ViewLink SDK 3.4.7 initialized ###########
debug:[ViewLink.cpp][145][VLK_RegisterDevStatusCB]VLK_RegisterDevStatusCB
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][119][VLK_Disconnect]VLK_Disconnect
debug:[ViewLink.cpp][64][VLK_UnInit]########### ViewLink SDK 3.4.7 uninitialized ###########

@ -0,0 +1,23 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 11
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 4
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
/usr/include/c++/11 \
/usr/include/x86_64-linux-gnu/c++/11 \
/usr/include/c++/11/backward \
/usr/lib/gcc/x86_64-linux-gnu/11/include \
/usr/local/include \
/usr/include/x86_64-linux-gnu \
/usr/include
QMAKE_CXX.LIBDIRS = \
/usr/lib/gcc/x86_64-linux-gnu/11 \
/usr/lib/x86_64-linux-gnu \
/usr/lib \
/lib/x86_64-linux-gnu \
/lib

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save