-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