source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/Mavlink_test.h @ 46

Last change on this file since 46 was 46, checked in by Thomas Fuhrmann, 5 years ago

Add the mavlink branch

File size: 2.9 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5//  created:    2016/07/05
6//  filename:   Mavlink.h
7//
8//  authors:    Thomas Fuhrmann
9//              Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11//  version:    $Id: $
12//
13//  purpose:    Mavlink controller in client side.
14//
15//
16/*********************************************************************/
17
18#ifndef MAVLINK_TEST_H
19#define MAVLINK_TEST_H
20
21#include <stdint.h>
22#include <Thread.h>
23
24namespace flair {
25namespace core {
26  class FrameworkManager;
27  class Socket;
28}
29namespace gui {
30  class SpinBox;
31  class Label;
32  class CheckBox;
33  class Tab;
34  class TabWidget;
35  class DoubleSpinBox;
36  class PushButton;
37  class Label;
38  class ComboBox;
39  class GroupBox;
40}
41}
42
43namespace flair {
44namespace sensor {
45
46class Mavlink : public core::Thread {
47public:
48
49  Mavlink(const core::FrameworkManager *parent, std::string name,
50             std::string receiverAddress, int receiverPort);
51  ~Mavlink();
52
53private:
54  gui::SpinBox *deadZone;
55  gui::CheckBox *enabled;
56  gui::Label *batteryChargeLevel;
57  core::Time now;
58  gui::TabWidget *tabWidget;
59  gui::Tab *tab;
60  gui::Tab *settingsTab;
61 
62  // Controls groupbox
63  gui::GroupBox* controlsGroupBox;
64  gui::PushButton* btn_initialize;
65  gui::PushButton* btn_start_mission;
66  gui::PushButton* btn_stop_mission;
67  gui::PushButton* btn_kill;
68 
69  // Add wpt groupbox
70  gui::GroupBox* add_wptGroupBox;
71  gui::DoubleSpinBox* latField;
72  gui::DoubleSpinBox* lonField;
73  gui::PushButton* btn_add_mission_wpt;
74  gui::PushButton* btn_add_entrance_wpt;
75  gui::PushButton* btn_add_exit_wpt;
76
77  // Show wpt groupbox
78  gui::GroupBox* show_wptGroupBox;
79  gui::Label* label_mission_wpt;
80  gui::Label* label_mission_wpt_list;
81  gui::Label* label_entrance_wpt;
82  gui::Label* label_entrance_wpt_list;
83  gui::Label* label_exit_wpt;
84  gui::Label* label_exit_wpt_list;
85
86  // Remove wpt groupbox
87  // gui::GroupBox* show_wptGroupBox;
88  // gui::ComboBox* cmb_box_mission_wpt;
89  // gui::ComboBox* cmb_box_mission_wpt;
90  // gui::ComboBox* cmb_box_mission_wpt;
91
92  // Action wpt groupbox
93  gui::GroupBox* action_wptGroupBox;
94  gui::PushButton* btn_send_wpt;
95  gui::PushButton* btn_clear_wpt;
96  gui::PushButton* btn_loop;
97
98  core::Socket* mavlinkSocket;
99  core::Socket* recvSocket;
100
101  // reimplement the run of the Thread class
102  void Run();
103 
104  // First tab callbacks
105  void MissionInitialize();
106  void MissionStart();
107  void MissionStop();
108  void MissionKill();
109 
110  // Second tab callbacks
111  void MissionWptAdd();
112  void EntranceWptAdd();
113  void ExitWptAdd();
114  void WptSend();
115  void WptClear();
116  void WptLoopSend();
117
118  void SendWptMessage(gui::DoubleSpinBox* latField, gui::DoubleSpinBox* lonField);
119  void SendHeartbeat();
120
121  void SendAllWptMessage();
122
123  void DecodeWptMessage(std::string wpt_to_decode);
124
125  std::string U8toString(const uint8_t* chars, const uint16_t chars_size);
126};
127
128}
129}
130
131#endif // MAVLINK_H
Note: See TracBrowser for help on using the repository browser.