• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Background advertising and Peripheral detection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Background advertising and Peripheral detection


  • Subject: Re: Background advertising and Peripheral detection
  • From: Andras Kovi <email@hidden>
  • Date: Thu, 27 Sep 2012 22:37:46 +0200

I wrote an example app that advertises 180D (Heart Rate). This works well with the MacOS example app client from Apple.

Someone mentioned that they had issues with 128bit UUIDs. I don't exactly remember of the case and the solution but you may search the archives.

Could you try some other 16bit UUID first? E.g. 4234.

Thanks,
Andras 

On Sep 27, 2012, at 10:22 PM, Frederic Visticot <email@hidden> wrote:

Hello Andras,
I have tested today with a serviceUUID generated with uuidgen but same result :(

Is it  working for someone of the dev list ?

Fred

On Wed, Sep 26, 2012 at 12:19 PM, Andras Kovi <email@hidden> wrote:
Have you tried other service ids? Who knows, maybe 1804 is a special service that is filtered for some reason. 

Andras

On Sep 26, 2012, at 12:14 PM, Frederic Visticot <email@hidden> wrote:

Tx Andras,
I have double checked my code, and I correctly do what you suggested me (CBAdvertisementDataServiceUUIDsKey with 1804).

I can as well verify with the sniffer that this serviceId is visible in the advertising packet...

I think the pb is not there... but where :) ...

PS: agree that duplicate keys is ignored in background

-Fred

On Wed, Sep 26, 2012 at 11:51 AM, Andras Kovi <email@hidden> wrote:
Hi Frederic,

just a flash idea: You must set the list of advertised services when you start the advertisement, otherwise they can only be discovered and scanning will not find the peripheral.

Example code on the peripheral side:

    NSMutableDictionary *data = "">NSMutableDictionary alloc] init];
    
    data[CBAdvertisementDataLocalNameKey] = @"iPh5";
    data[CBAdvertisementDataServiceUUIDsKey] = @[[CBUUID UUIDWithString:@"1804"]];
    
    [peripheralManager startAdvertising:data];

One more note: duplicate keys is ignored in background

Regards,
Andras

On Sep 26, 2012, at 9:41 AM, Frederic Visticot <email@hidden> wrote:

What I try to do:

1. iPhone5 is making advertising for a service (1804) (in background or foreground)
--> it works

2.iPhone4S is  scanning peripherals with "scanForPeripheralsWithServices"

Different use cases:

a) iPhone5 is advertising in foreground and iPhone4S is scanning in foreground for all services with duplicateKey = YES
---> it works

b) iPhone5 is advertising in background and iPhone4S is scanning in foreground for all services with duplicateKey = YES
---> it works

c)iPhone5 is advertising in foreground and iPhone4S is scanning in foreground for a dedicated service (1804) with duplicateKey = YES or duplicateKey = NO
--> Does not work

d)iPhone5 is advertising in background and iPhone4S is scanning in background for a dedicated service (1804) with duplicateKey = YES or duplicateKey = NO
--> Does not work

e) iPhone5 is advertising in background and iPhone4S is scanning in foreground for a dedicated service (1804) with duplicateKey = YES or duplicateKey = NO
--> Does not work


I would like to have the cases c &  d working  and more especialy d (both peripheral and central in background)

Can someone help me on that ?


I have made several BLE tests with external USB tags and I can correctly detect tags when app is in background. 
To scan in background I'm using the following parameters for the scanForPeripheralsWithServices method:
DuplicateKey: NO in option
The service I want to scan


I'have made a "packet sniffer" for the Iphone5 advertising:
a) in foreground: 32ms + serviceID in advertising packet
b) in background 180ms but no serviceId in advertising packet

b) helps me to understand why iPhone4S can not detect the iPhone5 when background mode (case e)


PS: of course my plist file includes the 2 "magic flags" for background more (central & peripheral)

Code to start the scan in different conditions:

 NSArray *services = [NSArray arrayWithObject:[CBUUID UUIDWithString:@"1804"]];

            NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool: <YES or NO>],

                                     CBCentralManagerScanOptionAllowDuplicatesKey, nil];

                        [_centralManager scanForPeripheralsWithServices: <nil, or services> options:options];

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list      (email@hidden)

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

References: 
 >Background advertising and Peripheral detection (From: Frederic Visticot <email@hidden>)
 >Re: Background advertising and Peripheral detection (From: Andras Kovi <email@hidden>)
 >Re: Background advertising and Peripheral detection (From: Frederic Visticot <email@hidden>)
 >Re: Background advertising and Peripheral detection (From: Andras Kovi <email@hidden>)
 >Re: Background advertising and Peripheral detection (From: Frederic Visticot <email@hidden>)

  • Prev by Date: Re: Background advertising and Peripheral detection
  • Next by Date: Automatically reestablishing BLE connection when in range
  • Previous by thread: Re: Background advertising and Peripheral detection
  • Next by thread: Internet access in session backgrounding
  • Index(es):
    • Date
    • Thread