for andy debug
parent
efe5bc4e3c
commit
57588d5026
@ -1,10 +1,10 @@
|
||||
C=3.14
|
||||
connectPort=udp://:14550
|
||||
MAVSDKListeningPort=udp://:14550
|
||||
mysqlHost=140.120.108.238
|
||||
mysqlPort=1880
|
||||
mysqlUser=root
|
||||
mysqlPW=wp21qpck57
|
||||
mysqlDatabase=Mav_one
|
||||
C=3.14
|
||||
EOC
|
||||
|
||||
EOC 就是結尾了 所以這邊可以打註解
|
||||
@ -0,0 +1,6 @@
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
extern std::map<int, std::map<std::string, std::string>> gTelemetryInfo;
|
||||
extern std::map<int, std::map<std::string, double>> gVehicleCommand;
|
||||
extern std::mutex gTeleMtx;
|
||||
@ -0,0 +1,13 @@
|
||||
// globals.h
|
||||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
extern std::map<int, std::map<std::string, std::string>> gTelemetryInfo;
|
||||
extern std::map<int, std::map<std::string, double>> gVehicleCommand;
|
||||
extern std::mutex gTeleMtx;
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,62 @@
|
||||
#ifndef MAVONE_H
|
||||
#define MAVONE_H
|
||||
|
||||
|
||||
#include <mavsdk/mavsdk.h>
|
||||
#include <mavsdk/plugins/action/action.h>
|
||||
#include <mavsdk/plugins/telemetry/telemetry.h>
|
||||
#include <mavsdk/plugins/mavlink_passthrough/mavlink_passthrough.h>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <future>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include <mysql_driver.h>
|
||||
#include <mysql_connection.h>
|
||||
#include <cppconn/resultset.h>
|
||||
#include <cppconn/statement.h>
|
||||
|
||||
|
||||
using namespace mavsdk;
|
||||
using std::chrono::seconds;
|
||||
using std::chrono::milliseconds;
|
||||
using std::this_thread::sleep_for;
|
||||
|
||||
struct MavInitParameter {
|
||||
std::string connectPort;
|
||||
std::string connectPort2;
|
||||
|
||||
float C;
|
||||
std::string mysqlHost;
|
||||
std::string mysqlPort;
|
||||
std::string mysqlUser;
|
||||
std::string mysqlPW;
|
||||
std::string mysqlDatabase;
|
||||
};
|
||||
|
||||
enum class systemHandlerState {
|
||||
Init, // 剛剛交給 systemHandler 去處理
|
||||
Prologue, // 建立了 mysql row 並取得 serialNo
|
||||
Ready, // 收到第一筆並放到 telemetryInfo 後
|
||||
Disconnected // mavsdk 判斷該系統斷線了
|
||||
};
|
||||
|
||||
struct systemHandlerInfo {
|
||||
int systemID;
|
||||
std::thread systemThread;
|
||||
systemHandlerState handlerState;
|
||||
int mysqlSN;
|
||||
|
||||
};
|
||||
|
||||
bool reset;
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue