commit 2a2c9df8f0183028bb330faa46a15c9b3135d11c Author: hm Date: Mon Nov 30 11:20:08 2020 +0800 vehicle manage diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8aa279 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ + + +~$*.docx +*.pro.* +*~ +*.bak +*.swp +html/ +*.zip +*.bz2 +*.tar + + +bin +build diff --git a/Vehicle.cpp b/Vehicle.cpp new file mode 100644 index 0000000..5f91833 --- /dev/null +++ b/Vehicle.cpp @@ -0,0 +1,36 @@ +#include "Vehicle.h" + +Vehicle::Vehicle(QObject *parent) : QObject(parent) +{ + //WayPointGroup.begin().value().begin().value() + +} + +Vehicle::~Vehicle() +{ + +} + +void Vehicle::setType(int t) +{ + type = t; +} + +void Vehicle::setMsg(int idx,int m) +{ + Q_UNUSED(idx) + Q_UNUSED(m) +} + +void Vehicle::setParam(int idx, param *p) +{ + params.insert(idx,p); +} + +void Vehicle::setMission(int idx, item_int * i) +{ + //waypoint.insert(idx,i); +} + + + diff --git a/Vehicle.h b/Vehicle.h new file mode 100644 index 0000000..7ca5f2c --- /dev/null +++ b/Vehicle.h @@ -0,0 +1,70 @@ +#ifndef VEHICLE_H +#define VEHICLE_H + +#include "VehicleManage_global.h" +#include + + +#include "QHash" +#include "QMap" +#include "VehicleType.h" + +class VEHICLEMANAGE_EXPORT Vehicle : public QObject +{ + Q_OBJECT +public: + explicit Vehicle(QObject *parent = nullptr); + ~Vehicle(); + +signals: + + + +public slots: + + void setType(int t); + + void setMsg(int idx, int m); + void setParam(int idx,param *p); + void setMission(int idx, item_int *i); + +private slots: + + +private: + + bool isSeleted = false; + + int sysid; + + int type; + + + state m_state; + + /* + * 航线组 + * | + * / \ + * / \ + * 航线1 航线2 + * / | \ | \ + * p p p p p + * + * 组下面有航线,航线下面有航点 + * + */ + + QMap> WayPointGroup;//航线组 + + + QMap msg; + QMap params; + + + + + +}; + +#endif // VEHICLE_H diff --git a/VehicleManage.cpp b/VehicleManage.cpp new file mode 100644 index 0000000..c4e21c4 --- /dev/null +++ b/VehicleManage.cpp @@ -0,0 +1,19 @@ +#include "VehicleManage.h" + +VehicleManage::VehicleManage() +{ + +} + +VehicleManage::~VehicleManage() +{ + +} + +void VehicleManage::addVehicle(int sysid) +{ + qDebug() << sysid; +} + + + diff --git a/VehicleManage.h b/VehicleManage.h new file mode 100644 index 0000000..c227748 --- /dev/null +++ b/VehicleManage.h @@ -0,0 +1,35 @@ +#ifndef VEHICLEMANAGE_H +#define VEHICLEMANAGE_H + +#include "VehicleManage_global.h" +#include "QObject" +#include "QDebug" + + +#include "Vehicle.h" + +class VEHICLEMANAGE_EXPORT VehicleManage : public QObject +{ +public: + explicit VehicleManage(); + ~VehicleManage(); + +signals: + + void PluginLoading(bool flag); + +public slots: + + void addVehicle(int sysid); + +private slots: + + +private: + + + QMap Vehicles; + +}; + +#endif // VEHICLEMANAGE_H diff --git a/VehicleManage.pro b/VehicleManage.pro new file mode 100644 index 0000000..da0bd35 --- /dev/null +++ b/VehicleManage.pro @@ -0,0 +1,83 @@ +QT -= gui + +TEMPLATE = lib +DEFINES += VEHICLEMANAGE_LIBRARY + +CONFIG += c++11 \ + debug_and_release + + +CONFIG(debug, debug|release) { + # Target name. + TARGET = $$join(TARGET,,,d) +} + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +DESTDIR = $$PWD/bin +MOC_DIR = $$PWD/build +OBJECTS_DIR = $$PWD/build + + +SOURCES += \ + Vehicle.cpp \ + VehicleManage.cpp + +HEADERS += \ + Vehicle.h \ + VehicleManage_global.h \ + VehicleManage.h \ + VehicleType.h + +TRANSLATIONS += \ + VehicleManage_zh_CN.ts + +# Default rules for deployment. +unix { + target.path = /usr/lib +} +!isEmpty(target.path): INSTALLS += target + + + + + + +win { + src_dir = $$PWD\\*.h + dst_dir = $$PWD\\bin\\include\\ + # dst_dir 最后的 \\ 是必须的,用来标示 xcopy 到一个文件夹,若不存在,创建之 + + # Replace slashes in paths with backslashes for Windows + src_dir ~= s,/,\\,g + dst_dir ~= s,/,\\,g + + system(xcopy $$src_dir $$dst_dir /y /e) +} + + +unix { + src_dir = $$PWD/*.h + dst_dir = $$PWD\\bin\\include\\ + + !exists($$dst_dir): system(mkdir -p $$dst_dir) + + system(cp $$src_dir $$dst_dir -arf ) +} + + + + + + + + diff --git a/VehicleManage_global.h b/VehicleManage_global.h new file mode 100644 index 0000000..5959527 --- /dev/null +++ b/VehicleManage_global.h @@ -0,0 +1,12 @@ +#ifndef VEHICLEMANAGE_GLOBAL_H +#define VEHICLEMANAGE_GLOBAL_H + +#include + +#if defined(VEHICLEMANAGE_LIBRARY) +# define VEHICLEMANAGE_EXPORT Q_DECL_EXPORT +#else +# define VEHICLEMANAGE_EXPORT Q_DECL_IMPORT +#endif + +#endif // VEHICLEMANAGE_GLOBAL_H diff --git a/VehicleManage_zh_CN.ts b/VehicleManage_zh_CN.ts new file mode 100644 index 0000000..867e21b --- /dev/null +++ b/VehicleManage_zh_CN.ts @@ -0,0 +1,3 @@ + + + diff --git a/VehicleType.h b/VehicleType.h new file mode 100644 index 0000000..0e48915 --- /dev/null +++ b/VehicleType.h @@ -0,0 +1,96 @@ +#ifndef VEHICLETYPE_H +#define VEHICLETYPE_H + +#include "QDebug" +#include "QObject" + +typedef struct __state +{ + bool isSeleted = false; + + int type;//设备类型 + + bool arm; + int flightmode; + + + int lat; + int lng; + int alt; + + float vel; + float heading; + + int fix; + int svn; + + + + float tas; + float cas; + float gs; + float ma; + float as_err; + + + + + float rol; + float pit; + float yaw; + + float p; + float q; + float r; + + float ax; + float ay; + float az; + + + +}state; + + + + + + +typedef struct __param { + float param_value; /*< Onboard parameter value*/ + uint16_t param_count; /*< Total number of onboard parameters*/ + uint16_t param_index; /*< Index of this onboard parameter*/ + char param_id[16]; /*< Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string*/ + uint8_t param_type; /*< Onboard parameter type.*/ +} param; + +typedef struct __item_int { + float param1; /*< PARAM1, see MAV_CMD enum*/ + float param2; /*< PARAM2, see MAV_CMD enum*/ + float param3; /*< PARAM3, see MAV_CMD enum*/ + float param4; /*< PARAM4, see MAV_CMD enum*/ + int32_t x; /*< PARAM5 / local: x position in meters * 1e4, global: latitude in degrees * 10^7*/ + int32_t y; /*< PARAM6 / y position: local: x position in meters * 1e4, global: longitude in degrees *10^7*/ + float z; /*< PARAM7 / z position: global: altitude in meters (relative or absolute, depending on frame.*/ + uint16_t target_system; /*< System ID*/ + uint16_t seq; /*< Waypoint ID (sequence number). Starts at zero. Increases monotonically for each waypoint, no gaps in the sequence (0,1,2,3,4).*/ + uint16_t command; /*< The scheduled action for the waypoint.*/ + uint8_t target_component; /*< Component ID*/ + uint8_t frame; /*< The coordinate system of the waypoint.*/ + uint8_t current; /*< false:0, true:1*/ + uint8_t autocontinue; /*< Autocontinue to next waypoint*/ + uint8_t mission_type; /*< Mission type.*/ +} item_int; + + + + + + + + + + + + +#endif // VEHICLETYPE_H