gpt4 book ai didi

ios - ibeacons 发送 rssi 值为 0

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:17:55 28 4
gpt4 key购买 nike

我有 8 个 iBeacon,我给了它们所有相同的 proximityUUID 和不同的主要次要值

然而,当我尝试使用手机寻找信标时,其中一些发送的“rssi”值为 0

这是为什么?

    @implementation CLBeacon(description)
-(NSString *)stringProximity{
switch (self.proximity) {
case CLProximityUnknown:
return @"Unknown";
case CLProximityImmediate:
return @"less than 0.5 meters away";
case CLProximityNear:
return @"0.5<distance<4 meters away";
case CLProximityFar:
return @"more than 4 meters away";
}
return @"";
}

-(NSString *)UUIDString{
NSMutableString *string = [[[self proximityUUID]UUIDString]mutableCopy];
[string replaceOccurrencesOfString:@"-" withString:@"-\n" options:0 range:NSMakeRange(0, [string length])];
return string;
}
-(NSString *)describe{
NSString *contents = [NSString stringWithFormat:@"proximityUUID:%@\nmajor:%@\nminor:%@\naccuracy:%f\nproximity:%@\nrssi:%ld",[self UUIDString],[self major],[self minor],[self accuracy],[self stringProximity],[self rssi]];
return contents;
}

@end

@implementation WBBeaconManager


-(id)init{
self = [super init];
if(self){
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self initRegion];
[self locationManager:self.locationManager didStartMonitoringForRegion:self.beaconRegion];
}
return self;
}

- (void)locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region {
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
}

- (void)initRegion {
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:BEACONUUID];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:BEACONIDENTIFIER];
[self.locationManager startMonitoringForRegion:self.beaconRegion];

}

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
NSLog(@"Beacon Found");
[self makeText:[NSString stringWithFormat:@"entered region:%@",region.identifier ]];
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
[self makeText:[NSString stringWithFormat:@"entered region: %@",region.identifier]];
}

-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {
NSLog(@"Left Region");
[self makeText:[NSString stringWithFormat:@"left region:%@",region.identifier ]];
[self.locationManager stopRangingBeaconsInRegion:self.beaconRegion];
[self makeText:[NSString stringWithFormat:@"left region: %@",region.identifier]];
// self.beaconFoundLabel.text = @"No";
}

-(void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region {
CLBeacon *beacon = [beacons firstObject];
for(CLBeacon *b in beacons){
LogInfo(@"%@",[b describe]);
}
// if(beacon.proximity == CLProximityNear || beacon.proximity == CLProximityImmediate){
[self makeText:[beacon describe]];
// }
}

-(void)dealloc{
[self.locationManager stopMonitoringForRegion:self.beaconRegion];
[self.locationManager stopRangingBeaconsInRegion:self.beaconRegion];
}
@end

这是日志输出:

proximityUUID:73A7B094-35DD-4B36-A0AA-F11C62E9B4B0
major:0
minor:3
accuracy:-1.000000
proximity:Unknown
rssi:0

最佳答案

RSSI 是“接收到的信标信号强度,以分贝为单位”。有时信标监听器会找到信标,但实际上无法确定其 RSSI。这就是为什么你的准确性是负面的。 RSSI 也是“自上次向您的应用报告信标范围以来收到的样本值”的平均值。

A negative value in this property signifies that the actual accuracy could not be determined.

在这种情况下,您可能即将离开信标区域,或者您正处于其范围的边缘。

关于ios - ibeacons 发送 rssi 值为 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24730739/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com