iphone设备之间的蓝牙信号强度 [英] Bluetooth signal strength between iphone devices

查看:853
本文介绍了iphone设备之间的蓝牙信号强度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个通过蓝牙连接的iPhone手机。是否有可能在这些风险之间获得信号强度?如果可能,怎么样?
谢谢,
KD

I have two iphone deveices connected by bluetooth. Is it possible to get signal strength between those deveices? if possible,How? Thanks, K.D

推荐答案

查看Apple Sample Project,将数据从一台设备传输到另一个通过蓝牙。 BTLE Apple示例代码

Take a look on Apple Sample Project for Transferring Data from One device to another via Bluetooth. BTLE Apple Sample Code

您可以通过RSSI(接收信号强度指示)的值找出信号强度

You can find out the signal strength with the value of RSSI (Received signal strength indication)

在示例代码中,您将在收到数据时获得RSSI值。在Project中的BTLECentralViewController.m中检查以下方法:

In sample code you will get RSSI value when data is received. Check the following method in BTLECentralViewController.m in Project:

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
    // Reject any where the value is above reasonable range
    if (RSSI.integerValue > -15) {
        return;
    }

    // Reject if the signal strength is too low to be close enough (Close is around -22dB)
    if (RSSI.integerValue < -35) {
        return;
    }

    NSLog(@"Discovered %@ at %@", peripheral.name, RSSI);

    // Ok, it's in range - have we already seen it?
    if (self.discoveredPeripheral != peripheral) {

        // Save a local copy of the peripheral, so CoreBluetooth doesn't get rid of it
        self.discoveredPeripheral = peripheral;

        // And connect
        NSLog(@"Connecting to peripheral %@", peripheral);
        [self.centralManager connectPeripheral:peripheral options:nil];
    }
}

每当您收到其他设备的广告数据时。您将从此处收到RSSI值,您可以找到强度和设备范围。

Each time when u received data from advertising by another device. You will receive a RSSI value from this u can find strength and Range of device.

还可以查看 Wiki上的RSSI详细信息

我希望这会有所帮助。

这篇关于iphone设备之间的蓝牙信号强度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆