Hi Bob,
Please see comments below.
Thanks, Joakim
On Feb 13, 2012, at 11:09 AM, Bob Frankel wrote:
hi joakim,
thanks for the answer.... but this raises several more
questions....
in all cases, my app is *not* running in the background; do i
have to do anything to enable "active scanning"???
No, it's always on when the App is in the foreground.
as an experiment, i *removed* my peripheral name from my
advertising PDU and instead placed it in the scan_req PDU....
but when i received the callback to didDiscoverPeripheral, my
adverstisementData dictionary did not contain the
kCAdvDataLocalName key -- as it normally does when the local
name is within the adversting PDU.... shouldn't i still see
this key, as the local name was in the scan_req PDU???
It's in a consecutive callback. First, you get what's in the advertising packet, then you get the scan response data aggregated in.
then, as a second experiment, i *added* some "service data" to
my adversting PDU following the format described in volume 3,
part C, section 18.10 of the spec -- in this case, two octets of
service ID (the same one i used in my "service ID" segment of
the PDU) plus one octect of payload.... (all of this fits
within the 31 byte limit).... but, when i now scan for
peripherals in my (foreground) app, i *never* receive a
callback!! in general, is this the way to add
'kCAdvDataServiceData' to the advertisementData dictionary???
should i be using a different 16-bit UUID??? i clearly want to
associated this data with "my service"
Not sure what is going on. Could you please send the code to use in a bug report at bugreport.apple.com.
thanks in advance
bob.
On 2/13/2012 10:22 AM, Joakim Linde wrote:
Hi Bob,
See comments below.
Thanks,
Joakim
On Feb 13, 2012, at 7:49 AM, Bob Frankel wrote:
hi,
it mentions in the BluetoothDesignGuidelines that active
scanning is not always performed.... can you elaborate
just when this is the caseā¦.
Active scanning is only performed when the App is in the
foreground.
as a use-case, suppose i have a thermostat this is
adverstising the current temperature.... if i have an
app running in the background that is scanning for a
particular service presumably implemented by the
thermostat, will i be receiving the data in the
adverstising PDU or in the SCAN_RSP PDU (or both)???
If this App is in the background you will only receive data
in the Advertising PDU.
related to this, just when will i receive a callback to
my delegate -- everytime the peripheral device
broadcasts, or only when the information in the
advertising/SCAN_RSP PDUs actually change???
This depends on what options you specify. Either we provide
it the first time we see the device, or we provide it every
time we see a packet from the device (regardless if the
content has changed or not).
finally, just how much data can i pack into the
adversting/SCAN_RSP PDUs???
The Bluetooth 4.0 spec limits the size of the advertising
packet to 31 bytes. This includes headers and delimiters. See
BT 4.0 spec for details.
thanks,
bob.
|