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

mavlink / MAVSDK / 11549442665

28 Oct 2024 07:40AM UTC coverage: 42.635% (+4.7%) from 37.918%
11549442665

Pull #2386

github

web-flow
Merge db5fdd683 into d46bb7a96
Pull Request #2386: camera: support multiple cameras within one instance

1216 of 1893 new or added lines in 46 files covered. (64.24%)

54 existing lines in 9 files now uncovered.

13095 of 30714 relevant lines covered (42.64%)

289.07 hits per line

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

87.5
/src/mavsdk/core/mavlink_parameter_subscription.cpp
1
#include "mavlink_parameter_subscription.h"
2

3
namespace mavsdk {
4

UNCOV
5
void MavlinkParameterSubscription::subscribe_param_float_changed(
×
6
    const std::string& name, const ParamFloatChangedCallback& callback, const void* cookie)
7
{
UNCOV
8
    subscribe_param_changed<float>(name, callback, cookie);
×
UNCOV
9
}
×
10

11
void MavlinkParameterSubscription::subscribe_param_int_changed(
42✔
12
    const std::string& name, const ParamIntChangedCallback& callback, const void* cookie)
13
{
14
    subscribe_param_changed<int>(name, callback, cookie);
42✔
15
}
42✔
16

17
void MavlinkParameterSubscription::subscribe_param_custom_changed(
8✔
18
    const std::string& name, const ParamCustomChangedCallback& callback, const void* cookie)
19
{
20
    subscribe_param_changed<std::string>(name, callback, cookie);
8✔
21
}
8✔
22

23
void MavlinkParameterSubscription::find_and_call_subscriptions_value_changed(
37✔
24
    const std::string& param_name, const ParamValue& value)
25
{
26
    std::lock_guard<std::mutex> lock(_param_changed_subscriptions_mutex);
74✔
27
    for (const auto& subscription : _param_changed_subscriptions) {
450✔
28
        if (subscription.param_name != param_name) {
413✔
29
            continue;
376✔
30
        }
31
        LogDebug() << "Param " << param_name << " changed";
37✔
32
        // We have a subscription on this param name, now check if the subscription is for the right
33
        // type and call the callback when matching
34
        if (std::get_if<ParamFloatChangedCallback>(&subscription.callback) && value.get_float()) {
37✔
UNCOV
35
            std::get<ParamFloatChangedCallback>(subscription.callback)(value.get_float().value());
×
36
        } else if (
71✔
37
            std::get_if<ParamIntChangedCallback>(&subscription.callback) && value.get_int()) {
71✔
38
            std::get<ParamIntChangedCallback>(subscription.callback)(value.get_int().value());
32✔
39
        } else if (
7✔
40
            std::get_if<ParamCustomChangedCallback>(&subscription.callback) && value.get_custom()) {
7✔
41
            std::get<ParamCustomChangedCallback>(subscription.callback)(value.get_custom().value());
2✔
42
        } else {
43
            // The callback we have set is not for this type.
44
            LogErr() << "Type and callback mismatch";
3✔
45
        }
46
    }
47
}
37✔
48

49
void MavlinkParameterSubscription::unsubscribe_all_params_changed(const void* cookie)
8✔
50
{
51
    std::lock_guard<std::mutex> lock(_param_changed_subscriptions_mutex);
16✔
52

53
    _param_changed_subscriptions.erase(
8✔
54
        std::remove_if(
8✔
55
            _param_changed_subscriptions.begin(),
56
            _param_changed_subscriptions.end(),
57
            [&](const auto& subscription) { return subscription.cookie == cookie; }),
58✔
58
        _param_changed_subscriptions.end());
32✔
59
}
8✔
60

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