Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions include/zephyr/mgmt/mcumgr/transport/smp_bt.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,32 @@
#ifndef ZEPHYR_INCLUDE_MGMT_SMP_BT_H_
#define ZEPHYR_INCLUDE_MGMT_SMP_BT_H_

#include <zephyr/bluetooth/uuid.h>
#include <zephyr/types.h>
struct bt_conn;

#ifdef __cplusplus
extern "C" {
#endif

/** SMP service UUID value. */
#define SMP_BT_SVC_UUID_VAL \
BT_UUID_128_ENCODE(0x8d53dc1d, 0x1db7, 0x4cd3, 0x868b, 0x8a527460aa84)

/** SMP service UUID. */
#define SMP_BT_SVC_UUID \
BT_UUID_DECLARE_128(SMP_BT_SVC_UUID_VAL)

/** SMP characteristic UUID value. */
#define SMP_BT_CHR_UUID_VAL \
BT_UUID_128_ENCODE(0xda2e7828, 0xfbce, 0x4e01, 0xae9e, 0x261174997c48)

/** SMP characteristic UUID
* Used for both requests and responses.
*/
#define SMP_BT_CHR_UUID \
BT_UUID_DECLARE_128(SMP_BT_CHR_UUID_VAL)

Check notice on line 39 in include/zephyr/mgmt/mcumgr/transport/smp_bt.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/mgmt/mcumgr/transport/smp_bt.h:39 -#define SMP_BT_SVC_UUID_VAL \ - BT_UUID_128_ENCODE(0x8d53dc1d, 0x1db7, 0x4cd3, 0x868b, 0x8a527460aa84) +#define SMP_BT_SVC_UUID_VAL BT_UUID_128_ENCODE(0x8d53dc1d, 0x1db7, 0x4cd3, 0x868b, 0x8a527460aa84) /** SMP service UUID. */ -#define SMP_BT_SVC_UUID \ - BT_UUID_DECLARE_128(SMP_BT_SVC_UUID_VAL) +#define SMP_BT_SVC_UUID BT_UUID_DECLARE_128(SMP_BT_SVC_UUID_VAL) /** SMP characteristic UUID value. */ -#define SMP_BT_CHR_UUID_VAL \ - BT_UUID_128_ENCODE(0xda2e7828, 0xfbce, 0x4e01, 0xae9e, 0x261174997c48) +#define SMP_BT_CHR_UUID_VAL BT_UUID_128_ENCODE(0xda2e7828, 0xfbce, 0x4e01, 0xae9e, 0x261174997c48) /** SMP characteristic UUID * Used for both requests and responses. */ -#define SMP_BT_CHR_UUID \ - BT_UUID_DECLARE_128(SMP_BT_CHR_UUID_VAL) +#define SMP_BT_CHR_UUID BT_UUID_DECLARE_128(SMP_BT_CHR_UUID_VAL)

Check notice on line 39 in include/zephyr/mgmt/mcumgr/transport/smp_bt.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/mgmt/mcumgr/transport/smp_bt.h:39 -#define SMP_BT_SVC_UUID_VAL \ - BT_UUID_128_ENCODE(0x8d53dc1d, 0x1db7, 0x4cd3, 0x868b, 0x8a527460aa84) +#define SMP_BT_SVC_UUID_VAL BT_UUID_128_ENCODE(0x8d53dc1d, 0x1db7, 0x4cd3, 0x868b, 0x8a527460aa84) /** SMP service UUID. */ -#define SMP_BT_SVC_UUID \ - BT_UUID_DECLARE_128(SMP_BT_SVC_UUID_VAL) +#define SMP_BT_SVC_UUID BT_UUID_DECLARE_128(SMP_BT_SVC_UUID_VAL) /** SMP characteristic UUID value. */ -#define SMP_BT_CHR_UUID_VAL \ - BT_UUID_128_ENCODE(0xda2e7828, 0xfbce, 0x4e01, 0xae9e, 0x261174997c48) +#define SMP_BT_CHR_UUID_VAL BT_UUID_128_ENCODE(0xda2e7828, 0xfbce, 0x4e01, 0xae9e, 0x261174997c48) /** SMP characteristic UUID * Used for both requests and responses. */ -#define SMP_BT_CHR_UUID \ - BT_UUID_DECLARE_128(SMP_BT_CHR_UUID_VAL) +#define SMP_BT_CHR_UUID BT_UUID_DECLARE_128(SMP_BT_CHR_UUID_VAL)

Check notice on line 39 in include/zephyr/mgmt/mcumgr/transport/smp_bt.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/mgmt/mcumgr/transport/smp_bt.h:39 -#define SMP_BT_SVC_UUID_VAL \ - BT_UUID_128_ENCODE(0x8d53dc1d, 0x1db7, 0x4cd3, 0x868b, 0x8a527460aa84) +#define SMP_BT_SVC_UUID_VAL BT_UUID_128_ENCODE(0x8d53dc1d, 0x1db7, 0x4cd3, 0x868b, 0x8a527460aa84) /** SMP service UUID. */ -#define SMP_BT_SVC_UUID \ - BT_UUID_DECLARE_128(SMP_BT_SVC_UUID_VAL) +#define SMP_BT_SVC_UUID BT_UUID_DECLARE_128(SMP_BT_SVC_UUID_VAL) /** SMP characteristic UUID value. */ -#define SMP_BT_CHR_UUID_VAL \ - BT_UUID_128_ENCODE(0xda2e7828, 0xfbce, 0x4e01, 0xae9e, 0x261174997c48) +#define SMP_BT_CHR_UUID_VAL BT_UUID_128_ENCODE(0xda2e7828, 0xfbce, 0x4e01, 0xae9e, 0x261174997c48) /** SMP characteristic UUID * Used for both requests and responses. */ -#define SMP_BT_CHR_UUID \ - BT_UUID_DECLARE_128(SMP_BT_CHR_UUID_VAL) +#define SMP_BT_CHR_UUID BT_UUID_DECLARE_128(SMP_BT_CHR_UUID_VAL)
/**
* @brief Registers the SMP Bluetooth service. Should only be called if the Bluetooth
* transport has been unregistered by calling smp_bt_unregister().
Expand Down
16 changes: 2 additions & 14 deletions subsys/mgmt/mcumgr/transport/src/smp_bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,6 @@
static struct smp_transport smp_bt_transport;
static struct conn_param_data conn_data[CONFIG_BT_MAX_CONN];

/* SMP service.
* {8D53DC1D-1DB7-4CD3-868B-8A527460AA84}
*/
static const struct bt_uuid_128 smp_bt_svc_uuid = BT_UUID_INIT_128(
BT_UUID_128_ENCODE(0x8d53dc1d, 0x1db7, 0x4cd3, 0x868b, 0x8a527460aa84));

/* SMP characteristic; used for both requests and responses.
* {DA2E7828-FBCE-4E01-AE9E-261174997C48}
*/
static const struct bt_uuid_128 smp_bt_chr_uuid = BT_UUID_INIT_128(
BT_UUID_128_ENCODE(0xda2e7828, 0xfbce, 0x4e01, 0xae9e, 0x261174997c48));

static void connected(struct bt_conn *conn, uint8_t err);
static void disconnected(struct bt_conn *conn, uint8_t reason);

Expand Down Expand Up @@ -375,8 +363,8 @@
}

#define SMP_BT_ATTRS \
BT_GATT_PRIMARY_SERVICE(&smp_bt_svc_uuid), \
BT_GATT_CHARACTERISTIC(&smp_bt_chr_uuid.uuid, \
BT_GATT_PRIMARY_SERVICE(SMP_BT_SVC_UUID), \
BT_GATT_CHARACTERISTIC(SMP_BT_CHR_UUID, \
BT_GATT_CHRC_WRITE_WITHOUT_RESP | \
BT_GATT_CHRC_NOTIFY, \
SMP_GATT_PERM & SMP_GATT_PERM_WRITE_MASK, \
Expand All @@ -384,7 +372,7 @@
BT_GATT_CCC(smp_bt_ccc_changed, \
SMP_GATT_PERM),


Check notice on line 375 in subsys/mgmt/mcumgr/transport/src/smp_bt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/mgmt/mcumgr/transport/src/smp_bt.c:375 -#define SMP_BT_ATTRS \ - BT_GATT_PRIMARY_SERVICE(SMP_BT_SVC_UUID), \ - BT_GATT_CHARACTERISTIC(SMP_BT_CHR_UUID, \ - BT_GATT_CHRC_WRITE_WITHOUT_RESP | \ - BT_GATT_CHRC_NOTIFY, \ - SMP_GATT_PERM & SMP_GATT_PERM_WRITE_MASK, \ - NULL, smp_bt_chr_write, NULL), \ - BT_GATT_CCC(smp_bt_ccc_changed, \ - SMP_GATT_PERM), - +#define SMP_BT_ATTRS \ + BT_GATT_PRIMARY_SERVICE(SMP_BT_SVC_UUID), \ + BT_GATT_CHARACTERISTIC( \ + SMP_BT_CHR_UUID, BT_GATT_CHRC_WRITE_WITHOUT_RESP | BT_GATT_CHRC_NOTIFY, \ + SMP_GATT_PERM & SMP_GATT_PERM_WRITE_MASK, NULL, smp_bt_chr_write, NULL), \ + BT_GATT_CCC(smp_bt_ccc_changed, SMP_GATT_PERM),

Check notice on line 375 in subsys/mgmt/mcumgr/transport/src/smp_bt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/mgmt/mcumgr/transport/src/smp_bt.c:375 -#define SMP_BT_ATTRS \ - BT_GATT_PRIMARY_SERVICE(SMP_BT_SVC_UUID), \ - BT_GATT_CHARACTERISTIC(SMP_BT_CHR_UUID, \ - BT_GATT_CHRC_WRITE_WITHOUT_RESP | \ - BT_GATT_CHRC_NOTIFY, \ - SMP_GATT_PERM & SMP_GATT_PERM_WRITE_MASK, \ - NULL, smp_bt_chr_write, NULL), \ - BT_GATT_CCC(smp_bt_ccc_changed, \ - SMP_GATT_PERM), - +#define SMP_BT_ATTRS \ + BT_GATT_PRIMARY_SERVICE(SMP_BT_SVC_UUID), \ + BT_GATT_CHARACTERISTIC( \ + SMP_BT_CHR_UUID, BT_GATT_CHRC_WRITE_WITHOUT_RESP | BT_GATT_CHRC_NOTIFY, \ + SMP_GATT_PERM & SMP_GATT_PERM_WRITE_MASK, NULL, smp_bt_chr_write, NULL), \ + BT_GATT_CCC(smp_bt_ccc_changed, SMP_GATT_PERM),

Check notice on line 375 in subsys/mgmt/mcumgr/transport/src/smp_bt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/mgmt/mcumgr/transport/src/smp_bt.c:375 -#define SMP_BT_ATTRS \ - BT_GATT_PRIMARY_SERVICE(SMP_BT_SVC_UUID), \ - BT_GATT_CHARACTERISTIC(SMP_BT_CHR_UUID, \ - BT_GATT_CHRC_WRITE_WITHOUT_RESP | \ - BT_GATT_CHRC_NOTIFY, \ - SMP_GATT_PERM & SMP_GATT_PERM_WRITE_MASK, \ - NULL, smp_bt_chr_write, NULL), \ - BT_GATT_CCC(smp_bt_ccc_changed, \ - SMP_GATT_PERM), - +#define SMP_BT_ATTRS \ + BT_GATT_PRIMARY_SERVICE(SMP_BT_SVC_UUID), \ + BT_GATT_CHARACTERISTIC( \ + SMP_BT_CHR_UUID, BT_GATT_CHRC_WRITE_WITHOUT_RESP | BT_GATT_CHRC_NOTIFY, \ + SMP_GATT_PERM & SMP_GATT_PERM_WRITE_MASK, NULL, smp_bt_chr_write, NULL), \ + BT_GATT_CCC(smp_bt_ccc_changed, SMP_GATT_PERM),
#ifdef CONFIG_MCUMGR_TRANSPORT_BT_DYNAMIC_SVC_REGISTRATION
static struct bt_gatt_attr attr_smp_bt_svc[] = {SMP_BT_ATTRS};
static struct bt_gatt_service smp_bt_svc = BT_GATT_SERVICE(attr_smp_bt_svc);
Expand Down
Loading