【问题标题】:Convert the Rssi value of Beacon to array将 Beacon 的 Rssi 值转换为数组
【发布时间】:2019-12-26 11:07:02
【问题描述】:

我打算将扫描到的特定信标(信标 1 到 4)的输出值转换为如下所示的数组:

通过使用下面的代码,我可以将值保存到随机 Rssi 数字中,但不能保存到数组中。有谁知道如何在 Java 中做到这一点

【问题讨论】:

    标签: arrays bluetooth-lowenergy rssi


    【解决方案1】:

    您可以将遇到的每个次要的 RSSI 读数汇总到一个可变数组列表中。

    将此添加到您班级的 ctor:

    Map<Int, ArrayList> map = new HashMap<Int, ArrayList>();
    

    像这样附加 RSSI 读数:

    if (!map.containsKey(b.getMinor()) {
        map.put(b.getMinor(), new ArrayList<Int>());
    }
    map.get(b.getMinor()).add(b.getRssi());
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多