Drone.getAttribute(AttributeType.Signal)返回无效的Signal

时间:2018-01-08 17:49:43

标签: android kotlin dronekit-android

我正在尝试使用3DR Solo在我自己的应用上实现Dronekit-Android库。我有一个无人机遥测屏幕,它已经显示了无人机的高度,电池百分比,速度等。所有这些数据都被成功检索和显示。但是,以下代码段不会返回信号信息:

<script>
var page = 1;
var busy = false;
var baseURL = window.location.protocol + "//" + window.location.hostname;
var lastScrollTop = 0;
var thisWindow = $(window);
var loader = $('.ajax-load');

thisWindow.scroll(function (event) {
    var st = $(this).scrollTop();
    if (st > lastScrollTop)
    {
        //check busy first, if busy=true you avoid making calls
        //do scrollTop() and height()
        if (busy == false && thisWindow.scrollTop() + thisWindow.height() > $(document).height() - 550)
        {
            loadMoreData(page);
            page++;
        }

    }

    lastScrollTop = st;
});


function loadMoreData(page) {
    busy = true;
    loader.show();

    $.ajax(
            {
                type: "POST",
                url: baseURL + "/sura/load_verse/$sura_id/" + page,
                async: false,
                cache: false,
            })
            .done(function (data)
            {
                if (data == "") {
                    loader.html("No More Data Found");
                    return;
                }
                $("#post-data").append(data);
            })
            .fail(function (jqXHR, ajaxOptions, thrownError)
            {

            })
            .always(function () {
                busy = false;
                loader.hide();
            });

}
</script>
无论无人机状态如何(空闲,飞行,悬停等),

val signal = drone.getAttribute(AttributeType.SIGNAL) val signalStrength = signal.signalStrength if (!signal.isValid) { controller_strength_image_view.setImageLevel(0) } else if (signalStrength >= exceptionalWifi) { controller_strength_image_view.setImageLevel(5) } else if (signalStrength >= veryGoodWifi) { controller_strength_image_view.setImageLevel(4) } else if (signalStrength >= goodWifi) { controller_strength_image_view.setImageLevel(3) } else if (signalStrength >= marginalWifi) { controller_strength_image_view.setImageLevel(2) } else if (signalStrength >= poorWifi) { controller_strength_image_view.setImageLevel(1) } else { controller_strength_image_view.setImageLevel(0) } 总是返回false。使用3DR的应用程序显示信号信息正在更新。

我错过了什么?

0 个答案:

没有答案