Re: Peripheral not being discovered in the background until I open the BlueTooth Settings page
Re: Peripheral not being discovered in the background until I open the BlueTooth Settings page
- Subject: Re: Peripheral not being discovered in the background until I open the BlueTooth Settings page
- From: Robert Carlsen <email@hidden>
- Date: Mon, 09 Nov 2015 19:17:44 -0500
The Bluetooth sniffer will be a hardware device. I believe that TI makes one: http://www.ti.com/tool/cc2540emk-usb
Any of the iOS apps will use the same Core Bluetooth API that you are already using. While in the foreground, iOS will perform active scanning during device discovery (eg. it will issue a Scan Request to elicit a Scan Response from the peripheral). I believe the data provided in -didDiscoverPeripheral is the aggregate result of the advertising packet and the scan response (perhaps there a more official source could confirm that). While in the background, iOS will passively scan on behalf of your app, only returning the result of the advertising packet.
See Apple’s Bluetooth Accessory Design Guidelines for Apple Products for details on that (3.4 Advertising Data).
-r
> On Nov 9, 2015, at 4:54 PM, Jan Lübeck (Fyrastudio) <email@hidden> wrote:
>
> Ok, apparently the chip the vendor is using is a Texas Instruments one. So I downloaded the app SensorTag from TI, i see the device there. And when I look at the Advertisement Data, it shows the service UDIDs I'm scanning for even without never pairing to the device. So I'm guessing that means the service is on the advertisement?
>
> ______
> Jan Lübeck
> Chief Technology Officer
> fyrastudio.com
>
> On Mon, Nov 9, 2015 at 2:14 PM, Craig Dooley <email@hidden> wrote:
> What is the device? Is the service you are looking for in the advertisement, or in the scan response? If the service is only in the scan response, it will not be found in background mode.
>
> - Craig
>
>> On Nov 9, 2015, at 11:00 AM, Jan Lübeck (Fyrastudio) <email@hidden> wrote:
>>
>> Hey all, first message here, so I hope I don't sound too newbie.
>>
>> I've been looking at the documentation to have my app discover peripherals while on the background and I think I have it all set up correctly.
>>
>> 1) I wait until the CBCentralManager's state is CBCentralManagerStatePoweredOn before I start scanning.
>> 2) On scanForPeripheralsWithServices I pass an array of UUIDs with the services. NOT scanning with nil as that doesn't work in the background.
>> 3) I have bluetooth-central inside UIBackgroundModes in my plist
>>
>> With all these, eveything works great in the foreground, plus it works great if I discover the peripheral in the foreground and then go to the background. But if I go to the background before discovering the peripheral, it is never discovered.
>>
>> UNLESS
>>
>> I go to my phone Settings and open the BlueTooth page. Without even touching anything else, centralManager:didDiscoverPeripheral is called on my app as expected.
>>
>> This surprised me, but at least gave me something solid to come and ask here.
>>
>> Is there something I'm missing?
>>
>> I'm running iOS 9.1. Couldn't test on 8.x yet to see if it is a new thing.
>>
>> Thanks!
>> ______
>> Jan Lübeck
>> Chief Technology Officer
>> fyrastudio.com
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> 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
_______________________________________________
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