Bluetooth: Update advertising API

Update the advertising API according to what has recently been
discussed and agreed upon.

Naming-wise the most important change is the removal of "EIR" which
was confusing since this is mainly used with LE at the moment. The
Core Specification Supplement consistently uses the generic terms data
and data type to describe what we're dealing with here, so the new
names are bt_data and BT_DATA.

Another change is to detach the actual data from the struct by
converting it from an array to a pointer. This is not only essential
for supporting BR/EDR (which has a different length) but to also
minimize memory usage.

Another change is to require the caller of bt_le_adv_start() to
provide the array lengths of the ad and sd paramters. This way we
don't have to have the empty (8-byte) element at the end of each
array.

Lastly, the bt_le_adv_start() logic is slightly modified so that it
will always clear the respective data if necessary. Previously the
user might have been left with a previous callers data if it passed
NULL to the API.

Change-Id: I318026ceb1b52bb688edf4dcfed82613bd15c3e1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-01-13 12:53:54 +02:00 committed by Anas Nashif
commit 3c47e9515c
13 changed files with 174 additions and 224 deletions

View file

@ -24,7 +24,8 @@ int bt_enable(bt_ready_cb_t cb)
}
int bt_le_adv_start(const struct bt_le_adv_param *param,
const struct bt_eir *ad, const struct bt_eir *sd)
const struct bt_data *ad, size_t ad_len,
const struct bt_data *sd, size_t sd_len)
{
return -ENOSYS;
}