main.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef MAIN_H
  2. #define MAIN_H
  3. #include <QApplication>
  4. #include <QGuiApplication>
  5. #include <QQmlApplicationEngine>
  6. #include <QQuickView>
  7. #include <QtQml>
  8. #include <QDebug>
  9. #include <QLocale>
  10. #include <QTranslator>
  11. #include <QString>
  12. //
  13. #include <QtCore>
  14. #include <QStandardPaths>
  15. #include <qjniobject.h>
  16. //SQL
  17. #include <QSqlDatabase>
  18. #include <QSqlError>
  19. #include <QSqlQuery>
  20. //JSON
  21. #include <QJsonDocument>
  22. #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
  23. #include <spdlog/spdlog.h>
  24. #include <spdlog/logger.h>
  25. #include <spdlog/sinks/rotating_file_sink.h>
  26. #include <spdlog/sinks/stdout_color_sinks.h>
  27. //opencv
  28. #include <opencv2/opencv.hpp>
  29. #define LOG(...) SPDLOG_LOGGER_INFO(spdlog::get("console"), __VA_ARGS__);SPDLOG_LOGGER_INFO(spdlog::get("rotating_logger"), __VA_ARGS__)
  30. #define WARN(...) SPDLOG_LOGGER_WARN(spdlog::get("console"), __VA_ARGS__);SPDLOG_LOGGER_WARN(spdlog::get("rotating_logger"), __VA_ARGS__)
  31. #define SPD_ERROR(...) SPDLOG_LOGGER_ERROR(spdlog::get("console"), __VA_ARGS__);SPDLOG_LOGGER_ERROR(spdlog::get("rotating_logger"), __VA_ARGS__)
  32. #define DEBUG(...) SPDLOG_LOGGER_DEBUG(spdlog::get("console"), __VA_ARGS__);SPDLOG_LOGGER_DEBUG(spdlog::get("rotating_logger"), __VA_ARGS__)
  33. using namespace std;
  34. using namespace cv;
  35. //全局变量类继承自QObject,用于qml访问
  36. class param
  37. {
  38. public:
  39. //explicit param();
  40. //db表
  41. static QString table_mqtt;
  42. static QString table_mqtt_other;
  43. static QString table_ftp;
  44. static QString table_ftp_other;
  45. static QString table_location;
  46. static QString table_camera;
  47. static QString table_mqtt_historydata;
  48. //type
  49. static QString dtype;
  50. static QString imei;
  51. //mqtt
  52. static QString mqtt_main_ip;
  53. static QString mqtt_other_ip;
  54. static int mqtt_main_port;
  55. static int mqtt_other_port;
  56. static int mqtt_main_keepalive;
  57. static int mqtt_other_keepalive;
  58. static int mqtt_main_qos;
  59. static int mqtt_other_qos;
  60. static QString mqtt_main_clientid;
  61. static QString mqtt_other_clientid;
  62. static QString mqtt_main_uid;
  63. static QString mqtt_other_uid;
  64. static QString mqtt_main_pwd;
  65. static QString mqtt_other_pwd;
  66. static QString mqtt_main_sub;
  67. static QString mqtt_other_sub;
  68. static QString mqtt_main_pub;
  69. static QString mqtt_other_pub;
  70. static QString mqtt_main_offline;
  71. static QString mqtt_other_offline;
  72. //ftp
  73. static QString ftp_main_ip;
  74. static QString ftp_other_ip;
  75. static int ftp_main_port;
  76. static int ftp_other_port;
  77. static QString ftp_main_dir;
  78. static QString ftp_other_dir;
  79. static QString ftp_main_uid;
  80. static QString ftp_other_uid;
  81. static QString ftp_main_pwd;
  82. static QString ftp_other_pwd;
  83. static int ftp_main_mode; //主动模式? 被动模式
  84. static int ftp_other_mode; //主动模式? 被动模式
  85. //location
  86. static QString lbs_lat;
  87. static QString lbs_lng;
  88. static QString gps_lat;
  89. static QString gps_lng;
  90. static QString gps_elevation;
  91. //camera
  92. private:
  93. };
  94. #endif // MAIN_H