diff --git a/samples/bluetooth/beacon/src/main.c b/samples/bluetooth/beacon/src/main.c index 6c1ce7db843..7066c5bf55d 100644 --- a/samples/bluetooth/beacon/src/main.c +++ b/samples/bluetooth/beacon/src/main.c @@ -24,6 +24,9 @@ #include #include +#define DEVICE_NAME "Test beacon" +#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) + /* Set Advertisement data */ static const struct bt_data ad[] = { BT_DATA_BYTES(BT_DATA_UUID16_ALL, 0xd8, 0xfe), @@ -33,7 +36,7 @@ static const struct bt_data ad[] = { /* Set Scan Response data */ static const struct bt_data sd[] = { - BT_DATA(BT_DATA_NAME_COMPLETE, "Test beacon", 11), + BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN), }; static void bt_ready(int err) diff --git a/samples/bluetooth/ipsp/src/main.c b/samples/bluetooth/ipsp/src/main.c index e8299f03145..fd9e0c4cd8e 100644 --- a/samples/bluetooth/ipsp/src/main.c +++ b/samples/bluetooth/ipsp/src/main.c @@ -35,7 +35,7 @@ #include #define DEVICE_NAME "Test IPSP node" -#define DEVICE_NAME_LEN 14 +#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) #define UNKNOWN_APPEARANCE 0x0000 /* The 2001:db8::/32 is the private address space for documentation RFC 3849 */ diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index 368077b263e..7a67d89de9d 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -31,7 +31,7 @@ #include #define DEVICE_NAME "Test peripheral" -#define DEVICE_NAME_LEN 15 +#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) #define HEART_RATE_APPEARANCE 0x0341 static int read_name(struct bt_conn *conn, const struct bt_gatt_attr *attr, diff --git a/samples/bluetooth/peripheral_dis/src/main.c b/samples/bluetooth/peripheral_dis/src/main.c index bb214cc92d4..b5bc3e6fae3 100644 --- a/samples/bluetooth/peripheral_dis/src/main.c +++ b/samples/bluetooth/peripheral_dis/src/main.c @@ -31,7 +31,7 @@ #include #define DEVICE_NAME "DIS peripheral" -#define DEVICE_NAME_LEN 14 +#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) #define APPEARANCE 0x0000 static int read_appearance(struct bt_conn *conn, diff --git a/samples/bluetooth/peripheral_sc_only/src/main.c b/samples/bluetooth/peripheral_sc_only/src/main.c index ae4a78664a2..59fd7422e5a 100644 --- a/samples/bluetooth/peripheral_sc_only/src/main.c +++ b/samples/bluetooth/peripheral_sc_only/src/main.c @@ -31,7 +31,7 @@ #include #define DEVICE_NAME "SC only peripheral" -#define DEVICE_NAME_LEN 18 +#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) #define APPEARANCE 0x0000 static int read_appearance(struct bt_conn *conn, diff --git a/samples/bluetooth/shell/src/main.c b/samples/bluetooth/shell/src/main.c index b6e6c086393..f6cb8b5dc78 100644 --- a/samples/bluetooth/shell/src/main.c +++ b/samples/bluetooth/shell/src/main.c @@ -38,7 +38,7 @@ #include #define DEVICE_NAME "test shell" -#define DEVICE_NAME_LEN 10 +#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) #define AD_SHORT_NAME 0x08 #define AD_COMPLETE_NAME 0x09 #define CREDITS 10