【问题标题】:RSSI from Bluetooth Low Energy (BLE) Tags?来自低功耗蓝牙 (BLE) 标签的 RSSI?
【发布时间】:2013-03-07 19:14:56
【问题描述】:

我正在编写一个应用程序(在 Android 上)从蓝牙设备读取 RSSI,以使用 rssi 指纹识别进行位置识别。我有用于从非 BT4.0/BLE 的非配对和可发现蓝牙设备读取 RSSI 的工作代码。我想知道如果我得到一些基于 BLE 的标签(例如stick-n-find),我是否只能通过将自己(准确地说是我的 android 手机)置于 bt-discovery 模式来读取它们的 RSSI。

【问题讨论】:

    标签: android bluetooth bluetooth-lowenergy rssi


    【解决方案1】:

    在 BT Low Energy 中,角色互换了。 Stick-n-find 将是广告它的服务名称或其他信息。当您从您的 iOS APP 收到该广告时,您将获得该广告的 RSSI 值。

    所以只需执行以下操作:

    @property (strong, nonatomic) CBCentralManager *CM;
    
    #define SERVICE_ID_STR     "4d1dc300-424d-13e2-a661-0002a55dc51b"
    
    self.CM = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
    NSDictionary *scanOptions = [NSDictionary dictionaryWithObject:[NSNumber
       numberWithBool:NO] forKey:CBCentralManagerScanOptionAllowDuplicatesKey];
    CBUUID *peripheralUUID = [CBUUID UUIDWithString:@SERVICE_ID_STR];
    [self.CM scanForPeripheralsWithServices:[NSArray arrayWithObject:myUUID]
       options:scanOptions];
    

    然后当它听到来自外围设备的广告包时,你会得到

    - (void)centralManager:(CBCentralManager *)central 
        didDiscoverPeripheral:(CBPeripheral *)peripheral 
        advertisementData:(NSDictionary *)advertisementData
        RSSI:(NSNumber *)RSSI {
    

    从哪里获得 RSSI。

    如果您只想在第一次听到外围设备时回调 didDiscoverPeripheral,则不要使用 ScanOptions

    [self.CM scanForPeripheralsWithServices:[NSArray arrayWithObject:myUUID] options:nil];
    

    【讨论】:

    • 非常感谢您描述工作流程,甚至提供了 iOS 代码。我们目前还没有尝试过 iOS,但很想知道如何在 Android 4.2 的 Bluedroid 堆栈中对其进行编码。
    【解决方案2】:

    据我所知,一些 Android 手机制造商可能包含 BLE 支持,但目前 Android 不直接支持(截至 4.2 Jellybean)。请参阅Issue 33371 了解更多信息。

    正如this Google Groups discussion 所暗示的那样,看起来 BLE 可能会出现在下一个 Android 版本中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-05
      • 2016-06-14
      • 2021-10-27
      • 2013-01-12
      • 2017-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多