diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2016-01-30 13:26:23 +0200 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2016-02-05 20:25:31 -0500 |
commit | 7d8303bbbf549f3f74e301cb80c3105c6b0cb224 (patch) | |
tree | 2f98b0e20374ef0ed1d2a1b815d78099eb68344b /samples | |
parent | 08dd836791ccbb3af3884e84698ad0c98e840563 (diff) |
Bluetooth: Introduce BT_DATA_BYTES convenience macro
This way we don't need a special BT_BYTES macro and avoid bugs coming
from wrongly counted number of bytes (which is now evaluated at
build-time).
Change-Id: Ic6319234a816fe2fab6229b3bb980d0e3503e241
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/bluetooth/beacon/src/main.c | 6 | ||||
-rw-r--r-- | samples/bluetooth/ipsp/src/main.c | 5 | ||||
-rw-r--r-- | samples/bluetooth/peripheral/src/main.c | 13 | ||||
-rw-r--r-- | samples/bluetooth/peripheral_dis/src/main.c | 5 | ||||
-rw-r--r-- | samples/bluetooth/peripheral_sc_only/src/main.c | 3 | ||||
-rw-r--r-- | samples/bluetooth/shell/src/main.c | 3 |
6 files changed, 15 insertions, 20 deletions
diff --git a/samples/bluetooth/beacon/src/main.c b/samples/bluetooth/beacon/src/main.c index 491709c49..6c1ce7db8 100644 --- a/samples/bluetooth/beacon/src/main.c +++ b/samples/bluetooth/beacon/src/main.c @@ -26,9 +26,9 @@ /* Set Advertisement data */ static const struct bt_data ad[] = { - BT_DATA(BT_DATA_UUID16_ALL, BT_BYTES(0xd8, 0xfe), 2), - BT_DATA(BT_DATA_SVC_DATA16, - BT_BYTES(0xd8, 0xfe, 0x00, 0x20, 0x02, '0', '1', 0x08), 8) + BT_DATA_BYTES(BT_DATA_UUID16_ALL, 0xd8, 0xfe), + BT_DATA_BYTES(BT_DATA_SVC_DATA16, + 0xd8, 0xfe, 0x00, 0x20, 0x02, '0', '1', 0x08) }; /* Set Scan Response data */ diff --git a/samples/bluetooth/ipsp/src/main.c b/samples/bluetooth/ipsp/src/main.c index 27d7d439a..e8299f031 100644 --- a/samples/bluetooth/ipsp/src/main.c +++ b/samples/bluetooth/ipsp/src/main.c @@ -105,9 +105,8 @@ static struct bt_gatt_attr attrs[] = { }; static const struct bt_data ad[] = { - BT_DATA(BT_DATA_FLAGS, - BT_BYTES(BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR), 1), - BT_DATA(BT_DATA_UUID16_ALL, BT_BYTES(0x20, 0x18), 3), + BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), + BT_DATA_BYTES(BT_DATA_UUID16_ALL, 0x20, 0x18), }; static const struct bt_data sd[] = { diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index 6ae93716b..368077b26 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -387,13 +387,12 @@ static struct bt_gatt_attr vnd_attrs[] = { }; static const struct bt_data ad[] = { - BT_DATA(BT_DATA_FLAGS, - BT_BYTES(BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR), 1), - BT_DATA(BT_DATA_UUID16_ALL, - BT_BYTES(0x0d, 0x18, 0x0f, 0x18, 0x05, 0x18), 6), - BT_DATA(BT_DATA_UUID128_ALL, - BT_BYTES(0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12, - 0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12), 16), + BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), + BT_DATA_BYTES(BT_DATA_UUID16_ALL, + 0x0d, 0x18, 0x0f, 0x18, 0x05, 0x18), + BT_DATA_BYTES(BT_DATA_UUID128_ALL, + 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12, + 0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12), }; static const struct bt_data sd[] = { diff --git a/samples/bluetooth/peripheral_dis/src/main.c b/samples/bluetooth/peripheral_dis/src/main.c index 4f42e17ec..bb214cc92 100644 --- a/samples/bluetooth/peripheral_dis/src/main.c +++ b/samples/bluetooth/peripheral_dis/src/main.c @@ -73,9 +73,8 @@ static struct bt_gatt_attr attrs[] = { }; static const struct bt_data ad[] = { - BT_DATA(BT_DATA_FLAGS, - BT_BYTES(BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR), 1), - BT_DATA(BT_DATA_UUID16_ALL, BT_BYTES(0x0a, 0x18), 2), + BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), + BT_DATA_BYTES(BT_DATA_UUID16_ALL, 0x0a, 0x18), }; static const struct bt_data sd[] = { diff --git a/samples/bluetooth/peripheral_sc_only/src/main.c b/samples/bluetooth/peripheral_sc_only/src/main.c index 9f7fb0735..ae4a78664 100644 --- a/samples/bluetooth/peripheral_sc_only/src/main.c +++ b/samples/bluetooth/peripheral_sc_only/src/main.c @@ -64,8 +64,7 @@ static struct bt_gatt_attr attrs[] = { }; static const struct bt_data ad[] = { - BT_DATA(BT_DATA_FLAGS, - BT_BYTES(BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR), 1) + BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), }; static const struct bt_data sd[] = { diff --git a/samples/bluetooth/shell/src/main.c b/samples/bluetooth/shell/src/main.c index 79b529fe8..b6e6c0863 100644 --- a/samples/bluetooth/shell/src/main.c +++ b/samples/bluetooth/shell/src/main.c @@ -543,8 +543,7 @@ static void cmd_gatt_exchange_mtu(int argc, char *argv[]) } static const struct bt_data ad_discov[] = { - BT_DATA(BT_DATA_FLAGS, - BT_BYTES(BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR), 1), + BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), }; static const struct bt_data sd[] = { |