How to decode the BLE advertisement data

前端 未结 2 1374
野趣味
野趣味 2021-01-25 16:59

After scanning for the BLE device, I call the below method:

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral          


        
2条回答
  •  旧时难觅i
    2021-01-25 17:43

    my small code snippet:

    -(void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
    {
        // NSLog(@"%@", central);
        NSLog(@"%@", peripheral);
        //NSLog(@"%@", advertisementData);
        NSLog(@"%@", RSSI);
    
        // more details:
        NSString* name = [peripheral name]; // name in NULL in iOS 6
        NSLog(@"%@", name);
    
        for (NSString * key in advertisementData){
            NSLog(@"%@", advertisementData[key]);
        }
    
    
    }
    

提交回复
热议问题