Line data Source code
1 1 : /*
2 : * Copyright Runtime.io 2018. All rights reserved.
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : /** @file
8 : * @brief Bluetooth transport for the mcumgr SMP protocol.
9 : * @ingroup mcumgr_transport_bt
10 : */
11 :
12 : #ifndef ZEPHYR_INCLUDE_MGMT_SMP_BT_H_
13 : #define ZEPHYR_INCLUDE_MGMT_SMP_BT_H_
14 :
15 : /**
16 : * @brief This allows to use the MCUmgr SMP protocol over Bluetooth.
17 : * @defgroup mcumgr_transport_bt Bluetooth transport
18 : * @ingroup mcumgr_transport
19 : * @{
20 : */
21 :
22 : #include <zephyr/bluetooth/uuid.h>
23 : #include <zephyr/types.h>
24 : struct bt_conn;
25 :
26 : #ifdef __cplusplus
27 : extern "C" {
28 : #endif
29 :
30 : /** SMP service UUID value. */
31 1 : #define SMP_BT_SVC_UUID_VAL \
32 : BT_UUID_128_ENCODE(0x8d53dc1d, 0x1db7, 0x4cd3, 0x868b, 0x8a527460aa84)
33 :
34 : /** SMP service UUID. */
35 1 : #define SMP_BT_SVC_UUID \
36 : BT_UUID_DECLARE_128(SMP_BT_SVC_UUID_VAL)
37 :
38 : /** SMP characteristic UUID value. */
39 1 : #define SMP_BT_CHR_UUID_VAL \
40 : BT_UUID_128_ENCODE(0xda2e7828, 0xfbce, 0x4e01, 0xae9e, 0x261174997c48)
41 :
42 : /** SMP characteristic UUID
43 : * Used for both requests and responses.
44 : */
45 1 : #define SMP_BT_CHR_UUID \
46 : BT_UUID_DECLARE_128(SMP_BT_CHR_UUID_VAL)
47 :
48 : /**
49 : * @brief Registers the SMP Bluetooth service. Should only be called if the Bluetooth
50 : * transport has been unregistered by calling smp_bt_unregister().
51 : *
52 : * @return 0 on success; negative error code on failure.
53 : */
54 1 : int smp_bt_register(void);
55 :
56 : /**
57 : * @brief Unregisters the SMP Bluetooth service.
58 : *
59 : * @return 0 on success; negative error code on failure.
60 : */
61 1 : int smp_bt_unregister(void);
62 :
63 : /**
64 : * @brief Transmits an SMP command/response over the specified Bluetooth connection as a
65 : * notification.
66 : *
67 : * @param conn Connection object.
68 : * @param data Pointer to SMP message.
69 : * @param len data length.
70 : *
71 : * @return 0 in case of success or negative value in case of error.
72 : */
73 1 : int smp_bt_notify(struct bt_conn *conn, const void *data, uint16_t len);
74 :
75 : #ifdef __cplusplus
76 : }
77 : #endif
78 :
79 : /**
80 : * @}
81 : */
82 :
83 : #endif
|