• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mavlink / MAVSDK / 13826010889

13 Mar 2025 02:51AM UTC coverage: 44.43% (-0.1%) from 44.565%
13826010889

push

github

web-flow
Merge pull request #2512 from jonathanreeves/feature/public-set-armed

ActionServer: allow direct setting of arm/disarm state and vehicle flight mode

0 of 92 new or added lines in 2 files covered. (0.0%)

8 existing lines in 3 files now uncovered.

14594 of 32847 relevant lines covered (44.43%)

282.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.88
/src/mavsdk/plugins/action_server/action_server.cpp
1
// WARNING: THIS FILE IS AUTOGENERATED! As such, it should not be edited.
2
// Edits need to be made to the proto files
3
// (see
4
// https://github.com/mavlink/MAVSDK-Proto/blob/master/protos/action_server/action_server.proto)
5

6
#include <iomanip>
7

8
#include "action_server_impl.h"
9
#include "plugins/action_server/action_server.h"
10

11
namespace mavsdk {
12

13
using AllowableFlightModes = ActionServer::AllowableFlightModes;
14
using ArmDisarm = ActionServer::ArmDisarm;
15

16
ActionServer::ActionServer(std::shared_ptr<ServerComponent> server_component) :
1✔
17
    ServerPluginBase(),
18
    _impl{std::make_unique<ActionServerImpl>(server_component)}
1✔
19
{}
1✔
20

21
ActionServer::~ActionServer() {}
1✔
22

23
ActionServer::ArmDisarmHandle ActionServer::subscribe_arm_disarm(const ArmDisarmCallback& callback)
×
24
{
25
    return _impl->subscribe_arm_disarm(callback);
×
26
}
27

28
void ActionServer::unsubscribe_arm_disarm(ArmDisarmHandle handle)
×
29
{
30
    _impl->unsubscribe_arm_disarm(handle);
×
31
}
×
32

33
ActionServer::FlightModeChangeHandle
34
ActionServer::subscribe_flight_mode_change(const FlightModeChangeCallback& callback)
×
35
{
36
    return _impl->subscribe_flight_mode_change(callback);
×
37
}
38

39
void ActionServer::unsubscribe_flight_mode_change(FlightModeChangeHandle handle)
×
40
{
41
    _impl->unsubscribe_flight_mode_change(handle);
×
42
}
×
43

44
ActionServer::TakeoffHandle ActionServer::subscribe_takeoff(const TakeoffCallback& callback)
×
45
{
46
    return _impl->subscribe_takeoff(callback);
×
47
}
48

49
void ActionServer::unsubscribe_takeoff(TakeoffHandle handle)
×
50
{
51
    _impl->unsubscribe_takeoff(handle);
×
52
}
×
53

54
ActionServer::LandHandle ActionServer::subscribe_land(const LandCallback& callback)
×
55
{
56
    return _impl->subscribe_land(callback);
×
57
}
58

59
void ActionServer::unsubscribe_land(LandHandle handle)
×
60
{
61
    _impl->unsubscribe_land(handle);
×
62
}
×
63

64
ActionServer::RebootHandle ActionServer::subscribe_reboot(const RebootCallback& callback)
×
65
{
66
    return _impl->subscribe_reboot(callback);
×
67
}
68

69
void ActionServer::unsubscribe_reboot(RebootHandle handle)
×
70
{
71
    _impl->unsubscribe_reboot(handle);
×
72
}
×
73

74
ActionServer::ShutdownHandle ActionServer::subscribe_shutdown(const ShutdownCallback& callback)
×
75
{
76
    return _impl->subscribe_shutdown(callback);
×
77
}
78

79
void ActionServer::unsubscribe_shutdown(ShutdownHandle handle)
×
80
{
81
    _impl->unsubscribe_shutdown(handle);
×
82
}
×
83

84
ActionServer::TerminateHandle ActionServer::subscribe_terminate(const TerminateCallback& callback)
×
85
{
86
    return _impl->subscribe_terminate(callback);
×
87
}
88

89
void ActionServer::unsubscribe_terminate(TerminateHandle handle)
×
90
{
91
    _impl->unsubscribe_terminate(handle);
×
92
}
×
93

94
ActionServer::Result ActionServer::set_allow_takeoff(bool allow_takeoff) const
×
95
{
96
    return _impl->set_allow_takeoff(allow_takeoff);
×
97
}
98

99
ActionServer::Result ActionServer::set_armable(bool armable, bool force_armable) const
1✔
100
{
101
    return _impl->set_armable(armable, force_armable);
1✔
102
}
103

104
ActionServer::Result ActionServer::set_disarmable(bool disarmable, bool force_disarmable) const
1✔
105
{
106
    return _impl->set_disarmable(disarmable, force_disarmable);
1✔
107
}
108

109
ActionServer::Result
110
ActionServer::set_allowable_flight_modes(AllowableFlightModes flight_modes) const
×
111
{
112
    return _impl->set_allowable_flight_modes(flight_modes);
×
113
}
114

115
ActionServer::AllowableFlightModes ActionServer::get_allowable_flight_modes() const
×
116
{
117
    return _impl->get_allowable_flight_modes();
×
118
}
119

NEW
120
ActionServer::Result ActionServer::set_armed_state(bool is_armed) const
×
121
{
NEW
122
    return _impl->set_armed_state(is_armed);
×
123
}
124

NEW
125
ActionServer::Result ActionServer::set_flight_mode(FlightMode flight_mode) const
×
126
{
NEW
127
    return _impl->set_flight_mode(flight_mode);
×
128
}
129

UNCOV
130
bool operator==(
×
131
    const ActionServer::AllowableFlightModes& lhs, const ActionServer::AllowableFlightModes& rhs)
132
{
133
    return (rhs.can_auto_mode == lhs.can_auto_mode) &&
×
134
           (rhs.can_guided_mode == lhs.can_guided_mode) &&
×
135
           (rhs.can_stabilize_mode == lhs.can_stabilize_mode);
×
136
}
137

138
std::ostream&
139
operator<<(std::ostream& str, ActionServer::AllowableFlightModes const& allowable_flight_modes)
×
140
{
141
    str << std::setprecision(15);
×
142
    str << "allowable_flight_modes:" << '\n' << "{\n";
×
143
    str << "    can_auto_mode: " << allowable_flight_modes.can_auto_mode << '\n';
×
144
    str << "    can_guided_mode: " << allowable_flight_modes.can_guided_mode << '\n';
×
145
    str << "    can_stabilize_mode: " << allowable_flight_modes.can_stabilize_mode << '\n';
×
146
    str << '}';
×
147
    return str;
×
148
}
149

150
bool operator==(const ActionServer::ArmDisarm& lhs, const ActionServer::ArmDisarm& rhs)
×
151
{
152
    return (rhs.arm == lhs.arm) && (rhs.force == lhs.force);
×
153
}
154

155
std::ostream& operator<<(std::ostream& str, ActionServer::ArmDisarm const& arm_disarm)
×
156
{
157
    str << std::setprecision(15);
×
158
    str << "arm_disarm:" << '\n' << "{\n";
×
159
    str << "    arm: " << arm_disarm.arm << '\n';
×
160
    str << "    force: " << arm_disarm.force << '\n';
×
161
    str << '}';
×
162
    return str;
×
163
}
164

165
std::ostream& operator<<(std::ostream& str, ActionServer::Result const& result)
×
166
{
167
    switch (result) {
×
168
        case ActionServer::Result::Unknown:
×
169
            return str << "Unknown";
×
170
        case ActionServer::Result::Success:
×
171
            return str << "Success";
×
172
        case ActionServer::Result::NoSystem:
×
173
            return str << "No System";
×
174
        case ActionServer::Result::ConnectionError:
×
175
            return str << "Connection Error";
×
176
        case ActionServer::Result::Busy:
×
177
            return str << "Busy";
×
178
        case ActionServer::Result::CommandDenied:
×
179
            return str << "Command Denied";
×
180
        case ActionServer::Result::CommandDeniedLandedStateUnknown:
×
181
            return str << "Command Denied Landed State Unknown";
×
182
        case ActionServer::Result::CommandDeniedNotLanded:
×
183
            return str << "Command Denied Not Landed";
×
184
        case ActionServer::Result::Timeout:
×
185
            return str << "Timeout";
×
186
        case ActionServer::Result::VtolTransitionSupportUnknown:
×
187
            return str << "Vtol Transition Support Unknown";
×
188
        case ActionServer::Result::NoVtolTransitionSupport:
×
189
            return str << "No Vtol Transition Support";
×
190
        case ActionServer::Result::ParameterError:
×
191
            return str << "Parameter Error";
×
192
        case ActionServer::Result::Next:
×
193
            return str << "Next";
×
194
        default:
×
195
            return str << "Unknown";
×
196
    }
197
}
198

199
std::ostream& operator<<(std::ostream& str, ActionServer::FlightMode const& flight_mode)
×
200
{
201
    switch (flight_mode) {
×
202
        case ActionServer::FlightMode::Unknown:
×
203
            return str << "Unknown";
×
204
        case ActionServer::FlightMode::Ready:
×
205
            return str << "Ready";
×
206
        case ActionServer::FlightMode::Takeoff:
×
207
            return str << "Takeoff";
×
208
        case ActionServer::FlightMode::Hold:
×
209
            return str << "Hold";
×
210
        case ActionServer::FlightMode::Mission:
×
211
            return str << "Mission";
×
212
        case ActionServer::FlightMode::ReturnToLaunch:
×
213
            return str << "Return To Launch";
×
214
        case ActionServer::FlightMode::Land:
×
215
            return str << "Land";
×
216
        case ActionServer::FlightMode::Offboard:
×
217
            return str << "Offboard";
×
218
        case ActionServer::FlightMode::FollowMe:
×
219
            return str << "Follow Me";
×
220
        case ActionServer::FlightMode::Manual:
×
221
            return str << "Manual";
×
222
        case ActionServer::FlightMode::Altctl:
×
223
            return str << "Altctl";
×
224
        case ActionServer::FlightMode::Posctl:
×
225
            return str << "Posctl";
×
226
        case ActionServer::FlightMode::Acro:
×
227
            return str << "Acro";
×
228
        case ActionServer::FlightMode::Stabilized:
×
229
            return str << "Stabilized";
×
230
        default:
×
231
            return str << "Unknown";
×
232
    }
233
}
234

235
} // namespace mavsdk
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc