samples: bluetooth: ibeacon: change to ADV_NONCONN_IND type
According to the Apple iBeacon spec chapter "2.1 Advertising Packet", "beacons must use a non connectable undirected Advertising PDU, ADV_NONCONN_IND". Refer to https://developer.apple.com/ibeacon/ Signed-off-by: Aaron Tsui <aaron.tsui@outlook.com>
This commit is contained in:
parent
ffcbf121e8
commit
631cd007bd
2 changed files with 1 additions and 10 deletions
|
@ -1,3 +1,2 @@
|
||||||
CONFIG_BT=y
|
CONFIG_BT=y
|
||||||
CONFIG_BT_DEBUG_LOG=y
|
CONFIG_BT_DEBUG_LOG=y
|
||||||
CONFIG_BT_DEVICE_NAME="Zephyr iBeacon Demo"
|
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
#include <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
#include <bluetooth/hci.h>
|
#include <bluetooth/hci.h>
|
||||||
|
|
||||||
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
|
|
||||||
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
|
|
||||||
|
|
||||||
#ifndef IBEACON_RSSI
|
#ifndef IBEACON_RSSI
|
||||||
#define IBEACON_RSSI 0xc8
|
#define IBEACON_RSSI 0xc8
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,11 +40,6 @@ static const struct bt_data ad[] = {
|
||||||
IBEACON_RSSI) /* Calibrated RSSI @ 1m */
|
IBEACON_RSSI) /* Calibrated RSSI @ 1m */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Set Scan Response data */
|
|
||||||
static const struct bt_data sd[] = {
|
|
||||||
BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
|
|
||||||
};
|
|
||||||
|
|
||||||
static void bt_ready(int err)
|
static void bt_ready(int err)
|
||||||
{
|
{
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -59,7 +51,7 @@ static void bt_ready(int err)
|
||||||
|
|
||||||
/* Start advertising */
|
/* Start advertising */
|
||||||
err = bt_le_adv_start(BT_LE_ADV_NCONN, ad, ARRAY_SIZE(ad),
|
err = bt_le_adv_start(BT_LE_ADV_NCONN, ad, ARRAY_SIZE(ad),
|
||||||
sd, ARRAY_SIZE(sd));
|
NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk("Advertising failed to start (err %d)\n", err);
|
printk("Advertising failed to start (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue