Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios ibeacons发送的rssi值为0_Ios_Ibeacon - Fatal编程技术网

Ios ibeacons发送的rssi值为0

Ios ibeacons发送的rssi值为0,ios,ibeacon,Ios,Ibeacon,我有8个iBeacon,我给了它们所有相同的ProximityUID和不同的主次值 但是,当我尝试使用手机查找信标时,其中一些信标发送的“rssi”值为0 为什么呢 @implementation CLBeacon(description) -(NSString *)stringProximity{ switch (self.proximity) { case CLProximityUnknown: return @"Unknown";

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

但是,当我尝试使用手机查找信标时,其中一些信标发送的“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

似乎RSSI是使用x个样本计算的平均值,当iPhone/iPad没有收到该信标的最小样本量时,它不会计算平均RSSI值,也不会计算精度,并且得到未知的接近度。

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

此属性中的负值表示无法确定实际精度


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

我制作了自己的采样器,使用平均rssi 5秒,如果平均rssi不为零,则忽略零值,因为它必须是噪声数据。

如果你谈论的是编码为有效负载最后一个字节的发射场功率电平,因为它为零可能意味着没有人费心设置它。如果您谈论的是接收到的功率电平,那么0(dBm)是不可信的,因此这可能意味着您的BLE芯片/驱动程序未设置为报告此信息,或者由于代码中的错误而丢失了此信息。似乎RSSI是使用x个样本计算的平均值,当iPhone/iPad没有收到该信标的最小样本量时,它不会计算平均rssi值,也不会计算准确度,并且得到未知的接近度
proximityUUID:73A7B094-35DD-4B36-A0AA-F11C62E9B4B0
major:0
minor:3
accuracy:-1.000000
proximity:Unknown
rssi:0