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

mavlink / MAVSDK / 22170517996

19 Feb 2026 06:01AM UTC coverage: 48.97% (-0.04%) from 49.009%
22170517996

Pull #2771

github

web-flow
Merge fff04f030 into 17ad598f0
Pull Request #2771: Fix: setting current mission item

18355 of 37482 relevant lines covered (48.97%)

664.74 hits per line

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

98.08
/cpp/src/system_tests/camera_storage.cpp
1
#include "mavsdk.h"
2
#include "plugins/camera/camera.h"
3
#include "plugins/camera_server/camera_server.h"
4
#include "plugins/ftp_server/ftp_server.h"
5
#include "log.h"
6
#include <future>
7
#include <mutex>
8
#include <thread>
9
#include <gtest/gtest.h>
10

11
using namespace mavsdk;
12

13
TEST(SystemTest, CameraStorage)
4 ✔
14
{
15
    Mavsdk mavsdk_groundstation{Mavsdk::Configuration{ComponentType::GroundStation}};
1 ✔
16
    Mavsdk mavsdk_camera{Mavsdk::Configuration{ComponentType::Camera}};
1 ✔
17

18
    ASSERT_EQ(
1 ✔
19
        mavsdk_groundstation.add_any_connection("udpin://0.0.0.0:17000"),
20
        ConnectionResult::Success);
1 ✔
21
    ASSERT_EQ(
1 ✔
22
        mavsdk_camera.add_any_connection("udpout://127.0.0.1:17000"), ConnectionResult::Success);
1 ✔
23

24
    auto camera_server = CameraServer{mavsdk_camera.server_component()};
1 ✔
25

26
    CameraServer::Information information{};
1 ✔
27
    information.vendor_name = "UVC";
1 ✔
28
    information.model_name = "Some random camera";
1 ✔
29
    information.firmware_version = "1.0.0";
1 ✔
30
    information.definition_file_uri = "";
1 ✔
31
    EXPECT_EQ(camera_server.set_information(information), CameraServer::Result::Success);
1 ✔
32

33
    camera_server.subscribe_storage_information([&](int32_t) {
3 ✔
34
        CameraServer::StorageInformation storage_info{};
2 ✔
35
        storage_info.available_storage_mib = 1000.0f;
2 ✔
36
        storage_info.storage_status = CameraServer::StorageInformation::StorageStatus::Formatted;
2 ✔
37
        camera_server.respond_storage_information(CameraServer::CameraFeedback::Ok, storage_info);
2 ✔
38
    });
2 ✔
39

40
    auto prom = std::promise<std::shared_ptr<System>>();
1 ✔
41
    auto fut = prom.get_future();
1 ✔
42
    std::once_flag flag;
1 ✔
43

44
    auto handle = mavsdk_groundstation.subscribe_on_new_system([&]() {
2 ✔
45
        const auto system = mavsdk_groundstation.systems().back();
1 ✔
46
        if (system->is_connected() && system->has_camera()) {
1 ✔
47
            std::call_once(flag, [&]() { prom.set_value(system); });
2 ✔
48
        }
49
    });
1 ✔
50

51
    ASSERT_EQ(fut.wait_for(std::chrono::seconds(2)), std::future_status::ready);
1 ✔
52
    mavsdk_groundstation.unsubscribe_on_new_system(handle);
1 ✔
53
    auto system = fut.get();
2 ✔
54

55
    auto camera = Camera{system};
2 ✔
56

57
    std::this_thread::sleep_for(std::chrono::milliseconds(1500));
1 ✔
58
    EXPECT_EQ(camera.camera_list().cameras.size(), 1);
1 ✔
59

60
    std::this_thread::sleep_for(std::chrono::milliseconds(500));
1 ✔
61

62
    camera.subscribe_storage([](const Camera::StorageUpdate& update) {
3 ✔
63
        EXPECT_EQ(update.storage.available_storage_mib, 1000.0f);
2 ✔
64
        EXPECT_EQ(update.storage.storage_status, Camera::Storage::StorageStatus::Formatted);
2 ✔
65
    });
2 ✔
66

67
    bool got_storage = false;
1 ✔
68
    for (unsigned i = 0; i < 60; ++i) {
61 ✔
69
        std::this_thread::sleep_for(std::chrono::milliseconds(100));
60 ✔
70
        auto ret = camera.get_storage(camera.camera_list().cameras[0].component_id);
60 ✔
71
        if (ret.first == Camera::Result::Unavailable) {
60 ✔
72
            continue;
×
73
        }
74
        EXPECT_EQ(ret.first, Camera::Result::Success);
60 ✔
75
        EXPECT_EQ(ret.second.available_storage_mib, 1000.0f);
60 ✔
76
        EXPECT_EQ(ret.second.storage_status, Camera::Storage::StorageStatus::Formatted);
60 ✔
77
        got_storage = true;
60 ✔
78
    }
60 ✔
79
    EXPECT_TRUE(got_storage);
1 ✔
80
}
1 ✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc