Allan,
Advertising does normally stop when a connection request is received. Not sure about iOS, but there is no way to stop advertising with the API currently. Have to check that with a sniffer.
When you program the central side, connecting becomes very slow while scanning. A solution for your problem would be to first build a list of devices to connect, then stop scanning and then connecting to all peripherals.
Etan
On 16.01.2013, at 17:46, "Allan Young" < email@hidden> wrote:
Etan,
Regarding your comment:
> Also don't forget to stop scanning and advertising as soon as you establish a connection.
…is it really necessary to stop scanning and advertising when the connection is established?
From the peripheral side, what if multiple centrals want access to my data?
And from the central side, what if I want to get data from a number of peripherals advertising the same service/characteristics? To use a medical/sports example, should I be able to monitor the heart rates reported by a number of different peripherals?
Is this not possible?
Thanks.
-Allan
Hi Joakim,
Bug number: 12963322
On 16 Jan 2013, at 03:06, Joakim Linde < email@hidden> wrote:
Hi Darren,
What's the bug report number for this?
Thanks,
Joakim
On Jan 11, 2013, at 8:23 AM, Darren Jones < email@hidden> wrote:
Thanks Etan,
I have actually filed a bug report for the backgrounding of bluetooth-central stopping.
I hope they fix it soon as there's so much more potential for apps when continuous background scanning is available.
On 11 Jan 2013, at 16:21, Etan Kissling < email@hidden> wrote:
Darren,
OK. If you want to enable background scanning and advertising, just add the bluetooth-central and bluetooth-peripheral keys
to the UIBackgroundModes array in your Info.plist.
bluetooth-central
|
The app uses the CoreBluetooth framework to communicate with a Bluetooth accessory while in the background.
This value is supported in iOS 5.0 and later.
|
bluetooth-peripheral
|
The app uses the CoreBluetooth framework to communicate in peripheral mode with a Bluetooth accessory.
This value is supported in iOS 6.0 and later.
|
You will then receive the callbacks for around 45-60 minutes of background mode. After this, a bug
prevents to receive more callbacks, as the connection is terminated as soon as your app is purged
from the memory. After relaunching the app, scanning should resume to function properly.
Etan
wrote:
Thank you. I want to use non pairing so CoreBluetooth is the way.
I'm glad it's possible. I wasn't sure if background scanning and advertising would be allowed.
On 11 Jan 2013, at 16:02, Etan Kissling <email@hidden> wrote:
Darren,
If you want to perform iPhone to iPhone communication only, I suggest using GameKit for it.
You will have an increased throughput, as classic Bluetooth is used as a transport, and don't have
to worry about specifying who is master and who is slave.
If you want to stay with CoreBluetooth: at least from the Bluetooth Core Specification, a device is
allowed to scan and advertise at the same time. I have not yet tried it under iOS, but can tell for your
background requirement that scanning times are pretty slow while backgrounded (around 55x
advertisement interval). Also don't forget to stop scanning and advertising as soon as you establish
a connection.
Etan
On 10.01.2013, at 23:59, Darren Jones <email@hidden> wrote:
Is it possible to use CBCentral scanning and CBPeripheral advertising at the same time? (Also in the background)
If I wanted 2 random iPhones to communicate and both where set to Central or both to Peripheral they wouldn't see each other. I'd like to remove that they would both have to know which method to activate.
Is that possible?
Thanks
Sent from my iPhone 5
|