-1。首先你需要开始发现。
-(void)startDiscovery
{
if (self.mBtmanager == nil) {
_mScanState = false;
self.mBtmanager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
self.mBtmanager.delegate = self;
}
if (self.mBtmanager.state != CBCentralManagerStatePoweredOn) {
_mScanState = true;
}
NSDictionary *scanOption = @{CBCentralManagerScanOptionAllowDuplicatesKey:@YES};
[self.mBtmanager scanForPeripheralsWithServices:[[NSArray alloc] initWithObjects:[CBUUID UUIDWithString:JAALEE_ADV_SERVICE_UUID_STRING], nil] options:scanOption];
}
- 2.您需要连接到Beacon。
-(void)startConnectDevice:(CBPeripheral*)peripheral
{
peripheral.delegate = self;
[self.mBtmanager connectPeripheral:peripheral options:nil];
}
-3。然后使用writeServicesUUID
[peripheral writeValue:value forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse];
- 最后CONFIGURE_BROADCAST_INTERVAL_CHARACTERISTIC_将帮助你改变播放间隔。
我解决了这个问题,无论如何感谢您的关注。 – HuangLW