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)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden