从RSSI蓝牙低功耗(BLE)标签? [英] RSSI from Bluetooth Low Energy (BLE) Tags?
问题描述
我正在写一个应用程序(在Android)从蓝牙设备中读取RSSI,使用RSSI指纹位置辨识。我有工作code从不在BT4.0 / BLE非成对和发现的蓝牙设备读取RSSI。我想知道如果我得到一些基于BLE-标签(如棒-N-FIND)我就可以只把自己阅读他们的RSSI(我的Android手机是precise),为BT-发现模式。
I'm writing an app (on android) to read RSSI from bluetooth devices, for location recognition using rssi fingerprinting. I have working code for reading RSSI from non-paired and discoverable bluetooth devices that are not BT4.0/BLE. I would like to know if I get some BLE-based tags (such as stick-n-find) would I be able to read their RSSI only by putting myself (my android phone to be precise), into bt-discovery mode.
推荐答案
在BT低能的角色转换。
棍子-N-FIND将广告它的服务(S)姓名或其他信息。当您从iOS应用接收广告,你会得到与广告的RSSI值。
In BT Low Energy the roles are switched. The Stick-n-find would be Advertising it's service(s) Name or other information. When you receive that Advertisement from your iOS APP you will get an RSSI value with that Advertisement.
所以才做这样的事情:
@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];
那么当它从周围听到的广告包您将获得
then when it hears the Advertisement package from a Peripheral you will get
- (void)centralManager:(CBCentralManager *)central
didDiscoverPeripheral:(CBPeripheral *)peripheral
advertisementData:(NSDictionary *)advertisementData
RSSI:(NSNumber *)RSSI {
你在哪里得到的RSSI。
where you get the RSSI.
如果你只想要一个回调didDiscoverPeripheral的第一次外围的一声,然后不使用ScanOptions
If you only want a callback to didDiscoverPeripheral for the FIRST time the peripheral is heard then don't use the ScanOptions
[self.CM scanForPeripheralsWithServices:[NSArray arrayWithObject:myUUID] options:nil];
这篇关于从RSSI蓝牙低功耗(BLE)标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!