b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

rssi?rssi变红?rssi值多少为正常?Stone的专栏

电脑杂谈  发布时间:2016-07-07 22:02:30  来源:网络整理

你是否正在寻找关于rssi的内容?让我把最受欢迎的东西奉献给你:

利用CoreLocation.framework很容易扫描获得周边蓝牙设备,苹果开源代码AirLocate有具体实现,下载地址:

https://developer.apple.com/library/ios/samplecode/AirLocate/Introduction/Intro.html

所获得的iBeacon在CoreLocation里以CLBeacon表示,其中有rssi(接收信号强度),可以用来计算发射端和接收端间距离。


计算公式:

d = 10^((abs(rssi) - A) / (10 * n))

其中:

d - 计算所得距离

rssi -接收信号强度(负)

A - 发射端和接收端相隔1米时的信号强度

n - 环境衰减因子



计算公式的代码实现

- (float)calcDistByRSSI:(int)rssi { int iRssi = abs(rssi); float power = (irssi-59)/(10*2.0); return pow(10, power); }
传入rssi,返回距离(单位:米)。其中,A参数赋了59,n赋了2.0。

由于所处环境不同,每台发射源(蓝牙设备)对应参数都不一样。按道理,公式里的每项参数都应该做实验(校准)获得。

当你不知道周围蓝牙设备准确位置时,只能给A和n赋经验(如本例)。


修改AirLocate的APLRangingViewController.m展现部分代码,输出计算距离

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *identifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; // Display the UUID, major, minor and accuracy for each beacon. NSNumber *sectionKey = [self.beacons allKeys][indexPath.section]; CLBeacon *beacon = self.beacons[sectionKey][indexPath.row]; cell.textLabel.text = [beacon.proximityUUID UUIDString]; // NSLog(@"%@", [beacon.proximityUUID UUIDString]); // NSString *formatString = NSLocalizedString(@"Major: %@, Minor: %@, Acc: %.2fm, Rssi: %d, Dis: %.2f", @"Format string for ranging table cells."); // cell.detailTextLabel.text = [NSString stringWithFormat:formatString, beacon.major, beacon.minor, beacon.accuracy, beacon.rssi, [self calcDistByRSSI:beacon.rssi]]; NSString *formatString = NSLocalizedString(@"Acc: %.2fm, Rssi: %d, Dis: %.2fm", @"Format string for ranging table cells."); cell.detailTextLabel.text = [NSString stringWithFormat:formatString, beacon.accuracy, beacon.rssi, [self calcDistByRSSI:beacon.rssi]]; return cell; }
扫描结果

技术分享


展现了每台蓝牙设备的Acc(精度)、rssi(信号强度)和Dis(距离),。

以上就是关于rssi的全部内容,相信你一定会非常满意。


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-12130-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...