MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / get_all_settings

Method get_all_settings

OpenHD/ohd_interface/src/wb_link.cpp:626–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

624#pragma clang diagnostic push
625#pragma ide diagnostic ignored "performance-unnecessary-value-param"
626std::vector<openhd::Setting> WBLink::get_all_settings() {
627 using namespace openhd;
628 std::vector<openhd::Setting> ret{};
629 const auto settings = m_settings->get_settings();
630 auto change_freq = openhd::IntSetting{
631 (int)settings.wb_frequency,
632 [this](std::string, int value) { return request_set_frequency(value); }};
633 change_freq.get_callback = [this]() {
634 return m_settings->unsafe_get_settings().wb_frequency;
635 };
636 ret.push_back(Setting{WB_FREQUENCY, change_freq});
637 if (m_profile.is_air) {
638 // MCS is only changeable on air
639 auto change_wb_air_mcs_index = openhd::IntSetting{
640 (int)settings.wb_air_mcs_index, [this](std::string, int value) {
641 return request_set_air_mcs_index(value);
642 }};
643 ret.push_back(Setting{WB_MCS_INDEX, change_wb_air_mcs_index});
644 // Channel width is only changeable on the air
645 auto change_wb_channel_width = openhd::IntSetting{
646 (int)settings.wb_air_tx_channel_width, [this](std::string, int value) {
647 return request_set_air_tx_channel_width(value);
648 }};
649 change_wb_channel_width.get_callback = [this]() {
650 return m_settings->unsafe_get_settings().wb_air_tx_channel_width;
651 };
652 ret.push_back(Setting{WB_CHANNEL_WIDTH, change_wb_channel_width});
653 auto cb_change_video_fec_percentage = [this](std::string, int value) {
654 return set_air_video_fec_percentage(value);
655 };
656 ret.push_back(
657 Setting{WB_VIDEO_FEC_PERCENTAGE,
658 openhd::IntSetting{(int)settings.wb_video_fec_percentage,
659 cb_change_video_fec_percentage}});
660 auto cb_enable_wb_video_variable_bitrate = [this](std::string, int value) {
661 return set_air_enable_wb_video_variable_bitrate(value);
662 };
663 ret.push_back(Setting{
664 WB_VIDEO_VARIABLE_BITRATE,
665 openhd::IntSetting{(int)settings.enable_wb_video_variable_bitrate,
666 cb_enable_wb_video_variable_bitrate}});
667 auto cb_wb_qp_max = [this](std::string, int value) {
668 m_console->warn("qp_max value: {}", value);
669 if (value < 0 || value > 51) {
670 m_console->warn("Invalid wb_qp_max value: {}", value);
671 return false;
672 }
673 m_settings->unsafe_get_settings().wb_qp_max = value;
674 m_settings->persist();
675 return true;
676 };
677 ret.push_back(Setting{
678 WB_QP_MAX, openhd::IntSetting{(int)settings.wb_qp_max, cb_wb_qp_max}});
679
680 auto cb_wb_qp_min = [this](std::string, int value) {
681 m_console->warn("wb_qp_min value: {}", value);
682 if (value < 0 || value > 51) {
683 m_console->warn("Invalid wb_qp_min value: {}", value);

Callers 1

mainFunction · 0.45

Calls 6

validate_yes_or_noFunction · 0.85
push_backMethod · 0.80
persistMethod · 0.80
is_groundMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected