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

mavlink / MAVSDK / 4899817366

pending completion
4899817366

Pull #1772

github

GitHub
Merge c0bb90862 into e4e9c71dd
Pull Request #1772: Refactor MAVLinkParameters into client and server classes

2192 of 2192 new or added lines in 34 files covered. (100.0%)

7708 of 24812 relevant lines covered (31.07%)

19.96 hits per line

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

4.72
/src/mavsdk/plugins/camera_server/camera_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/camera_server/camera_server.proto)
5

6
#include <iomanip>
7

8
#include "camera_server_impl.h"
9
#include "plugins/camera_server/camera_server.h"
10

11
namespace mavsdk {
12

13
using Information = CameraServer::Information;
14
using Position = CameraServer::Position;
15
using Quaternion = CameraServer::Quaternion;
16
using CaptureInfo = CameraServer::CaptureInfo;
17

18
CameraServer::CameraServer(std::shared_ptr<ServerComponent> server_component) :
1✔
19
    ServerPluginBase(),
20
    _impl{std::make_unique<CameraServerImpl>(server_component)}
1✔
21
{}
1✔
22

23
CameraServer::~CameraServer() {}
1✔
24

25
CameraServer::Result CameraServer::set_information(Information information) const
×
26
{
27
    return _impl->set_information(information);
×
28
}
29

30
CameraServer::Result CameraServer::set_in_progress(bool in_progress) const
×
31
{
32
    return _impl->set_in_progress(in_progress);
×
33
}
34

35
CameraServer::TakePhotoHandle CameraServer::subscribe_take_photo(const TakePhotoCallback& callback)
1✔
36
{
37
    return _impl->subscribe_take_photo(callback);
1✔
38
}
39

40
void CameraServer::unsubscribe_take_photo(TakePhotoHandle handle)
×
41
{
42
    _impl->unsubscribe_take_photo(handle);
×
43
}
×
44

45
CameraServer::Result CameraServer::respond_take_photo(
×
46
    TakePhotoFeedback take_photo_feedback, CaptureInfo capture_info) const
47
{
48
    return _impl->respond_take_photo(take_photo_feedback, capture_info);
×
49
}
50

51
bool operator==(const CameraServer::Information& lhs, const CameraServer::Information& rhs)
×
52
{
53
    return (rhs.vendor_name == lhs.vendor_name) && (rhs.model_name == lhs.model_name) &&
×
54
           (rhs.firmware_version == lhs.firmware_version) &&
×
55
           ((std::isnan(rhs.focal_length_mm) && std::isnan(lhs.focal_length_mm)) ||
×
56
            rhs.focal_length_mm == lhs.focal_length_mm) &&
×
57
           ((std::isnan(rhs.horizontal_sensor_size_mm) &&
×
58
             std::isnan(lhs.horizontal_sensor_size_mm)) ||
×
59
            rhs.horizontal_sensor_size_mm == lhs.horizontal_sensor_size_mm) &&
×
60
           ((std::isnan(rhs.vertical_sensor_size_mm) && std::isnan(lhs.vertical_sensor_size_mm)) ||
×
61
            rhs.vertical_sensor_size_mm == lhs.vertical_sensor_size_mm) &&
×
62
           (rhs.horizontal_resolution_px == lhs.horizontal_resolution_px) &&
×
63
           (rhs.vertical_resolution_px == lhs.vertical_resolution_px) &&
×
64
           (rhs.lens_id == lhs.lens_id) &&
×
65
           (rhs.definition_file_version == lhs.definition_file_version) &&
×
66
           (rhs.definition_file_uri == lhs.definition_file_uri);
×
67
}
68

69
std::ostream& operator<<(std::ostream& str, CameraServer::Information const& information)
×
70
{
71
    str << std::setprecision(15);
×
72
    str << "information:" << '\n' << "{\n";
×
73
    str << "    vendor_name: " << information.vendor_name << '\n';
×
74
    str << "    model_name: " << information.model_name << '\n';
×
75
    str << "    firmware_version: " << information.firmware_version << '\n';
×
76
    str << "    focal_length_mm: " << information.focal_length_mm << '\n';
×
77
    str << "    horizontal_sensor_size_mm: " << information.horizontal_sensor_size_mm << '\n';
×
78
    str << "    vertical_sensor_size_mm: " << information.vertical_sensor_size_mm << '\n';
×
79
    str << "    horizontal_resolution_px: " << information.horizontal_resolution_px << '\n';
×
80
    str << "    vertical_resolution_px: " << information.vertical_resolution_px << '\n';
×
81
    str << "    lens_id: " << information.lens_id << '\n';
×
82
    str << "    definition_file_version: " << information.definition_file_version << '\n';
×
83
    str << "    definition_file_uri: " << information.definition_file_uri << '\n';
×
84
    str << '}';
×
85
    return str;
×
86
}
87

88
bool operator==(const CameraServer::Position& lhs, const CameraServer::Position& rhs)
×
89
{
90
    return ((std::isnan(rhs.latitude_deg) && std::isnan(lhs.latitude_deg)) ||
×
91
            rhs.latitude_deg == lhs.latitude_deg) &&
×
92
           ((std::isnan(rhs.longitude_deg) && std::isnan(lhs.longitude_deg)) ||
×
93
            rhs.longitude_deg == lhs.longitude_deg) &&
×
94
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
95
            rhs.absolute_altitude_m == lhs.absolute_altitude_m) &&
×
96
           ((std::isnan(rhs.relative_altitude_m) && std::isnan(lhs.relative_altitude_m)) ||
×
97
            rhs.relative_altitude_m == lhs.relative_altitude_m);
×
98
}
99

100
std::ostream& operator<<(std::ostream& str, CameraServer::Position const& position)
×
101
{
102
    str << std::setprecision(15);
×
103
    str << "position:" << '\n' << "{\n";
×
104
    str << "    latitude_deg: " << position.latitude_deg << '\n';
×
105
    str << "    longitude_deg: " << position.longitude_deg << '\n';
×
106
    str << "    absolute_altitude_m: " << position.absolute_altitude_m << '\n';
×
107
    str << "    relative_altitude_m: " << position.relative_altitude_m << '\n';
×
108
    str << '}';
×
109
    return str;
×
110
}
111

112
bool operator==(const CameraServer::Quaternion& lhs, const CameraServer::Quaternion& rhs)
×
113
{
114
    return ((std::isnan(rhs.w) && std::isnan(lhs.w)) || rhs.w == lhs.w) &&
×
115
           ((std::isnan(rhs.x) && std::isnan(lhs.x)) || rhs.x == lhs.x) &&
×
116
           ((std::isnan(rhs.y) && std::isnan(lhs.y)) || rhs.y == lhs.y) &&
×
117
           ((std::isnan(rhs.z) && std::isnan(lhs.z)) || rhs.z == lhs.z);
×
118
}
119

120
std::ostream& operator<<(std::ostream& str, CameraServer::Quaternion const& quaternion)
×
121
{
122
    str << std::setprecision(15);
×
123
    str << "quaternion:" << '\n' << "{\n";
×
124
    str << "    w: " << quaternion.w << '\n';
×
125
    str << "    x: " << quaternion.x << '\n';
×
126
    str << "    y: " << quaternion.y << '\n';
×
127
    str << "    z: " << quaternion.z << '\n';
×
128
    str << '}';
×
129
    return str;
×
130
}
131

132
bool operator==(const CameraServer::CaptureInfo& lhs, const CameraServer::CaptureInfo& rhs)
×
133
{
134
    return (rhs.position == lhs.position) && (rhs.attitude_quaternion == lhs.attitude_quaternion) &&
×
135
           (rhs.time_utc_us == lhs.time_utc_us) && (rhs.is_success == lhs.is_success) &&
×
136
           (rhs.index == lhs.index) && (rhs.file_url == lhs.file_url);
×
137
}
138

139
std::ostream& operator<<(std::ostream& str, CameraServer::CaptureInfo const& capture_info)
×
140
{
141
    str << std::setprecision(15);
×
142
    str << "capture_info:" << '\n' << "{\n";
×
143
    str << "    position: " << capture_info.position << '\n';
×
144
    str << "    attitude_quaternion: " << capture_info.attitude_quaternion << '\n';
×
145
    str << "    time_utc_us: " << capture_info.time_utc_us << '\n';
×
146
    str << "    is_success: " << capture_info.is_success << '\n';
×
147
    str << "    index: " << capture_info.index << '\n';
×
148
    str << "    file_url: " << capture_info.file_url << '\n';
×
149
    str << '}';
×
150
    return str;
×
151
}
152

153
std::ostream& operator<<(std::ostream& str, CameraServer::Result const& result)
×
154
{
155
    switch (result) {
×
156
        case CameraServer::Result::Unknown:
×
157
            return str << "Unknown";
×
158
        case CameraServer::Result::Success:
×
159
            return str << "Success";
×
160
        case CameraServer::Result::InProgress:
×
161
            return str << "In Progress";
×
162
        case CameraServer::Result::Busy:
×
163
            return str << "Busy";
×
164
        case CameraServer::Result::Denied:
×
165
            return str << "Denied";
×
166
        case CameraServer::Result::Error:
×
167
            return str << "Error";
×
168
        case CameraServer::Result::Timeout:
×
169
            return str << "Timeout";
×
170
        case CameraServer::Result::WrongArgument:
×
171
            return str << "Wrong Argument";
×
172
        case CameraServer::Result::NoSystem:
×
173
            return str << "No System";
×
174
        default:
×
175
            return str << "Unknown";
×
176
    }
177
}
178

179
std::ostream&
180
operator<<(std::ostream& str, CameraServer::TakePhotoFeedback const& take_photo_feedback)
×
181
{
182
    switch (take_photo_feedback) {
×
183
        case CameraServer::TakePhotoFeedback::Unknown:
×
184
            return str << "Unknown";
×
185
        case CameraServer::TakePhotoFeedback::Ok:
×
186
            return str << "Ok";
×
187
        case CameraServer::TakePhotoFeedback::Busy:
×
188
            return str << "Busy";
×
189
        case CameraServer::TakePhotoFeedback::Failed:
×
190
            return str << "Failed";
×
191
        default:
×
192
            return str << "Unknown";
×
193
    }
194
}
195

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