From 0270fe43a5156b9c7c90391f27bd35e9ce27c920 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Fri, 12 Feb 2016 15:47:05 +0200 Subject: [PATCH] drivers/nble: Change RPC following firmware update Due to firmware update of NBLE starting from 02/12 revisions onwards there is a need to sync RPC headers and functions. Only to be used with above mentioned NBLE firmware! Change-Id: Ifc2ce28f81e819bb517ef3891610d78089a00428 Signed-off-by: Andrei Emeltchenko --- drivers/nble/conn.c | 6 +- drivers/nble/gap.c | 86 +++-- drivers/nble/gap_internal.h | 394 ++++++++++++----------- drivers/nble/gatt.c | 54 ++-- drivers/nble/gatt_internal.h | 182 ++++++----- drivers/nble/rpc_functions_to_ble_core.h | 112 +++---- drivers/nble/rpc_functions_to_quark.h | 151 +++++---- 7 files changed, 501 insertions(+), 484 deletions(-) diff --git a/drivers/nble/conn.c b/drivers/nble/conn.c index 51a1ae058fe..9fd9dff865c 100644 --- a/drivers/nble/conn.c +++ b/drivers/nble/conn.c @@ -206,7 +206,7 @@ static void notify_disconnected(struct bt_conn *conn) } } -void on_ble_gap_connect_evt(const struct ble_gap_connect_evt *ev) +void on_nble_gap_connect_evt(const struct nble_gap_connect_evt *ev) { struct bt_conn *conn; @@ -224,7 +224,7 @@ void on_ble_gap_connect_evt(const struct ble_gap_connect_evt *ev) notify_connected(conn); } -void on_ble_gap_disconnect_evt(const struct ble_gap_disconnect_evt *ev) +void on_nble_gap_disconnect_evt(const struct nble_gap_disconnect_evt *ev) { struct bt_conn *conn; @@ -244,7 +244,7 @@ void on_ble_gap_disconnect_evt(const struct ble_gap_disconnect_evt *ev) bt_conn_unref(conn); } -void on_ble_gap_conn_update_evt(const struct ble_gap_conn_update_evt *ev) +void on_nble_gap_conn_update_evt(const struct nble_gap_conn_update_evt *ev) { struct bt_conn *conn; diff --git a/drivers/nble/gap.c b/drivers/nble/gap.c index 91c42901330..71ac5580c0b 100644 --- a/drivers/nble/gap.c +++ b/drivers/nble/gap.c @@ -50,13 +50,14 @@ static const char *bt_addr_le_str(const bt_addr_le_t *addr) static void send_dm_config(void) { - struct ble_core_gap_sm_config_params config; + struct nble_gap_sm_config_params config = { + .options = 1, /* bonding */ + .io_caps = 3, /* no input no output */ + .key_size = 16, /* or 7 */ + .oob_present = 0, /* no oob */ + }; - config.options = 1; /* bonding */ - config.io_caps = 3; /* no input no output */ - config.key_size = 16; /* or 7 */ - - ble_gap_sm_config_req(&config, NULL); + nble_gap_sm_config_req(&config); } void on_nble_up(void) @@ -66,7 +67,7 @@ void on_nble_up(void) send_dm_config(); } -void on_ble_get_version_rsp(const struct ble_version_response *rsp) +void on_nble_get_version_rsp(const struct nble_version_response *rsp) { BT_DBG("VERSION: %d.%d.%d %.20s", rsp->version.major, rsp->version.minor, rsp->version.patch, @@ -191,7 +192,7 @@ int bt_le_adv_start(const struct bt_le_adv_param *param, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len) { - struct ble_gap_adv_params params = { 0 }; + struct nble_gap_adv_params params = { 0 }; int i; if (!valid_adv_param(param)) { @@ -245,7 +246,7 @@ send_set_param: params.interval_min = param->interval_min; params.type = param->type; - ble_gap_start_advertise_req(¶ms); + nble_gap_start_advertise_req(¶ms); return 0; } @@ -265,12 +266,12 @@ int bt_le_scan_stop(void) return -ENOSYS; } -void on_ble_gap_dtm_init_rsp(void *user_data) +void on_nble_gap_dtm_init_rsp(void *user_data) { BT_DBG(""); } -void ble_log(const struct ble_log_s *param, char *format, uint8_t len) +void nble_log(const struct nble_log_s *param, char *format, uint8_t len) { #if defined(CONFIG_BLUETOOTH_DEBUG) /* Build meaningful output */ @@ -281,37 +282,37 @@ void ble_log(const struct ble_log_s *param, char *format, uint8_t len) #endif } -void on_ble_gap_sm_status_evt(const struct ble_gap_sm_status_evt *ev) +void on_nble_gap_sm_status_evt(const struct nble_gap_sm_status_evt *ev) { BT_DBG(""); } -void on_ble_gap_sm_passkey_display_evt(const struct ble_gap_sm_passkey_disp_evt *ev) +void on_nble_gap_sm_passkey_display_evt(const struct nble_gap_sm_passkey_disp_evt *ev) { BT_DBG(""); } -void on_ble_gap_sm_passkey_req_evt(const struct ble_gap_sm_passkey_req_evt *ev) +void on_nble_gap_sm_passkey_req_evt(const struct nble_gap_sm_passkey_req_evt *ev) { BT_DBG(""); } -void on_ble_gap_to_evt(const struct ble_gap_timout_evt *ev) +void on_nble_gap_to_evt(const struct nble_gap_timout_evt *ev) { BT_DBG(""); } -void on_ble_gap_rssi_evt(const struct ble_gap_rssi_evt *ev) +void on_nble_gap_rssi_evt(const struct nble_gap_rssi_evt *ev) { BT_DBG(""); } -void on_ble_gap_service_read_rsp(const struct ble_core_response *rsp) +void on_nble_gap_service_read_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_read_bda_rsp(const struct ble_service_read_bda_response *rsp) +void on_nble_gap_read_bda_rsp(const struct nble_service_read_bda_response *rsp) { if (rsp->status) { BT_ERR("Read bdaddr failed, status %d", rsp->status); @@ -322,20 +323,20 @@ void on_ble_gap_read_bda_rsp(const struct ble_service_read_bda_response *rsp) BT_DBG("Local bdaddr: %s", bt_addr_le_str(&bdaddr)); - ble_get_version_req(NULL); + nble_get_version_req(NULL); } -void on_ble_gap_disconnect_rsp(const struct ble_core_response *rsp) +void on_nble_gap_disconnect_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_sm_pairing_rsp(const struct ble_core_response *rsp) +void on_nble_gap_sm_pairing_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_sm_config_rsp(struct ble_gap_sm_config_rsp *rsp) +void on_nble_gap_sm_config_rsp(struct nble_gap_sm_config_rsp *rsp) { if (rsp->status) { BT_ERR("SM config failed, status %d", rsp->status); @@ -345,96 +346,91 @@ void on_ble_gap_sm_config_rsp(struct ble_gap_sm_config_rsp *rsp) BT_DBG("state %u", rsp->state); /* Get bdaddr queued after SM setup */ - ble_gap_read_bda_req(NULL); + nble_gap_read_bda_req(NULL); } -void on_ble_gap_clr_white_list_rsp(const struct ble_core_response *rsp) +void on_nble_gap_clr_white_list_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_sm_passkey_reply_rsp(const struct ble_core_response *rsp) +void on_nble_gap_sm_passkey_reply_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_connect_rsp(const struct ble_core_response *rsp) +void on_nble_gap_connect_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_start_scan_rsp(const struct ble_core_response *rsp) +void on_nble_gap_start_scan_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_stop_scan_rsp(const struct ble_core_response *rsp) +void on_nble_gap_stop_scan_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_cancel_connect_rsp(const struct ble_core_response *rsp) +void on_nble_gap_cancel_connect_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_set_option_rsp(const struct ble_core_response *rsp) +void on_nble_gap_set_option_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_generic_cmd_rsp(const struct ble_core_response *rsp) +void on_nble_gap_generic_cmd_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_conn_update_rsp(const struct ble_core_response *rsp) +void on_nble_gap_conn_update_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_sm_clear_bonds_rsp(const struct ble_core_response *rsp) +void on_nble_gap_sm_clear_bonds_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_service_write_rsp(const struct ble_service_write_response *rsp) +void on_nble_gap_service_write_rsp(const struct nble_service_write_response *rsp) { BT_DBG(""); } -void on_ble_set_enable_config_rsp(const struct ble_core_response *rsp) +void on_ble_set_enable_config_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_set_rssi_report_rsp(const struct ble_core_response *rsp) +void on_nble_gap_set_rssi_report_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_wr_white_list_rsp(const struct ble_core_response *rsp) +void on_nble_gap_wr_white_list_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_dbg_rsp(const struct debug_response *rsp) +void on_nble_gap_dbg_rsp(const struct debug_response *rsp) { BT_DBG(""); } -void on_ble_get_bonded_device_list_rsp(const struct ble_get_bonded_device_list_rsp *rsp) -{ - BT_DBG(""); -} - -void on_ble_gap_start_advertise_rsp(const struct ble_core_response *rsp) +void on_nble_gap_start_advertise_rsp(const struct nble_response *rsp) { BT_DBG(""); } -void on_ble_gap_stop_advertise_rsp(const struct ble_core_response *rsp) +void on_nble_gap_stop_advertise_rsp(const struct nble_response *rsp) { BT_DBG(""); } diff --git a/drivers/nble/gap_internal.h b/drivers/nble/gap_internal.h index 88cb80ce2cf..84d1a7ec6f2 100644 --- a/drivers/nble/gap_internal.h +++ b/drivers/nble/gap_internal.h @@ -19,11 +19,12 @@ */ #include +#include /* For bt_addr_le_t */ #include "bluetooth/hci.h" #include "version.h" -/* Must be the same with ble_service_gap_api.h ! */ +/* Must be the same with nble_service_gap_api.h ! */ /**< Maximum security key len (LTK, CSRK) */ #define BLE_GAP_SEC_MAX_KEY_LEN 16 @@ -72,7 +73,7 @@ enum BLE_CORE_GAP_RSSI_OPS { BLE_CORE_GAP_RSSI_ENABLE_REPORT }; -/** Test Mode opcodes. The same with ble_service_gap_api.h */ +/** Test Mode opcodes. The same with nble_service_gap_api.h */ enum BLE_CORE_TEST_OPCODE { /**< Put BLE controller in HCI UART DTM test mode */ BLE_CORE_TEST_INIT_DTM = 0x01, @@ -86,12 +87,12 @@ enum BLE_CORE_TEST_OPCODE { BLE_CORE_TEST_START_TX_CARRIER, /**< Start Tx Carrier Test */ }; -struct ble_core_response { +struct nble_response { int status; /**< Status of the operation */ void *user_data; }; -struct ble_gap_device_name { +struct nble_gap_device_name { /**< Security mode for writing device name, @ref BLE_GAP_SEC_MODES */ uint8_t sec_mode; /**< 0: no authorization, 1: authorization required */ @@ -100,7 +101,7 @@ struct ble_gap_device_name { uint8_t name_array[20]; /**< Device */ }; -struct ble_gap_connection_values { +struct nble_gap_connection_values { uint16_t interval; /**< Conn interval (unit 1.25 ms) */ uint16_t latency; /**< Conn latency (unit interval) */ uint16_t supervision_to; /**< Conn supervision timeout (10ms) */ @@ -119,7 +120,7 @@ enum BLE_GAP_SVC_ATTR_TYPE { /** * Connection requested parameters. */ -struct ble_core_gap_connection_params { +struct nble_gap_connection_params { /**< minimal conne interval: range 0x0006 to 0x0c80 (unit 1.25ms) */ uint16_t interval_min; /**< max conn interv: range 0x0006 to 0x0c80 must be bigger then min */ @@ -133,7 +134,7 @@ struct ble_core_gap_connection_params { /** * Connection scan requested parameters. */ -struct ble_core_gap_scan_params { +struct nble_core_gap_scan_params { uint8_t active; /**< If 1, perform active scan (scan req) */ uint8_t selective; /**< If 1, ignore unknown dev (non whitelist) */ /**< Scan interval between 0x0004 and 0x4000 in 0.625ms units @@ -150,33 +151,33 @@ struct ble_core_gap_scan_params { uint16_t timeout; }; -struct ble_gap_service_write_params { +struct nble_gap_service_write_params { /**< GAP Characteristics attribute type @ref BLE_GAP_SVC_ATTR_TYPE */ uint16_t attr_type; union { - struct ble_gap_device_name name; + struct nble_gap_device_name name; uint16_t appearance; /**< Appearance UUID */ /**< Preferred Peripheral Connection Parameters */ - struct ble_core_gap_connection_params conn_params; + struct nble_gap_connection_params conn_params; /**< Central Address Resolution support 0: no, 1: yes */ uint8_t car; }; }; -struct ble_service_read_bda_response { +struct nble_service_read_bda_response { int status; /**< Status of the operation */ bt_addr_le_t bd; /**< If @ref status ok */ void *user_data; }; -struct ble_service_write_response { +struct nble_service_write_response { int status; /**< Status of the operation */ /**< GAP Characteristics attribute type @ref BLE_GAP_SVC_ATTR_TYPE */ uint16_t attr_type; void *user_data; /**< Pointer to the user data of the request */ }; -struct ble_gap_service_read_params { +struct nble_gap_service_read_params { /**< Type of GAP data charact to read @ref BLE_GAP_SVC_ATTR_TYPE */ uint16_t attr_type; }; @@ -193,11 +194,12 @@ struct debug_response { void *user_data; /**< Pointer to the user data of the request */ }; -struct ble_wr_config_params { +struct nble_wr_config_params { bt_addr_le_t bda; uint8_t bda_present; int8_t tx_power; - struct ble_core_gap_connection_params central_conn_params; + /* Central supported range */ + struct nble_gap_connection_params central_conn_params; }; /** @@ -210,7 +212,7 @@ struct bt_eir_data { uint8_t data[31]; }; -struct ble_gap_adv_params { +struct nble_gap_adv_params { uint16_t timeout; uint16_t interval_min; /**< min interval 0xffff: use default 0x0800 */ uint16_t interval_max; /**< max interval 0xffff: use default 0x0800 */ @@ -222,16 +224,16 @@ struct ble_gap_adv_params { struct bt_eir_data sd; /**< Scan response data, maybe 0 (length) */ }; -struct ble_log_s { +struct nble_log_s { uint8_t param0; uint8_t param1; uint8_t param2; uint8_t param3; }; -void ble_log(const struct ble_log_s *p_param, char *p_buf, uint8_t buflen); +void nble_log(const struct nble_log_s *p_param, char *p_buf, uint8_t buflen); -void ble_core_delete_conn_params_timer(void); +void nble_core_delete_conn_params_timer(void); void on_nble_up(void); @@ -239,50 +241,50 @@ void on_nble_up(void); * Write GAP Service Attribute Characteristics. * * The response to this request is received through - * @ref on_ble_gap_service_write_rsp + * @ref on_nble_gap_service_write_rsp * * @param par Data of the characteristic to write * @param user_data User data */ -void ble_gap_service_write_req(const struct ble_gap_service_write_params *par, +void nble_gap_service_write_req(const struct nble_gap_service_write_params *par, void *user_data); /** - * Response to @ref ble_gap_read_bda_req. + * Response to @ref nble_gap_read_bda_req. * * @param par Response */ -void on_ble_gap_read_bda_rsp(const struct ble_service_read_bda_response *par); +void on_nble_gap_read_bda_rsp(const struct nble_service_read_bda_response *par); /** - * Response to @ref ble_gap_service_write_req. + * Response to @ref nble_gap_service_write_req. * * @param par Response */ -void on_ble_gap_service_write_rsp(const struct ble_service_write_response *par); +void on_nble_gap_service_write_rsp(const struct nble_service_write_response *par); /** * Send generic debug command * - * The response to this request is received through @ref on_ble_gap_dbg_rsp + * The response to this request is received through @ref on_nble_gap_dbg_rsp * * @param par Debug parameters * @param user_data User data */ -void ble_gap_dbg_req(const struct debug_params *par, void *user_data); +void nble_gap_dbg_req(const struct debug_params *par, void *user_data); /** - * Response to @ref ble_gap_dbg_req. + * Response to @ref nble_gap_dbg_req. * * @param par Response */ -void on_ble_gap_dbg_rsp(const struct debug_response *par); +void on_nble_gap_dbg_rsp(const struct debug_response *par); /** * Set Enable configuration parameters (BD address, etc). * * The response to this request is received through - * @ref on_ble_set_enable_config_rsp + * @ref on_nble_set_enable_config_rsp * * This shall put the controller stack into a usable (enabled) state. * Hence this should be called first! @@ -291,51 +293,51 @@ void on_ble_gap_dbg_rsp(const struct debug_response *par); * @param user_data User data * */ -void ble_set_enable_config_req(const struct ble_wr_config_params *config, - void *user_data); +void nble_set_enable_config_req(const struct nble_wr_config_params *config, + void *user_data); /** * Start advertising. * * The response to this request is received through - * @ref on_ble_gap_start_advertise_rsp + * @ref on_nble_gap_start_advertise_rsp * * @param par Advertisement * @param p_adv_data Pointer to advertisement and scan response data */ -void ble_gap_start_advertise_req(struct ble_gap_adv_params *par); +void nble_gap_start_advertise_req(struct nble_gap_adv_params *par); /** - * Response to @ref ble_gap_start_advertise_req. + * Response to @ref nble_gap_start_advertise_req. * * @param par Response */ -void on_ble_gap_start_advertise_rsp(const struct ble_core_response *par); +void on_nble_gap_start_advertise_rsp(const struct nble_response *par); /** * Request to stop advertisement * * @param user_data Pointer to private data */ -void ble_gap_stop_advertise_req(void *user_data); +void nble_gap_stop_advertise_req(void *user_data); /** - * Response to @ref ble_gap_stop_advertise_req. + * Response to @ref nble_gap_stop_advertise_req. * * @param par Response */ -void on_ble_gap_stop_advertise_rsp(const struct ble_core_response *par); +void on_nble_gap_stop_advertise_rsp(const struct nble_response *par); /** * Read BD address from Controller. * - * The response to this request is received through @ref on_ble_gap_read_bda_rsp + * The response to this request is received through @ref on_nble_gap_read_bda_rsp * * @param priv Pointer to private data */ -void ble_gap_read_bda_req(void *priv); +void nble_gap_read_bda_req(void *priv); -struct ble_gap_irk_info { +struct nble_gap_irk_info { uint8_t irk[BLE_GAP_SEC_MAX_KEY_LEN]; }; @@ -343,7 +345,7 @@ struct ble_gap_irk_info { * Write white list to the BLE controller. * * The response to this request is received through - * @ref on_ble_gap_wr_white_list_rsp + * @ref on_nble_gap_wr_white_list_rsp * * Store white in BLE controller. It needs to be done BEFORE starting * advertisement or start scanning @@ -354,44 +356,44 @@ struct ble_gap_irk_info { * @param irk_array_size Size of irk keys array * @param priv Pointer to private data */ -void ble_gap_wr_white_list_req(bt_addr_le_t *bd_array, uint8_t bd_array_size, - struct ble_gap_irk_info *irk_array, - uint8_t irk_array_size, void *priv); +void nble_gap_wr_white_list_req(bt_addr_le_t *bd_array, uint8_t bd_array_size, + struct nble_gap_irk_info *irk_array, + uint8_t irk_array_size, void *priv); /** - * Response to @ref ble_gap_wr_white_list_req. + * Response to @ref nble_gap_wr_white_list_req. * * @param par Response */ -void on_ble_gap_wr_white_list_rsp(const struct ble_core_response *par); +void on_nble_gap_wr_white_list_rsp(const struct nble_response *par); /** * Clear previously stored white list. * * The response to this request is received through - * @ref on_ble_gap_clr_white_list_rsp + * @ref on_nble_gap_clr_white_list_rsp * * @param priv Pointer to private data */ -void ble_gap_clr_white_list_req(void *priv); +void nble_gap_clr_white_list_req(void *priv); /** - * Response to @ref ble_gap_clr_white_list_req. + * Response to @ref nble_gap_clr_white_list_req. * * @param par Response */ -void on_ble_gap_clr_white_list_rsp(const struct ble_core_response *par); +void on_nble_gap_clr_white_list_rsp(const struct nble_response *par); -struct ble_gap_connect_update_params { +struct nble_gap_connect_update_params { uint16_t conn_handle; - struct ble_core_gap_connection_params params; + struct nble_gap_connection_params params; }; /** * Update connection. * * The response to this request is received through - * @ref on_ble_gap_conn_update_rsp + * @ref on_nble_gap_conn_update_rsp * * This function's behavior depends on the role of the connection: * - in peripheral mode, it sends an L2CAP signaling connection parameter @@ -401,29 +403,29 @@ struct ble_gap_connect_update_params { * connection values based on the values in p_conn_param argument * where the connection interval is interval_min. * - * When the connection is updated, function event on_ble_gap_conn_update_evt + * When the connection is updated, function event on_nble_gap_conn_update_evt * is called. * * @param par Connection parameters * @param user_data User data */ -void ble_gap_conn_update_req(const struct ble_gap_connect_update_params *par, - void *user_data); +void nble_gap_conn_update_req(const struct nble_gap_connect_update_params *par, + void *user_data); /** - * Response to @ref ble_gap_conn_update_req. + * Response to @ref nble_gap_conn_update_req. * * @param par Response */ -void on_ble_gap_conn_update_rsp(const struct ble_core_response *par); +void on_nble_gap_conn_update_rsp(const struct nble_response *par); -struct ble_gap_connect_req_params { +struct nble_gap_connect_req_params { bt_addr_le_t bda; - struct ble_core_gap_connection_params conn_params; - struct ble_core_gap_scan_params scan_params; + struct nble_gap_connection_params conn_params; + struct nble_core_gap_scan_params scan_params; }; -struct ble_gap_disconnect_req_params { +struct nble_gap_disconnect_req_params { uint16_t conn_handle; /**< Connection handle */ uint8_t reason; /**< Reason of the disconnect */ }; @@ -432,38 +434,38 @@ struct ble_gap_disconnect_req_params { * Disconnect connection (peripheral or central role). * * The response to this request is received through - * @ref on_ble_gap_disconnect_rsp + * @ref on_nble_gap_disconnect_rsp * * @param par Connection to terminate * @param user_data User data */ -void ble_gap_disconnect_req(const struct ble_gap_disconnect_req_params *par, - void *user_data); +void nble_gap_disconnect_req(const struct nble_gap_disconnect_req_params *par, + void *user_data); /** - * Response to @ref ble_gap_disconnect_req. + * Response to @ref nble_gap_disconnect_req. * * @param par Response */ -void on_ble_gap_disconnect_rsp(const struct ble_core_response *par); +void on_nble_gap_disconnect_rsp(const struct nble_response *par); /** * Read GAP Service Characteristics. * * The response to this request is received through - * @ref on_ble_gap_service_read_rsp + * @ref on_nble_gap_service_read_rsp * - * @param ble_gap_service_read GAP service characteristic to read + * @param nble_gap_service_read GAP service characteristic to read * @param user_data Pointer to private data */ -void ble_gap_service_read_req(const struct ble_gap_service_read_params *par, - void *user_data); +void nble_gap_service_read_req(const struct nble_gap_service_read_params *par, + void *user_data); /** - * Response to @ref ble_gap_service_read_req. + * Response to @ref nble_gap_service_read_req. * * @param par Response */ -void on_ble_gap_service_read_rsp(const struct ble_core_response *par); +void on_nble_gap_service_read_rsp(const struct nble_response *par); /** * Security manager configuration parameters. @@ -471,78 +473,77 @@ void on_ble_gap_service_read_rsp(const struct ble_core_response *par); * options and io_caps will define there will be a passkey request or not. * It is assumed that io_caps and options are compatible. */ -struct ble_core_gap_sm_config_params { - uint8_t options; /**< Sec options (@ref BLE_GAP_SM_OPTIONS) */ +struct nble_gap_sm_config_params { + /**< Sec options (@ref BLE_GAP_SM_OPTIONS) */ + uint8_t options; /**< I/O Capabilities to allow passkey exchange * (@ref BLE_GAP_IO_CAPABILITIES) */ uint8_t io_caps; uint8_t key_size; /**< Maximum encryption key size (7-16) */ + uint8_t oob_present; }; /** * Configuring the security manager. * * The response to this request is received through - * @ref on_ble_gap_sm_config_rsp + * @ref on_nble_gap_sm_config_rsp * * @param par Local authentication/bonding parameters - * @param user_data User data */ -void ble_gap_sm_config_req(const struct ble_core_gap_sm_config_params *par, - void *user_data); +void nble_gap_sm_config_req(const struct nble_gap_sm_config_params *par); -struct ble_gap_sm_config_rsp { +struct nble_gap_sm_config_rsp { void *user_data; /**< Pointer to user data structure */ int status; /**< Result of sec manager initialization */ uint32_t state; /**< State of bond DB */ }; /** - * Response to @ref ble_gap_sm_config_req. + * Response to @ref nble_gap_sm_config_req. * * @param par Response */ -void on_ble_gap_sm_config_rsp(struct ble_gap_sm_config_rsp *par); +void on_nble_gap_sm_config_rsp(struct nble_gap_sm_config_rsp *par); /** * Security manager pairing parameters. */ -struct ble_core_gap_sm_pairing_params { +struct nble_core_gap_sm_pairing_params { /**< authentication level see @ref BLE_GAP_SM_OPTIONS */ uint8_t auth_level; }; -struct ble_core_gap_sm_pairing_req_params { +struct nble_gap_sm_security_params { + struct bt_conn *conn; /**< Connection on which bonding procedure is executed */ uint16_t conn_handle; /**< Local authentication/bonding parameters */ - struct ble_core_gap_sm_pairing_params params; + struct nble_core_gap_sm_pairing_params params; }; /** * Initiate the bonding procedure (central). * * The response to this request is received through - * @ref on_ble_gap_sm_pairing_rsp + * @ref on_nble_gap_sm_pairing_rsp * * @param par Connection to initiate with its parameters - * @param user_data Pointer to private data */ -void ble_gap_sm_pairing_req(const struct ble_core_gap_sm_pairing_req_params *p, - void *user_data); +void nble_gap_sm_security_req(const struct nble_gap_sm_security_params *par); /** - * Response to @ref ble_gap_sm_pairing_req. + * Response to @ref nble_gap_sm_pairing_req. * * @param par Response */ -void on_ble_gap_sm_pairing_rsp(const struct ble_core_response *par); +void on_nble_gap_sm_pairing_rsp(const struct nble_response *par); /** * Security reply to incoming security request. */ -struct ble_core_gap_sm_passkey { +struct nble_core_gap_sm_passkey { /**< Security data type in this reply @ref BLE_GAP_SM_PASSKEY_TYPE */ uint8_t type; union { @@ -551,53 +552,53 @@ struct ble_core_gap_sm_passkey { }; }; -struct ble_gap_sm_key_reply_req_params { +struct nble_gap_sm_key_reply_req_params { /**< Connection on which bonding is going on */ uint16_t conn_handle; - struct ble_core_gap_sm_passkey params; /**< Bonding security reply */ + struct nble_core_gap_sm_passkey params; /**< Bonding security reply */ }; /** * Reply to an incoming passkey request event. * * The response to this request is received through - * @ref on_ble_gap_sm_passkey_reply_rsp + * @ref on_nble_gap_sm_passkey_reply_rsp * * @param par Connection on which bonding is going on and bonding security * reply - * @param user_data User data */ -void ble_gap_sm_passkey_reply_req(const struct ble_gap_sm_key_reply_req_params *par, - void *user_data); +void nble_gap_sm_passkey_reply_req(const struct nble_gap_sm_key_reply_req_params *par); -/** - * Response to @ref ble_gap_sm_passkey_reply_req. - * - * @param par Response - */ -void on_ble_gap_sm_passkey_reply_rsp(const struct ble_core_response *par); +struct nble_gap_sm_clear_bond_req_params { + bt_addr_le_t addr; +}; /** * Clear bonds * * The response to this request is received through - * @ref on_ble_gap_sm_clear_bonds_rsp + * @ref on_nble_gap_sm_clear_bonds_rsp * - * @param user_data User data + * @param par Parameters */ -void ble_gap_sm_clear_bonds_req(void *user_data); +void nble_gap_sm_clear_bonds_req(const struct nble_gap_sm_clear_bond_req_params *par); /** - * Response to @ref ble_gap_sm_clear_bonds_req. + * Response to @ref nble_gap_sm_clear_bonds_req. * * @param par Response */ -void on_ble_gap_sm_clear_bonds_rsp(const struct ble_core_response *par); +void on_nble_gap_sm_clear_bonds_rsp(const struct nble_response *par); + +struct nble_gap_sm_response { + int status; + struct bt_conn *conn; +}; /** * RSSI report parameters */ -struct ble_core_rssi_report_params { +struct nble_rssi_report_params { uint16_t conn_handle; /**< Connection handle */ uint8_t op; /**< RSSI operation @ref BLE_GAP_RSSI_OPS */ uint8_t delta_dBm; /**< minimum RSSI dBm change report new val */ @@ -609,20 +610,20 @@ struct ble_core_rssi_report_params { * Enable or disable the reporting of the RSSI value. * * The response to this request is received through - * @ref on_ble_gap_set_rssi_report_rsp + * @ref on_nble_gap_set_rssi_report_rsp * * @param params RSSI report parameters * @param user_data Pointer to user data */ -void ble_gap_set_rssi_report_req(const struct ble_core_rssi_report_params *par, - void *user_data); +void nble_gap_set_rssi_report_req(const struct nble_rssi_report_params *par, + void *user_data); /** - * Response to @ref ble_gap_set_rssi_report_req. + * Response to @ref nble_gap_set_rssi_report_req. * * @param par Response */ -void on_ble_gap_set_rssi_report_rsp(const struct ble_core_response *par); +void on_nble_gap_set_rssi_report_rsp(const struct nble_response *par); enum BLE_GAP_SCAN_OPTIONS { BLE_GAP_SCAN_DEFAULT = 0, @@ -641,54 +642,53 @@ struct nble_gap_scan_params { * Start scanning for BLE devices doing advertisement. * * The response to this request is received through - * @ref on_ble_gap_start_scan_rsp + * @ref on_nble_gap_start_scan_rsp * * @param par Scan parameters */ void nble_gap_start_scan_req(const struct nble_gap_scan_params *par); /** - * Response to @ref ble_gap_start_scan_req. + * Response to @ref nble_gap_start_scan_req. * * @param par Response */ -void on_ble_gap_start_scan_rsp(const struct ble_core_response *par); +void on_nble_gap_start_scan_rsp(const struct nble_response *par); /** * Stop scanning. * - * The response to this request is received through @ref on_ble_gap_stop_scan_rsp - * - * @param user_data Pointer to user data + * The response to this request is received through + * @ref on_nble_gap_stop_scan_rsp */ -void ble_gap_stop_scan_req(void *priv); +void nble_gap_stop_scan_req(void); /** - * Response to @ref ble_gap_stop_scan_req. + * Response to @ref nble_gap_stop_scan_req. * * @param par Response */ -void on_ble_gap_stop_scan_rsp(const struct ble_core_response *par); +void on_nble_gap_stop_scan_rsp(const struct nble_response *par); /** * Connect to a Remote Device. * - * The response to this request is received through @ref on_ble_gap_connect_rsp + * The response to this request is received through @ref on_nble_gap_connect_rsp * - * @param par connection parameters @ref ble_gap_connect_req_params + * @param par connection parameters @ref nble_gap_connect_req_params * @param priv Pointer to private data */ -void ble_gap_connect_req(const struct ble_gap_connect_req_params *par, +void nble_gap_connect_req(const struct nble_gap_connect_req_params *par, void *user_data); /** - * Response to @ref ble_gap_connect_req. + * Response to @ref nble_gap_connect_req. * * @param par Response */ -void on_ble_gap_connect_rsp(const struct ble_core_response *par); +void on_nble_gap_connect_rsp(const struct nble_response *par); -struct ble_gap_cancel_connect_params { +struct nble_gap_cancel_connect_params { const bt_addr_le_t bd; }; @@ -696,33 +696,33 @@ struct ble_gap_cancel_connect_params { * Cancel an ongoing connection attempt. * * The response to this request is received through - * @ref on_ble_gap_cancel_connect_rsp + * @ref on_nble_gap_cancel_connect_rsp * * @param user_data Pointer to user data */ -void ble_gap_cancel_connect_req(void *user_data); +void nble_gap_cancel_connect_req(void *user_data); /** - * Response to @ref ble_gap_cancel_connect_req. + * Response to @ref nble_gap_cancel_connect_req. * * @param par Response */ -void on_ble_gap_cancel_connect_rsp(const struct ble_core_response *par); +void on_nble_gap_cancel_connect_rsp(const struct nble_response *par); enum BLE_GAP_SET_OPTIONS { BLE_GAP_SET_CH_MAP = 0, /**< Set channel map */ }; -struct ble_gap_channel_map { +struct nble_gap_channel_map { uint16_t conn_handle; /**< conn on which to change channel map */ uint8_t map[5]; /**< 37 bits are used of the 40 bits (LSB) */ }; -struct ble_gap_set_option_params { +struct nble_gap_set_option_params { uint8_t op; /**< Option to set @ref BLE_GAP_SET_OPTIONS */ union { - struct ble_gap_channel_map ch_map; + struct nble_gap_channel_map ch_map; }; }; @@ -730,20 +730,20 @@ struct ble_gap_set_option_params { * Set a gap option (channel map etc) on a connection. * * The response to this request is received through - * @ref on_ble_gap_set_option_rsp + * @ref on_nble_gap_set_option_rsp * * @param par Contains gap options parameters * @param user_data Pointer to user data */ -void ble_gap_set_option_req(const struct ble_gap_set_option_params *par, - void *user_data); +void nble_gap_set_option_req(const struct nble_gap_set_option_params *par, + void *user_data); /** - * Response to @ref ble_gap_set_option_req. + * Response to @ref nble_gap_set_option_req. * * @param par Response */ -void on_ble_gap_set_option_rsp(const struct ble_core_response *par); +void on_nble_gap_set_option_rsp(const struct nble_response *par); /** Generic request op codes. * This allows to access some non connection related commands like DTM. @@ -753,7 +753,7 @@ enum BLE_GAP_GEN_OPS { }; /** Generic command parameters. */ -struct ble_gap_gen_cmd_params { +struct nble_gap_gen_cmd_params { uint8_t op_code; /**< @ref BLE_GAP_GEN_OPS */ }; @@ -761,61 +761,62 @@ struct ble_gap_gen_cmd_params { * Generic command * * The response to this request is received through - * @ref on_ble_gap_generic_cmd_rsp + * @ref on_nble_gap_generic_cmd_rsp * * @param par Contains Generic command parameters. * @param user_data Pointer to user data */ -void ble_gap_generic_cmd_req(const struct ble_gap_gen_cmd_params *par, - void *priv); +void nble_gap_generic_cmd_req(const struct nble_gap_gen_cmd_params *par, + void *priv); /** - * Response to @ref ble_gap_generic_cmd_req. + * Response to @ref nble_gap_generic_cmd_req. * * @param par Response */ -void on_ble_gap_generic_cmd_rsp(const struct ble_core_response *par); +void on_nble_gap_generic_cmd_rsp(const struct nble_response *par); /** - * Get ble_core version. + * Get nble_core version. * * The response to this request is received through @ref on_ble_get_version_rsp * * @param rsp Pointer to response data structure */ -void ble_get_version_req(void *user_data); +void nble_get_version_req(void *user_data); -struct ble_version_response { +struct nble_version_response { struct version_header version; void *user_data; /**< Pointer to response data structure */ }; /** - * Response to @ref ble_get_version_req. + * Response to @ref nble_get_version_req. * * @param par Response */ -void on_ble_get_version_rsp(const struct ble_version_response *par); +void on_nble_get_version_rsp(const struct nble_version_response *par); /** * Init DTM mode. * - * The response to this request is received through @ref on_ble_gap_dtm_init_rsp + * The response to this request is received through + * @ref on_nble_gap_dtm_init_rsp * * @param user_data Pointer to response data structure */ -void ble_gap_dtm_init_req(void *user_data); +void nble_gap_dtm_init_req(void *user_data); /** - * Response to @ref ble_gap_dtm_init_req. + * Response to @ref nble_gap_dtm_init_req. * * @param user_data Pointer to user data structure */ -void on_ble_gap_dtm_init_rsp(void *user_data); +void on_nble_gap_dtm_init_rsp(void *user_data); -struct ble_gap_connect_evt { +struct nble_gap_connect_evt { uint16_t conn_handle; - struct ble_gap_connection_values conn_values; + struct nble_gap_connection_values conn_values; uint8_t role; bt_addr_le_t peer_bda; }; @@ -825,9 +826,9 @@ struct ble_gap_connect_evt { * * @param ev Pointer to the event structure. */ -void on_ble_gap_connect_evt(const struct ble_gap_connect_evt *ev); +void on_nble_gap_connect_evt(const struct nble_gap_connect_evt *ev); -struct ble_gap_disconnect_evt { +struct nble_gap_disconnect_evt { uint16_t conn_handle; /**< Connection handle */ uint8_t hci_reason; /**< HCI disconnect reason */ }; @@ -837,15 +838,15 @@ struct ble_gap_disconnect_evt { * * @param ev Pointer to the event structure. */ -void on_ble_gap_disconnect_evt(const struct ble_gap_disconnect_evt *ev); +void on_nble_gap_disconnect_evt(const struct nble_gap_disconnect_evt *ev); /** * Updated connection event. */ -struct ble_gap_conn_update_evt { +struct nble_gap_conn_update_evt { uint16_t conn_handle; - struct ble_gap_connection_values conn_values; + struct nble_gap_connection_values conn_values; }; /** @@ -853,7 +854,7 @@ struct ble_gap_conn_update_evt { * * @param ev Pointer to the event structure. */ -void on_ble_gap_conn_update_evt(const struct ble_gap_conn_update_evt *ev); +void on_nble_gap_conn_update_evt(const struct nble_gap_conn_update_evt *ev); struct nble_gap_adv_report_evt { bt_addr_le_t addr; @@ -861,7 +862,7 @@ struct nble_gap_adv_report_evt { uint8_t adv_type; }; -struct ble_gap_rssi_evt { +struct nble_gap_rssi_evt { uint16_t conn_handle; /**< Connection handle */ int8_t rssi_lvl; /**< RSSI level (compared to 0 dBm) */ }; @@ -871,9 +872,9 @@ struct ble_gap_rssi_evt { * * @param ev Pointer to the event structure. */ -void on_ble_gap_rssi_evt(const struct ble_gap_rssi_evt *ev); +void on_nble_gap_rssi_evt(const struct nble_gap_rssi_evt *ev); -struct ble_gap_timout_evt { +struct nble_gap_timout_evt { uint16_t conn_handle; /**< Connection handle */ /**< reason for timeout @ref BLE_SVC_GAP_TIMEOUT_REASON */ int reason; @@ -884,9 +885,9 @@ struct ble_gap_timout_evt { * * @param ev Pointer to the event structure. */ -void on_ble_gap_to_evt(const struct ble_gap_timout_evt *ev); +void on_nble_gap_to_evt(const struct nble_gap_timout_evt *ev); -struct ble_gap_sm_passkey_req_evt { +struct nble_gap_sm_passkey_req_evt { uint16_t conn_handle; /**< Connection handle */ /**< Passkey or OBB data see @ref BLE_GAP_SM_PASSKEY_TYPE */ uint8_t key_type; @@ -898,9 +899,9 @@ struct ble_gap_sm_passkey_req_evt { * * @param ev Pointer to the event structure. */ -void on_ble_gap_sm_passkey_req_evt(const struct ble_gap_sm_passkey_req_evt *ev); +void on_nble_gap_sm_passkey_req_evt(const struct nble_gap_sm_passkey_req_evt *); -struct ble_gap_sm_passkey_disp_evt { +struct nble_gap_sm_passkey_disp_evt { uint16_t conn_handle; /**< Connection handle */ uint8_t passkey[BLE_PASSKEY_LEN]; /**< Passkey to be displayed */ }; @@ -910,9 +911,9 @@ struct ble_gap_sm_passkey_disp_evt { * * @param ev Pointer to the event structure. */ -void on_ble_gap_sm_passkey_display_evt(const struct ble_gap_sm_passkey_disp_evt *ev); +void on_nble_gap_sm_passkey_display_evt(const struct nble_gap_sm_passkey_disp_evt *ev); -struct ble_gap_sm_status_evt { +struct nble_gap_sm_status_evt { uint16_t conn_handle; /**< Connection handle */ /**< Security manager status @ref BLE_GAP_SM_STATUS */ uint8_t status; @@ -925,24 +926,24 @@ struct ble_gap_sm_status_evt { * * @param ev Pointer to the event structure. */ -void on_ble_gap_sm_status_evt(const struct ble_gap_sm_status_evt *ev); +void on_nble_gap_sm_status_evt(const struct nble_gap_sm_status_evt *ev); /** - * Response to @ref ble_set_enable_config_req. + * Response to @ref nble_set_enable_config_req. * * @param par Response */ -void on_ble_set_enable_config_rsp(const struct ble_core_response *par); +void on_ble_set_enable_config_rsp(const struct nble_response *par); /** * Get the list of bonded devices * * @param user_data User Data */ -void ble_get_bonded_device_list_req(void *user_data); +void nble_get_bonded_device_list_req(void *user_data); /**@brief Structure containing list of bonded devices. */ -struct ble_core_bonded_devices { +struct nble_core_bonded_devices { #ifdef CONFIG_TCMD_BLE_DEBUG /**< Pointer to an array of device address pointers, pointing to * addresses to be used in whitelist. NULL if none are given. @@ -952,10 +953,31 @@ struct ble_core_bonded_devices { uint8_t addr_count; /**< Count of device addr in array. */ }; -struct ble_get_bonded_device_list_rsp { - int status; /**< Status of the operation */ - struct ble_core_bonded_devices bonded_dev; - struct cfw_message *priv; +struct nble_gap_sm_bond_info; + +typedef void (*ble_bond_info_cb_t)(const struct nble_gap_sm_bond_info *info, + const bt_addr_le_t *addr, uint16_t len, + void *user_data); + +struct nble_gap_sm_bond_info_param { + ble_bond_info_cb_t cb; + void *user_data; + bool include_bonded_addrs; }; -void on_ble_get_bonded_device_list_rsp(const struct ble_get_bonded_device_list_rsp *par); +void nble_gap_sm_bond_info_req(const struct nble_gap_sm_bond_info_param *params); + +struct nble_gap_sm_bond_info { + int err; + uint8_t addr_count; + uint8_t irk_count; +}; + +struct nble_gap_sm_bond_info_rsp { + ble_bond_info_cb_t cb; + void *user_data; + struct nble_gap_sm_bond_info info; +}; + +void on_nble_gap_sm_bond_info_rsp(const struct nble_gap_sm_bond_info_rsp *rsp, + const bt_addr_le_t *peer_addr, uint16_t len); diff --git a/drivers/nble/gatt.c b/drivers/nble/gatt.c index 84393d0b0b7..96da6f2c31a 100644 --- a/drivers/nble/gatt.c +++ b/drivers/nble/gatt.c @@ -31,12 +31,12 @@ #define NBLE_BUF_SIZE 384 -struct ble_gatt_service { +struct nble_gatt_service { const struct bt_gatt_attr *attrs; uint16_t attr_count; }; -static struct ble_gatt_service svc_db[BLE_GATTS_MAX_SERVICES]; +static struct nble_gatt_service svc_db[BLE_GATTS_MAX_SERVICES]; static uint8_t svc_count; /** @@ -112,7 +112,7 @@ static int attr_read(struct bt_gatt_attr *attr, uint8_t *data, size_t len) int bt_gatt_register(struct bt_gatt_attr *attrs, size_t count) { - struct ble_gatt_register_req param; + struct nble_gatt_register_req param; size_t i; /* TODO: Replace the following with net_buf */ uint8_t attr_table[NBLE_BUF_SIZE]; @@ -133,7 +133,7 @@ int bt_gatt_register(struct bt_gatt_attr *attrs, size_t count) for (i = 0; i < count; i++) { struct bt_gatt_attr *attr = &attrs[i]; - struct ble_gatt_attr *att; + struct nble_gatt_attr *att; int err; if (attr_table_size + sizeof(*att) > sizeof(attr_table)) { @@ -164,12 +164,12 @@ int bt_gatt_register(struct bt_gatt_attr *attrs, size_t count) att->data_size); } - ble_gatt_register_req(¶m, attr_table, attr_table_size); + nble_gatt_register_req(¶m, attr_table, attr_table_size); return 0; } -void on_ble_gatt_register_rsp(const struct ble_gatt_register_rsp *rsp, - const struct ble_gatt_attr_handles *handles, +void on_ble_gatt_register_rsp(const struct nble_gatt_register_rsp *rsp, + const struct nble_gatt_attr_handles *handles, uint8_t len) { BT_DBG("status %u", rsp->status); @@ -359,7 +359,7 @@ int bt_gatt_attr_read_cpf(struct bt_conn *conn, int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *data, uint16_t len) { - struct ble_gatt_send_notif_ind_params notif; + struct nble_gatt_send_notif_ind_params notif; if (conn) { notif.conn_handle = conn->handle; @@ -370,7 +370,7 @@ int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr, notif.params.attr = (struct bt_gatt_attr *)attr; notif.params.offset = 0; - ble_gatt_send_notif_req(¬if, (uint8_t *)data, len); + nble_gatt_send_notif_req(¬if, (uint8_t *)data, len); return 0; } @@ -419,29 +419,29 @@ void bt_gatt_cancel(struct bt_conn *conn) { } -void on_ble_gattc_write_rsp(const struct ble_gattc_write_rsp *ev, - void *priv) +void on_nble_gattc_write_rsp(const struct nble_gattc_write_rsp *ev, + void *priv) { BT_DBG(""); } -void on_ble_gattc_read_rsp(const struct ble_gattc_read_rsp *ev, - uint8_t *data, uint8_t data_len, void *priv) +void on_nble_gattc_read_rsp(const struct nble_gattc_read_rsp *ev, + uint8_t *data, uint8_t data_len, void *priv) { BT_DBG(""); } -void on_ble_gattc_value_evt(const struct ble_gattc_value_evt *ev, - uint8_t *buf, uint8_t buflen) +void on_nble_gattc_value_evt(const struct nble_gattc_value_evt *ev, + uint8_t *buf, uint8_t buflen) { BT_DBG(""); } -void on_ble_gatts_write_evt(const struct ble_gatt_wr_evt *evt, - const uint8_t *buf, uint8_t buflen) +void on_nble_gatts_write_evt(const struct nble_gatt_wr_evt *evt, + const uint8_t *buf, uint8_t buflen) { const struct bt_gatt_attr *attr = evt->attr; - struct ble_gatts_rw_reply_params reply_data; + struct nble_gatts_rw_reply_params reply_data; BT_DBG("handle 0x%04x buf %p len %u", attr->handle, buf, buflen); @@ -460,36 +460,36 @@ void on_ble_gatts_write_evt(const struct ble_gatt_wr_evt *evt, } } -void on_ble_gatts_get_attribute_value_rsp(const struct ble_gatts_attribute_response *par, - uint8_t *data, uint8_t length) +void on_nble_gatts_get_attribute_value_rsp(const struct nble_gatts_attribute_response *par, + uint8_t *data, uint8_t length) { BT_DBG(""); } -void on_ble_gattc_discover_rsp(const struct ble_gattc_disc_rsp *rsp, - const uint8_t *data, uint8_t len) +void on_nble_gattc_discover_rsp(const struct nble_gattc_disc_rsp *rsp, + const uint8_t *data, uint8_t len) { BT_DBG(""); } -void on_ble_gatts_send_svc_changed_rsp(const struct ble_core_response *par) +void on_nble_gatts_send_svc_changed_rsp(const struct nble_core_response *par) { BT_DBG(""); } -void on_ble_gatts_set_attribute_value_rsp(const struct ble_gatts_attribute_response *par) +void on_nble_gatts_set_attribute_value_rsp(const struct nble_gatts_attribute_response *par) { BT_DBG(""); } -void on_ble_gatts_send_notif_ind_rsp(const struct ble_gatt_notif_ind_rsp *par) +void on_nble_gatts_send_notif_ind_rsp(const struct nble_gatt_notif_ind_rsp *par) { BT_DBG(""); } -void on_ble_gatts_read_evt(const struct nble_gatt_rd_evt *evt) +void on_nble_gatts_read_evt(const struct nble_gatt_rd_evt *evt) { - struct ble_gatts_rw_reply_params reply_data; + struct nble_gatts_rw_reply_params reply_data; const struct bt_gatt_attr *attr; /* TODO: Replace the following with net_buf */ uint8_t data[NBLE_BUF_SIZE]; diff --git a/drivers/nble/gatt_internal.h b/drivers/nble/gatt_internal.h index 34662dd7825..a6965d7fd9f 100644 --- a/drivers/nble/gatt_internal.h +++ b/drivers/nble/gatt_internal.h @@ -23,7 +23,7 @@ #include /* Forward declarations */ -struct ble_core_response; +struct nble_core_response; /* Max number of service supported, if changed update BLE core needs to be * updated too! @@ -46,14 +46,14 @@ enum BLE_GATT_IND_TYPES { }; /** GATT Register structure for one service */ -struct ble_gatt_register_req { +struct nble_gatt_register_req { /**< Base address of the attribute table in the Quark mem space */ struct bt_gatt_attr *attr_base; uint8_t attr_count; /**< Number of of attributes in this service */ }; /** GATT Register structure for one service */ -struct ble_gatt_register_rsp { +struct nble_gatt_register_rsp { int status; /**< Status of the registration op */ struct bt_gatt_attr *attr_base; /**< Pointer to the registered table */ uint8_t attr_count; /**< Number of attributes added */ @@ -62,9 +62,9 @@ struct ble_gatt_register_rsp { /** Service index and Attribute index mapping structure. * * Mapping index into attribute tables as registered with bt_gatt_register/ - * ble_gatt_register. + * nble_gatt_register. */ -struct ble_gatt_attr_handle_mapping { +struct nble_gatt_attr_handle_mapping { uint8_t svc_idx; /**< Service index */ uint8_t attr_idx; /**< Attribute index into service attribute table */ }; @@ -92,7 +92,7 @@ enum BLE_GATTS_WR_OPS { /** * Write event context data structure. */ -struct ble_gatt_wr_evt { +struct nble_gatt_wr_evt { struct bt_gatt_attr *attr; /**< GATT Attribute */ uint16_t conn_handle; /**< Connection handle */ uint16_t attr_handle; /**< handle of attribute to write */ @@ -110,7 +110,7 @@ struct nble_gatt_rd_evt { uint16_t offset; /**< offset in attribute buffer */ }; -struct ble_gatts_rw_reply_params { +struct nble_gatts_rw_reply_params { int status; /**< Reply status, from errno */ uint16_t conn_handle; /**< Connection handle */ uint16_t offset; /**< Offset in attribute buffer */ @@ -120,7 +120,7 @@ struct ble_gatts_rw_reply_params { /** * Notification/Indication parameters */ -struct ble_gatt_notif_ind_params { +struct nble_gatt_notif_ind_params { struct bt_gatt_attr *attr; uint16_t offset; }; @@ -129,34 +129,28 @@ struct ble_gatt_notif_ind_params { * Indication or notification. */ -struct ble_gatt_send_notif_ind_params { +struct nble_gatt_send_notif_ind_params { void *cback; uint16_t conn_handle; - struct ble_gatt_notif_ind_params params; + struct nble_gatt_notif_ind_params params; }; -enum ble_gatts_notif_ind_type { +enum nble_gatts_notif_ind_type { MSG_ID_BLE_GATTS_SEND_NOTIF_RSP, /**< Notification type */ MSG_ID_BLE_GATTS_SEND_IND_RSP, /**< Indication type */ }; -struct ble_gatt_notif_ind_rsp { - /**< Callback function to call on reception of this message */ +struct nble_gatt_notif_ind_rsp { bt_gatt_notify_func_t cback; - int status; /**< Status of the operation. */ - /**< Connection handle, can be 0xFFFF if value change broadcast */ + int status; uint16_t conn_handle; - struct bt_gatt_attr *attr; /**< GATT Attribute */ - /**< MSG_ID_BLE_GATTS_SEND_NOTIF_RSP for notification or - * MSG_ID_BLE_GATTS_SEND_IND_RSP for indication - */ - uint8_t msg_type; + struct bt_gatt_attr *attr; }; /** * Attribute handle range definition. */ -struct ble_core_gatt_handle_range { +struct nble_gatt_handle_range { uint16_t start_handle; uint16_t end_handle; }; @@ -164,27 +158,27 @@ struct ble_core_gatt_handle_range { /** * Primary service */ -struct ble_gattc_prim_svc { +struct nble_gattc_prim_svc { uint16_t handle; /**< Attribute handle */ - struct ble_core_gatt_handle_range handle_range; /**< handle range */ + struct nble_gatt_handle_range handle_range; /**< handle range */ struct bt_uuid_128 uuid; /**< Attribute's UUID */ }; /** * Generic GATTC response message. */ -struct ble_gattc_rsp { +struct nble_gattc_rsp { int status; uint16_t conn_handle; /**< GAP connection handle */ }; -struct ble_gattc_disc_rsp { +struct nble_gattc_disc_rsp { int status; uint16_t conn_handle; uint8_t type; /**< @ref BLE_GATT_DISC_TYPES */ }; -struct ble_gattc_evt { +struct nble_gattc_evt { uint16_t conn_handle; int status; }; @@ -192,14 +186,14 @@ struct ble_gattc_evt { /** * Included service. */ -struct ble_gattc_incl_svc { +struct nble_gattc_incl_svc { uint16_t handle; /**< Handle of included svc */ - struct ble_core_gatt_handle_range handle_range; /**< handle range */ + struct nble_gatt_handle_range handle_range; /**< handle range */ struct bt_uuid_128 uuid; /**< Service UUID */ }; /* GATTC characteristic */ -struct ble_gattc_characteristic { +struct nble_gattc_characteristic { uint16_t handle; /**< Characteristic Definition handle */ uint8_t prop; /**< Characteristic property */ uint16_t value_handle; /**< Characteristic value handle */ @@ -210,31 +204,31 @@ struct ble_gattc_characteristic { /** * GATTC descriptor. */ -struct ble_gattc_descriptor { +struct nble_gattc_descriptor { uint16_t handle; /**< descriptor handle */ struct bt_uuid_128 uuid; /**< uuid of the descriptor */ }; -struct ble_gattc_attr { +struct nble_gattc_attr { uint8_t type; /**< @ref BLE_GATT_DISC_TYPES */ union { - struct ble_gattc_prim_svc prim; - struct ble_gattc_incl_svc incls; - struct ble_gattc_characteristic chars; - struct ble_gattc_descriptor desc; + struct nble_gattc_prim_svc prim; + struct nble_gattc_incl_svc incls; + struct nble_gattc_characteristic chars; + struct nble_gattc_descriptor desc; }; }; -struct ble_gatts_set_attribute_params { +struct nble_gatts_set_attribute_params { uint16_t value_handle; /* mandatory */ uint16_t offset; /* by default 0 */ }; -struct ble_gatts_get_attribute_params { +struct nble_gatts_get_attribute_params { uint16_t value_handle; /* mandatory */ }; -struct ble_gatts_attribute_response { +struct nble_gatts_attribute_response { int status; /**< Status of the operation. */ uint16_t value_handle; /* mandatory */ void *priv; @@ -251,15 +245,15 @@ struct ble_gatts_attribute_response { * @param len Length of attribute value to write * @param priv Pointer to private data */ -void ble_gatts_set_attribute_value_req(const struct ble_gatts_set_attribute_params *par, - uint8_t *data, uint8_t len, void *priv); +void nble_gatts_set_attribute_value_req(const struct nble_gatts_set_attribute_params *par, + uint8_t *data, uint8_t len, void *priv); /** - * Response to @ref ble_gatts_send_svc_changed_req. + * Response to @ref nble_gatts_send_svc_changed_req. * * @param par Response */ -void on_ble_gatts_set_attribute_value_rsp(const struct ble_gatts_attribute_response *par); +void on_ble_gatts_set_attribute_value_rsp(const struct nble_gatts_attribute_response *par); /** * Get an attribute value. @@ -270,20 +264,20 @@ void on_ble_gatts_set_attribute_value_rsp(const struct ble_gatts_attribute_respo * @param par Getting attribute parameters * @param priv Pointer to private data */ -void ble_gatts_get_attribute_value_req(const struct ble_gatts_get_attribute_params *par, - void *priv); +void nble_gatts_get_attribute_value_req(const struct nble_gatts_get_attribute_params *par, + void *priv); /** - * Response to @ref ble_gatts_get_attribute_value_req. + * Response to @ref nble_gatts_get_attribute_value_req. * * @param par Response * @param data Attribute value * @param length Length of attribute value */ -void on_ble_gatts_get_attribute_value_rsp(const struct ble_gatts_attribute_response *par, +void on_ble_gatts_get_attribute_value_rsp(const struct nble_gatts_attribute_response *par, uint8_t *data, uint8_t length); -struct ble_gatts_svc_changed_params { +struct nble_gatts_svc_changed_params { uint16_t conn_handle; uint16_t start_handle; uint16_t end_handle; @@ -300,15 +294,15 @@ struct ble_gatts_svc_changed_params { * @param par Service parameters * @param priv Pointer to private data */ -void ble_gatts_send_svc_changed_req(const struct ble_gatts_svc_changed_params *par, - void *priv); +void nble_gatts_send_svc_changed_req(const struct nble_gatts_svc_changed_params *par, + void *priv); /** - * Response to @ref ble_gatts_send_svc_changed_req. + * Response to @ref nble_gatts_send_svc_changed_req. * * @param par Response */ -void on_ble_gatts_send_svc_changed_rsp(const struct ble_core_response *par); +void on_ble_gatts_send_svc_changed_rsp(const struct nble_core_response *par); /** Register a BLE GATT Service. * @@ -316,8 +310,8 @@ void on_ble_gatts_send_svc_changed_rsp(const struct ble_core_response *par); * @param attr Serialized attribute buffer * @param attr_len Length of buffer */ -void ble_gatt_register_req(const struct ble_gatt_register_req *par, - uint8_t *buf, uint16_t len); +void nble_gatt_register_req(const struct nble_gatt_register_req *par, + uint8_t *buf, uint16_t len); /** * Reply to an authorize request. @@ -326,30 +320,30 @@ void ble_gatt_register_req(const struct ble_gatt_register_req *par, * @param buf read value of the attribute * @param len length of buf */ -void nble_gatts_authorize_reply_req(const struct ble_gatts_rw_reply_params *par, +void nble_gatts_authorize_reply_req(const struct nble_gatts_rw_reply_params *par, uint8_t *buf, uint16_t len); /** - * Conversion table entry ble_core to host attr index + * Conversion table entry nble_core to host attr index * * This is returned as a table on registering. */ -struct ble_gatt_attr_handles { +struct nble_gatt_attr_handles { uint16_t handle; /* handle from ble controller should be sufficient */ }; /** Response to registering a BLE GATT Service. * - * The returned buffer contains an array (@ref ble_gatt_attr_idx_entry)with the + * The returned buffer contains an array (@ref nble_gatt_attr_idx_entry)with the * corresponding handles. * * @param par Parameters of attribute data base * @param attr Returned attributes index list * @param len Length of buffer */ -void on_ble_gatt_register_rsp(const struct ble_gatt_register_rsp *par, - const struct ble_gatt_attr_handles *attr, - uint8_t len); +void on_nble_gatt_register_rsp(const struct nble_gatt_register_rsp *par, + const struct nble_gatt_attr_handles *attr, + uint8_t len); /** * Function invoked by the BLE core when a write occurs. @@ -358,7 +352,7 @@ void on_ble_gatt_register_rsp(const struct ble_gatt_register_rsp *par, * @param buf Pointer to data buffer * @param len Buffer length */ -void on_ble_gatts_write_evt(const struct ble_gatt_wr_evt *ev, +void on_ble_gatts_write_evt(const struct nble_gatt_wr_evt *ev, const uint8_t *buf, uint8_t len); /** @@ -369,7 +363,7 @@ void on_ble_gatts_write_evt(const struct ble_gatt_wr_evt *ev, * * @return Handle of attribute or 0 if not found */ -uint16_t ble_attr_idx_to_handle(const struct bt_gatt_attr *attrs, +uint16_t nble_attr_idx_to_handle(const struct bt_gatt_attr *attrs, uint8_t index); /** @@ -383,8 +377,8 @@ uint16_t ble_attr_idx_to_handle(const struct bt_gatt_attr *attrs, * @param length Length of indication - may be 0, in this case already * stored data is sent */ -void ble_gatt_send_notif_req(const struct ble_gatt_send_notif_ind_params *par, - uint8_t *data, uint16_t length); +void nble_gatt_send_notif_req(const struct nble_gatt_send_notif_ind_params *par, + uint8_t *data, uint16_t length); /** * Send indication. @@ -397,41 +391,42 @@ void ble_gatt_send_notif_req(const struct ble_gatt_send_notif_ind_params *par, * @param length Length of indication - may be 0, in this case already * stored data is sent */ -void ble_gatt_send_ind_req(const struct ble_gatt_send_notif_ind_params *par, - uint8_t *data, uint8_t length); +void nble_gatt_send_ind_req(const struct nble_gatt_send_notif_ind_params *par, + uint8_t *data, uint8_t length); /** - * Response to @ref ble_gatts_send_ind_req and @ref ble_gatts_send_notif_req + * Response to @ref nble_gatts_send_ind_req and @ref nble_gatts_send_notif_req * * @param par Response */ -void on_ble_gatts_send_notif_ind_rsp(const struct ble_gatt_notif_ind_rsp *par); +void on_ble_gatts_send_notif_ind_rsp(const struct nble_gatt_notif_ind_rsp *par); /** Discover parameters. */ -struct ble_core_discover_params { +struct nble_discover_params { struct bt_uuid_128 uuid; /**< Attribute UUID */ - struct ble_core_gatt_handle_range handle_range; /**< Discover range */ + struct nble_gatt_handle_range handle_range; /**< Discover range */ uint16_t conn_handle; /**< Connection handl */ - uint8_t type; /**< Discover type @ref BLE_GATT_DISC_TYPES */ + /**< Discover type @ref BLE_GATT_DISC_TYPES */ + uint8_t type; }; /** * Discover service. * * @param req Request structure. - * @param priv Pointer to private data. + * @param user_data Pointer to private data. */ -void ble_gattc_discover_req(const struct ble_core_discover_params *req, - void *priv); +void nble_gattc_discover_req(const struct nble_discover_params *req, + void *user_data); /** - * Response to @ref ble_gattc_discover_req. + * Response to @ref nble_gattc_discover_req. * * @param rsp Response * @param data Pointer to the data * @param len Length of the data */ -void on_ble_gattc_discover_rsp(const struct ble_gattc_disc_rsp *rsp, +void on_ble_gattc_discover_rsp(const struct nble_gattc_disc_rsp *rsp, const uint8_t *data, uint8_t len); @@ -441,36 +436,39 @@ void on_ble_gattc_discover_rsp(const struct ble_gattc_disc_rsp *rsp, * UUID pointer and user_data pointer are used as offset into buffer itself. * The offset is from the beginning of the buffer. therefore a value of 0 * means that UUID or user_data is not present. */ -struct ble_gatt_attr { +struct nble_gatt_attr { /** Attribute permissions */ uint16_t perm; /** Attribute variable data size */ uint16_t data_size; - /** Attribute variable data: always starts with the UUID and data follows */ + /** + * Attribute variable data: always starts with the UUID and + * data follows + */ uint8_t data[0]; }; -struct ble_gattc_read_params { +struct nble_gattc_read_params { uint16_t conn_handle; /**< Connection handle*/ uint16_t char_handle; /**< Handle of the attribute to be read */ uint16_t offset; /**< Offset into the attr value to be read */ }; -struct ble_gattc_read_rsp { +struct nble_gattc_read_rsp { uint16_t conn_handle; int status; uint16_t handle; /**< handle of char attr read */ uint16_t offset; /**< offset of data returned */ }; -struct ble_gattc_write_params { +struct nble_gattc_write_params { uint16_t conn_handle; /**< Connection handle*/ uint16_t char_handle; /**< Handle of the attribute to be read */ uint16_t offset; /**< Offset into the attr value to be write */ bool with_resp; /**< Equal to true is response is needed */ }; -struct ble_gattc_write_rsp { +struct nble_gattc_write_rsp { uint16_t conn_handle; int status; uint16_t char_handle; @@ -484,18 +482,18 @@ struct ble_gattc_write_rsp { * @param params Request structure. * @param priv Pointer to private data. */ -void ble_gattc_read_req(const struct ble_gattc_read_params *params, +void nble_gattc_read_req(const struct nble_gattc_read_params *params, void *priv); /** - * Response to @ref ble_gattc_read_req. + * Response to @ref nble_gattc_read_req. * * @param ev Pointer to the event structure * @param data Pointer to the data byte stream * @param data_len Length of the data byte stream * @param priv Pointer to private data. */ -void on_ble_gattc_read_rsp(const struct ble_gattc_read_rsp *ev, +void on_ble_gattc_read_rsp(const struct nble_gattc_read_rsp *ev, uint8_t *data, uint8_t data_len, void *priv); /** @@ -507,16 +505,16 @@ void on_ble_gattc_read_rsp(const struct ble_gattc_read_rsp *ev, * size, the controller fragment buffer itself. * @param priv Pointer to private data. */ -void ble_gattc_write_req(const struct ble_gattc_write_params *params, +void nble_gattc_write_req(const struct nble_gattc_write_params *params, const uint8_t *buf, uint8_t len, void *priv); /** - * Response to @ref ble_gattc_write_req. + * Response to @ref nble_gattc_write_req. * * @param ev Pointer to the event structure * @param priv Pointer to private data. */ -void on_ble_gattc_write_rsp(const struct ble_gattc_write_rsp *ev, +void on_ble_gattc_write_rsp(const struct nble_gattc_write_rsp *ev, void *priv); #if defined(CONFIG_BLUETOOTH_GATT_CLIENT) @@ -524,7 +522,7 @@ void bt_gatt_connected(struct bt_conn *conn); void bt_gatt_disconnected(struct bt_conn *conn); #endif -struct ble_gattc_value_evt { +struct nble_gattc_value_evt { uint16_t conn_handle; int status; /**< handle of characteristic being notified/indicated */ @@ -540,10 +538,10 @@ struct ble_gattc_value_evt { * @param buf Pointer to the data byte stream * @param len Length of the data byte stream */ -void on_ble_gattc_value_evt(const struct ble_gattc_value_evt *ev, +void on_ble_gattc_value_evt(const struct nble_gattc_value_evt *ev, uint8_t *buf, uint8_t len); -struct ble_gattc_to_evt { +struct nble_gattc_to_evt { uint16_t conn_handle; uint16_t reason; /**< GATT timeout reason */ }; @@ -553,4 +551,4 @@ struct ble_gattc_to_evt { * * @param ev Pointer to the event structure */ -void on_ble_gattc_to_evt(const struct ble_gattc_to_evt *ev); +void on_ble_gattc_to_evt(const struct nble_gattc_to_evt *ev); diff --git a/drivers/nble/rpc_functions_to_ble_core.h b/drivers/nble/rpc_functions_to_ble_core.h index d10c7e7cec9..7d447e829ce 100644 --- a/drivers/nble/rpc_functions_to_ble_core.h +++ b/drivers/nble/rpc_functions_to_ble_core.h @@ -19,81 +19,83 @@ FN_SIG_NONE(nble_gap_stop_scan_req) #define LIST_FN_SIG_S \ - FN_SIG_S(ble_gap_start_advertise_req, \ - struct ble_gap_adv_params *) \ + FN_SIG_S(nble_gap_start_advertise_req, \ + struct nble_gap_adv_params *) \ FN_SIG_S(nble_gap_start_scan_req, \ - const struct nble_gap_scan_params *) + const struct nble_gap_scan_params *) \ + FN_SIG_S(nble_gap_sm_config_req, \ + const struct nble_gap_sm_config_params *) \ + FN_SIG_S(nble_gap_sm_passkey_reply_req, \ + const struct nble_gap_sm_key_reply_req_params *) \ + FN_SIG_S(nble_gap_sm_bond_info_req, \ + const struct nble_gap_sm_bond_info_param *) \ + FN_SIG_S(nble_gap_sm_security_req, \ + const struct nble_gap_sm_security_params *) \ + FN_SIG_S(nble_gap_sm_clear_bonds_req, \ + const struct nble_gap_sm_clear_bond_req_params *) #define LIST_FN_SIG_P \ - FN_SIG_P(ble_get_version_req, void *) \ - FN_SIG_P(ble_gap_dtm_init_req, void *) \ - FN_SIG_P(ble_gap_read_bda_req, void *) \ - FN_SIG_P(ble_gap_stop_advertise_req, void *) \ - FN_SIG_P(ble_gap_clr_white_list_req, void *) \ - FN_SIG_P(ble_gap_sm_clear_bonds_req, void *) \ - FN_SIG_P(ble_gap_cancel_connect_req, void *) \ - FN_SIG_P(ble_get_bonded_device_list_req, void *) + FN_SIG_P(nble_get_version_req, void *) \ + FN_SIG_P(nble_gap_dtm_init_req, void *) \ + FN_SIG_P(nble_gap_read_bda_req, void *) \ + FN_SIG_P(nble_gap_stop_advertise_req, void *) \ + FN_SIG_P(nble_gap_clr_white_list_req, void *) \ + FN_SIG_P(nble_gap_cancel_connect_req, void *) #define LIST_FN_SIG_S_B \ - FN_SIG_S_B(ble_gatt_register_req, \ - const struct ble_gatt_register_req *, \ + FN_SIG_S_B(nble_gatt_register_req, \ + const struct nble_gatt_register_req *, \ uint8_t *, uint16_t) \ - FN_SIG_S_B(ble_gatt_send_notif_req, \ - const struct ble_gatt_send_notif_ind_params *, \ + FN_SIG_S_B(nble_gatt_send_notif_req, \ + const struct nble_gatt_send_notif_ind_params *, \ uint8_t *, uint16_t) \ - FN_SIG_S_B(ble_gatt_send_ind_req, \ - const struct ble_gatt_send_notif_ind_params *, \ + FN_SIG_S_B(nble_gatt_send_ind_req, \ + const struct nble_gatt_send_notif_ind_params *, \ uint8_t *, uint8_t) \ FN_SIG_S_B(nble_gatts_authorize_reply_req, \ - const struct ble_gatts_rw_reply_params *, \ + const struct nble_gatts_rw_reply_params *, \ uint8_t *, uint16_t) #define LIST_FN_SIG_B_B_P \ - FN_SIG_B_B_P(ble_gap_wr_white_list_req, bt_addr_le_t *, \ - uint8_t, struct ble_gap_irk_info *, \ + FN_SIG_B_B_P(nble_gap_wr_white_list_req, bt_addr_le_t *, \ + uint8_t, struct nble_gap_irk_info *, \ uint8_t, void *) #define LIST_FN_SIG_S_P \ - FN_SIG_S_P(ble_gap_disconnect_req, \ - const struct ble_gap_disconnect_req_params *, void *)\ - FN_SIG_S_P(ble_gap_sm_pairing_req, \ - const struct ble_core_gap_sm_pairing_req_params *, \ + FN_SIG_S_P(nble_gap_disconnect_req, \ + const struct nble_gap_disconnect_req_params *, void *)\ + FN_SIG_S_P(nble_gap_connect_req, \ + const struct nble_gap_connect_req_params *, void *) \ + FN_SIG_S_P(nble_gap_generic_cmd_req, \ + const struct nble_gap_gen_cmd_params *, void *) \ + FN_SIG_S_P(nble_gap_set_option_req, \ + const struct nble_gap_set_option_params *, void *) \ + FN_SIG_S_P(nble_gap_conn_update_req, \ + const struct nble_gap_connect_update_params *, \ void *) \ - FN_SIG_S_P(ble_gap_sm_config_req, \ - const struct ble_core_gap_sm_config_params *, void *)\ - FN_SIG_S_P(ble_gap_sm_passkey_reply_req, \ - const struct ble_gap_sm_key_reply_req_params *, \ + FN_SIG_S_P(nble_gap_service_read_req, \ + const struct nble_gap_service_read_params *, void *) \ + FN_SIG_S_P(nble_set_enable_config_req, \ + const struct nble_wr_config_params *, void *) \ + FN_SIG_S_P(nble_gap_set_rssi_report_req, \ + const struct nble_rssi_report_params *, void *) \ + FN_SIG_S_P(nble_gap_service_write_req, \ + const struct nble_gap_service_write_params *, void *)\ + FN_SIG_S_P(nble_gap_dbg_req, const struct debug_params *, \ void *) \ - FN_SIG_S_P(ble_gap_connect_req, \ - const struct ble_gap_connect_req_params *, void *) \ - FN_SIG_S_P(ble_gap_generic_cmd_req, \ - const struct ble_gap_gen_cmd_params *, void *) \ - FN_SIG_S_P(ble_gap_set_option_req, \ - const struct ble_gap_set_option_params *, void *) \ - FN_SIG_S_P(ble_gap_conn_update_req, \ - const struct ble_gap_connect_update_params *, void *)\ - FN_SIG_S_P(ble_gap_service_read_req, \ - const struct ble_gap_service_read_params *, void *) \ - FN_SIG_S_P(ble_set_enable_config_req, \ - const struct ble_wr_config_params *, void *) \ - FN_SIG_S_P(ble_gap_set_rssi_report_req, \ - const struct ble_core_rssi_report_params *, void *) \ - FN_SIG_S_P(ble_gap_service_write_req, \ - const struct ble_gap_service_write_params *, void *) \ - FN_SIG_S_P(ble_gap_dbg_req, const struct debug_params *, void *)\ - FN_SIG_S_P(ble_gattc_discover_req, \ - const struct ble_core_discover_params *, void *) \ - FN_SIG_S_P(ble_gattc_read_req, \ - const struct ble_gattc_read_params *, void *) \ - FN_SIG_S_P(ble_gatts_send_svc_changed_req, \ - const struct ble_gatts_svc_changed_params *, void *) \ - FN_SIG_S_P(ble_gatts_get_attribute_value_req, \ - const struct ble_gatts_get_attribute_params *, \ + FN_SIG_S_P(nble_gattc_discover_req, \ + const struct nble_discover_params *, void *) \ + FN_SIG_S_P(nble_gattc_read_req, \ + const struct nble_gattc_read_params *, void *) \ + FN_SIG_S_P(nble_gatts_send_svc_changed_req, \ + const struct nble_gatts_svc_changed_params *, void *)\ + FN_SIG_S_P(nble_gatts_get_attribute_value_req, \ + const struct nble_gatts_get_attribute_params *, \ void *) #define LIST_FN_SIG_S_B_P \ - FN_SIG_S_B_P(ble_gattc_write_req, \ - const struct ble_gattc_write_params *, \ + FN_SIG_S_B_P(nble_gattc_write_req, \ + const struct nble_gattc_write_params *, \ const uint8_t *, uint8_t, void *) #define LIST_FN_SIG_S_B_B_P diff --git a/drivers/nble/rpc_functions_to_quark.h b/drivers/nble/rpc_functions_to_quark.h index b54fe05ca72..032ef985448 100644 --- a/drivers/nble/rpc_functions_to_quark.h +++ b/drivers/nble/rpc_functions_to_quark.h @@ -19,102 +19,101 @@ FN_SIG_NONE(on_nble_up) #define LIST_FN_SIG_S \ - FN_SIG_S(on_ble_get_version_rsp, \ - const struct ble_version_response *) \ - FN_SIG_S(on_ble_gap_connect_evt, \ - const struct ble_gap_connect_evt *) \ - FN_SIG_S(on_ble_gap_disconnect_evt, \ - const struct ble_gap_disconnect_evt *) \ - FN_SIG_S(on_ble_gap_conn_update_evt, \ - const struct ble_gap_conn_update_evt *) \ - FN_SIG_S(on_ble_gap_sm_status_evt, \ - const struct ble_gap_sm_status_evt *) \ - FN_SIG_S(on_ble_gap_sm_passkey_display_evt, \ - const struct ble_gap_sm_passkey_disp_evt *) \ - FN_SIG_S(on_ble_gap_sm_passkey_req_evt, \ - const struct ble_gap_sm_passkey_req_evt *) \ - FN_SIG_S(on_ble_gap_to_evt, \ - const struct ble_gap_timout_evt *) \ - FN_SIG_S(on_ble_gap_rssi_evt, \ - const struct ble_gap_rssi_evt *) \ - FN_SIG_S(on_ble_common_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_connect_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_cancel_connect_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_read_bda_rsp, \ - const struct ble_service_read_bda_response *) \ - FN_SIG_S(on_ble_gap_disconnect_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_sm_config_rsp, \ - struct ble_gap_sm_config_rsp *) \ - FN_SIG_S(on_ble_gap_sm_passkey_reply_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_generic_cmd_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_conn_update_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_sm_clear_bonds_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_service_write_rsp, \ - const struct ble_service_write_response *) \ - FN_SIG_S(on_ble_set_enable_config_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_set_rssi_report_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_dbg_rsp, \ + FN_SIG_S(on_nble_get_version_rsp, \ + const struct nble_version_response *) \ + FN_SIG_S(on_nble_gap_connect_evt, \ + const struct nble_gap_connect_evt *) \ + FN_SIG_S(on_nble_gap_disconnect_evt, \ + const struct nble_gap_disconnect_evt *) \ + FN_SIG_S(on_nble_gap_conn_update_evt, \ + const struct nble_gap_conn_update_evt *) \ + FN_SIG_S(on_nble_gap_sm_status_evt, \ + const struct nble_gap_sm_status_evt *) \ + FN_SIG_S(on_nble_gap_sm_passkey_display_evt, \ + const struct nble_gap_sm_passkey_disp_evt *) \ + FN_SIG_S(on_nble_gap_sm_passkey_req_evt, \ + const struct nble_gap_sm_passkey_req_evt *) \ + FN_SIG_S(on_nble_gap_to_evt, \ + const struct nble_gap_timout_evt *) \ + FN_SIG_S(on_nble_gap_rssi_evt, \ + const struct nble_gap_rssi_evt *) \ + FN_SIG_S(on_nble_common_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gap_connect_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gap_cancel_connect_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gap_read_bda_rsp, \ + const struct nble_service_read_bda_response *) \ + FN_SIG_S(on_nble_gap_disconnect_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gap_sm_config_rsp, \ + struct nble_gap_sm_config_rsp *) \ + FN_SIG_S(on_nble_gap_generic_cmd_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gap_conn_update_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gap_sm_common_rsp, \ + const struct nble_gap_sm_response *) \ + FN_SIG_S(on_nble_gap_service_write_rsp, \ + const struct nble_service_write_response *) \ + FN_SIG_S(on_nble_set_enable_config_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gap_set_rssi_report_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gap_dbg_rsp, \ const struct debug_response *) \ - FN_SIG_S(on_ble_gatts_send_svc_changed_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gatts_send_notif_ind_rsp, \ - const struct ble_gatt_notif_ind_rsp *) \ - FN_SIG_S(on_ble_get_bonded_device_list_rsp, \ - const struct ble_get_bonded_device_list_rsp*) \ - FN_SIG_S(on_ble_gap_start_advertise_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gap_stop_advertise_rsp, \ - const struct ble_core_response *) \ - FN_SIG_S(on_ble_gatts_read_evt, \ + FN_SIG_S(on_nble_gatts_send_svc_changed_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gatts_send_notif_ind_rsp, \ + const struct nble_gatt_notif_ind_rsp *) \ + FN_SIG_S(on_nble_gap_start_advertise_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gap_stop_advertise_rsp, \ + const struct nble_response *) \ + FN_SIG_S(on_nble_gatts_read_evt, \ const struct nble_gatt_rd_evt *) \ FN_SIG_S(on_nble_gap_scan_start_stop_rsp, \ - const struct ble_core_response *) + const struct nble_response *) #define LIST_FN_SIG_P \ - FN_SIG_P(on_ble_gap_dtm_init_rsp, void *) + FN_SIG_P(on_nble_gap_dtm_init_rsp, void *) #define LIST_FN_SIG_S_B \ - FN_SIG_S_B(ble_log, const struct ble_log_s *, \ + FN_SIG_S_B(nble_log, const struct nble_log_s *, \ char *, uint8_t) \ - FN_SIG_S_B(on_ble_gattc_value_evt, \ - const struct ble_gattc_value_evt *, \ + FN_SIG_S_B(on_nble_gattc_value_evt, \ + const struct nble_gattc_value_evt *, \ uint8_t *, uint8_t) \ - FN_SIG_S_B(on_ble_gatts_write_evt, \ - const struct ble_gatt_wr_evt *, \ + FN_SIG_S_B(on_nble_gatts_write_evt, \ + const struct nble_gatt_wr_evt *, \ const uint8_t *, uint8_t) \ - FN_SIG_S_B(on_ble_gatts_get_attribute_value_rsp, \ - const struct ble_gatts_attribute_response *, \ + FN_SIG_S_B(on_nble_gatts_get_attribute_value_rsp, \ + const struct nble_gatts_attribute_response *,\ uint8_t *, uint8_t) \ - FN_SIG_S_B(on_ble_gatt_register_rsp, \ - const struct ble_gatt_register_rsp *, \ - const struct ble_gatt_attr_handles *, \ + FN_SIG_S_B(on_nble_gatt_register_rsp, \ + const struct nble_gatt_register_rsp *, \ + const struct nble_gatt_attr_handles *, \ uint8_t) \ - FN_SIG_S_B(on_ble_gattc_discover_rsp, \ - const struct ble_gattc_disc_rsp *, \ + FN_SIG_S_B(on_nble_gattc_discover_rsp, \ + const struct nble_gattc_disc_rsp *, \ const uint8_t *, uint8_t) \ FN_SIG_S_B(on_nble_gap_adv_report_evt, \ const struct nble_gap_adv_report_evt *, \ - const uint8_t *, uint8_t) + const uint8_t *, uint8_t) \ + FN_SIG_S_B(on_nble_gap_sm_bond_info_rsp, \ + const struct nble_gap_sm_bond_info_rsp *, \ + const bt_addr_le_t *, uint16_t) #define LIST_FN_SIG_B_B_P #define LIST_FN_SIG_S_P \ - FN_SIG_S_P(on_ble_gattc_write_rsp, \ - const struct ble_gattc_write_rsp *, void*) + FN_SIG_S_P(on_nble_gattc_write_rsp, \ + const struct nble_gattc_write_rsp *, void *) #define LIST_FN_SIG_S_B_P \ - FN_SIG_S_B_P(on_ble_gattc_read_rsp, \ - const struct ble_gattc_read_rsp *, \ - uint8_t *, uint8_t, void*) + FN_SIG_S_B_P(on_nble_gattc_read_rsp, \ + const struct nble_gattc_read_rsp *, \ + uint8_t *, uint8_t, void *) #define LIST_FN_SIG_S_B_B_P