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

mavlink / MAVSDK / 20440875926

22 Dec 2025 06:41PM UTC coverage: 48.058% (+0.1%) from 47.959%
20440875926

push

github

web-flow
Merge pull request #2739 from mavlink/pr-param-changes

param_server: add error when params are provided too late

77 of 80 new or added lines in 4 files covered. (96.25%)

10 existing lines in 3 files now uncovered.

17734 of 36901 relevant lines covered (48.06%)

466.52 hits per line

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

17.48
/src/mavsdk/plugins/param_server/param_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 https://github.com/mavlink/MAVSDK-Proto/blob/master/protos/param_server/param_server.proto)
4

5
#include <iomanip>
6

7
#include "param_server_impl.h"
8
#include "plugins/param_server/param_server.h"
9

10
namespace mavsdk {
11

12
using IntParam = ParamServer::IntParam;
13
using FloatParam = ParamServer::FloatParam;
14
using CustomParam = ParamServer::CustomParam;
15
using AllParams = ParamServer::AllParams;
16

17
ParamServer::ParamServer(std::shared_ptr<ServerComponent> server_component) :
10✔
18
    ServerPluginBase(),
19
    _impl{std::make_unique<ParamServerImpl>(server_component)}
10✔
20
{}
10✔
21

22
ParamServer::~ParamServer() {}
10✔
23

24
ParamServer::Result ParamServer::set_protocol(bool extended_protocol) const
×
25
{
26
    return _impl->set_protocol(extended_protocol);
×
27
}
28

29
std::pair<ParamServer::Result, int32_t> ParamServer::retrieve_param_int(std::string name) const
2✔
30
{
31
    return _impl->retrieve_param_int(name);
2✔
32
}
33

34
ParamServer::Result ParamServer::provide_param_int(std::string name, int32_t value) const
53✔
35
{
36
    return _impl->provide_param_int(name, value);
53✔
37
}
38

39
std::pair<ParamServer::Result, float> ParamServer::retrieve_param_float(std::string name) const
2✔
40
{
41
    return _impl->retrieve_param_float(name);
2✔
42
}
43

44
ParamServer::Result ParamServer::provide_param_float(std::string name, float value) const
11✔
45
{
46
    return _impl->provide_param_float(name, value);
11✔
47
}
48

49
std::pair<ParamServer::Result, std::string>
50
ParamServer::retrieve_param_custom(std::string name) const
2✔
51
{
52
    return _impl->retrieve_param_custom(name);
2✔
53
}
54

55
ParamServer::Result ParamServer::provide_param_custom(std::string name, std::string value) const
8✔
56
{
57
    return _impl->provide_param_custom(name, value);
8✔
58
}
59

60
ParamServer::AllParams ParamServer::retrieve_all_params() const
2✔
61
{
62
    return _impl->retrieve_all_params();
2✔
63
}
64

65
ParamServer::ChangedParamIntHandle
66
ParamServer::subscribe_changed_param_int(const ChangedParamIntCallback& callback)
×
67
{
68
    return _impl->subscribe_changed_param_int(callback);
×
69
}
70

71
void ParamServer::unsubscribe_changed_param_int(ChangedParamIntHandle handle)
×
72
{
73
    _impl->unsubscribe_changed_param_int(handle);
×
74
}
×
75

76
ParamServer::ChangedParamFloatHandle
77
ParamServer::subscribe_changed_param_float(const ChangedParamFloatCallback& callback)
×
78
{
79
    return _impl->subscribe_changed_param_float(callback);
×
80
}
81

82
void ParamServer::unsubscribe_changed_param_float(ChangedParamFloatHandle handle)
×
83
{
84
    _impl->unsubscribe_changed_param_float(handle);
×
85
}
×
86

87
ParamServer::ChangedParamCustomHandle
88
ParamServer::subscribe_changed_param_custom(const ChangedParamCustomCallback& callback)
×
89
{
90
    return _impl->subscribe_changed_param_custom(callback);
×
91
}
92

93
void ParamServer::unsubscribe_changed_param_custom(ChangedParamCustomHandle handle)
×
94
{
95
    _impl->unsubscribe_changed_param_custom(handle);
×
96
}
×
97

98
bool operator==(const ParamServer::IntParam& lhs, const ParamServer::IntParam& rhs)
×
99
{
100
    return (rhs.name == lhs.name) && (rhs.value == lhs.value);
×
101
}
102

103
std::ostream& operator<<(std::ostream& str, ParamServer::IntParam const& int_param)
×
104
{
105
    str << std::setprecision(15);
×
106
    str << "int_param:" << '\n' << "{\n";
×
107
    str << "    name: " << int_param.name << '\n';
×
108
    str << "    value: " << int_param.value << '\n';
×
109
    str << '}';
×
110
    return str;
×
111
}
112

113
bool operator==(const ParamServer::FloatParam& lhs, const ParamServer::FloatParam& rhs)
×
114
{
115
    return (rhs.name == lhs.name) &&
×
116
           ((std::isnan(rhs.value) && std::isnan(lhs.value)) || rhs.value == lhs.value);
×
117
}
118

119
std::ostream& operator<<(std::ostream& str, ParamServer::FloatParam const& float_param)
×
120
{
121
    str << std::setprecision(15);
×
122
    str << "float_param:" << '\n' << "{\n";
×
123
    str << "    name: " << float_param.name << '\n';
×
124
    str << "    value: " << float_param.value << '\n';
×
125
    str << '}';
×
126
    return str;
×
127
}
128

129
bool operator==(const ParamServer::CustomParam& lhs, const ParamServer::CustomParam& rhs)
×
130
{
131
    return (rhs.name == lhs.name) && (rhs.value == lhs.value);
×
132
}
133

134
std::ostream& operator<<(std::ostream& str, ParamServer::CustomParam const& custom_param)
×
135
{
136
    str << std::setprecision(15);
×
137
    str << "custom_param:" << '\n' << "{\n";
×
138
    str << "    name: " << custom_param.name << '\n';
×
139
    str << "    value: " << custom_param.value << '\n';
×
140
    str << '}';
×
141
    return str;
×
142
}
143

144
bool operator==(const ParamServer::AllParams& lhs, const ParamServer::AllParams& rhs)
×
145
{
146
    return (rhs.int_params == lhs.int_params) && (rhs.float_params == lhs.float_params) &&
×
147
           (rhs.custom_params == lhs.custom_params);
×
148
}
149

150
std::ostream& operator<<(std::ostream& str, ParamServer::AllParams const& all_params)
×
151
{
152
    str << std::setprecision(15);
×
153
    str << "all_params:" << '\n' << "{\n";
×
154
    str << "    int_params: [";
×
155
    for (auto it = all_params.int_params.begin(); it != all_params.int_params.end(); ++it) {
×
156
        str << *it;
×
157
        str << (it + 1 != all_params.int_params.end() ? ", " : "]\n");
×
158
    }
159
    str << "    float_params: [";
×
160
    for (auto it = all_params.float_params.begin(); it != all_params.float_params.end(); ++it) {
×
161
        str << *it;
×
162
        str << (it + 1 != all_params.float_params.end() ? ", " : "]\n");
×
163
    }
164
    str << "    custom_params: [";
×
165
    for (auto it = all_params.custom_params.begin(); it != all_params.custom_params.end(); ++it) {
×
166
        str << *it;
×
167
        str << (it + 1 != all_params.custom_params.end() ? ", " : "]\n");
×
168
    }
169
    str << '}';
×
170
    return str;
×
171
}
172

173
std::ostream& operator<<(std::ostream& str, ParamServer::Result const& result)
×
174
{
175
    switch (result) {
×
176
        case ParamServer::Result::Unknown:
×
177
            return str << "Unknown";
×
178
        case ParamServer::Result::Success:
×
179
            return str << "Success";
×
180
        case ParamServer::Result::NotFound:
×
181
            return str << "Not Found";
×
182
        case ParamServer::Result::WrongType:
×
183
            return str << "Wrong Type";
×
184
        case ParamServer::Result::ParamNameTooLong:
×
185
            return str << "Param Name Too Long";
×
186
        case ParamServer::Result::NoSystem:
×
187
            return str << "No System";
×
188
        case ParamServer::Result::ParamValueTooLong:
×
189
            return str << "Param Value Too Long";
×
NEW
190
        case ParamServer::Result::ParamProvidedTooLate:
×
NEW
191
            return str << "Param Provided Too Late";
×
192
        default:
×
193
            return str << "Unknown";
×
194
    }
195
}
196

197
} // 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