Skip to content

Commit fc140d8

Browse files
rugeGerritsennashif
authored andcommitted
samples: bluetooth: Remove useless default_conn
The connection object is not used. Signed-off-by: Rubin Gerritsen <[email protected]>
1 parent 942979b commit fc140d8

File tree

2 files changed

+0
-16
lines changed
  • samples/bluetooth

2 files changed

+0
-16
lines changed

samples/bluetooth/peripheral_hr/src/main.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include <bluetooth/services/bas.h>
2323
#include <bluetooth/services/hrs.h>
2424

25-
struct bt_conn *default_conn;
26-
2725
static const struct bt_data ad[] = {
2826
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
2927
BT_DATA_BYTES(BT_DATA_UUID16_ALL,
@@ -37,19 +35,13 @@ static void connected(struct bt_conn *conn, uint8_t err)
3735
if (err) {
3836
printk("Connection failed (err 0x%02x)\n", err);
3937
} else {
40-
default_conn = bt_conn_ref(conn);
4138
printk("Connected\n");
4239
}
4340
}
4441

4542
static void disconnected(struct bt_conn *conn, uint8_t reason)
4643
{
4744
printk("Disconnected (reason 0x%02x)\n", reason);
48-
49-
if (default_conn) {
50-
bt_conn_unref(default_conn);
51-
default_conn = NULL;
52-
}
5345
}
5446

5547
static struct bt_conn_cb conn_callbacks = {

samples/bluetooth/peripheral_ht/src/main.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
#include "hts.h"
2525

26-
struct bt_conn *default_conn;
27-
2826
static const struct bt_data ad[] = {
2927
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
3028
BT_DATA_BYTES(BT_DATA_UUID16_ALL,
@@ -38,19 +36,13 @@ static void connected(struct bt_conn *conn, uint8_t err)
3836
if (err) {
3937
printk("Connection failed (err 0x%02x)\n", err);
4038
} else {
41-
default_conn = bt_conn_ref(conn);
4239
printk("Connected\n");
4340
}
4441
}
4542

4643
static void disconnected(struct bt_conn *conn, uint8_t reason)
4744
{
4845
printk("Disconnected (reason 0x%02x)\n", reason);
49-
50-
if (default_conn) {
51-
bt_conn_unref(default_conn);
52-
default_conn = NULL;
53-
}
5446
}
5547

5648
static struct bt_conn_cb conn_callbacks = {

0 commit comments

Comments
 (0)