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

mavlink / MAVSDK / 7305109977

23 Dec 2023 12:47AM UTC coverage: 36.89% (-0.2%) from 37.119%
7305109977

push

github

web-flow
Merge pull request #2197 from mavlink/pr-remove-default-ctor

Require configuration for Mavsdk ctor

116 of 122 new or added lines in 20 files covered. (95.08%)

6 existing lines in 2 files now uncovered.

9975 of 27040 relevant lines covered (36.89%)

130.98 hits per line

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

0.0
/src/system_tests/component_information.cpp
1
#include <iostream>
2
#include <fstream>
3
#include <vector>
4
#include <atomic>
5
#include <future>
6
#include <thread>
7

8
#include "mavsdk.h"
9
#include "log.h"
10
#include "plugins/component_information/component_information.h"
11
#include "plugins/component_information_server/component_information_server.h"
12
#include "plugins/param/param.h"
13
#include <gtest/gtest.h>
14

15
using namespace mavsdk;
16

17
// Disabled for now because the mavlink ftp plugin is not available properly on
18
// the server side right now. It needs to be split into client and server and
19
// split across system_impl, and server_component_impl.
20
TEST(SystemTest, DISABLED_ComponentInformationConnect)
×
21
{
NEW
22
    Mavsdk mavsdk_groundstation{Mavsdk::Configuration{Mavsdk::ComponentType::GroundStation}};
×
23
    ASSERT_EQ(mavsdk_groundstation.add_any_connection("udp://:17000"), ConnectionResult::Success);
×
24

NEW
25
    Mavsdk mavsdk_companion{Mavsdk::Configuration{Mavsdk::ComponentType::CompanionComputer}};
×
26
    ASSERT_EQ(
×
27
        mavsdk_companion.add_any_connection("udp://127.0.0.1:17000"), ConnectionResult::Success);
28

29
    auto maybe_system = mavsdk_groundstation.first_autopilot(10.0);
×
30
    ASSERT_TRUE(maybe_system);
×
31
    auto system = maybe_system.value();
×
32

NEW
33
    auto server = ComponentInformationServer{mavsdk_companion.server_component()};
×
34

35
    auto param = ComponentInformationServer::FloatParam{};
×
36
    param.name = "ANG_RATE_ACC_MAX";
×
37
    param.short_description = "Angular rate acceleration maximum.";
×
38
    param.long_description = "The lower the maximum angular rate acceleration, "
39
                             "the smoother the gimbal will react to user input.";
×
40
    param.unit = "rad/s^2";
×
41
    param.min_value = 1.0f;
×
42
    param.max_value = 10.0f;
×
43
    param.default_value = 3.0f;
×
44
    param.start_value = 4.0f;
×
45
    param.decimal_places = 1;
×
46

47
    server.provide_float_param(param);
×
48

49
    server.subscribe_float_param([](ComponentInformationServer::FloatParamUpdate param_update) {
×
50
        LogInfo() << "Param " << param_update.name << " changed to " << param_update.value
×
51
                  << " on server side";
×
52
    });
×
53

54
    auto param_client = Param{system};
×
55

56
    param_client.set_param_float("ANG_RATE_ACC_MAX", 5.0f);
×
57

58
    auto client = ComponentInformation{system};
×
59
    client.subscribe_float_param([](ComponentInformation::FloatParamUpdate param_update) {
×
60
        LogInfo() << "Param " << param_update.name << " changed to " << param_update.value
×
61
                  << " on client side";
×
62
    });
×
63

64
    // Use another parameter to trigger the second callback.
65
    param_client.set_param_float("ANG_RATE_ACC_MAX", 6.0f);
×
66

67
    std::this_thread::sleep_for(std::chrono::milliseconds(100));
×
68
}
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