Peripheral for advertising static data
Peripheral for advertising static data
- Subject: Peripheral for advertising static data
- From: Amin Asadi <email@hidden>
- Date: Tue, 19 Feb 2013 22:28:20 +0100
Hi,
I'm developing two separate applications. One is dedicated for advertising a single static Id which does not need to get updated and the other app is just for scanning these advertisements to extract the id.
Since it's just a static ID to advertise, I have put my id as the name of the peripheral. So centrals without any need to make connection to peripheral, would be able to get advertisement packets and extract the id out of that. I put the the id in advertising packet of peripheral as follow:
[self.peripheralManager startAdvertising:@{ CBAdvertisementDataLocalNameKey : idToAdvertise, CBAdvertisementDataServiceUUIDsKey : @[[CBUUID UUIDWithString:kServiceUUID]] }];
and I get idToAdvertise value in centrals as follow:
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {
self.peripheralStaticId = peripheral.name;
}
Everything works great and as expected but only if the peripheral app remains in foreground. Once I put the peripheral in the background, it still advertises but instead of advertising the whole array (idToAdvertise and serviceUUID), it only advertises serviceUUID. So in peripheral background mode, my centrals only know which serviceUUID is getting advertises but they couldn't know what's the name of the peripheral.
Could you please guide me how to advertise a static ID without making connection. SInce I want to have one to many functionality. A lot of devices need to get advertisements at the same time.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden