diff options
-rw-r--r-- | apps/bletiny/src/bletiny_priv.h | 2 | ||||
-rw-r--r-- | apps/bletiny/src/cmd.c | 2 | ||||
-rwxr-xr-x | apps/bletiny/src/main.c | 18 | ||||
-rw-r--r-- | net/nimble/host/src/ble_att_clt.c | 48 | ||||
-rw-r--r-- | net/nimble/host/src/ble_att_svr.c | 26 | ||||
-rw-r--r-- | net/nimble/host/src/ble_eddystone.c | 4 | ||||
-rw-r--r-- | net/nimble/host/src/ble_gap.c | 30 | ||||
-rw-r--r-- | net/nimble/host/src/ble_gattc.c | 64 | ||||
-rw-r--r-- | net/nimble/host/src/ble_gatts.c | 2 | ||||
-rw-r--r-- | net/nimble/host/src/ble_hs_adv.c | 4 | ||||
-rw-r--r-- | net/nimble/host/src/ble_hs_cfg.c | 4 | ||||
-rw-r--r-- | net/nimble/host/src/ble_hs_conn.c | 22 | ||||
-rw-r--r-- | net/nimble/host/src/ble_l2cap_sm.c | 2 | ||||
-rw-r--r-- | net/nimble/host/src/ble_l2cap_sm_alg.c | 2 | ||||
-rw-r--r-- | net/nimble/host/src/ble_l2cap_sm_cmd.c | 2 | ||||
-rw-r--r-- | net/nimble/host/src/ble_l2cap_sm_priv.h | 4 | ||||
-rw-r--r-- | net/nimble/host/src/test/ble_l2cap_sm_test.c | 4 | ||||
-rw-r--r-- | net/nimble/include/nimble/nimble_opt.h | 9 |
18 files changed, 129 insertions, 120 deletions
diff --git a/apps/bletiny/src/bletiny_priv.h b/apps/bletiny/src/bletiny_priv.h index d27740f6..fc85bc8d 100644 --- a/apps/bletiny/src/bletiny_priv.h +++ b/apps/bletiny/src/bletiny_priv.h @@ -76,7 +76,7 @@ struct bletiny_conn { struct bletiny_svc_list svcs; }; -extern struct bletiny_conn bletiny_conns[NIMBLE_OPT_MAX_CONNECTIONS]; +extern struct bletiny_conn bletiny_conns[NIMBLE_OPT(MAX_CONNECTIONS)]; extern int bletiny_num_conns; extern const char *bletiny_device_name; diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c index 4510c3e7..50151573 100644 --- a/apps/bletiny/src/cmd.c +++ b/apps/bletiny/src/cmd.c @@ -1698,7 +1698,7 @@ cmd_write(int argc, char **argv) static int cmd_passkey(int argc, char **argv) { -#if !NIMBLE_OPT_SM +#if !NIMBLE_OPT(SM) return BLE_HS_ENOTSUP; #endif diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c index 02f08fae..9c07f76b 100755 --- a/apps/bletiny/src/main.c +++ b/apps/bletiny/src/main.c @@ -86,7 +86,7 @@ struct os_mempool default_mbuf_mpool; #define BLETINY_STACK_SIZE (OS_STACK_ALIGN(288)) #define BLETINY_TASK_PRIO 1 -#if NIMBLE_OPT_ROLE_CENTRAL +#if NIMBLE_OPT(ROLE_CENTRAL) #define BLETINY_MAX_SVCS 32 #define BLETINY_MAX_CHRS 64 #define BLETINY_MAX_DSCS 64 @@ -105,13 +105,13 @@ bssnz_t os_stack_t bletiny_stack[BLETINY_STACK_SIZE]; static struct log_handler bletiny_log_console_handler; struct log bletiny_log; -struct bletiny_conn ble_shell_conns[NIMBLE_OPT_MAX_CONNECTIONS]; +struct bletiny_conn ble_shell_conns[NIMBLE_OPT(MAX_CONNECTIONS)]; int bletiny_num_conns; void bletest_inc_adv_pkt_num(void) { } -bssnz_t struct bletiny_conn bletiny_conns[NIMBLE_OPT_MAX_CONNECTIONS]; +bssnz_t struct bletiny_conn bletiny_conns[NIMBLE_OPT(MAX_CONNECTIONS)]; int bletiny_num_conns; static void *bletiny_svc_mem; @@ -386,7 +386,7 @@ bletiny_conn_add(struct ble_gap_conn_desc *desc) { struct bletiny_conn *conn; - assert(bletiny_num_conns < NIMBLE_OPT_MAX_CONNECTIONS); + assert(bletiny_num_conns < NIMBLE_OPT(MAX_CONNECTIONS)); conn = bletiny_conns + bletiny_num_conns; bletiny_num_conns++; @@ -416,7 +416,7 @@ bletiny_conn_delete_idx(int idx) /* This '#if' is not strictly necessary. It is here to prevent a spurious * warning from being reported. */ -#if NIMBLE_OPT_MAX_CONNECTIONS > 1 +#if NIMBLE_OPT(MAX_CONNECTIONS) > 1 int i; for (i = idx + 1; i < bletiny_num_conns; i++) { bletiny_conns[i - 1] = bletiny_conns[i]; @@ -1338,7 +1338,7 @@ bletiny_show_rssi(uint16_t conn_handle) int bletiny_sec_start(uint16_t conn_handle) { -#if !NIMBLE_OPT_SM +#if !NIMBLE_OPT(SM) return BLE_HS_ENOTSUP; #endif @@ -1355,9 +1355,9 @@ bletiny_sec_restart(uint16_t conn_handle, uint64_t rand_val, int auth) { - #if !NIMBLE_OPT_SM - return BLE_HS_ENOTSUP; - #endif +#if !NIMBLE_OPT(SM) + return BLE_HS_ENOTSUP; +#endif int rc; diff --git a/net/nimble/host/src/ble_att_clt.c b/net/nimble/host/src/ble_att_clt.c index 5f628c66..a049f333 100644 --- a/net/nimble/host/src/ble_att_clt.c +++ b/net/nimble/host/src/ble_att_clt.c @@ -290,7 +290,7 @@ int ble_att_clt_tx_find_info(uint16_t conn_handle, struct ble_att_find_info_req *req) { -#if !NIMBLE_OPT_ATT_CLT_FIND_INFO +#if !NIMBLE_OPT(ATT_CLT_FIND_INFO) return BLE_HS_ENOTSUP; #endif @@ -372,7 +372,7 @@ ble_att_clt_parse_find_info_entry(struct os_mbuf **rxom, uint8_t rsp_format, int ble_att_clt_rx_find_info(uint16_t conn_handle, struct os_mbuf **om) { -#if !NIMBLE_OPT_ATT_CLT_FIND_INFO +#if !NIMBLE_OPT(ATT_CLT_FIND_INFO) return BLE_HS_ENOTSUP; #endif @@ -441,7 +441,7 @@ ble_att_clt_tx_find_type_value(uint16_t conn_handle, struct ble_att_find_type_value_req *req, void *attribute_value, int value_len) { -#if !NIMBLE_OPT_ATT_CLT_FIND_TYPE +#if !NIMBLE_OPT(ATT_CLT_FIND_TYPE) return BLE_HS_ENOTSUP; #endif @@ -488,7 +488,7 @@ ble_att_clt_parse_find_type_value_hinfo( int ble_att_clt_rx_find_type_value(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_FIND_TYPE +#if !NIMBLE_OPT(ATT_CLT_FIND_TYPE) return BLE_HS_ENOTSUP; #endif @@ -560,7 +560,7 @@ ble_att_clt_tx_read_type(uint16_t conn_handle, struct ble_att_read_type_req *req, void *uuid128) { -#if !NIMBLE_OPT_ATT_CLT_READ_TYPE +#if !NIMBLE_OPT(ATT_CLT_READ_TYPE) return BLE_HS_ENOTSUP; #endif @@ -607,7 +607,7 @@ ble_att_clt_parse_read_type_adata(struct os_mbuf **om, int data_len, int ble_att_clt_rx_read_type(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_READ_TYPE +#if !NIMBLE_OPT(ATT_CLT_READ_TYPE) return BLE_HS_ENOTSUP; #endif @@ -676,7 +676,7 @@ done: int ble_att_clt_tx_read(uint16_t conn_handle, struct ble_att_read_req *req) { -#if !NIMBLE_OPT_ATT_CLT_READ +#if !NIMBLE_OPT(ATT_CLT_READ) return BLE_HS_ENOTSUP; #endif @@ -703,7 +703,7 @@ ble_att_clt_tx_read(uint16_t conn_handle, struct ble_att_read_req *req) int ble_att_clt_rx_read(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_READ +#if !NIMBLE_OPT(ATT_CLT_READ) return BLE_HS_ENOTSUP; #endif @@ -758,7 +758,7 @@ int ble_att_clt_tx_read_blob(uint16_t conn_handle, struct ble_att_read_blob_req *req) { -#if !NIMBLE_OPT_ATT_CLT_READ_BLOB +#if !NIMBLE_OPT(ATT_CLT_READ_BLOB) return BLE_HS_ENOTSUP; #endif @@ -785,7 +785,7 @@ ble_att_clt_tx_read_blob(uint16_t conn_handle, int ble_att_clt_rx_read_blob(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_READ_BLOB +#if !NIMBLE_OPT(ATT_CLT_READ_BLOB) return BLE_HS_ENOTSUP; #endif @@ -854,7 +854,7 @@ int ble_att_clt_tx_read_mult(uint16_t conn_handle, uint16_t *att_handles, int num_att_handles) { -#if !NIMBLE_OPT_ATT_CLT_READ_MULT +#if !NIMBLE_OPT(ATT_CLT_READ_MULT) return BLE_HS_ENOTSUP; #endif @@ -881,7 +881,7 @@ ble_att_clt_tx_read_mult(uint16_t conn_handle, uint16_t *att_handles, int ble_att_clt_rx_read_mult(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_READ_MULT +#if !NIMBLE_OPT(ATT_CLT_READ_MULT) return BLE_HS_ENOTSUP; #endif @@ -942,7 +942,7 @@ ble_att_clt_tx_read_group_type(uint16_t conn_handle, struct ble_att_read_group_type_req *req, void *uuid128) { -#if !NIMBLE_OPT_ATT_CLT_READ_GROUP_TYPE +#if !NIMBLE_OPT(ATT_CLT_READ_GROUP_TYPE) return BLE_HS_ENOTSUP; #endif @@ -997,7 +997,7 @@ ble_att_clt_parse_read_group_type_adata( int ble_att_clt_rx_read_group_type(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_READ_GROUP_TYPE +#if !NIMBLE_OPT(ATT_CLT_READ_GROUP_TYPE) return BLE_HS_ENOTSUP; #endif @@ -1101,7 +1101,7 @@ int ble_att_clt_tx_write_req(uint16_t conn_handle, struct ble_att_write_req *req, void *value, uint16_t value_len) { -#if !NIMBLE_OPT_ATT_CLT_WRITE +#if !NIMBLE_OPT(ATT_CLT_WRITE) return BLE_HS_ENOTSUP; #endif @@ -1117,7 +1117,7 @@ ble_att_clt_tx_write_cmd(uint16_t conn_handle, struct ble_att_write_req *req, void *value, uint16_t value_len) { -#if !NIMBLE_OPT_ATT_CLT_WRITE_NO_RSP +#if !NIMBLE_OPT(ATT_CLT_WRITE_NO_RSP) return BLE_HS_ENOTSUP; #endif @@ -1131,7 +1131,7 @@ ble_att_clt_tx_write_cmd(uint16_t conn_handle, int ble_att_clt_rx_write(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_WRITE +#if !NIMBLE_OPT(ATT_CLT_WRITE) return BLE_HS_ENOTSUP; #endif @@ -1182,7 +1182,7 @@ ble_att_clt_tx_prep_write(uint16_t conn_handle, struct ble_att_prep_write_cmd *req, void *value, uint16_t value_len) { -#if !NIMBLE_OPT_ATT_CLT_PREP_WRITE +#if !NIMBLE_OPT(ATT_CLT_PREP_WRITE) return BLE_HS_ENOTSUP; #endif @@ -1220,7 +1220,7 @@ ble_att_clt_tx_prep_write(uint16_t conn_handle, int ble_att_clt_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_PREP_WRITE +#if !NIMBLE_OPT(ATT_CLT_PREP_WRITE) return BLE_HS_ENOTSUP; #endif @@ -1287,7 +1287,7 @@ int ble_att_clt_tx_exec_write(uint16_t conn_handle, struct ble_att_exec_write_req *req) { -#if !NIMBLE_OPT_ATT_CLT_EXEC_WRITE +#if !NIMBLE_OPT(ATT_CLT_EXEC_WRITE) return BLE_HS_ENOTSUP; #endif @@ -1314,7 +1314,7 @@ ble_att_clt_tx_exec_write(uint16_t conn_handle, int ble_att_clt_rx_exec_write(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_EXEC_WRITE +#if !NIMBLE_OPT(ATT_CLT_EXEC_WRITE) return BLE_HS_ENOTSUP; #endif @@ -1370,7 +1370,7 @@ int ble_att_clt_tx_notify(uint16_t conn_handle, struct ble_att_notify_req *req, void *value, uint16_t value_len) { -#if !NIMBLE_OPT_ATT_CLT_NOTIFY +#if !NIMBLE_OPT(ATT_CLT_NOTIFY) return BLE_HS_ENOTSUP; #endif @@ -1437,7 +1437,7 @@ ble_att_clt_tx_indicate(uint16_t conn_handle, struct ble_att_indicate_req *req, void *value, uint16_t value_len) { -#if !NIMBLE_OPT_ATT_CLT_INDICATE +#if !NIMBLE_OPT(ATT_CLT_INDICATE) return BLE_HS_ENOTSUP; #endif @@ -1466,7 +1466,7 @@ ble_att_clt_tx_indicate(uint16_t conn_handle, int ble_att_clt_rx_indicate(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_CLT_INDICATE +#if !NIMBLE_OPT(ATT_CLT_INDICATE) return BLE_HS_ENOTSUP; #endif diff --git a/net/nimble/host/src/ble_att_svr.c b/net/nimble/host/src/ble_att_svr.c index 44cde96b..df427888 100644 --- a/net/nimble/host/src/ble_att_svr.c +++ b/net/nimble/host/src/ble_att_svr.c @@ -776,7 +776,7 @@ done: int ble_att_svr_rx_find_info(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_FIND_INFO +#if !NIMBLE_OPT(ATT_SVR_FIND_INFO) return BLE_HS_ENOTSUP; #endif @@ -1088,7 +1088,7 @@ done: int ble_att_svr_rx_find_type_value(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_FIND_TYPE +#if !NIMBLE_OPT(ATT_SVR_FIND_TYPE) return BLE_HS_ENOTSUP; #endif @@ -1269,7 +1269,7 @@ done: int ble_att_svr_rx_read_type(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_READ_TYPE +#if !NIMBLE_OPT(ATT_SVR_READ_TYPE) return BLE_HS_ENOTSUP; #endif @@ -1407,7 +1407,7 @@ done: int ble_att_svr_rx_read(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_READ +#if !NIMBLE_OPT(ATT_SVR_READ) return BLE_HS_ENOTSUP; #endif @@ -1505,7 +1505,7 @@ done: int ble_att_svr_rx_read_blob(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_READ_BLOB +#if !NIMBLE_OPT(ATT_SVR_READ_BLOB) return BLE_HS_ENOTSUP; #endif @@ -1663,7 +1663,7 @@ done: int ble_att_svr_rx_read_mult(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_READ_MULT +#if !NIMBLE_OPT(ATT_SVR_READ_MULT) return BLE_HS_ENOTSUP; #endif @@ -1966,7 +1966,7 @@ done: int ble_att_svr_rx_read_group_type(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_READ_GROUP_TYPE +#if !NIMBLE_OPT(ATT_SVR_READ_GROUP_TYPE) return BLE_HS_ENOTSUP; #endif @@ -2070,7 +2070,7 @@ done: int ble_att_svr_rx_write(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_WRITE +#if !NIMBLE_OPT(ATT_SVR_WRITE) return BLE_HS_ENOTSUP; #endif @@ -2125,7 +2125,7 @@ done: int ble_att_svr_rx_write_no_rsp(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_WRITE_NO_RSP +#if !NIMBLE_OPT(ATT_SVR_WRITE_NO_RSP) return BLE_HS_ENOTSUP; #endif @@ -2342,7 +2342,7 @@ ble_att_svr_prep_write(uint16_t conn_handle, int ble_att_svr_rx_prep_write(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_PREP_WRITE +#if !NIMBLE_OPT(ATT_SVR_PREP_WRITE) return BLE_HS_ENOTSUP; #endif @@ -2517,7 +2517,7 @@ done: int ble_att_svr_rx_exec_write(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_EXEC_WRITE +#if !NIMBLE_OPT(ATT_SVR_EXEC_WRITE) return BLE_HS_ENOTSUP; #endif @@ -2589,7 +2589,7 @@ done: int ble_att_svr_rx_notify(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_NOTIFY +#if !NIMBLE_OPT(ATT_SVR_NOTIFY) return BLE_HS_ENOTSUP; #endif @@ -2666,7 +2666,7 @@ done: int ble_att_svr_rx_indicate(uint16_t conn_handle, struct os_mbuf **rxom) { -#if !NIMBLE_OPT_ATT_SVR_INDICATE +#if !NIMBLE_OPT(ATT_SVR_INDICATE) return BLE_HS_ENOTSUP; #endif diff --git a/net/nimble/host/src/ble_eddystone.c b/net/nimble/host/src/ble_eddystone.c index 98ce4ab3..dbd8a716 100644 --- a/net/nimble/host/src/ble_eddystone.c +++ b/net/nimble/host/src/ble_eddystone.c @@ -117,7 +117,7 @@ ble_eddystone_set_adv_data_gen(struct ble_hs_adv_fields *adv_fields, int ble_eddystone_set_adv_data_uid(struct ble_hs_adv_fields *adv_fields, void *uid) { -#if !NIMBLE_OPT_EDDYSTONE +#if !NIMBLE_OPT(EDDYSTONE) return BLE_HS_ENOTSUP; #endif @@ -158,7 +158,7 @@ ble_eddystone_set_adv_data_url(struct ble_hs_adv_fields *adv_fields, uint8_t url_scheme, char *url_body, uint8_t url_body_len, uint8_t url_suffix) { -#if !NIMBLE_OPT_EDDYSTONE +#if !NIMBLE_OPT(EDDYSTONE) return BLE_HS_ENOTSUP; #endif diff --git a/net/nimble/host/src/ble_gap.c b/net/nimble/host/src/ble_gap.c index 22c95d0e..a51442cd 100644 --- a/net/nimble/host/src/ble_gap.c +++ b/net/nimble/host/src/ble_gap.c @@ -512,7 +512,7 @@ ble_gap_conn_broken(struct ble_gap_snapshot *snap, int status) void ble_gap_rx_disconn_complete(struct hci_disconn_complete *evt) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return; #endif @@ -551,7 +551,7 @@ ble_gap_rx_disconn_complete(struct hci_disconn_complete *evt) void ble_gap_rx_update_complete(struct hci_le_conn_upd_complete *evt) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return; #endif @@ -709,7 +709,7 @@ ble_gap_accept_slave_conn(uint8_t addr_type, uint8_t *addr) void ble_gap_rx_adv_report(struct ble_hs_adv *adv) { -#if !NIMBLE_OPT_ROLE_OBSERVER +#if !NIMBLE_OPT(ROLE_OBSERVER) return; #endif @@ -744,7 +744,7 @@ ble_gap_rx_adv_report(struct ble_hs_adv *adv) int ble_gap_rx_conn_complete(struct hci_le_conn_complete *evt) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return BLE_HS_ENOTSUP; #endif @@ -917,7 +917,7 @@ ble_gap_heartbeat(void) static int ble_gap_wl_busy(void) { -#if !NIMBLE_OPT_WHITELIST +#if !NIMBLE_OPT(WHITELIST) return BLE_HS_ENOTSUP; #endif @@ -967,7 +967,7 @@ int ble_gap_wl_set(struct ble_gap_white_entry *white_list, uint8_t white_list_count) { -#if !NIMBLE_OPT_WHITELIST +#if !NIMBLE_OPT(WHITELIST) return BLE_HS_ENOTSUP; #endif @@ -1040,7 +1040,7 @@ ble_gap_adv_disable_tx(void) int ble_gap_adv_stop(void) { -#if !NIMBLE_OPT_ADVERTISE +#if !NIMBLE_OPT(ADVERTISE) return BLE_HS_ENOTSUP; #endif @@ -1274,7 +1274,7 @@ ble_gap_adv_start(uint8_t discoverable_mode, uint8_t connectable_mode, struct hci_adv_params *adv_params, ble_gap_conn_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_ADVERTISE +#if !NIMBLE_OPT(ADVERTISE) return BLE_HS_ENOTSUP; #endif @@ -1395,7 +1395,7 @@ done: int ble_gap_adv_set_fields(struct ble_hs_adv_fields *adv_fields) { -#if !NIMBLE_OPT_ADVERTISE +#if !NIMBLE_OPT(ADVERTISE) return BLE_HS_ENOTSUP; #endif @@ -1428,7 +1428,7 @@ ble_gap_adv_set_fields(struct ble_hs_adv_fields *adv_fields) int ble_gap_adv_rsp_set_fields(struct ble_hs_adv_fields *rsp_fields) { -#if !NIMBLE_OPT_ADVERTISE +#if !NIMBLE_OPT(ADVERTISE) return BLE_HS_ENOTSUP; #endif @@ -1518,7 +1518,7 @@ ble_gap_disc(uint32_t duration_ms, uint8_t discovery_mode, uint8_t scan_type, uint8_t filter_policy, ble_gap_disc_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_ROLE_OBSERVER +#if !NIMBLE_OPT(ROLE_OBSERVER) return BLE_HS_ENOTSUP; #endif @@ -1653,7 +1653,7 @@ ble_gap_conn_initiate(int addr_type, uint8_t *addr, struct ble_gap_crt_params *params, ble_gap_conn_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_ROLE_CENTRAL +#if !NIMBLE_OPT(ROLE_CENTRAL) return BLE_HS_ENOTSUP; #endif @@ -1840,7 +1840,7 @@ ble_gap_tx_param_neg_reply(uint16_t conn_handle, uint8_t reject_reason) void ble_gap_rx_param_req(struct hci_le_conn_param_req *evt) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return; #endif @@ -1926,7 +1926,7 @@ ble_gap_update_tx(uint16_t conn_handle, struct ble_gap_upd_params *params) int ble_gap_update_params(uint16_t conn_handle, struct ble_gap_upd_params *params) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return BLE_HS_ENOTSUP; #endif @@ -1973,7 +1973,7 @@ done: * $security * *****************************************************************************/ -#if NIMBLE_OPT_SM +#if NIMBLE_OPT(SM) int ble_gap_security_initiate(uint16_t conn_handle) { diff --git a/net/nimble/host/src/ble_gattc.c b/net/nimble/host/src/ble_gattc.c index 7bfd2ddf..916da80f 100644 --- a/net/nimble/host/src/ble_gattc.c +++ b/net/nimble/host/src/ble_gattc.c @@ -1174,7 +1174,7 @@ int ble_gattc_disc_all_svcs(uint16_t conn_handle, ble_gatt_disc_svc_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_DISC_ALL_SVCS +#if !NIMBLE_OPT(GATT_DISC_ALL_SVCS) return BLE_HS_ENOTSUP; #endif @@ -1368,7 +1368,7 @@ int ble_gattc_disc_svc_by_uuid(uint16_t conn_handle, void *service_uuid128, ble_gatt_disc_svc_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_DISC_SVC_UUID +#if !NIMBLE_OPT(GATT_DISC_SVC_UUID) return BLE_HS_ENOTSUP; #endif @@ -1675,7 +1675,7 @@ ble_gattc_find_inc_svcs(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, ble_gatt_disc_svc_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_FIND_INC_SVCS +#if !NIMBLE_OPT(GATT_FIND_INC_SVCS) return BLE_HS_ENOTSUP; #endif @@ -1900,7 +1900,7 @@ ble_gattc_disc_all_chrs(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, ble_gatt_chr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_DISC_ALL_CHRS +#if !NIMBLE_OPT(GATT_DISC_ALL_CHRS) return BLE_HS_ENOTSUP; #endif @@ -2135,7 +2135,7 @@ ble_gattc_disc_chrs_by_uuid(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, void *uuid128, ble_gatt_chr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_DISC_CHR_UUID +#if !NIMBLE_OPT(GATT_DISC_CHR_UUID) return BLE_HS_ENOTSUP; #endif @@ -2333,7 +2333,7 @@ ble_gattc_disc_all_dscs(uint16_t conn_handle, uint16_t chr_def_handle, uint16_t chr_end_handle, ble_gatt_dsc_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_DISC_ALL_DSCS +#if !NIMBLE_OPT(GATT_DISC_ALL_DSCS) return BLE_HS_ENOTSUP; #endif @@ -2456,7 +2456,7 @@ int ble_gattc_read(uint16_t conn_handle, uint16_t attr_handle, ble_gatt_attr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_READ +#if !NIMBLE_OPT(GATT_READ) return BLE_HS_ENOTSUP; #endif @@ -2603,7 +2603,7 @@ ble_gattc_read_by_uuid(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, void *uuid128, ble_gatt_attr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_READ_UUID +#if !NIMBLE_OPT(GATT_READ_UUID) return BLE_HS_ENOTSUP; #endif @@ -2781,7 +2781,7 @@ int ble_gattc_read_long(uint16_t conn_handle, uint16_t handle, ble_gatt_attr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_READ_LONG +#if !NIMBLE_OPT(GATT_READ_LONG) return BLE_HS_ENOTSUP; #endif @@ -2895,7 +2895,7 @@ ble_gattc_read_mult(uint16_t conn_handle, uint16_t *handles, uint8_t num_handles, ble_gatt_attr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_READ_MULT +#if !NIMBLE_OPT(GATT_READ_MULT) return BLE_HS_ENOTSUP; #endif @@ -2952,7 +2952,7 @@ int ble_gattc_write_no_rsp(uint16_t conn_handle, uint16_t attr_handle, void *value, uint16_t value_len) { -#if !NIMBLE_OPT_GATT_WRITE_NO_RSP +#if !NIMBLE_OPT(GATT_WRITE_NO_RSP) return BLE_HS_ENOTSUP; #endif @@ -3039,7 +3039,7 @@ int ble_gattc_write(uint16_t conn_handle, uint16_t attr_handle, void *value, uint16_t value_len, ble_gatt_attr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_WRITE +#if !NIMBLE_OPT(GATT_WRITE) return BLE_HS_ENOTSUP; #endif @@ -3264,7 +3264,7 @@ int ble_gattc_write_long(uint16_t conn_handle, uint16_t attr_handle, void *value, uint16_t value_len, ble_gatt_attr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_WRITE_LONG +#if !NIMBLE_OPT(GATT_WRITE_LONG) return BLE_HS_ENOTSUP; #endif @@ -3478,7 +3478,7 @@ ble_gattc_write_reliable(uint16_t conn_handle, struct ble_gatt_attr *attrs, int num_attrs, ble_gatt_reliable_attr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_WRITE_RELIABLE +#if !NIMBLE_OPT(GATT_WRITE_RELIABLE) return BLE_HS_ENOTSUP; #endif @@ -3529,7 +3529,7 @@ int ble_gattc_notify_custom(uint16_t conn_handle, uint16_t att_handle, void *attr_data, uint16_t attr_data_len) { -#if !NIMBLE_OPT_GATT_NOTIFY +#if !NIMBLE_OPT(GATT_NOTIFY) return BLE_HS_ENOTSUP; #endif @@ -3579,7 +3579,7 @@ err: int ble_gattc_notify(uint16_t conn_handle, uint16_t chr_val_handle) { -#if !NIMBLE_OPT_GATT_NOTIFY +#if !NIMBLE_OPT(GATT_NOTIFY) return BLE_HS_ENOTSUP; #endif @@ -3675,7 +3675,7 @@ int ble_gattc_indicate(uint16_t conn_handle, uint16_t chr_val_handle, ble_gatt_attr_fn *cb, void *cb_arg) { -#if !NIMBLE_OPT_GATT_INDICATE +#if !NIMBLE_OPT(GATT_INDICATE) return BLE_HS_ENOTSUP; #endif @@ -3775,7 +3775,7 @@ void ble_gattc_rx_find_info_idata(uint16_t conn_handle, struct ble_att_find_info_idata *idata) { -#if !NIMBLE_OPT_ATT_CLT_FIND_INFO +#if !NIMBLE_OPT(ATT_CLT_FIND_INFO) return; #endif @@ -3796,7 +3796,7 @@ ble_gattc_rx_find_info_idata(uint16_t conn_handle, void ble_gattc_rx_find_info_complete(uint16_t conn_handle, int status) { -#if !NIMBLE_OPT_ATT_CLT_FIND_INFO +#if !NIMBLE_OPT(ATT_CLT_FIND_INFO) return; #endif @@ -3818,7 +3818,7 @@ void ble_gattc_rx_find_type_value_hinfo(uint16_t conn_handle, struct ble_att_find_type_value_hinfo *hinfo) { -#if !NIMBLE_OPT_ATT_CLT_FIND_TYPE +#if !NIMBLE_OPT(ATT_CLT_FIND_TYPE) return; #endif @@ -3839,7 +3839,7 @@ ble_gattc_rx_find_type_value_hinfo(uint16_t conn_handle, void ble_gattc_rx_find_type_value_complete(uint16_t conn_handle, int status) { -#if !NIMBLE_OPT_ATT_CLT_FIND_TYPE +#if !NIMBLE_OPT(ATT_CLT_FIND_TYPE) return; #endif @@ -3861,7 +3861,7 @@ void ble_gattc_rx_read_type_adata(uint16_t conn_handle, struct ble_att_read_type_adata *adata) { -#if !NIMBLE_OPT_ATT_CLT_READ_TYPE +#if !NIMBLE_OPT(ATT_CLT_READ_TYPE) return; #endif @@ -3885,7 +3885,7 @@ ble_gattc_rx_read_type_adata(uint16_t conn_handle, void ble_gattc_rx_read_type_complete(uint16_t conn_handle, int status) { -#if !NIMBLE_OPT_ATT_CLT_READ_TYPE +#if !NIMBLE_OPT(ATT_CLT_READ_TYPE) return; #endif @@ -3910,7 +3910,7 @@ void ble_gattc_rx_read_group_type_adata(uint16_t conn_handle, struct ble_att_read_group_type_adata *adata) { -#if !NIMBLE_OPT_ATT_CLT_READ_GROUP_TYPE +#if !NIMBLE_OPT(ATT_CLT_READ_GROUP_TYPE) return; #endif @@ -3931,7 +3931,7 @@ ble_gattc_rx_read_group_type_adata(uint16_t conn_handle, void ble_gattc_rx_read_group_type_complete(uint16_t conn_handle, int status) { -#if !NIMBLE_OPT_ATT_CLT_READ_GROUP_TYPE +#if !NIMBLE_OPT(ATT_CLT_READ_GROUP_TYPE) return; #endif @@ -3953,7 +3953,7 @@ void ble_gattc_rx_read_rsp(uint16_t conn_handle, int status, void *value, int value_len) { -#if !NIMBLE_OPT_ATT_CLT_READ +#if !NIMBLE_OPT(ATT_CLT_READ) return; #endif @@ -3978,7 +3978,7 @@ void ble_gattc_rx_read_blob_rsp(uint16_t conn_handle, int status, void *value, int value_len) { -#if !NIMBLE_OPT_ATT_CLT_READ_BLOB +#if !NIMBLE_OPT(ATT_CLT_READ_BLOB) return; #endif @@ -4000,7 +4000,7 @@ void ble_gattc_rx_read_mult_rsp(uint16_t conn_handle, int status, void *value, int value_len) { -#if !NIMBLE_OPT_ATT_CLT_READ_MULT +#if !NIMBLE_OPT(ATT_CLT_READ_MULT) return; #endif @@ -4020,7 +4020,7 @@ ble_gattc_rx_read_mult_rsp(uint16_t conn_handle, int status, void ble_gattc_rx_write_rsp(uint16_t conn_handle) { -#if !NIMBLE_OPT_ATT_CLT_WRITE +#if !NIMBLE_OPT(ATT_CLT_WRITE) return; #endif @@ -4042,7 +4042,7 @@ ble_gattc_rx_prep_write_rsp(uint16_t conn_handle, int status, struct ble_att_prep_write_cmd *rsp, void *attr_data, uint16_t attr_data_len) { -#if !NIMBLE_OPT_ATT_CLT_PREP_WRITE +#if !NIMBLE_OPT(ATT_CLT_PREP_WRITE) return; #endif @@ -4066,7 +4066,7 @@ ble_gattc_rx_prep_write_rsp(uint16_t conn_handle, int status, void ble_gattc_rx_exec_write_rsp(uint16_t conn_handle, int status) { -#if !NIMBLE_OPT_ATT_CLT_EXEC_WRITE +#if !NIMBLE_OPT(ATT_CLT_EXEC_WRITE) return; #endif @@ -4089,7 +4089,7 @@ ble_gattc_rx_exec_write_rsp(uint16_t conn_handle, int status) void ble_gattc_rx_indicate_rsp(uint16_t conn_handle) { -#if !NIMBLE_OPT_ATT_CLT_INDICATE +#if !NIMBLE_OPT(ATT_CLT_INDICATE) return; #endif diff --git a/net/nimble/host/src/ble_gatts.c b/net/nimble/host/src/ble_gatts.c index 2f3d85e4..cb710928 100644 --- a/net/nimble/host/src/ble_gatts.c +++ b/net/nimble/host/src/ble_gatts.c @@ -1111,7 +1111,7 @@ ble_gatts_chr_updated(uint16_t chr_def_handle) { struct ble_gatts_clt_cfg *clt_cfg; struct ble_hs_conn *conn; - uint16_t conn_handles[NIMBLE_OPT_MAX_CONNECTIONS]; + uint16_t conn_handles[NIMBLE_OPT(MAX_CONNECTIONS)]; int any_updates; int num_conns; int idx; diff --git a/net/nimble/host/src/ble_hs_adv.c b/net/nimble/host/src/ble_hs_adv.c index ef038a7a..c56bb194 100644 --- a/net/nimble/host/src/ble_hs_adv.c +++ b/net/nimble/host/src/ble_hs_adv.c @@ -42,7 +42,7 @@ int ble_hs_adv_set_flat(uint8_t type, int data_len, void *data, uint8_t *dst, uint8_t *dst_len, uint8_t max_len) { -#if !NIMBLE_OPT_ADVERTISE +#if !NIMBLE_OPT(ADVERTISE) return BLE_HS_ENOTSUP; #endif @@ -112,7 +112,7 @@ int ble_hs_adv_set_fields(struct ble_hs_adv_fields *adv_fields, uint8_t *dst, uint8_t *dst_len, uint8_t max_len) { -#if !NIMBLE_OPT_ADVERTISE +#if !NIMBLE_OPT(ADVERTISE) return BLE_HS_ENOTSUP; #endif diff --git a/net/nimble/host/src/ble_hs_cfg.c b/net/nimble/host/src/ble_hs_cfg.c index 6faf74ef..3cad0b68 100644 --- a/net/nimble/host/src/ble_hs_cfg.c +++ b/net/nimble/host/src/ble_hs_cfg.c @@ -26,8 +26,8 @@ const struct ble_hs_cfg ble_hs_cfg_dflt = { /** Connection settings. */ .max_outstanding_pkts_per_conn = 5, -#if NIMBLE_OPT_CONNECT - .max_connections = NIMBLE_OPT_MAX_CONNECTIONS, +#if NIMBLE_OPT(CONNECT) + .max_connections = NIMBLE_OPT(MAX_CONNECTIONS), .max_conn_update_entries = 4, #else .max_connections = 0, diff --git a/net/nimble/host/src/ble_hs_conn.c b/net/nimble/host/src/ble_hs_conn.c index 567da512..7afcce35 100644 --- a/net/nimble/host/src/ble_hs_conn.c +++ b/net/nimble/host/src/ble_hs_conn.c @@ -34,7 +34,7 @@ static os_membuf_t *ble_hs_conn_elem_mem; int ble_hs_conn_can_alloc(void) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return 0; #endif @@ -46,7 +46,7 @@ ble_hs_conn_can_alloc(void) struct ble_l2cap_chan * ble_hs_conn_chan_find(struct ble_hs_conn *conn, uint16_t cid) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return NULL; #endif @@ -67,7 +67,7 @@ ble_hs_conn_chan_find(struct ble_hs_conn *conn, uint16_t cid) int ble_hs_conn_chan_insert(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return BLE_HS_ENOTSUP; #endif @@ -98,7 +98,7 @@ ble_hs_conn_chan_insert(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan) struct ble_hs_conn * ble_hs_conn_alloc(void) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return NULL; #endif @@ -135,7 +135,7 @@ ble_hs_conn_alloc(void) /* XXX: We should create the SM channel even if not configured. We need it * to reject SM messages. */ -#if NIMBLE_OPT_SM +#if NIMBLE_OPT(SM) chan = ble_l2cap_sm_create_chan(); if (chan == NULL) { goto err; @@ -174,7 +174,7 @@ ble_hs_conn_delete_chan(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan) void ble_hs_conn_free(struct ble_hs_conn *conn) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return; #endif @@ -202,7 +202,7 @@ ble_hs_conn_free(struct ble_hs_conn *conn) void ble_hs_conn_insert(struct ble_hs_conn *conn) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return; #endif @@ -215,7 +215,7 @@ ble_hs_conn_insert(struct ble_hs_conn *conn) void ble_hs_conn_remove(struct ble_hs_conn *conn) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return; #endif @@ -227,7 +227,7 @@ ble_hs_conn_remove(struct ble_hs_conn *conn) struct ble_hs_conn * ble_hs_conn_find(uint16_t conn_handle) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return NULL; #endif @@ -247,7 +247,7 @@ ble_hs_conn_find(uint16_t conn_handle) int ble_hs_conn_exists(uint16_t conn_handle) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return 0; #endif return ble_hs_conn_find(conn_handle) != NULL; @@ -259,7 +259,7 @@ ble_hs_conn_exists(uint16_t conn_handle) struct ble_hs_conn * ble_hs_conn_first(void) { -#if !NIMBLE_OPT_CONNECT +#if !NIMBLE_OPT(CONNECT) return NULL; #endif diff --git a/net/nimble/host/src/ble_l2cap_sm.c b/net/nimble/host/src/ble_l2cap_sm.c index 1fa05be5..6adc8200 100644 --- a/net/nimble/host/src/ble_l2cap_sm.c +++ b/net/nimble/host/src/ble_l2cap_sm.c @@ -48,7 +48,7 @@ #include "nimble/nimble_opt.h" #include "ble_hs_priv.h" -#if NIMBLE_OPT_SM +#if NIMBLE_OPT(SM) #define BLE_L2CAP_SM_PROC_STATE_NONE ((uint8_t)-1) diff --git a/net/nimble/host/src/ble_l2cap_sm_alg.c b/net/nimble/host/src/ble_l2cap_sm_alg.c index 61a98256..df1002ad 100644 --- a/net/nimble/host/src/ble_l2cap_sm_alg.c +++ b/net/nimble/host/src/ble_l2cap_sm_alg.c @@ -25,7 +25,7 @@ #include "nimble/nimble_opt.h" #include "ble_hs_priv.h" -#if NIMBLE_OPT_SM +#if NIMBLE_OPT(SM) static mbedtls_aes_context ble_l2cap_sm_alg_ctxt; diff --git a/net/nimble/host/src/ble_l2cap_sm_cmd.c b/net/nimble/host/src/ble_l2cap_sm_cmd.c index 14c50934..ced4c1c9 100644 --- a/net/nimble/host/src/ble_l2cap_sm_cmd.c +++ b/net/nimble/host/src/ble_l2cap_sm_cmd.c @@ -24,7 +24,7 @@ #include "nimble/nimble_opt.h" #include "ble_hs_priv.h" -#if NIMBLE_OPT_SM +#if NIMBLE_OPT(SM) static int ble_l2cap_sm_tx(uint16_t conn_handle, struct os_mbuf *txom) diff --git a/net/nimble/host/src/ble_l2cap_sm_priv.h b/net/nimble/host/src/ble_l2cap_sm_priv.h index f084f6e7..e65d6d2f 100644 --- a/net/nimble/host/src/ble_l2cap_sm_priv.h +++ b/net/nimble/host/src/ble_l2cap_sm_priv.h @@ -20,6 +20,8 @@ #ifndef H_BLE_L2CAP_SM_ #define H_BLE_L2CAP_SM_ +#include "nimble/nimble_opt.h" + struct ble_gap_sec_state; struct hci_le_lt_key_req; @@ -152,7 +154,7 @@ struct ble_l2cap_sm_sec_req { }; -#if NIMBLE_OPT_SM +#if NIMBLE_OPT(SM) #ifdef BLE_HS_DEBUG void ble_l2cap_sm_dbg_set_next_pair_rand(uint8_t *next_pair_rand); diff --git a/net/nimble/host/src/test/ble_l2cap_sm_test.c b/net/nimble/host/src/test/ble_l2cap_sm_test.c index a775cd5b..7530144a 100644 --- a/net/nimble/host/src/test/ble_l2cap_sm_test.c +++ b/net/nimble/host/src/test/ble_l2cap_sm_test.c @@ -27,7 +27,7 @@ #include "host/ble_hs_test.h" #include "ble_hs_test_util.h" -#if NIMBLE_OPT_SM +#if NIMBLE_OPT(SM) int ble_l2cap_sm_test_gap_event; int ble_l2cap_sm_test_gap_status; @@ -1915,7 +1915,7 @@ TEST_SUITE(ble_l2cap_sm_test_suite) int ble_l2cap_sm_test_all(void) { -#if !NIMBLE_OPT_SM +#if !NIMBLE_OPT(SM) return 0; #else ble_l2cap_sm_test_suite(); diff --git a/net/nimble/include/nimble/nimble_opt.h b/net/nimble/include/nimble/nimble_opt.h index 604db862..38fb5a70 100644 --- a/net/nimble/include/nimble/nimble_opt.h +++ b/net/nimble/include/nimble/nimble_opt.h @@ -58,7 +58,6 @@ #define NIMBLE_OPT_SM 1 #endif - /** HOST: Supported GATT procedures. By default, all are enabled. */ #ifndef NIMBLE_OPT_GATT_DISC_ALL_SVCS @@ -367,6 +366,14 @@ #define BLE_LL_CFG_FEAT_EXT_SCAN_FILT (0) #endif +/** + * This macro exists to help catch bugs at compile time. If code uses this + * macro to check an option value, the compiler will complain when this header + * is not included. If the code checks the option symbol directly without + * including this header, it will appear as though the option is set to 0. + */ +#define NIMBLE_OPT(x) NIMBLE_OPT_ ## x + /* Include automatically-generated settings. */ #include "nimble/nimble_opt_auto.h" |