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

mavlink / MAVSDK / 12385035894

18 Dec 2024 02:13AM UTC coverage: 43.594% (+4.9%) from 38.708%
12385035894

push

github

web-flow
Merge pull request #2386 from mavlink/pr-multiple-cameras

camera: support multiple cameras within one instance

1407 of 2127 new or added lines in 47 files covered. (66.15%)

48 existing lines in 8 files now uncovered.

13974 of 32055 relevant lines covered (43.59%)

290.15 hits per line

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

8.64
/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 Option = Camera::Option;
13
using Setting = Camera::Setting;
14
using SettingOptions = Camera::SettingOptions;
15
using VideoStreamSettings = Camera::VideoStreamSettings;
16
using VideoStreamInfo = Camera::VideoStreamInfo;
17
using ModeUpdate = Camera::ModeUpdate;
18
using VideoStreamUpdate = Camera::VideoStreamUpdate;
19
using Storage = Camera::Storage;
20
using StorageUpdate = Camera::StorageUpdate;
21
using CurrentSettingsUpdate = Camera::CurrentSettingsUpdate;
22
using PossibleSettingOptionsUpdate = Camera::PossibleSettingOptionsUpdate;
23

24
using Position = Camera::Position;
25
using Quaternion = Camera::Quaternion;
26
using EulerAngle = Camera::EulerAngle;
27
using CaptureInfo = Camera::CaptureInfo;
28
using Information = Camera::Information;
29
using CameraList = Camera::CameraList;
30

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

33
Camera::Camera(std::shared_ptr<System> system) :
9✔
34
    PluginBase(),
35
    _impl{std::make_unique<CameraImpl>(system)}
9✔
36
{}
9✔
37

38
Camera::~Camera() {}
9✔
39

NEW
40
void Camera::take_photo_async(int32_t component_id, const ResultCallback callback)
×
41
{
NEW
42
    _impl->take_photo_async(component_id, callback);
×
43
}
×
44

45
Camera::Result Camera::take_photo(int32_t component_id) const
1✔
46
{
47
    return _impl->take_photo(component_id);
1✔
48
}
49

NEW
50
void Camera::start_photo_interval_async(
×
51
    int32_t component_id, float interval_s, const ResultCallback callback)
52
{
NEW
53
    _impl->start_photo_interval_async(component_id, interval_s, callback);
×
54
}
×
55

56
Camera::Result Camera::start_photo_interval(int32_t component_id, float interval_s) const
1✔
57
{
58
    return _impl->start_photo_interval(component_id, interval_s);
1✔
59
}
60

NEW
61
void Camera::stop_photo_interval_async(int32_t component_id, const ResultCallback callback)
×
62
{
NEW
63
    _impl->stop_photo_interval_async(component_id, callback);
×
64
}
×
65

66
Camera::Result Camera::stop_photo_interval(int32_t component_id) const
1✔
67
{
68
    return _impl->stop_photo_interval(component_id);
1✔
69
}
70

NEW
71
void Camera::start_video_async(int32_t component_id, const ResultCallback callback)
×
72
{
NEW
73
    _impl->start_video_async(component_id, callback);
×
74
}
×
75

NEW
76
Camera::Result Camera::start_video(int32_t component_id) const
×
77
{
NEW
78
    return _impl->start_video(component_id);
×
79
}
80

NEW
81
void Camera::stop_video_async(int32_t component_id, const ResultCallback callback)
×
82
{
NEW
83
    _impl->stop_video_async(component_id, callback);
×
84
}
×
85

NEW
86
Camera::Result Camera::stop_video(int32_t component_id) const
×
87
{
NEW
88
    return _impl->stop_video(component_id);
×
89
}
90

NEW
91
Camera::Result Camera::start_video_streaming(int32_t component_id, int32_t stream_id) const
×
92
{
NEW
93
    return _impl->start_video_streaming(component_id, stream_id);
×
94
}
95

NEW
96
Camera::Result Camera::stop_video_streaming(int32_t component_id, int32_t stream_id) const
×
97
{
NEW
98
    return _impl->stop_video_streaming(component_id, stream_id);
×
99
}
100

NEW
101
void Camera::set_mode_async(int32_t component_id, Mode mode, const ResultCallback callback)
×
102
{
NEW
103
    _impl->set_mode_async(component_id, mode, callback);
×
UNCOV
104
}
×
105

106
Camera::Result Camera::set_mode(int32_t component_id, Mode mode) const
2✔
107
{
108
    return _impl->set_mode(component_id, mode);
2✔
109
}
110

NEW
111
void Camera::list_photos_async(
×
112
    int32_t component_id, PhotosRange photos_range, const ListPhotosCallback callback)
113
{
NEW
114
    _impl->list_photos_async(component_id, photos_range, callback);
×
115
}
×
116

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

123
Camera::CameraListHandle Camera::subscribe_camera_list(const CameraListCallback& callback)
1✔
124
{
125
    return _impl->subscribe_camera_list(callback);
1✔
126
}
127

NEW
128
void Camera::unsubscribe_camera_list(CameraListHandle handle)
×
129
{
NEW
130
    _impl->unsubscribe_camera_list(handle);
×
131
}
×
132

133
Camera::CameraList Camera::camera_list() const
86✔
134
{
135
    return _impl->camera_list();
86✔
136
}
137

NEW
138
Camera::ModeHandle Camera::subscribe_mode(const ModeCallback& callback)
×
139
{
NEW
140
    return _impl->subscribe_mode(callback);
×
141
}
142

NEW
143
void Camera::unsubscribe_mode(ModeHandle handle)
×
144
{
NEW
145
    _impl->unsubscribe_mode(handle);
×
146
}
×
147

148
std::pair<Camera::Result, Camera::Mode> Camera::get_mode(int32_t component_id) const
1✔
149
{
150
    return _impl->get_mode(component_id);
1✔
151
}
152

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

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

164
std::pair<Camera::Result, Camera::VideoStreamInfo>
NEW
165
Camera::get_video_stream_info(int32_t component_id) const
×
166
{
NEW
167
    return _impl->get_video_stream_info(component_id);
×
168
}
169

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

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

180
Camera::StorageHandle Camera::subscribe_storage(const StorageCallback& callback)
1✔
181
{
182
    return _impl->subscribe_storage(callback);
1✔
183
}
184

NEW
185
void Camera::unsubscribe_storage(StorageHandle handle)
×
186
{
NEW
187
    _impl->unsubscribe_storage(handle);
×
188
}
×
189

190
std::pair<Camera::Result, Camera::Storage> Camera::get_storage(int32_t component_id) const
60✔
191
{
192
    return _impl->get_storage(component_id);
60✔
193
}
194

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

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

206
std::pair<Camera::Result, std::vector<Camera::Setting>>
207
Camera::get_current_settings(int32_t component_id) const
2✔
208
{
209
    return _impl->get_current_settings(component_id);
2✔
210
}
211

212
Camera::PossibleSettingOptionsHandle
213
Camera::subscribe_possible_setting_options(const PossibleSettingOptionsCallback& callback)
1✔
214
{
215
    return _impl->subscribe_possible_setting_options(callback);
1✔
216
}
217

218
void Camera::unsubscribe_possible_setting_options(PossibleSettingOptionsHandle handle)
×
219
{
220
    _impl->unsubscribe_possible_setting_options(handle);
×
221
}
×
222

223
std::pair<Camera::Result, std::vector<Camera::SettingOptions>>
224
Camera::get_possible_setting_options(int32_t component_id) const
2✔
225
{
226
    return _impl->get_possible_setting_options(component_id);
2✔
227
}
228

NEW
229
void Camera::set_setting_async(int32_t component_id, Setting setting, const ResultCallback callback)
×
230
{
NEW
231
    _impl->set_setting_async(component_id, setting, callback);
×
UNCOV
232
}
×
233

234
Camera::Result Camera::set_setting(int32_t component_id, Setting setting) const
3✔
235
{
236
    return _impl->set_setting(component_id, setting);
3✔
237
}
238

NEW
239
void Camera::get_setting_async(
×
240
    int32_t component_id, Setting setting, const GetSettingCallback callback)
241
{
NEW
242
    _impl->get_setting_async(component_id, setting, callback);
×
UNCOV
243
}
×
244

245
std::pair<Camera::Result, Camera::Setting>
246
Camera::get_setting(int32_t component_id, Setting setting) const
2✔
247
{
248
    return _impl->get_setting(component_id, setting);
2✔
249
}
250

NEW
251
void Camera::format_storage_async(
×
252
    int32_t component_id, int32_t storage_id, const ResultCallback callback)
253
{
NEW
254
    _impl->format_storage_async(component_id, storage_id, callback);
×
UNCOV
255
}
×
256

257
Camera::Result Camera::format_storage(int32_t component_id, int32_t storage_id) const
1✔
258
{
259
    return _impl->format_storage(component_id, storage_id);
1✔
260
}
261

NEW
262
void Camera::reset_settings_async(int32_t component_id, const ResultCallback callback)
×
263
{
NEW
264
    _impl->reset_settings_async(component_id, callback);
×
265
}
×
266

267
Camera::Result Camera::reset_settings(int32_t component_id) const
1✔
268
{
269
    return _impl->reset_settings(component_id);
1✔
270
}
271

NEW
272
void Camera::zoom_in_start_async(int32_t component_id, const ResultCallback callback)
×
273
{
NEW
274
    _impl->zoom_in_start_async(component_id, callback);
×
275
}
×
276

NEW
277
Camera::Result Camera::zoom_in_start(int32_t component_id) const
×
278
{
NEW
279
    return _impl->zoom_in_start(component_id);
×
280
}
281

NEW
282
void Camera::zoom_out_start_async(int32_t component_id, const ResultCallback callback)
×
283
{
NEW
284
    _impl->zoom_out_start_async(component_id, callback);
×
285
}
×
286

NEW
287
Camera::Result Camera::zoom_out_start(int32_t component_id) const
×
288
{
NEW
289
    return _impl->zoom_out_start(component_id);
×
290
}
291

NEW
292
void Camera::zoom_stop_async(int32_t component_id, const ResultCallback callback)
×
293
{
NEW
294
    _impl->zoom_stop_async(component_id, callback);
×
295
}
×
296

NEW
297
Camera::Result Camera::zoom_stop(int32_t component_id) const
×
298
{
NEW
299
    return _impl->zoom_stop(component_id);
×
300
}
301

NEW
302
void Camera::zoom_range_async(int32_t component_id, float range, const ResultCallback callback)
×
303
{
NEW
304
    _impl->zoom_range_async(component_id, range, callback);
×
305
}
×
306

NEW
307
Camera::Result Camera::zoom_range(int32_t component_id, float range) const
×
308
{
NEW
309
    return _impl->zoom_range(component_id, range);
×
310
}
311

312
void Camera::track_point_async(
×
313
    int32_t component_id, float point_x, float point_y, float radius, const ResultCallback callback)
314
{
NEW
315
    _impl->track_point_async(component_id, point_x, point_y, radius, callback);
×
316
}
×
317

318
Camera::Result
NEW
319
Camera::track_point(int32_t component_id, float point_x, float point_y, float radius) const
×
320
{
NEW
321
    return _impl->track_point(component_id, point_x, point_y, radius);
×
322
}
323

324
void Camera::track_rectangle_async(
×
325
    int32_t component_id,
326
    float top_left_x,
327
    float top_left_y,
328
    float bottom_right_x,
329
    float bottom_right_y,
330
    const ResultCallback callback)
331
{
NEW
332
    _impl->track_rectangle_async(
×
333
        component_id, top_left_x, top_left_y, bottom_right_x, bottom_right_y, callback);
UNCOV
334
}
×
335

336
Camera::Result Camera::track_rectangle(
×
337
    int32_t component_id,
338
    float top_left_x,
339
    float top_left_y,
340
    float bottom_right_x,
341
    float bottom_right_y) const
342
{
NEW
343
    return _impl->track_rectangle(
×
NEW
344
        component_id, top_left_x, top_left_y, bottom_right_x, bottom_right_y);
×
345
}
346

NEW
347
void Camera::track_stop_async(int32_t component_id, const ResultCallback callback)
×
348
{
NEW
349
    _impl->track_stop_async(component_id, callback);
×
350
}
×
351

NEW
352
Camera::Result Camera::track_stop(int32_t component_id) const
×
353
{
NEW
354
    return _impl->track_stop(component_id);
×
355
}
356

NEW
357
void Camera::focus_in_start_async(int32_t component_id, const ResultCallback callback)
×
358
{
NEW
359
    _impl->focus_in_start_async(component_id, callback);
×
360
}
×
361

NEW
362
Camera::Result Camera::focus_in_start(int32_t component_id) const
×
363
{
NEW
364
    return _impl->focus_in_start(component_id);
×
365
}
366

NEW
367
void Camera::focus_out_start_async(int32_t component_id, const ResultCallback callback)
×
368
{
NEW
369
    _impl->focus_out_start_async(component_id, callback);
×
370
}
×
371

NEW
372
Camera::Result Camera::focus_out_start(int32_t component_id) const
×
373
{
NEW
374
    return _impl->focus_out_start(component_id);
×
375
}
376

NEW
377
void Camera::focus_stop_async(int32_t component_id, const ResultCallback callback)
×
378
{
NEW
379
    _impl->focus_stop_async(component_id, callback);
×
380
}
×
381

NEW
382
Camera::Result Camera::focus_stop(int32_t component_id) const
×
383
{
NEW
384
    return _impl->focus_stop(component_id);
×
385
}
386

NEW
387
void Camera::focus_range_async(int32_t component_id, float range, const ResultCallback callback)
×
388
{
NEW
389
    _impl->focus_range_async(component_id, range, callback);
×
390
}
×
391

NEW
392
Camera::Result Camera::focus_range(int32_t component_id, float range) const
×
393
{
NEW
394
    return _impl->focus_range(component_id, range);
×
395
}
396

NEW
397
bool operator==(const Camera::Option& lhs, const Camera::Option& rhs)
×
398
{
NEW
399
    return (rhs.option_id == lhs.option_id) && (rhs.option_description == lhs.option_description);
×
400
}
401

NEW
402
std::ostream& operator<<(std::ostream& str, Camera::Option const& option)
×
403
{
404
    str << std::setprecision(15);
×
NEW
405
    str << "option:" << '\n' << "{\n";
×
NEW
406
    str << "    option_id: " << option.option_id << '\n';
×
NEW
407
    str << "    option_description: " << option.option_description << '\n';
×
408
    str << '}';
×
409
    return str;
×
410
}
411

NEW
412
bool operator==(const Camera::Setting& lhs, const Camera::Setting& rhs)
×
413
{
NEW
414
    return (rhs.setting_id == lhs.setting_id) &&
×
NEW
415
           (rhs.setting_description == lhs.setting_description) && (rhs.option == lhs.option) &&
×
NEW
416
           (rhs.is_range == lhs.is_range);
×
417
}
418

NEW
419
std::ostream& operator<<(std::ostream& str, Camera::Setting const& setting)
×
420
{
421
    str << std::setprecision(15);
×
NEW
422
    str << "setting:" << '\n' << "{\n";
×
NEW
423
    str << "    setting_id: " << setting.setting_id << '\n';
×
NEW
424
    str << "    setting_description: " << setting.setting_description << '\n';
×
NEW
425
    str << "    option: " << setting.option << '\n';
×
NEW
426
    str << "    is_range: " << setting.is_range << '\n';
×
427
    str << '}';
×
428
    return str;
×
429
}
430

NEW
431
bool operator==(const Camera::SettingOptions& lhs, const Camera::SettingOptions& rhs)
×
432
{
NEW
433
    return (rhs.component_id == lhs.component_id) && (rhs.setting_id == lhs.setting_id) &&
×
NEW
434
           (rhs.setting_description == lhs.setting_description) && (rhs.options == lhs.options) &&
×
NEW
435
           (rhs.is_range == lhs.is_range);
×
436
}
437

NEW
438
std::ostream& operator<<(std::ostream& str, Camera::SettingOptions const& setting_options)
×
439
{
440
    str << std::setprecision(15);
×
NEW
441
    str << "setting_options:" << '\n' << "{\n";
×
NEW
442
    str << "    component_id: " << setting_options.component_id << '\n';
×
NEW
443
    str << "    setting_id: " << setting_options.setting_id << '\n';
×
NEW
444
    str << "    setting_description: " << setting_options.setting_description << '\n';
×
NEW
445
    str << "    options: [";
×
NEW
446
    for (auto it = setting_options.options.begin(); it != setting_options.options.end(); ++it) {
×
NEW
447
        str << *it;
×
NEW
448
        str << (it + 1 != setting_options.options.end() ? ", " : "]\n");
×
449
    }
NEW
450
    str << "    is_range: " << setting_options.is_range << '\n';
×
451
    str << '}';
×
452
    return str;
×
453
}
454

455
bool operator==(const Camera::VideoStreamSettings& lhs, const Camera::VideoStreamSettings& rhs)
×
456
{
457
    return ((std::isnan(rhs.frame_rate_hz) && std::isnan(lhs.frame_rate_hz)) ||
×
458
            rhs.frame_rate_hz == lhs.frame_rate_hz) &&
×
459
           (rhs.horizontal_resolution_pix == lhs.horizontal_resolution_pix) &&
×
460
           (rhs.vertical_resolution_pix == lhs.vertical_resolution_pix) &&
×
461
           (rhs.bit_rate_b_s == lhs.bit_rate_b_s) && (rhs.rotation_deg == lhs.rotation_deg) &&
×
462
           (rhs.uri == lhs.uri) &&
×
463
           ((std::isnan(rhs.horizontal_fov_deg) && std::isnan(lhs.horizontal_fov_deg)) ||
×
464
            rhs.horizontal_fov_deg == lhs.horizontal_fov_deg);
×
465
}
466

467
std::ostream&
468
operator<<(std::ostream& str, Camera::VideoStreamSettings const& video_stream_settings)
×
469
{
470
    str << std::setprecision(15);
×
471
    str << "video_stream_settings:" << '\n' << "{\n";
×
472
    str << "    frame_rate_hz: " << video_stream_settings.frame_rate_hz << '\n';
×
473
    str << "    horizontal_resolution_pix: " << video_stream_settings.horizontal_resolution_pix
×
474
        << '\n';
×
475
    str << "    vertical_resolution_pix: " << video_stream_settings.vertical_resolution_pix << '\n';
×
476
    str << "    bit_rate_b_s: " << video_stream_settings.bit_rate_b_s << '\n';
×
477
    str << "    rotation_deg: " << video_stream_settings.rotation_deg << '\n';
×
478
    str << "    uri: " << video_stream_settings.uri << '\n';
×
479
    str << "    horizontal_fov_deg: " << video_stream_settings.horizontal_fov_deg << '\n';
×
480
    str << '}';
×
481
    return str;
×
482
}
483

484
std::ostream&
485
operator<<(std::ostream& str, Camera::VideoStreamInfo::VideoStreamStatus const& video_stream_status)
×
486
{
487
    switch (video_stream_status) {
×
488
        case Camera::VideoStreamInfo::VideoStreamStatus::NotRunning:
×
489
            return str << "Not Running";
×
490
        case Camera::VideoStreamInfo::VideoStreamStatus::InProgress:
×
491
            return str << "In Progress";
×
492
        default:
×
493
            return str << "Unknown";
×
494
    }
495
}
496

497
std::ostream& operator<<(
×
498
    std::ostream& str, Camera::VideoStreamInfo::VideoStreamSpectrum const& video_stream_spectrum)
499
{
500
    switch (video_stream_spectrum) {
×
501
        case Camera::VideoStreamInfo::VideoStreamSpectrum::Unknown:
×
502
            return str << "Unknown";
×
503
        case Camera::VideoStreamInfo::VideoStreamSpectrum::VisibleLight:
×
504
            return str << "Visible Light";
×
505
        case Camera::VideoStreamInfo::VideoStreamSpectrum::Infrared:
×
506
            return str << "Infrared";
×
507
        default:
×
508
            return str << "Unknown";
×
509
    }
510
}
511
bool operator==(const Camera::VideoStreamInfo& lhs, const Camera::VideoStreamInfo& rhs)
×
512
{
NEW
513
    return (rhs.stream_id == lhs.stream_id) && (rhs.settings == lhs.settings) &&
×
NEW
514
           (rhs.status == lhs.status) && (rhs.spectrum == lhs.spectrum);
×
515
}
516

517
std::ostream& operator<<(std::ostream& str, Camera::VideoStreamInfo const& video_stream_info)
×
518
{
519
    str << std::setprecision(15);
×
520
    str << "video_stream_info:" << '\n' << "{\n";
×
NEW
521
    str << "    stream_id: " << video_stream_info.stream_id << '\n';
×
522
    str << "    settings: " << video_stream_info.settings << '\n';
×
523
    str << "    status: " << video_stream_info.status << '\n';
×
524
    str << "    spectrum: " << video_stream_info.spectrum << '\n';
×
525
    str << '}';
×
526
    return str;
×
527
}
528

NEW
529
bool operator==(const Camera::ModeUpdate& lhs, const Camera::ModeUpdate& rhs)
×
530
{
NEW
531
    return (rhs.component_id == lhs.component_id) && (rhs.mode == lhs.mode);
×
532
}
533

NEW
534
std::ostream& operator<<(std::ostream& str, Camera::ModeUpdate const& mode_update)
×
535
{
NEW
536
    str << std::setprecision(15);
×
NEW
537
    str << "mode_update:" << '\n' << "{\n";
×
NEW
538
    str << "    component_id: " << mode_update.component_id << '\n';
×
NEW
539
    str << "    mode: " << mode_update.mode << '\n';
×
NEW
540
    str << '}';
×
NEW
541
    return str;
×
542
}
543

NEW
544
bool operator==(const Camera::VideoStreamUpdate& lhs, const Camera::VideoStreamUpdate& rhs)
×
545
{
NEW
546
    return (rhs.component_id == lhs.component_id) &&
×
NEW
547
           (rhs.video_stream_info == lhs.video_stream_info);
×
548
}
549

NEW
550
std::ostream& operator<<(std::ostream& str, Camera::VideoStreamUpdate const& video_stream_update)
×
551
{
NEW
552
    str << std::setprecision(15);
×
NEW
553
    str << "video_stream_update:" << '\n' << "{\n";
×
NEW
554
    str << "    component_id: " << video_stream_update.component_id << '\n';
×
NEW
555
    str << "    video_stream_info: " << video_stream_update.video_stream_info << '\n';
×
NEW
556
    str << '}';
×
NEW
557
    return str;
×
558
}
559

NEW
560
std::ostream& operator<<(std::ostream& str, Camera::Storage::StorageStatus const& storage_status)
×
561
{
562
    switch (storage_status) {
×
NEW
563
        case Camera::Storage::StorageStatus::NotAvailable:
×
564
            return str << "Not Available";
×
NEW
565
        case Camera::Storage::StorageStatus::Unformatted:
×
566
            return str << "Unformatted";
×
NEW
567
        case Camera::Storage::StorageStatus::Formatted:
×
568
            return str << "Formatted";
×
NEW
569
        case Camera::Storage::StorageStatus::NotSupported:
×
570
            return str << "Not Supported";
×
571
        default:
×
572
            return str << "Unknown";
×
573
    }
574
}
575

NEW
576
std::ostream& operator<<(std::ostream& str, Camera::Storage::StorageType const& storage_type)
×
577
{
578
    switch (storage_type) {
×
NEW
579
        case Camera::Storage::StorageType::Unknown:
×
580
            return str << "Unknown";
×
NEW
581
        case Camera::Storage::StorageType::UsbStick:
×
582
            return str << "Usb Stick";
×
NEW
583
        case Camera::Storage::StorageType::Sd:
×
584
            return str << "Sd";
×
NEW
585
        case Camera::Storage::StorageType::Microsd:
×
586
            return str << "Microsd";
×
NEW
587
        case Camera::Storage::StorageType::Hd:
×
588
            return str << "Hd";
×
NEW
589
        case Camera::Storage::StorageType::Other:
×
590
            return str << "Other";
×
591
        default:
×
592
            return str << "Unknown";
×
593
    }
594
}
NEW
595
bool operator==(const Camera::Storage& lhs, const Camera::Storage& rhs)
×
596
{
NEW
597
    return (rhs.component_id == lhs.component_id) && (rhs.video_on == lhs.video_on) &&
×
NEW
598
           (rhs.photo_interval_on == lhs.photo_interval_on) &&
×
599
           ((std::isnan(rhs.used_storage_mib) && std::isnan(lhs.used_storage_mib)) ||
×
600
            rhs.used_storage_mib == lhs.used_storage_mib) &&
×
601
           ((std::isnan(rhs.available_storage_mib) && std::isnan(lhs.available_storage_mib)) ||
×
602
            rhs.available_storage_mib == lhs.available_storage_mib) &&
×
603
           ((std::isnan(rhs.total_storage_mib) && std::isnan(lhs.total_storage_mib)) ||
×
604
            rhs.total_storage_mib == lhs.total_storage_mib) &&
×
605
           ((std::isnan(rhs.recording_time_s) && std::isnan(lhs.recording_time_s)) ||
×
606
            rhs.recording_time_s == lhs.recording_time_s) &&
×
607
           (rhs.media_folder_name == lhs.media_folder_name) &&
×
608
           (rhs.storage_status == lhs.storage_status) && (rhs.storage_id == lhs.storage_id) &&
×
609
           (rhs.storage_type == lhs.storage_type);
×
610
}
611

NEW
612
std::ostream& operator<<(std::ostream& str, Camera::Storage const& storage)
×
613
{
614
    str << std::setprecision(15);
×
NEW
615
    str << "storage:" << '\n' << "{\n";
×
NEW
616
    str << "    component_id: " << storage.component_id << '\n';
×
NEW
617
    str << "    video_on: " << storage.video_on << '\n';
×
NEW
618
    str << "    photo_interval_on: " << storage.photo_interval_on << '\n';
×
NEW
619
    str << "    used_storage_mib: " << storage.used_storage_mib << '\n';
×
NEW
620
    str << "    available_storage_mib: " << storage.available_storage_mib << '\n';
×
NEW
621
    str << "    total_storage_mib: " << storage.total_storage_mib << '\n';
×
NEW
622
    str << "    recording_time_s: " << storage.recording_time_s << '\n';
×
NEW
623
    str << "    media_folder_name: " << storage.media_folder_name << '\n';
×
NEW
624
    str << "    storage_status: " << storage.storage_status << '\n';
×
NEW
625
    str << "    storage_id: " << storage.storage_id << '\n';
×
NEW
626
    str << "    storage_type: " << storage.storage_type << '\n';
×
627
    str << '}';
×
628
    return str;
×
629
}
630

NEW
631
bool operator==(const Camera::StorageUpdate& lhs, const Camera::StorageUpdate& rhs)
×
632
{
NEW
633
    return (rhs.component_id == lhs.component_id) && (rhs.storage == lhs.storage);
×
634
}
635

NEW
636
std::ostream& operator<<(std::ostream& str, Camera::StorageUpdate const& storage_update)
×
637
{
638
    str << std::setprecision(15);
×
NEW
639
    str << "storage_update:" << '\n' << "{\n";
×
NEW
640
    str << "    component_id: " << storage_update.component_id << '\n';
×
NEW
641
    str << "    storage: " << storage_update.storage << '\n';
×
642
    str << '}';
×
643
    return str;
×
644
}
645

NEW
646
bool operator==(const Camera::CurrentSettingsUpdate& lhs, const Camera::CurrentSettingsUpdate& rhs)
×
647
{
NEW
648
    return (rhs.component_id == lhs.component_id) && (rhs.current_settings == lhs.current_settings);
×
649
}
650

651
std::ostream&
NEW
652
operator<<(std::ostream& str, Camera::CurrentSettingsUpdate const& current_settings_update)
×
653
{
654
    str << std::setprecision(15);
×
NEW
655
    str << "current_settings_update:" << '\n' << "{\n";
×
NEW
656
    str << "    component_id: " << current_settings_update.component_id << '\n';
×
NEW
657
    str << "    current_settings: [";
×
NEW
658
    for (auto it = current_settings_update.current_settings.begin();
×
NEW
659
         it != current_settings_update.current_settings.end();
×
NEW
660
         ++it) {
×
NEW
661
        str << *it;
×
NEW
662
        str << (it + 1 != current_settings_update.current_settings.end() ? ", " : "]\n");
×
663
    }
664
    str << '}';
×
665
    return str;
×
666
}
667

NEW
668
bool operator==(
×
669
    const Camera::PossibleSettingOptionsUpdate& lhs,
670
    const Camera::PossibleSettingOptionsUpdate& rhs)
671
{
NEW
672
    return (rhs.component_id == lhs.component_id) && (rhs.setting_options == lhs.setting_options);
×
673
}
674

NEW
675
std::ostream& operator<<(
×
676
    std::ostream& str, Camera::PossibleSettingOptionsUpdate const& possible_setting_options_update)
677
{
678
    str << std::setprecision(15);
×
NEW
679
    str << "possible_setting_options_update:" << '\n' << "{\n";
×
NEW
680
    str << "    component_id: " << possible_setting_options_update.component_id << '\n';
×
NEW
681
    str << "    setting_options: [";
×
NEW
682
    for (auto it = possible_setting_options_update.setting_options.begin();
×
NEW
683
         it != possible_setting_options_update.setting_options.end();
×
NEW
684
         ++it) {
×
685
        str << *it;
×
NEW
686
        str << (it + 1 != possible_setting_options_update.setting_options.end() ? ", " : "]\n");
×
687
    }
NEW
688
    str << '}';
×
NEW
689
    return str;
×
690
}
691

NEW
692
std::ostream& operator<<(std::ostream& str, Camera::Result const& result)
×
693
{
NEW
694
    switch (result) {
×
NEW
695
        case Camera::Result::Unknown:
×
NEW
696
            return str << "Unknown";
×
NEW
697
        case Camera::Result::Success:
×
NEW
698
            return str << "Success";
×
NEW
699
        case Camera::Result::InProgress:
×
NEW
700
            return str << "In Progress";
×
NEW
701
        case Camera::Result::Busy:
×
NEW
702
            return str << "Busy";
×
NEW
703
        case Camera::Result::Denied:
×
NEW
704
            return str << "Denied";
×
NEW
705
        case Camera::Result::Error:
×
NEW
706
            return str << "Error";
×
NEW
707
        case Camera::Result::Timeout:
×
NEW
708
            return str << "Timeout";
×
NEW
709
        case Camera::Result::WrongArgument:
×
NEW
710
            return str << "Wrong Argument";
×
NEW
711
        case Camera::Result::NoSystem:
×
NEW
712
            return str << "No System";
×
NEW
713
        case Camera::Result::ProtocolUnsupported:
×
NEW
714
            return str << "Protocol Unsupported";
×
NEW
715
        case Camera::Result::Unavailable:
×
NEW
716
            return str << "Unavailable";
×
NEW
717
        case Camera::Result::CameraIdInvalid:
×
NEW
718
            return str << "Camera Id Invalid";
×
NEW
719
        case Camera::Result::ActionUnsupported:
×
NEW
720
            return str << "Action Unsupported";
×
NEW
721
        default:
×
NEW
722
            return str << "Unknown";
×
723
    }
724
}
725

NEW
726
bool operator==(const Camera::Position& lhs, const Camera::Position& rhs)
×
727
{
NEW
728
    return ((std::isnan(rhs.latitude_deg) && std::isnan(lhs.latitude_deg)) ||
×
NEW
729
            rhs.latitude_deg == lhs.latitude_deg) &&
×
NEW
730
           ((std::isnan(rhs.longitude_deg) && std::isnan(lhs.longitude_deg)) ||
×
NEW
731
            rhs.longitude_deg == lhs.longitude_deg) &&
×
NEW
732
           ((std::isnan(rhs.absolute_altitude_m) && std::isnan(lhs.absolute_altitude_m)) ||
×
NEW
733
            rhs.absolute_altitude_m == lhs.absolute_altitude_m) &&
×
NEW
734
           ((std::isnan(rhs.relative_altitude_m) && std::isnan(lhs.relative_altitude_m)) ||
×
NEW
735
            rhs.relative_altitude_m == lhs.relative_altitude_m);
×
736
}
737

NEW
738
std::ostream& operator<<(std::ostream& str, Camera::Position const& position)
×
739
{
NEW
740
    str << std::setprecision(15);
×
NEW
741
    str << "position:" << '\n' << "{\n";
×
NEW
742
    str << "    latitude_deg: " << position.latitude_deg << '\n';
×
NEW
743
    str << "    longitude_deg: " << position.longitude_deg << '\n';
×
NEW
744
    str << "    absolute_altitude_m: " << position.absolute_altitude_m << '\n';
×
NEW
745
    str << "    relative_altitude_m: " << position.relative_altitude_m << '\n';
×
NEW
746
    str << '}';
×
NEW
747
    return str;
×
748
}
749

NEW
750
bool operator==(const Camera::Quaternion& lhs, const Camera::Quaternion& rhs)
×
751
{
NEW
752
    return ((std::isnan(rhs.w) && std::isnan(lhs.w)) || rhs.w == lhs.w) &&
×
NEW
753
           ((std::isnan(rhs.x) && std::isnan(lhs.x)) || rhs.x == lhs.x) &&
×
NEW
754
           ((std::isnan(rhs.y) && std::isnan(lhs.y)) || rhs.y == lhs.y) &&
×
NEW
755
           ((std::isnan(rhs.z) && std::isnan(lhs.z)) || rhs.z == lhs.z);
×
756
}
757

NEW
758
std::ostream& operator<<(std::ostream& str, Camera::Quaternion const& quaternion)
×
759
{
NEW
760
    str << std::setprecision(15);
×
NEW
761
    str << "quaternion:" << '\n' << "{\n";
×
NEW
762
    str << "    w: " << quaternion.w << '\n';
×
NEW
763
    str << "    x: " << quaternion.x << '\n';
×
NEW
764
    str << "    y: " << quaternion.y << '\n';
×
NEW
765
    str << "    z: " << quaternion.z << '\n';
×
NEW
766
    str << '}';
×
NEW
767
    return str;
×
768
}
769

NEW
770
bool operator==(const Camera::EulerAngle& lhs, const Camera::EulerAngle& rhs)
×
771
{
NEW
772
    return ((std::isnan(rhs.roll_deg) && std::isnan(lhs.roll_deg)) ||
×
NEW
773
            rhs.roll_deg == lhs.roll_deg) &&
×
NEW
774
           ((std::isnan(rhs.pitch_deg) && std::isnan(lhs.pitch_deg)) ||
×
NEW
775
            rhs.pitch_deg == lhs.pitch_deg) &&
×
NEW
776
           ((std::isnan(rhs.yaw_deg) && std::isnan(lhs.yaw_deg)) || rhs.yaw_deg == lhs.yaw_deg);
×
777
}
778

NEW
779
std::ostream& operator<<(std::ostream& str, Camera::EulerAngle const& euler_angle)
×
780
{
NEW
781
    str << std::setprecision(15);
×
NEW
782
    str << "euler_angle:" << '\n' << "{\n";
×
NEW
783
    str << "    roll_deg: " << euler_angle.roll_deg << '\n';
×
NEW
784
    str << "    pitch_deg: " << euler_angle.pitch_deg << '\n';
×
NEW
785
    str << "    yaw_deg: " << euler_angle.yaw_deg << '\n';
×
NEW
786
    str << '}';
×
NEW
787
    return str;
×
788
}
789

NEW
790
bool operator==(const Camera::CaptureInfo& lhs, const Camera::CaptureInfo& rhs)
×
791
{
NEW
792
    return (rhs.component_id == lhs.component_id) && (rhs.position == lhs.position) &&
×
NEW
793
           (rhs.attitude_quaternion == lhs.attitude_quaternion) &&
×
NEW
794
           (rhs.attitude_euler_angle == lhs.attitude_euler_angle) &&
×
NEW
795
           (rhs.time_utc_us == lhs.time_utc_us) && (rhs.is_success == lhs.is_success) &&
×
NEW
796
           (rhs.index == lhs.index) && (rhs.file_url == lhs.file_url);
×
797
}
798

NEW
799
std::ostream& operator<<(std::ostream& str, Camera::CaptureInfo const& capture_info)
×
800
{
NEW
801
    str << std::setprecision(15);
×
NEW
802
    str << "capture_info:" << '\n' << "{\n";
×
NEW
803
    str << "    component_id: " << capture_info.component_id << '\n';
×
NEW
804
    str << "    position: " << capture_info.position << '\n';
×
NEW
805
    str << "    attitude_quaternion: " << capture_info.attitude_quaternion << '\n';
×
NEW
806
    str << "    attitude_euler_angle: " << capture_info.attitude_euler_angle << '\n';
×
NEW
807
    str << "    time_utc_us: " << capture_info.time_utc_us << '\n';
×
NEW
808
    str << "    is_success: " << capture_info.is_success << '\n';
×
NEW
809
    str << "    index: " << capture_info.index << '\n';
×
NEW
810
    str << "    file_url: " << capture_info.file_url << '\n';
×
811
    str << '}';
×
812
    return str;
×
813
}
814

815
bool operator==(const Camera::Information& lhs, const Camera::Information& rhs)
×
816
{
NEW
817
    return (rhs.component_id == lhs.component_id) && (rhs.vendor_name == lhs.vendor_name) &&
×
NEW
818
           (rhs.model_name == lhs.model_name) &&
×
819
           ((std::isnan(rhs.focal_length_mm) && std::isnan(lhs.focal_length_mm)) ||
×
820
            rhs.focal_length_mm == lhs.focal_length_mm) &&
×
821
           ((std::isnan(rhs.horizontal_sensor_size_mm) &&
×
822
             std::isnan(lhs.horizontal_sensor_size_mm)) ||
×
823
            rhs.horizontal_sensor_size_mm == lhs.horizontal_sensor_size_mm) &&
×
824
           ((std::isnan(rhs.vertical_sensor_size_mm) && std::isnan(lhs.vertical_sensor_size_mm)) ||
×
825
            rhs.vertical_sensor_size_mm == lhs.vertical_sensor_size_mm) &&
×
826
           (rhs.horizontal_resolution_px == lhs.horizontal_resolution_px) &&
×
827
           (rhs.vertical_resolution_px == lhs.vertical_resolution_px);
×
828
}
829

830
std::ostream& operator<<(std::ostream& str, Camera::Information const& information)
×
831
{
832
    str << std::setprecision(15);
×
833
    str << "information:" << '\n' << "{\n";
×
NEW
834
    str << "    component_id: " << information.component_id << '\n';
×
835
    str << "    vendor_name: " << information.vendor_name << '\n';
×
836
    str << "    model_name: " << information.model_name << '\n';
×
837
    str << "    focal_length_mm: " << information.focal_length_mm << '\n';
×
838
    str << "    horizontal_sensor_size_mm: " << information.horizontal_sensor_size_mm << '\n';
×
839
    str << "    vertical_sensor_size_mm: " << information.vertical_sensor_size_mm << '\n';
×
840
    str << "    horizontal_resolution_px: " << information.horizontal_resolution_px << '\n';
×
841
    str << "    vertical_resolution_px: " << information.vertical_resolution_px << '\n';
×
842
    str << '}';
×
843
    return str;
×
844
}
845

NEW
846
bool operator==(const Camera::CameraList& lhs, const Camera::CameraList& rhs)
×
847
{
NEW
848
    return (rhs.cameras == lhs.cameras);
×
849
}
850

NEW
851
std::ostream& operator<<(std::ostream& str, Camera::CameraList const& camera_list)
×
852
{
NEW
853
    str << std::setprecision(15);
×
NEW
854
    str << "camera_list:" << '\n' << "{\n";
×
NEW
855
    str << "    cameras: [";
×
NEW
856
    for (auto it = camera_list.cameras.begin(); it != camera_list.cameras.end(); ++it) {
×
NEW
857
        str << *it;
×
NEW
858
        str << (it + 1 != camera_list.cameras.end() ? ", " : "]\n");
×
859
    }
NEW
860
    str << '}';
×
NEW
861
    return str;
×
862
}
863

UNCOV
864
std::ostream& operator<<(std::ostream& str, Camera::Mode const& mode)
×
865
{
866
    switch (mode) {
×
867
        case Camera::Mode::Unknown:
×
868
            return str << "Unknown";
×
869
        case Camera::Mode::Photo:
×
870
            return str << "Photo";
×
871
        case Camera::Mode::Video:
×
872
            return str << "Video";
×
873
        default:
×
874
            return str << "Unknown";
×
875
    }
876
}
877

878
std::ostream& operator<<(std::ostream& str, Camera::PhotosRange const& photos_range)
×
879
{
880
    switch (photos_range) {
×
881
        case Camera::PhotosRange::All:
×
882
            return str << "All";
×
883
        case Camera::PhotosRange::SinceConnection:
×
884
            return str << "Since Connection";
×
885
        default:
×
886
            return str << "Unknown";
×
887
    }
888
}
889

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