29#include <bm/softdevice_handler/nrf_sdh_ble.h>
30#include <bm/bluetooth/ble_qwr.h>
42#define BLE_BMS_DEF(_name) \
43 static struct ble_bms _name; \
44 NRF_SDH_BLE_OBSERVER(_name##_obs, ble_bms_on_ble_evt, &_name, HIGH)
47#define BLE_BMS_CONFIG_SEC_MODE_DEFAULT \
49 .feature_char.read = BLE_GAP_CONN_SEC_MODE_ENC_NO_MITM, \
50 .ctrlpt_char.write = BLE_GAP_CONN_SEC_MODE_ENC_NO_MITM, \
54#define BLE_BMS_CTRLPT_MAX_LEN 128
56#define BLE_BMS_AUTH_CODE_MAX_LEN BLE_BMS_CTRLPT_MAX_LEN - 1
62#define BLE_BMS_REQUESTING_DEVICE_BR_LE (0x01 << 0)
64#define BLE_BMS_REQUESTING_DEVICE_BR_LE_AUTH_CODE (0x01 << 1)
66#define BLE_BMS_REQUESTING_DEVICE_BR (0x01 << 2)
68#define BLE_BMS_REQUESTING_DEVICE_BR_AUTH_CODE (0x01 << 3)
70#define BLE_BMS_REQUESTING_DEVICE_LE (0x01 << 4)
72#define BLE_BMS_REQUESTING_DEVICE_LE_AUTH_CODE (0x01 << 5)
74#define BLE_BMS_ALL_BONDS_BR_LE (0x01 << 6)
76#define BLE_BMS_ALL_BONDS_BR_LE_AUTH_CODE (0x01 << 7)
78#define BLE_BMS_ALL_BONDS_BR (0x01 << 8)
80#define BLE_BMS_ALL_BONDS_BR_AUTH_CODE (0x01 << 9)
82#define BLE_BMS_ALL_BONDS_LE (0x01 << 10)
84#define BLE_BMS_ALL_BONDS_LE_AUTH_CODE (0x01 << 11)
88#define BLE_BMS_ALL_EXCEPT_REQUESTING_DEVICE_BR_LE (0x01 << 12)
92#define BLE_BMS_ALL_EXCEPT_REQUESTING_DEVICE_BR_LE_AUTH_CODE (0x01 << 13)
96#define BLE_BMS_ALL_EXCEPT_REQUESTING_DEVICE_BR (0x01 << 14)
100#define BLE_BMS_ALL_EXCEPT_REQUESTING_DEVICE_BR_AUTH_CODE (0x01 << 15)
104#define BLE_BMS_ALL_EXCEPT_REQUESTING_DEVICE_LE (0x01 << 16)
108#define BLE_BMS_ALL_EXCEPT_REQUESTING_DEVICE_LE_AUTH_CODE (0x01 << 17)
112#define BLE_BMS_OPCODE_NOT_SUPPORTED 0x80
114#define BLE_BMS_OPERATION_FAILED 0x81
void(* ble_bms_evt_handler_t)(struct ble_bms *bms, struct ble_bms_evt *evt)
BMS event handler type.
Definition ble_bms.h:243
ble_bms_auth_status
Authorization status values.
Definition ble_bms.h:177
@ BLE_BMS_AUTH_STATUS_PENDING
Definition ble_bms.h:183
@ BLE_BMS_AUTH_STATUS_DENIED
Definition ble_bms.h:181
@ BLE_BMS_AUTH_STATUS_ALLOWED
Definition ble_bms.h:179
uint16_t ble_bms_on_qwr_evt(struct ble_bms *bms, struct ble_qwr *qwr, const struct ble_qwr_evt *evt)
Handle events from the nrf_ble_qwr.
#define BLE_BMS_AUTH_CODE_MAX_LEN
Definition ble_bms.h:56
uint32_t ble_bms_auth_response(struct ble_bms *bms, bool authorize)
Respond to an authorization request.
void ble_bms_on_ble_evt(const ble_evt_t *ble_evt, void *ble_bms)
Bluetooth LE event handler for the Bond Management Service.
ble_bms_evt_type
BMS event types.
Definition ble_bms.h:195
@ BLE_BMS_EVT_BOND_DELETE_ALL_EXCEPT_REQUESTING
Definition ble_bms.h:207
@ BLE_BMS_EVT_BOND_DELETE_ALL
Definition ble_bms.h:205
@ BLE_BMS_EVT_BOND_DELETE_REQUESTING
Definition ble_bms.h:203
@ BLE_BMS_EVT_ERROR
Definition ble_bms.h:197
@ BLE_BMS_EVT_AUTH
Definition ble_bms.h:201
ble_bms_op
BMS Control Point opcodes.
Definition ble_bms.h:143
@ BLE_BMS_OP_DEL_ALL_BONDS_ON_SERVER_BR_ONLY
Definition ble_bms.h:157
@ BLE_BMS_OP_DEL_ALL_BUT_ACTIVE_BOND_BR_LE
Definition ble_bms.h:163
@ BLE_BMS_OP_DEL_BOND_REQ_DEVICE_BR_ONLY
Definition ble_bms.h:150
@ BLE_BMS_OP_DEL_BOND_REQ_DEVICE_LE_ONLY
Definition ble_bms.h:152
@ BLE_BMS_OP_NONE
Definition ble_bms.h:173
@ BLE_BMS_OP_DEL_ALL_BONDS_ON_SERVER_BR_LE
Definition ble_bms.h:155
@ BLE_BMS_OP_DEL_ALL_BONDS_ON_SERVER_LE_ONLY
Definition ble_bms.h:159
@ BLE_BMS_OP_DEL_ALL_BUT_ACTIVE_BOND_LE_ONLY
Definition ble_bms.h:171
@ BLE_BMS_OP_DEL_ALL_BUT_ACTIVE_BOND_BR_ONLY
Definition ble_bms.h:167
@ BLE_BMS_OP_DEL_BOND_REQ_DEVICE_BR_LE
Definition ble_bms.h:147
uint32_t ble_bms_init(struct ble_bms *bms, struct ble_bms_config *bms_config)
Initialize the Bond Management Service.
uint8_t code[128 - 1]
Definition ble_bms.h:189
uint16_t len
Definition ble_bms.h:191
Received authorization codes.
Definition ble_bms.h:187
ble_gap_conn_sec_mode_t write
Definition ble_bms.h:264
ble_bms_evt_handler_t evt_handler
Definition ble_bms.h:248
struct ble_bms_features feature
Definition ble_bms.h:250
struct ble_bms_config::@59 sec_mode
ble_gap_conn_sec_mode_t read
Definition ble_bms.h:259
uint8_t qwr_count
Definition ble_bms.h:254
struct ble_qwr * qwr
Definition ble_bms.h:252
BMS initialization structure with all information needed to initialize the service.
Definition ble_bms.h:246
enum ble_bms_op op_code
Definition ble_bms.h:231
struct ble_bms_auth_code auth_code
Definition ble_bms.h:233
BMS control points.
Definition ble_bms.h:229
struct ble_bms_evt::@55::@58 auth
struct ble_bms_auth_code auth_code
Definition ble_bms.h:223
struct ble_bms_evt::@55::@57 error
enum ble_bms_evt_type evt_type
Definition ble_bms.h:213
uint32_t reason
Definition ble_bms.h:218
BMS events.
Definition ble_bms.h:211
bool delete_all_but_requesting_auth
Definition ble_bms.h:139
bool delete_requesting_auth
Definition ble_bms.h:131
bool delete_all
Definition ble_bms.h:119
bool delete_all_auth
Definition ble_bms.h:123
bool delete_all_but_requesting
Definition ble_bms.h:135
bool delete_requesting
Definition ble_bms.h:127
Supported features.
Definition ble_bms.h:117
ble_gatts_char_handles_t feature_handles
Definition ble_bms.h:282
uint16_t service_handle
Definition ble_bms.h:272
enum ble_bms_auth_status auth_status
Definition ble_bms.h:286
struct ble_bms_features feature
Definition ble_bms.h:280
ble_bms_evt_handler_t evt_handler
Definition ble_bms.h:278
uint16_t conn_handle
Definition ble_bms.h:276
ble_gatts_char_handles_t ctrlpt_handles
Definition ble_bms.h:284
Status information for the service.
Definition ble_bms.h:270
Queued Writes module events.
Definition ble_qwr.h:58
Queued Writes structure.
Definition ble_qwr.h:96