mainwindow.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include "common_data.h"
  4. #include "ctl.h"
  5. #include "tlm.h"
  6. #include <QTime>
  7. #include <QTimer>
  8. #include <QScrollBar>
  9. #include <QEnterEvent>
  10. #include <iostream>
  11. #include <QMainWindow>
  12. #include <QLabel>
  13. #include <ctime>
  14. QT_BEGIN_NAMESPACE
  15. namespace Ui {
  16. class MainWindow;
  17. }
  18. QT_END_NAMESPACE
  19. class MainWindow : public QMainWindow
  20. {
  21. Q_OBJECT
  22. public:
  23. MainWindow(QWidget *parent = nullptr);
  24. ~MainWindow();
  25. private slots:
  26. void slotTimerAlarm();
  27. void on_taskStart_button_clicked();
  28. void on_interrupt_button_clicked();
  29. void on_stop_button_clicked();
  30. void on_resum_button_clicked();
  31. void on_pass_val_returnPressed();
  32. private:
  33. Ui::MainWindow *ui;
  34. QTimer *timer;
  35. int ctl_sock = 0;
  36. int tlm_sock = 0;
  37. int external_cmd_sock = 0;
  38. int ctl_state = 0;
  39. int task_state = 0;
  40. int last_fail_time = 0;
  41. QString alarm_buff{""};
  42. QString fail_buff{""};
  43. EVENT_t last_event = EVENT_UNKNOWN;
  44. gcs_tlm_t tlm;
  45. void auth();
  46. void telemHandler();
  47. void taskInit();
  48. void ctlConnector();
  49. void external_cmds_handler();
  50. double pwm_convert(int pwm);
  51. std::vector<QString> alarms = {
  52. "Инициировано полетное задание"
  53. , "Инициирован взлет"
  54. , "Инициировано зависание"
  55. , "Инициирована посадка"
  56. , "Выполнена посадка"
  57. , "Прервано полетное задание"
  58. , "Принудительное зависание"
  59. , "Возобновлено выполнение полетного задания"
  60. , "max"
  61. , "unknown"
  62. };
  63. };
  64. #endif // MAINWINDOW_H