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

mavlink / MAVSDK / 7317183253

24 Dec 2023 10:25PM UTC coverage: 36.26% (-0.6%) from 36.89%
7317183253

push

github

web-flow
Merge pull request #2088 from tbago/add_more_camera_function

More camera server functionality

28 of 718 new or added lines in 12 files covered. (3.9%)

20 existing lines in 6 files now uncovered.

10035 of 27675 relevant lines covered (36.26%)

127.93 hits per line

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

1.03
/src/mavsdk/plugins/camera/camera.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/camera/camera.proto)
4

5
#include <iomanip>
6

7
#include "camera_impl.h"
8
#include "plugins/camera/camera.h"
9

10
namespace mavsdk {
11

12
using Position = Camera::Position;
13
using Quaternion = Camera::Quaternion;
14
using EulerAngle = Camera::EulerAngle;
15
using CaptureInfo = Camera::CaptureInfo;
16
using VideoStreamSettings = Camera::VideoStreamSettings;
17
using VideoStreamInfo = Camera::VideoStreamInfo;
18
using Status = Camera::Status;
19
using Option = Camera::Option;
20
using Setting = Camera::Setting;
21
using SettingOptions = Camera::SettingOptions;
22
using Information = Camera::Information;
23

24
Camera::Camera(System& system) : PluginBase(), _impl{std::make_unique<CameraImpl>(system)} {}
×
25

26
Camera::Camera(std::shared_ptr<System> system) :
1✔
27
    PluginBase(),
28
    _impl{std::make_unique<CameraImpl>(system)}
1✔
29
{}
1✔
30

31
Camera::~Camera() {}
1✔
32

33
void Camera::prepare_async(const ResultCallback callback)
×
34
{
35
    _impl->prepare_async(callback);
×
36
}
×
37

38
Camera::Result Camera::prepare() const
×
39
{
40
    return _impl->prepare();
×
41
}
42

43
void Camera::take_photo_async(const ResultCallback callback)
×
44
{
45
    _impl->take_photo_async(callback);
×
46
}
×
47

48
Camera::Result Camera::take_photo() const
×
49
{
50
    return _impl->take_photo();
×
51
}
52

53
void Camera::start_photo_interval_async(float interval_s, const ResultCallback callback)
×
54
{
55
    _impl->start_photo_interval_async(interval_s, callback);
×
56
}
×
57

58
Camera::Result Camera::start_photo_interval(float interval_s) const
×
59
{
60
    return _impl->start_photo_interval(interval_s);
×
61
}
62

63
void Camera::stop_photo_interval_async(const ResultCallback callback)
×
64
{
65
    _impl->stop_photo_interval_async(callback);
×
66
}
×
67

68
Camera::Result Camera::stop_photo_interval() const
×
69
{
70
    return _impl->stop_photo_interval();
×
71
}
72

73
void Camera::start_video_async(const ResultCallback callback)
×
74
{
75
    _impl->start_video_async(callback);
×
76
}
×
77

78
Camera::Result Camera::start_video() const
×
79
{
80
    return _impl->start_video();
×
81
}
82

83
void Camera::stop_video_async(const ResultCallback callback)
×
84
{
85
    _impl->stop_video_async(callback);
×
86
}
×
87

88
Camera::Result Camera::stop_video() const
×
89
{
90
    return _impl->stop_video();
×
91
}
92

NEW
93
Camera::Result Camera::start_video_streaming(int32_t stream_id) const
×
94
{
NEW
95
    return _impl->start_video_streaming(stream_id);
×
96
}
97

NEW
98
Camera::Result Camera::stop_video_streaming(int32_t stream_id) const
×
99
{
NEW
100
    return _impl->stop_video_streaming(stream_id);
×
101
}
102

103
void Camera::set_mode_async(Mode mode, const ResultCallback callback)
×
104
{
105
    _impl->set_mode_async(mode, callback);
×
106
}
×
107

108
Camera::Result Camera::set_mode(Mode mode) const
×
109
{
110
    return _impl->set_mode(mode);
×
111
}
112

113
void Camera::list_photos_async(PhotosRange photos_range, const ListPhotosCallback callback)
×
114
{
115
    _impl->list_photos_async(photos_range, callback);
×
116
}
×
117

118
std::pair<Camera::Result, std::vector<Camera::CaptureInfo>>
119
Camera::list_photos(PhotosRange photos_range) const
×
120
{
121
    return _impl->list_photos(photos_range);
×
122
}
123

124
Camera::ModeHandle Camera::subscribe_mode(const ModeCallback& callback)
×
125
{
126
    return _impl->subscribe_mode(callback);
×
127
}
128

129
void Camera::unsubscribe_mode(ModeHandle handle)
×
130
{
131
    _impl->unsubscribe_mode(handle);
×
132
}
×
133

134
Camera::Mode Camera::mode() const
×
135
{
136
    return _impl->mode();
×
137
}
138

139
Camera::InformationHandle Camera::subscribe_information(const InformationCallback& callback)
×
140
{
141
    return _impl->subscribe_information(callback);
×
142
}
143

144
void Camera::unsubscribe_information(InformationHandle handle)
×
145
{
146
    _impl->unsubscribe_information(handle);
×
147
}
×
148

149
Camera::Information Camera::information() const
×
150
{
151
    return _impl->information();
×
152
}
153

154
Camera::VideoStreamInfoHandle
155
Camera::subscribe_video_stream_info(const VideoStreamInfoCallback& callback)
×
156
{
157
    return _impl->subscribe_video_stream_info(callback);
×
158
}
159

160
void Camera::unsubscribe_video_stream_info(VideoStreamInfoHandle handle)
×
161
{
162
    _impl->unsubscribe_video_stream_info(handle);
×
163
}
×
164

165
Camera::VideoStreamInfo Camera::video_stream_info() const
×
166
{
167
    return _impl->video_stream_info();
×
168
}
169

170
Camera::CaptureInfoHandle Camera::subscribe_capture_info(const CaptureInfoCallback& callback)
×
171
{
172
    return _impl->subscribe_capture_info(callback);
×
173
}
174

175
void Camera::unsubscribe_capture_info(CaptureInfoHandle handle)
×
176
{
177
    _impl->unsubscribe_capture_info(handle);
×
178
}
×
179

180
Camera::StatusHandle Camera::subscribe_status(const StatusCallback& callback)
×
181
{
182
    return _impl->subscribe_status(callback);
×
183
}
184

185
void Camera::unsubscribe_status(StatusHandle handle)
×
186
{
187
    _impl->unsubscribe_status(handle);
×
188
}
×
189

190
Camera::Status Camera::status() const
×
191
{
192
    return _impl->status();
×
193
}
194

195
Camera::CurrentSettingsHandle
196
Camera::subscribe_current_settings(const CurrentSettingsCallback& callback)
×
197
{
198
    return _impl->subscribe_current_settings(callback);
×
199
}
200

201
void Camera::unsubscribe_current_settings(CurrentSettingsHandle handle)
×
202
{
203
    _impl->unsubscribe_current_settings(handle);
×
204
}
×
205

206
Camera::PossibleSettingOptionsHandle
207
Camera::subscribe_possible_setting_options(const PossibleSettingOptionsCallback& callback)
×
208
{
209
    return _impl->subscribe_possible_setting_options(callback);
×
210
}
211

212
void Camera::unsubscribe_possible_setting_options(PossibleSettingOptionsHandle handle)
×
213
{
214
    _impl->unsubscribe_possible_setting_options(handle);
×
215
}
×
216

217
std::vector<Camera::SettingOptions> Camera::possible_setting_options() const
×
218
{
219
    return _impl->possible_setting_options();
×
220
}
221

222
void Camera::set_setting_async(Setting setting, const ResultCallback callback)
×
223
{
224
    _impl->set_setting_async(setting, callback);
×
225
}
×
226

227
Camera::Result Camera::set_setting(Setting setting) const
×
228
{
229
    return _impl->set_setting(setting);
×
230
}
231

232
void Camera::get_setting_async(Setting setting, const GetSettingCallback callback)
×
233
{
234
    _impl->get_setting_async(setting, callback);
×
235
}
×
236

237
std::pair<Camera::Result, Camera::Setting> Camera::get_setting(Setting setting) const
×
238
{
239
    return _impl->get_setting(setting);
×
240
}
241

NEW
242
void Camera::format_storage_async(int32_t storage_id, const ResultCallback callback)
×
243
{
NEW
244
    _impl->format_storage_async(storage_id, callback);
×
245
}
×
246

NEW
247
Camera::Result Camera::format_storage(int32_t storage_id) const
×
248
{
NEW
249
    return _impl->format_storage(storage_id);
×
250
}
251

252
Camera::Result Camera::select_camera(int32_t camera_id) const
×
253
{
254
    return _impl->select_camera(camera_id);
×
255
}
256

NEW
257
void Camera::reset_settings_async(const ResultCallback callback)
×
258
{
NEW
259
    _impl->reset_settings_async(callback);
×
NEW
260
}
×
261

NEW
262
Camera::Result Camera::reset_settings() const
×
263
{
NEW
264
    return _impl->reset_settings();
×
265
}
266

UNCOV
267
std::ostream& operator<<(std::ostream& str, Camera::Result const& result)
×
268
{
269
    switch (result) {
×
270
        case Camera::Result::Unknown:
×
271
            return str << "Unknown";
×
272
        case Camera::Result::Success:
×
273
            return str << "Success";
×
274
        case Camera::Result::InProgress:
×
275
            return str << "In Progress";
×
276
        case Camera::Result::Busy:
×
277
            return str << "Busy";
×
278
        case Camera::Result::Denied:
×
279
            return str << "Denied";
×
280
        case Camera::Result::Error:
×
281
            return str << "Error";
×
282
        case Camera::Result::Timeout:
×
283
            return str << "Timeout";
×
284
        case Camera::Result::WrongArgument:
×
285
            return str << "Wrong Argument";
×
286
        case Camera::Result::NoSystem:
×
287
            return str << "No System";
×
288
        case Camera::Result::ProtocolUnsupported:
×
289
            return str << "Protocol Unsupported";
×
290
        default:
×
291
            return str << "Unknown";
×
292
    }
293
}
294

295
bool operator==(const Camera::Position& lhs, const Camera::Position& rhs)
×
296
{
297
    return ((std::isnan(rhs.latitude_deg) && std::isnan(lhs.latitude_deg)) ||
×
298
            rhs.latitude_deg == lhs.latitude_deg) &&
×
299
           ((std::isnan(rhs.longitude_deg) && std::isnan(lhs.longitude_deg)) ||
×
300
            rhs.longitude_deg == lhs.longitude_deg) &&
×
301
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
302
            rhs.absolute_altitude_m == lhs.absolute_altitude_m) &&
×
303
           ((std::isnan(rhs.relative_altitude_m) && std::isnan(lhs.relative_altitude_m)) ||
×
304
            rhs.relative_altitude_m == lhs.relative_altitude_m);
×
305
}
306

307
std::ostream& operator<<(std::ostream& str, Camera::Position const& position)
×
308
{
309
    str << std::setprecision(15);
×
310
    str << "position:" << '\n' << "{\n";
×
311
    str << "    latitude_deg: " << position.latitude_deg << '\n';
×
312
    str << "    longitude_deg: " << position.longitude_deg << '\n';
×
313
    str << "    absolute_altitude_m: " << position.absolute_altitude_m << '\n';
×
314
    str << "    relative_altitude_m: " << position.relative_altitude_m << '\n';
×
315
    str << '}';
×
316
    return str;
×
317
}
318

319
bool operator==(const Camera::Quaternion& lhs, const Camera::Quaternion& rhs)
×
320
{
321
    return ((std::isnan(rhs.w) && std::isnan(lhs.w)) || rhs.w == lhs.w) &&
×
322
           ((std::isnan(rhs.x) && std::isnan(lhs.x)) || rhs.x == lhs.x) &&
×
323
           ((std::isnan(rhs.y) && std::isnan(lhs.y)) || rhs.y == lhs.y) &&
×
324
           ((std::isnan(rhs.z) && std::isnan(lhs.z)) || rhs.z == lhs.z);
×
325
}
326

327
std::ostream& operator<<(std::ostream& str, Camera::Quaternion const& quaternion)
×
328
{
329
    str << std::setprecision(15);
×
330
    str << "quaternion:" << '\n' << "{\n";
×
331
    str << "    w: " << quaternion.w << '\n';
×
332
    str << "    x: " << quaternion.x << '\n';
×
333
    str << "    y: " << quaternion.y << '\n';
×
334
    str << "    z: " << quaternion.z << '\n';
×
335
    str << '}';
×
336
    return str;
×
337
}
338

339
bool operator==(const Camera::EulerAngle& lhs, const Camera::EulerAngle& rhs)
×
340
{
341
    return ((std::isnan(rhs.roll_deg) && std::isnan(lhs.roll_deg)) ||
×
342
            rhs.roll_deg == lhs.roll_deg) &&
×
343
           ((std::isnan(rhs.pitch_deg) && std::isnan(lhs.pitch_deg)) ||
×
344
            rhs.pitch_deg == lhs.pitch_deg) &&
×
345
           ((std::isnan(rhs.yaw_deg) && std::isnan(lhs.yaw_deg)) || rhs.yaw_deg == lhs.yaw_deg);
×
346
}
347

348
std::ostream& operator<<(std::ostream& str, Camera::EulerAngle const& euler_angle)
×
349
{
350
    str << std::setprecision(15);
×
351
    str << "euler_angle:" << '\n' << "{\n";
×
352
    str << "    roll_deg: " << euler_angle.roll_deg << '\n';
×
353
    str << "    pitch_deg: " << euler_angle.pitch_deg << '\n';
×
354
    str << "    yaw_deg: " << euler_angle.yaw_deg << '\n';
×
355
    str << '}';
×
356
    return str;
×
357
}
358

359
bool operator==(const Camera::CaptureInfo& lhs, const Camera::CaptureInfo& rhs)
×
360
{
361
    return (rhs.position == lhs.position) && (rhs.attitude_quaternion == lhs.attitude_quaternion) &&
×
362
           (rhs.attitude_euler_angle == lhs.attitude_euler_angle) &&
×
363
           (rhs.time_utc_us == lhs.time_utc_us) && (rhs.is_success == lhs.is_success) &&
×
364
           (rhs.index == lhs.index) && (rhs.file_url == lhs.file_url);
×
365
}
366

367
std::ostream& operator<<(std::ostream& str, Camera::CaptureInfo const& capture_info)
×
368
{
369
    str << std::setprecision(15);
×
370
    str << "capture_info:" << '\n' << "{\n";
×
371
    str << "    position: " << capture_info.position << '\n';
×
372
    str << "    attitude_quaternion: " << capture_info.attitude_quaternion << '\n';
×
373
    str << "    attitude_euler_angle: " << capture_info.attitude_euler_angle << '\n';
×
374
    str << "    time_utc_us: " << capture_info.time_utc_us << '\n';
×
375
    str << "    is_success: " << capture_info.is_success << '\n';
×
376
    str << "    index: " << capture_info.index << '\n';
×
377
    str << "    file_url: " << capture_info.file_url << '\n';
×
378
    str << '}';
×
379
    return str;
×
380
}
381

382
bool operator==(const Camera::VideoStreamSettings& lhs, const Camera::VideoStreamSettings& rhs)
×
383
{
384
    return ((std::isnan(rhs.frame_rate_hz) && std::isnan(lhs.frame_rate_hz)) ||
×
385
            rhs.frame_rate_hz == lhs.frame_rate_hz) &&
×
386
           (rhs.horizontal_resolution_pix == lhs.horizontal_resolution_pix) &&
×
387
           (rhs.vertical_resolution_pix == lhs.vertical_resolution_pix) &&
×
388
           (rhs.bit_rate_b_s == lhs.bit_rate_b_s) && (rhs.rotation_deg == lhs.rotation_deg) &&
×
389
           (rhs.uri == lhs.uri) &&
×
390
           ((std::isnan(rhs.horizontal_fov_deg) && std::isnan(lhs.horizontal_fov_deg)) ||
×
391
            rhs.horizontal_fov_deg == lhs.horizontal_fov_deg);
×
392
}
393

394
std::ostream&
395
operator<<(std::ostream& str, Camera::VideoStreamSettings const& video_stream_settings)
×
396
{
397
    str << std::setprecision(15);
×
398
    str << "video_stream_settings:" << '\n' << "{\n";
×
399
    str << "    frame_rate_hz: " << video_stream_settings.frame_rate_hz << '\n';
×
400
    str << "    horizontal_resolution_pix: " << video_stream_settings.horizontal_resolution_pix
×
401
        << '\n';
×
402
    str << "    vertical_resolution_pix: " << video_stream_settings.vertical_resolution_pix << '\n';
×
403
    str << "    bit_rate_b_s: " << video_stream_settings.bit_rate_b_s << '\n';
×
404
    str << "    rotation_deg: " << video_stream_settings.rotation_deg << '\n';
×
405
    str << "    uri: " << video_stream_settings.uri << '\n';
×
406
    str << "    horizontal_fov_deg: " << video_stream_settings.horizontal_fov_deg << '\n';
×
407
    str << '}';
×
408
    return str;
×
409
}
410

411
std::ostream&
412
operator<<(std::ostream& str, Camera::VideoStreamInfo::VideoStreamStatus const& video_stream_status)
×
413
{
414
    switch (video_stream_status) {
×
415
        case Camera::VideoStreamInfo::VideoStreamStatus::NotRunning:
×
416
            return str << "Not Running";
×
417
        case Camera::VideoStreamInfo::VideoStreamStatus::InProgress:
×
418
            return str << "In Progress";
×
419
        default:
×
420
            return str << "Unknown";
×
421
    }
422
}
423

424
std::ostream& operator<<(
×
425
    std::ostream& str, Camera::VideoStreamInfo::VideoStreamSpectrum const& video_stream_spectrum)
426
{
427
    switch (video_stream_spectrum) {
×
428
        case Camera::VideoStreamInfo::VideoStreamSpectrum::Unknown:
×
429
            return str << "Unknown";
×
430
        case Camera::VideoStreamInfo::VideoStreamSpectrum::VisibleLight:
×
431
            return str << "Visible Light";
×
432
        case Camera::VideoStreamInfo::VideoStreamSpectrum::Infrared:
×
433
            return str << "Infrared";
×
434
        default:
×
435
            return str << "Unknown";
×
436
    }
437
}
438
bool operator==(const Camera::VideoStreamInfo& lhs, const Camera::VideoStreamInfo& rhs)
×
439
{
440
    return (rhs.settings == lhs.settings) && (rhs.status == lhs.status) &&
×
441
           (rhs.spectrum == lhs.spectrum);
×
442
}
443

444
std::ostream& operator<<(std::ostream& str, Camera::VideoStreamInfo const& video_stream_info)
×
445
{
446
    str << std::setprecision(15);
×
447
    str << "video_stream_info:" << '\n' << "{\n";
×
448
    str << "    settings: " << video_stream_info.settings << '\n';
×
449
    str << "    status: " << video_stream_info.status << '\n';
×
450
    str << "    spectrum: " << video_stream_info.spectrum << '\n';
×
451
    str << '}';
×
452
    return str;
×
453
}
454

455
std::ostream& operator<<(std::ostream& str, Camera::Status::StorageStatus const& storage_status)
×
456
{
457
    switch (storage_status) {
×
458
        case Camera::Status::StorageStatus::NotAvailable:
×
459
            return str << "Not Available";
×
460
        case Camera::Status::StorageStatus::Unformatted:
×
461
            return str << "Unformatted";
×
462
        case Camera::Status::StorageStatus::Formatted:
×
463
            return str << "Formatted";
×
464
        case Camera::Status::StorageStatus::NotSupported:
×
465
            return str << "Not Supported";
×
466
        default:
×
467
            return str << "Unknown";
×
468
    }
469
}
470

471
std::ostream& operator<<(std::ostream& str, Camera::Status::StorageType const& storage_type)
×
472
{
473
    switch (storage_type) {
×
474
        case Camera::Status::StorageType::Unknown:
×
475
            return str << "Unknown";
×
476
        case Camera::Status::StorageType::UsbStick:
×
477
            return str << "Usb Stick";
×
478
        case Camera::Status::StorageType::Sd:
×
479
            return str << "Sd";
×
480
        case Camera::Status::StorageType::Microsd:
×
481
            return str << "Microsd";
×
482
        case Camera::Status::StorageType::Hd:
×
483
            return str << "Hd";
×
484
        case Camera::Status::StorageType::Other:
×
485
            return str << "Other";
×
486
        default:
×
487
            return str << "Unknown";
×
488
    }
489
}
490
bool operator==(const Camera::Status& lhs, const Camera::Status& rhs)
×
491
{
492
    return (rhs.video_on == lhs.video_on) && (rhs.photo_interval_on == lhs.photo_interval_on) &&
×
493
           ((std::isnan(rhs.used_storage_mib) && std::isnan(lhs.used_storage_mib)) ||
×
494
            rhs.used_storage_mib == lhs.used_storage_mib) &&
×
495
           ((std::isnan(rhs.available_storage_mib) && std::isnan(lhs.available_storage_mib)) ||
×
496
            rhs.available_storage_mib == lhs.available_storage_mib) &&
×
497
           ((std::isnan(rhs.total_storage_mib) && std::isnan(lhs.total_storage_mib)) ||
×
498
            rhs.total_storage_mib == lhs.total_storage_mib) &&
×
499
           ((std::isnan(rhs.recording_time_s) && std::isnan(lhs.recording_time_s)) ||
×
500
            rhs.recording_time_s == lhs.recording_time_s) &&
×
501
           (rhs.media_folder_name == lhs.media_folder_name) &&
×
502
           (rhs.storage_status == lhs.storage_status) && (rhs.storage_id == lhs.storage_id) &&
×
503
           (rhs.storage_type == lhs.storage_type);
×
504
}
505

506
std::ostream& operator<<(std::ostream& str, Camera::Status const& status)
×
507
{
508
    str << std::setprecision(15);
×
509
    str << "status:" << '\n' << "{\n";
×
510
    str << "    video_on: " << status.video_on << '\n';
×
511
    str << "    photo_interval_on: " << status.photo_interval_on << '\n';
×
512
    str << "    used_storage_mib: " << status.used_storage_mib << '\n';
×
513
    str << "    available_storage_mib: " << status.available_storage_mib << '\n';
×
514
    str << "    total_storage_mib: " << status.total_storage_mib << '\n';
×
515
    str << "    recording_time_s: " << status.recording_time_s << '\n';
×
516
    str << "    media_folder_name: " << status.media_folder_name << '\n';
×
517
    str << "    storage_status: " << status.storage_status << '\n';
×
518
    str << "    storage_id: " << status.storage_id << '\n';
×
519
    str << "    storage_type: " << status.storage_type << '\n';
×
520
    str << '}';
×
521
    return str;
×
522
}
523

524
bool operator==(const Camera::Option& lhs, const Camera::Option& rhs)
×
525
{
526
    return (rhs.option_id == lhs.option_id) && (rhs.option_description == lhs.option_description);
×
527
}
528

529
std::ostream& operator<<(std::ostream& str, Camera::Option const& option)
×
530
{
531
    str << std::setprecision(15);
×
532
    str << "option:" << '\n' << "{\n";
×
533
    str << "    option_id: " << option.option_id << '\n';
×
534
    str << "    option_description: " << option.option_description << '\n';
×
535
    str << '}';
×
536
    return str;
×
537
}
538

539
bool operator==(const Camera::Setting& lhs, const Camera::Setting& rhs)
×
540
{
541
    return (rhs.setting_id == lhs.setting_id) &&
×
542
           (rhs.setting_description == lhs.setting_description) && (rhs.option == lhs.option) &&
×
543
           (rhs.is_range == lhs.is_range);
×
544
}
545

546
std::ostream& operator<<(std::ostream& str, Camera::Setting const& setting)
×
547
{
548
    str << std::setprecision(15);
×
549
    str << "setting:" << '\n' << "{\n";
×
550
    str << "    setting_id: " << setting.setting_id << '\n';
×
551
    str << "    setting_description: " << setting.setting_description << '\n';
×
552
    str << "    option: " << setting.option << '\n';
×
553
    str << "    is_range: " << setting.is_range << '\n';
×
554
    str << '}';
×
555
    return str;
×
556
}
557

558
bool operator==(const Camera::SettingOptions& lhs, const Camera::SettingOptions& rhs)
×
559
{
560
    return (rhs.setting_id == lhs.setting_id) &&
×
561
           (rhs.setting_description == lhs.setting_description) && (rhs.options == lhs.options) &&
×
562
           (rhs.is_range == lhs.is_range);
×
563
}
564

565
std::ostream& operator<<(std::ostream& str, Camera::SettingOptions const& setting_options)
×
566
{
567
    str << std::setprecision(15);
×
568
    str << "setting_options:" << '\n' << "{\n";
×
569
    str << "    setting_id: " << setting_options.setting_id << '\n';
×
570
    str << "    setting_description: " << setting_options.setting_description << '\n';
×
571
    str << "    options: [";
×
572
    for (auto it = setting_options.options.begin(); it != setting_options.options.end(); ++it) {
×
573
        str << *it;
×
574
        str << (it + 1 != setting_options.options.end() ? ", " : "]\n");
×
575
    }
576
    str << "    is_range: " << setting_options.is_range << '\n';
×
577
    str << '}';
×
578
    return str;
×
579
}
580

581
bool operator==(const Camera::Information& lhs, const Camera::Information& rhs)
×
582
{
583
    return (rhs.vendor_name == lhs.vendor_name) && (rhs.model_name == lhs.model_name) &&
×
584
           ((std::isnan(rhs.focal_length_mm) && std::isnan(lhs.focal_length_mm)) ||
×
585
            rhs.focal_length_mm == lhs.focal_length_mm) &&
×
586
           ((std::isnan(rhs.horizontal_sensor_size_mm) &&
×
587
             std::isnan(lhs.horizontal_sensor_size_mm)) ||
×
588
            rhs.horizontal_sensor_size_mm == lhs.horizontal_sensor_size_mm) &&
×
589
           ((std::isnan(rhs.vertical_sensor_size_mm) && std::isnan(lhs.vertical_sensor_size_mm)) ||
×
590
            rhs.vertical_sensor_size_mm == lhs.vertical_sensor_size_mm) &&
×
591
           (rhs.horizontal_resolution_px == lhs.horizontal_resolution_px) &&
×
592
           (rhs.vertical_resolution_px == lhs.vertical_resolution_px);
×
593
}
594

595
std::ostream& operator<<(std::ostream& str, Camera::Information const& information)
×
596
{
597
    str << std::setprecision(15);
×
598
    str << "information:" << '\n' << "{\n";
×
599
    str << "    vendor_name: " << information.vendor_name << '\n';
×
600
    str << "    model_name: " << information.model_name << '\n';
×
601
    str << "    focal_length_mm: " << information.focal_length_mm << '\n';
×
602
    str << "    horizontal_sensor_size_mm: " << information.horizontal_sensor_size_mm << '\n';
×
603
    str << "    vertical_sensor_size_mm: " << information.vertical_sensor_size_mm << '\n';
×
604
    str << "    horizontal_resolution_px: " << information.horizontal_resolution_px << '\n';
×
605
    str << "    vertical_resolution_px: " << information.vertical_resolution_px << '\n';
×
606
    str << '}';
×
607
    return str;
×
608
}
609

610
std::ostream& operator<<(std::ostream& str, Camera::Mode const& mode)
×
611
{
612
    switch (mode) {
×
613
        case Camera::Mode::Unknown:
×
614
            return str << "Unknown";
×
615
        case Camera::Mode::Photo:
×
616
            return str << "Photo";
×
617
        case Camera::Mode::Video:
×
618
            return str << "Video";
×
619
        default:
×
620
            return str << "Unknown";
×
621
    }
622
}
623

624
std::ostream& operator<<(std::ostream& str, Camera::PhotosRange const& photos_range)
×
625
{
626
    switch (photos_range) {
×
627
        case Camera::PhotosRange::All:
×
628
            return str << "All";
×
629
        case Camera::PhotosRange::SinceConnection:
×
630
            return str << "Since Connection";
×
631
        default:
×
632
            return str << "Unknown";
×
633
    }
634
}
635

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

© 2026 Coveralls, Inc