From 35ce4dd411e11623ad95352c5d5bc0be61829d9f Mon Sep 17 00:00:00 2001 From: v_zhangshouxu Date: Wed, 7 Jul 2021 11:57:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E4=BE=9D=E8=B5=96=E7=89=88?= =?UTF-8?q?=E6=9C=AC=202.=E5=AF=B9=E6=A8=A1=E5=9D=97=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E7=B2=BE=E7=AE=80=203.=E5=A2=9E=E5=8A=A0output=5Fresult=5Fzmq?= =?UTF-8?q?=20input=5Fresult=5Fzmq=20=E6=A8=A1=E5=9D=97=204.=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=94=AF=E6=8C=81=E8=87=AA=E5=8A=A8=E8=A1=A5=E5=85=A8?= =?UTF-8?q?=E7=9A=84=E8=84=9A=E6=9C=ACauto=5Fcompletion.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 0 .gitmodules | 0 code/.gitkeep | 0 code/src/corelib/include/core/definitions.h | 77 ---------- code/src/corelib/include/log/log_interface.h | 1 + .../corelib/include/pipe/timer_trigger.hpp | 6 +- .../corelib/include/utils/app_preference.hpp | 140 +++++++++--------- code/src/corelib/include/utils/app_util.hpp | 14 +- code/src/corelib/include/utils/dl_utils.hpp | 4 +- code/src/corelib/include/utils/gps_helper.hpp | 40 ----- code/src/input_result_zmq/CMakeLists.txt | 23 +++ .../input_result_zmq/src/input_result_zmq.cpp | 41 +++++ .../input_result_zmq/src/input_result_zmq.h | 24 +++ code/src/input_result_zmq/src/plugin.cpp | 21 +++ code/src/output_result_zmq/CMakeLists.txt | 23 +++ .../src/output_result_zmq.cpp | 56 +++++++ .../output_result_zmq/src/output_result_zmq.h | 23 +++ code/src/output_result_zmq/src/plugin.cpp | 21 +++ code/src/proto_data/proto/data_info.proto | 31 ++++ code/src/server_log/src/server_log.cpp | 3 + opt/auto_completion.sh | 21 +++ version_depend.json | 0 22 files changed, 367 insertions(+), 202 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .gitmodules delete mode 100644 code/.gitkeep delete mode 100755 code/src/corelib/include/utils/gps_helper.hpp create mode 100755 code/src/input_result_zmq/CMakeLists.txt create mode 100755 code/src/input_result_zmq/src/input_result_zmq.cpp create mode 100755 code/src/input_result_zmq/src/input_result_zmq.h create mode 100755 code/src/input_result_zmq/src/plugin.cpp create mode 100755 code/src/output_result_zmq/CMakeLists.txt create mode 100755 code/src/output_result_zmq/src/output_result_zmq.cpp create mode 100755 code/src/output_result_zmq/src/output_result_zmq.h create mode 100755 code/src/output_result_zmq/src/plugin.cpp create mode 100755 code/src/proto_data/proto/data_info.proto create mode 100755 opt/auto_completion.sh mode change 100644 => 100755 version_depend.json diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.gitmodules b/.gitmodules old mode 100644 new mode 100755 diff --git a/code/.gitkeep b/code/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/code/src/corelib/include/core/definitions.h b/code/src/corelib/include/core/definitions.h index 19e6d02..5456ba6 100755 --- a/code/src/corelib/include/core/definitions.h +++ b/code/src/corelib/include/core/definitions.h @@ -17,16 +17,6 @@ #define M_2PI (M_PI * 2) - -// MATH_CHECK_INDEXES modifies some objects (e.g. SoloGimbalEKF) to -// include more debug information. It is also used by some functions -// to add extra code for debugging purposes. If you wish to activate -// this, do it here or as part of the top-level Makefile - -// e.g. Tools/Replay/Makefile -#ifndef MATH_CHECK_INDEXES -#define MATH_CHECK_INDEXES (0) -#endif - #ifndef DEG_TO_RAD #define DEG_TO_RAD (M_PI / 180.0f) #endif @@ -34,8 +24,6 @@ #ifndef RAD_TO_DEG #define RAD_TO_DEG (180.0 / M_PI) #endif -// Centi-degrees to radians -static const double DEGX100 = 5729.57795; // GPS Specific double precision conversions // The precision here does matter when using the wsg* functions for converting @@ -44,69 +32,4 @@ static const double DEG_TO_RAD_DOUBLE = asin(1) / 90; static const double RAD_TO_DEG_DOUBLE = 90 / asin(1); -// acceleration due to gravity in m/s/s -static const double GRAVITY_MSS = 9.80665; - -// radius of earth in meters -static const double RADIUS_OF_EARTH = 6378100; - -// convert a longitude or latitude point to meters or centimeters. -// Note: this does not include the longitude scaling which is dependent upon location - -static const double LATLON_TO_M = 0.01113195; -static const double LATLON_TO_CM = 1.113195; - -static const double G_ACCEL = (9.80151); -static const double RHO = (1.225); - -/* WGS84 reference ellipsoid constants */ - -// Semi-major axis of the Earth, in meters. -static const double WGS84_A = 6356752.3142 / 0.996647189335; - -//Inverse flattening of the Earth -static const double WGS84_IF = 2982572.23563; - -// The flattening of the Earth -static const double WGS84_F = (1.0 / WGS84_IF); - -// Semi-minor axis of the Earth in meters -static const double WGS84_B = 6356752.3142; - -// Eccentricity of the Earth -static const double WGS84_E = (sqrt(2 * (1.0 / 298.257223563) - (1.0 / 298.257223563) * - (1.0 / 298.257223563))); - -// Polar Radius of Curvature -static const double WGS84_C = 639.95936258; - -static const double WGS84_E2(WGS84_E * WGS84_E); - -static const double WGS84_A2(WGS84_A * WGS84_A); - -static const double WGS84_B2(WGS84_B * WGS84_B); - -static const double WGS84_AB2(WGS84_A2 * WGS84_B2); - -// air density at 15C at sea level in kg/m^3 -static const double AIR_DENSITY_SEA_LEVEL = 1.225; - -static const double C_TO_KELVIN = 273.15; - -// Gas Constant is from Aerodynamics for Engineering Students, Third Edition, E.L.Houghton and N.B.Carruthers -static const double ISA_GAS_CONSTANT = 287.26; -static const double ISA_LAPSE_RATE = 0.0065; - -/* - use AP_ prefix to prevent conflict with OS headers, such as NuttX - clock.h - */ -#define AP_NSEC_PER_SEC 1000000000ULL -#define AP_NSEC_PER_USEC 1000ULL -#define AP_USEC_PER_SEC 1000000ULL -#define AP_USEC_PER_MSEC 1000ULL -#define AP_MSEC_PER_SEC 1000ULL -#define AP_SEC_PER_WEEK (7ULL * 86400ULL) -#define AP_MSEC_PER_WEEK (AP_SEC_PER_WEEK * AP_MSEC_PER_SEC) - #endif diff --git a/code/src/corelib/include/log/log_interface.h b/code/src/corelib/include/log/log_interface.h index fbf00bf..226b48b 100755 --- a/code/src/corelib/include/log/log_interface.h +++ b/code/src/corelib/include/log/log_interface.h @@ -13,6 +13,7 @@ enum LogLevel{ FATAL = 4, DIRECT = 9999 }; + class LogInterface{ public: LogInterface(const std::function logging_func, diff --git a/code/src/corelib/include/pipe/timer_trigger.hpp b/code/src/corelib/include/pipe/timer_trigger.hpp index 61f9405..2130405 100755 --- a/code/src/corelib/include/pipe/timer_trigger.hpp +++ b/code/src/corelib/include/pipe/timer_trigger.hpp @@ -6,12 +6,14 @@ // TimerElement 模块的触发判断函数,设置其判断精度, 默认为2ms class TimerTrigger : public basic::PipeElement { public: - TimerTrigger() : PipeElement(false, "TimerTrigger") { + TimerTrigger(int precision = 2000) : PipeElement(false, "TimerTrigger"), _precision(precision) { } private: virtual void thread_func() { - std::this_thread::sleep_for(std::chrono::microseconds(2000)); + std::this_thread::sleep_for(std::chrono::microseconds(_precision)); Messager::publish("timer_trigger"); } + + int64_t _precision; }; \ No newline at end of file diff --git a/code/src/corelib/include/utils/app_preference.hpp b/code/src/corelib/include/utils/app_preference.hpp index 90114fe..f61723c 100755 --- a/code/src/corelib/include/utils/app_preference.hpp +++ b/code/src/corelib/include/utils/app_preference.hpp @@ -16,11 +16,11 @@ protected: }; private: std::map strings; - std::map ints; - std::map longs; - std::map floats; - std::map doubles; - std::map > vec_doubles; + // std::map ints; + // std::map longs; + // std::map floats; + // std::map doubles; + // std::map > vec_doubles; public: std::string get_string_data(const std::string& key) { if (strings.find(key) == strings.end()) { @@ -30,85 +30,85 @@ public: return strings[key]; } - int get_int_data(const std::string& key) { - if (ints.find(key) == ints.end()) { - ERROR() << "Int data has no key named " << key; - throw std::runtime_error("key_not_found"); - } + // int get_int_data(const std::string& key) { + // if (ints.find(key) == ints.end()) { + // ERROR() << "Int data has no key named " << key; + // throw std::runtime_error("key_not_found"); + // } - return ints[key]; - } - long get_long_data(const std::string& key) { - if (longs.find(key) == longs.end()) { - ERROR() << "Long data has no key named " << key; - throw std::runtime_error("key_not_found"); - } + // return ints[key]; + // } + // long get_long_data(const std::string& key) { + // if (longs.find(key) == longs.end()) { + // ERROR() << "Long data has no key named " << key; + // throw std::runtime_error("key_not_found"); + // } - return longs[key]; - } + // return longs[key]; + // } - float get_float_data(const std::string& key) { - if (floats.find(key) == floats.end()) { - ERROR() << "Float data has no key named " << key; - throw std::runtime_error("key_not_found"); - } + // float get_float_data(const std::string& key) { + // if (floats.find(key) == floats.end()) { + // ERROR() << "Float data has no key named " << key; + // throw std::runtime_error("key_not_found"); + // } - return floats[key]; - } + // return floats[key]; + // } - double get_double_data(const std::string& key) { - if (doubles.find(key) == doubles.end()) { - ERROR() << "Double data has no key named " << key; - throw std::runtime_error("key_not_found"); - } + // double get_double_data(const std::string& key) { + // if (doubles.find(key) == doubles.end()) { + // ERROR() << "Double data has no key named " << key; + // throw std::runtime_error("key_not_found"); + // } - return doubles[key]; - } + // return doubles[key]; + // } - std::vector get_double_vector_data(const std::string& key) { - if (vec_doubles.find(key) == vec_doubles.end()) { - ERROR() << "Double vector data has no key named " << key; - throw std::runtime_error("key_not_found"); - } - return vec_doubles[key]; - } + // std::vector get_double_vector_data(const std::string& key) { + // if (vec_doubles.find(key) == vec_doubles.end()) { + // ERROR() << "Double vector data has no key named " << key; + // throw std::runtime_error("key_not_found"); + // } + // return vec_doubles[key]; + // } void set_string_data(const std::string& key, const std::string& value) { strings[key] = value; } - void set_int_data(const std::string& key, int value) { - ints[key] = value; - } - void set_long_data(const std::string& key, long value) { - longs[key] = value; - } - void set_float_data(const std::string& key, float value) { - floats[key] = value; - } - void set_double_data(const std::string& key, double value) { - doubles[key] = value; - } - void set_double_vector_data(const std::string& key, std::vector value) { - vec_doubles[key] = value; - } + // void set_int_data(const std::string& key, int value) { + // ints[key] = value; + // } + // void set_long_data(const std::string& key, long value) { + // longs[key] = value; + // } + // void set_float_data(const std::string& key, float value) { + // floats[key] = value; + // } + // void set_double_data(const std::string& key, double value) { + // doubles[key] = value; + // } + // void set_double_vector_data(const std::string& key, std::vector value) { + // vec_doubles[key] = value; + // } bool has_string_key(std::string key) { return strings.find(key) != strings.end(); } - bool has_int_key(std::string key) { - return ints.find(key) != ints.end(); - } - bool has_long_key(std::string key) { - return longs.find(key) != longs.end(); - } - bool has_float_key(std::string key) { - return floats.find(key) != floats.end(); - } - bool has_double_key(std::string key) { - return doubles.find(key) != doubles.end(); - } - bool has_double_vector_key(std::string key) { - return vec_doubles.find(key) != vec_doubles.end(); - } + // bool has_int_key(std::string key) { + // return ints.find(key) != ints.end(); + // } + // bool has_long_key(std::string key) { + // return longs.find(key) != longs.end(); + // } + // bool has_float_key(std::string key) { + // return floats.find(key) != floats.end(); + // } + // bool has_double_key(std::string key) { + // return doubles.find(key) != doubles.end(); + // } + // bool has_double_vector_key(std::string key) { + // return vec_doubles.find(key) != vec_doubles.end(); + // } }; diff --git a/code/src/corelib/include/utils/app_util.hpp b/code/src/corelib/include/utils/app_util.hpp index b5d58aa..42aee93 100755 --- a/code/src/corelib/include/utils/app_util.hpp +++ b/code/src/corelib/include/utils/app_util.hpp @@ -98,15 +98,6 @@ public: return get_current_us() / 1000000; } - // 判断经纬度是否合理 - static bool is_legal_lonlat(const double &longitude, const double &latitude) { - if (longitude >= 73 && longitude <= 135 && latitude >= 0 && latitude <= 50) { - return true; - } - - return false; - } - // 读取文件path,以string输出,string格式限制大小<2G static std::string get_file_text(const std::string& path){ std::ifstream ifs(path); @@ -389,7 +380,7 @@ public: } // 返回文件大小 - static int64_t get_file_size(const std::string& path){ + static int64_t get_file_size(const std::string& path) { std::ifstream in(path); in.seekg(0, std::ios::end); return in.tellg(); @@ -418,6 +409,7 @@ public: return fd; } + // 删除文件或文件夹, 成功返回0, 失败返回-1 static int remove_rf(const char *dir) { char cur_dir[] = "."; char up_dir[] = ".."; @@ -425,7 +417,7 @@ public: struct dirent *dp; struct stat dir_stat; - if (access(dir, F_OK) != 0) { //文化是否存在 + if (access(dir, F_OK) != 0) { //文件不存在 return 0; } diff --git a/code/src/corelib/include/utils/dl_utils.hpp b/code/src/corelib/include/utils/dl_utils.hpp index 8202dd3..d4d2522 100755 --- a/code/src/corelib/include/utils/dl_utils.hpp +++ b/code/src/corelib/include/utils/dl_utils.hpp @@ -52,7 +52,7 @@ public: initial_log(); - Diagnose::register_server("load_plugin", [&](const std::string& name){ + Diagnose::register_server("load_plugin", [&](const std::string& name) { std::string message; if (DlUtils::try_load_plugin(name.c_str(), message)){ DlUtils::run_plugin(name.c_str()); @@ -60,7 +60,7 @@ public: return message; }); } - static bool try_load_plugin(const char* name, std::string& message){ + static bool try_load_plugin(const char* name, std::string& message) { std::string lib_folder = appPref.get_string_data("lib_folder"); std::string lib_file = lib_folder + "/lib"; lib_file += name; diff --git a/code/src/corelib/include/utils/gps_helper.hpp b/code/src/corelib/include/utils/gps_helper.hpp deleted file mode 100755 index 7cbf1bb..0000000 --- a/code/src/corelib/include/utils/gps_helper.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include -#include - -class GpsHelper { -public: - GpsHelper() { - _geo = geo::instance(); - } - - bool is_initialized() const{ - static bool& is_init = _geo->_map_projection_reference_point.init_done; - return is_init; - } - - void initial(const double& lon, const double& lat){ - if (!_geo->get_map_projection_reference().init_done) { - _geo->global_to_local_init(lat, lon, 0, AppUtil::get_current_ms()); - } - } - - void lonlat_2_mercator(const double& lon, const double& lat, double& x, double& y) const { - double z = 0; - _geo->global_to_local(lat, lon, -z, &x, &y, &z); - } - - void mercator_2_lonlat(const double& x, const double& y, double& lon, double& lat) const { - double z = 0; - _geo->local_to_global(x, y, -z, &lat, &lon, &z); - } - - double get_distance_point_2_point(const double& lon1, const double& lat1, - const double& lon2, const double& lat2){ - return _geo->get_distance_to_next_waypoint(lat1, lon1, lat2, lon2); - } - -private: - geo* _geo; -}; diff --git a/code/src/input_result_zmq/CMakeLists.txt b/code/src/input_result_zmq/CMakeLists.txt new file mode 100755 index 0000000..474e69e --- /dev/null +++ b/code/src/input_result_zmq/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 2.8) + +project(input_result_zmq) +set(CMAKE_CXX_STANDARD 11) +add_definitions(-DLOAD_PLUGIN=load_${PROJECT_NAME}) +add_definitions(-DRUN_PLUGIN=run_${PROJECT_NAME}) +add_definitions(-DUNLOAD_PLUGIN=unload_${PROJECT_NAME}) + +find_package(Protobuf REQUIRED) +find_package(Glog REQUIRED) +find_package(Zmq REQUIRED) +include_directories( + ${ZMQ_INCLUDE_DIR} + ${GLOG_INCLUDE_DIR} + ${CORELIB_INCLUDE_DIR} + ${PROTOBUF_INCLUDE_DIR} + ${DATA_INCLUDE_DIR} + ) + +ADDLIB(${PROJECT_NAME} src + ${ZMQ_LIBRARIES} + proto_data + ) diff --git a/code/src/input_result_zmq/src/input_result_zmq.cpp b/code/src/input_result_zmq/src/input_result_zmq.cpp new file mode 100755 index 0000000..c526696 --- /dev/null +++ b/code/src/input_result_zmq/src/input_result_zmq.cpp @@ -0,0 +1,41 @@ +#include "input_result_zmq.h" +#include +#include +#include +#include +#include +#include + +// TODO: 死循环, CPU占用问题 +InputResultZmqElement::InputResultZmqElement() : basic::PipeElement(false, "InputResultZmq"){ + auto input_result_url = appPref.get_string_data("zmq.input_result_url"); + _zmq_subscriber.subscribe(input_result_url); + _zmq_subscriber.set_recv_timeout(100); + _zmq_buffer.resize(200 * 1024); +} + +void InputResultZmqElement::thread_func() +{ + int size = _zmq_subscriber.receive(_zmq_buffer); + if (size > 0) { + message::BytesItem bytes; + std::string sub_str = _zmq_buffer.substr(0, size); + bytes.ParseFromString(sub_str); + if (bytes.id() == 3001){ + std::string data = bytes.data(); + Messager::publish("log_remote", "[remote]" + data); + } else if (bytes.id() == 3002){ + QnxProcList result; + result.ParseFromString(bytes.data()); + Messager::publish("performance_result", result); + } + } +} + +InputResultZmqElement::~InputResultZmqElement() { +} + +void InputResultZmqElement::thread_closing() +{ + _zmq_subscriber.shutdown(); +} diff --git a/code/src/input_result_zmq/src/input_result_zmq.h b/code/src/input_result_zmq/src/input_result_zmq.h new file mode 100755 index 0000000..b7ef6ec --- /dev/null +++ b/code/src/input_result_zmq/src/input_result_zmq.h @@ -0,0 +1,24 @@ + +#include +#include +#include +#include + +class InputResultZmqElement : public basic::PipeElement +{ +public: + InputResultZmqElement(); + virtual ~InputResultZmqElement(); + +private: + ZmqSubscriber _zmq_subscriber; + std::string _zmq_buffer; + DoubleBufferData _buffered_road_result; + +private: + virtual void thread_func() override; + + // PipeElement interface +private: + virtual void thread_closing() override; +}; diff --git a/code/src/input_result_zmq/src/plugin.cpp b/code/src/input_result_zmq/src/plugin.cpp new file mode 100755 index 0000000..73c1bc3 --- /dev/null +++ b/code/src/input_result_zmq/src/plugin.cpp @@ -0,0 +1,21 @@ +#include "input_result_zmq.h" +#include + +PipeController g_controllor; + +extern "C"{ + +void LOAD_PLUGIN(){ + g_controllor.add_element(); +} + +void RUN_PLUGIN(){ + g_controllor.start(); +} + +void UNLOAD_PLUGIN(){ + g_controllor.stop(); + g_controllor.wait(); +} + +} diff --git a/code/src/output_result_zmq/CMakeLists.txt b/code/src/output_result_zmq/CMakeLists.txt new file mode 100755 index 0000000..87abbb3 --- /dev/null +++ b/code/src/output_result_zmq/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 2.8) + +project(output_result_zmq) +set(CMAKE_CXX_STANDARD 11) +add_definitions(-DLOAD_PLUGIN=load_${PROJECT_NAME}) +add_definitions(-DRUN_PLUGIN=run_${PROJECT_NAME}) +add_definitions(-DUNLOAD_PLUGIN=unload_${PROJECT_NAME}) + +find_package(Protobuf REQUIRED) +find_package(Glog REQUIRED) +find_package(Zmq REQUIRED) +include_directories( + ${ZMQ_INCLUDE_DIR} + ${GLOG_INCLUDE_DIR} + ${CORELIB_INCLUDE_DIR} + ${PROTOBUF_INCLUDE_DIR} + ${DATA_INCLUDE_DIR} + ) + +ADDLIB(${PROJECT_NAME} src + ${ZMQ_LIBRARIES} + proto_data + ) diff --git a/code/src/output_result_zmq/src/output_result_zmq.cpp b/code/src/output_result_zmq/src/output_result_zmq.cpp new file mode 100755 index 0000000..73d4c09 --- /dev/null +++ b/code/src/output_result_zmq/src/output_result_zmq.cpp @@ -0,0 +1,56 @@ +#include "output_result_zmq.h" +#include +#include +#include +#include +#include + +OutputResultZmqElement::OutputResultZmqElement() : basic::PipeElement(true, "OutputResultZmq"){ + auto output_result_url = appPref.get_string_data("zmq.output_result_url"); + _zmq_publisher.register_publisher(output_result_url); + + auto log_func = [&](const std::string& log){ + auto data_info = std::make_shared(); + data_info->set_data(log); + data_info->set_id(3001); + _buffered_data.push_data(data_info); + submit(); + }; + + Messager::subcribe("log_debug", log_func); + Messager::subcribe("log_info", log_func); + Messager::subcribe("log_warning", log_func); + Messager::subcribe("log_error", log_func); + Messager::subcribe("log_fatal", log_func); + Messager::subcribe("log_direct", log_func); + + Messager::subcribe( + "performance_result", + [this](const QnxProcList &data) { + auto data_info = std::make_shared(); + auto data_str = data.SerializeAsString(); + data_info->set_data(data_str); + data_info->set_id(3002); + _buffered_data.push_data(data_info); + submit(); + }); +} + +void OutputResultZmqElement::thread_func() +{ + auto buffer_data = _buffered_data.get_data(); + for (const auto& data : buffer_data){ + std::string buffer; + data->SerializeToString(&buffer); + _zmq_publisher.publish(buffer); + } +} + +OutputResultZmqElement::~OutputResultZmqElement(){ +} + + +void OutputResultZmqElement::thread_closing() +{ + _zmq_publisher.shutdown(); +} diff --git a/code/src/output_result_zmq/src/output_result_zmq.h b/code/src/output_result_zmq/src/output_result_zmq.h new file mode 100755 index 0000000..b420058 --- /dev/null +++ b/code/src/output_result_zmq/src/output_result_zmq.h @@ -0,0 +1,23 @@ + +#include +#include +#include +#include + +class OutputResultZmqElement : public basic::PipeElement +{ +public: + OutputResultZmqElement(); + virtual ~OutputResultZmqElement(); +private: + ZmqPublisher _zmq_publisher; + + DoubleBufferedVector> _buffered_data; +private: + virtual void thread_func() override; + + // PipeElement interface +private: + virtual void thread_closing() override; +}; + diff --git a/code/src/output_result_zmq/src/plugin.cpp b/code/src/output_result_zmq/src/plugin.cpp new file mode 100755 index 0000000..4a61ec3 --- /dev/null +++ b/code/src/output_result_zmq/src/plugin.cpp @@ -0,0 +1,21 @@ +#include "output_result_zmq.h" +#include + +PipeController g_controllor; + +extern "C"{ + +void LOAD_PLUGIN(){ + g_controllor.add_element(); +} + +void RUN_PLUGIN(){ + g_controllor.start(); +} + +void UNLOAD_PLUGIN(){ + g_controllor.stop(); + g_controllor.wait(); +} + +} diff --git a/code/src/proto_data/proto/data_info.proto b/code/src/proto_data/proto/data_info.proto new file mode 100755 index 0000000..490546c --- /dev/null +++ b/code/src/proto_data/proto/data_info.proto @@ -0,0 +1,31 @@ +package message; + +message Double { + required string name = 1; + required double data = 2; +} + +message Doubles { + required string name = 1; + repeated double data = 2; +} + +message Long { + required string name = 1; + required int64 data = 2; +} + +message Longs { + required string name = 1; + repeated int64 data = 2; +} + +message String { + required string name = 1; + required string data = 2; +} + +message BytesItem { + required int32 id = 1; + required bytes data = 2; +} \ No newline at end of file diff --git a/code/src/server_log/src/server_log.cpp b/code/src/server_log/src/server_log.cpp index 9c0990f..5394cdc 100755 --- a/code/src/server_log/src/server_log.cpp +++ b/code/src/server_log/src/server_log.cpp @@ -26,6 +26,9 @@ ServerLogElement::ServerLogElement() : Messager::subcribe("log_fatal", [&](const std::string& log){ error(log); }); + Messager::subcribe("log_remote", [&](const std::string& log){ + info(log); + }); } void ServerLogElement::initial() diff --git a/opt/auto_completion.sh b/opt/auto_completion.sh new file mode 100755 index 0000000..ac40caa --- /dev/null +++ b/opt/auto_completion.sh @@ -0,0 +1,21 @@ +# 功能 +# 支持定位程序 run.sh 启动的自动补全. 如输入 ./run.sh -r [Tab][Tab] 会出现可选列表 +# +# 使用方法 +# source auto_completion.sh +# +# 可以将这条命令加在 ~/.bashrc 中,启动窗口自动执行 + +function auto_completion() { + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="linux_test linaro_iv_test linaro_someip_client linaro_iv linaro_2_linux_iv_test linux_someip_service linaro_someip_iv linaro_someip_service" + + if [[ $prev == "-r" ]] || [[ $prev == "-nr" ]]; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + fi + return 0 +} +complete -F auto_completion run.sh diff --git a/version_depend.json b/version_depend.json old mode 100644 new mode 100755 -- GitLab