drivers/nble: Update RPC to Nordic BLE
Update RPC to make it compatible with firmware 0309. Among other changes mostly related to cleanup there is extra flag octet in struct nble_discover_params. Change-Id: Ib4dbe15a6919c251f14888090e2f1d91c150c5f2 Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
f8102960c2
commit
0b309f3f73
@ -45,34 +45,13 @@ enum NBLE_GAP_SM_EVT {
|
||||
NBLE_GAP_SM_EVT_LINK_SECURITY_CHANGE,
|
||||
};
|
||||
|
||||
/* Must be the same with BLE_GAP_RSSI_OPS ! */
|
||||
/**
|
||||
* RSSI operation definition.
|
||||
*/
|
||||
enum BLE_CORE_GAP_RSSI_OPS {
|
||||
BLE_CORE_GAP_RSSI_DISABLE_REPORT = 0,
|
||||
BLE_CORE_GAP_RSSI_ENABLE_REPORT
|
||||
};
|
||||
|
||||
/** Test Mode opcodes. The same with nble_service_gap_api.h */
|
||||
enum BLE_CORE_TEST_OPCODE {
|
||||
BLE_CORE_TEST_INIT_DTM = 0x01,
|
||||
BLE_CORE_TEST_START_DTM_RX = 0x1d,
|
||||
BLE_CORE_TEST_START_DTM_TX = 0x1e,
|
||||
BLE_CORE_TEST_END_DTM = 0x1f,
|
||||
/* vendor specific commands start at 0x80 */
|
||||
/* Set Tx power. To be called before start of tx test */
|
||||
BLE_CORE_TEST_SET_TXPOWER = 0x80,
|
||||
BLE_CORE_TEST_START_TX_CARRIER,
|
||||
};
|
||||
|
||||
struct nble_response {
|
||||
int status;
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
struct nble_gap_device_name {
|
||||
/* Security mode for writing device name, @ref BLE_GAP_SEC_MODES */
|
||||
/* Security mode for writing device name */
|
||||
uint8_t sec_mode;
|
||||
/* 0: no authorization, 1: authorization required */
|
||||
uint8_t authorization;
|
||||
@ -90,7 +69,6 @@ struct nble_gap_connection_values {
|
||||
uint16_t supervision_to;
|
||||
};
|
||||
|
||||
|
||||
enum BLE_GAP_SVC_ATTR_TYPE {
|
||||
/* Device Name, UUID 0x2a00 */
|
||||
GAP_SVC_ATTR_NAME = 0,
|
||||
@ -102,9 +80,6 @@ enum BLE_GAP_SVC_ATTR_TYPE {
|
||||
GAP_SVC_ATTR_CAR = 0xa6,
|
||||
};
|
||||
|
||||
/**
|
||||
* Connection requested parameters.
|
||||
*/
|
||||
struct nble_gap_connection_params {
|
||||
/* minimal connection interval: range 0x0006 to 0x0c80 (unit 1.25ms) */
|
||||
uint16_t interval_min;
|
||||
@ -116,9 +91,6 @@ struct nble_gap_connection_params {
|
||||
uint16_t link_sup_to;
|
||||
};
|
||||
|
||||
/**
|
||||
* Connection scan requested parameters.
|
||||
*/
|
||||
struct nble_gap_scan_parameters {
|
||||
/* If 1, perform active scanning (scan requests). */
|
||||
uint8_t active;
|
||||
@ -221,122 +193,43 @@ struct nble_log_s {
|
||||
uint8_t param3;
|
||||
};
|
||||
|
||||
void nble_log(const struct nble_log_s *p_param, char *p_buf, uint8_t buflen);
|
||||
void nble_log(const struct nble_log_s *param, char *buf, uint8_t buflen);
|
||||
|
||||
void on_nble_up(void);
|
||||
|
||||
/**
|
||||
* Write GAP Service Attribute Characteristics.
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_service_write_rsp
|
||||
*
|
||||
* @param par Data of the characteristic to write
|
||||
* @param user_data User data
|
||||
*/
|
||||
void nble_gap_service_write_req(const struct nble_gap_service_write_params *par,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_read_bda_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_read_bda_rsp(const struct nble_service_read_bda_response *par);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_service_write_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
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_nble_gap_dbg_rsp
|
||||
*
|
||||
* @param par Debug parameters
|
||||
* @param user_data User data
|
||||
*/
|
||||
void nble_gap_dbg_req(const struct debug_params *par, void *user_data);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_dbg_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_dbg_rsp(const struct debug_response *par);
|
||||
|
||||
/**
|
||||
* Start advertising.
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_start_advertise_rsp
|
||||
*
|
||||
* @param par Advertisement
|
||||
*/
|
||||
void on_nble_set_bda_rsp(const struct nble_set_bda_rsp *par);
|
||||
|
||||
void nble_set_bda_req(const struct nble_set_bda_params *par);
|
||||
|
||||
void nble_gap_start_advertise_req(struct nble_gap_adv_params *par);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_start_advertise_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_start_advertise_rsp(const struct nble_response *par);
|
||||
|
||||
/**
|
||||
* Request to stop advertisement
|
||||
*
|
||||
* @param user_data Pointer to private data
|
||||
*/
|
||||
void nble_gap_stop_advertise_req(void *user_data);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_stop_advertise_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
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_nble_gap_read_bda_rsp
|
||||
*
|
||||
* @param priv Pointer to private data
|
||||
*/
|
||||
void nble_gap_read_bda_req(void *priv);
|
||||
|
||||
struct nble_gap_irk_info {
|
||||
uint8_t irk[BLE_GAP_SEC_MAX_KEY_LEN];
|
||||
};
|
||||
|
||||
/**
|
||||
* Write white list to the BLE controller.
|
||||
*
|
||||
* The response to this request is received through
|
||||
*
|
||||
* Store white in BLE controller. It needs to be done BEFORE starting
|
||||
* advertisement or start scanning
|
||||
*
|
||||
* @param bd_array Array of bd addresses
|
||||
* @param bd_array_size Size of bd addresses array
|
||||
* @param irk_array Array of irk keys (for address resolution offload)
|
||||
* @param irk_array_size Size of irk keys array
|
||||
* @param priv Pointer to private data
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* Clear previously stored white list.
|
||||
*
|
||||
* The response to this request is received through
|
||||
*
|
||||
* @param priv Pointer to private data
|
||||
*/
|
||||
void nble_gap_clr_white_list_req(void *priv);
|
||||
|
||||
struct nble_gap_connect_update_params {
|
||||
@ -344,28 +237,8 @@ struct nble_gap_connect_update_params {
|
||||
struct nble_gap_connection_params params;
|
||||
};
|
||||
|
||||
void on_nble_set_bda_rsp(const struct nble_set_bda_rsp *params);
|
||||
void nble_set_bda_req(const struct nble_set_bda_params *params);
|
||||
|
||||
/**
|
||||
* Update connection.
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @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
|
||||
* update request based the values in <i>p_conn_param</i> argument,
|
||||
* and the action can be taken by the central at link layer
|
||||
* - in central mode, it will send a link layer command to change the
|
||||
* connection values based on the values in <i>p_conn_param</i> argument
|
||||
* where the connection interval is interval_min.
|
||||
*
|
||||
* When the connection is updated, function event on_nble_gap_conn_update_evt
|
||||
* is called.
|
||||
*
|
||||
* @param par Connection parameters
|
||||
*/
|
||||
void nble_gap_conn_update_req(const struct nble_gap_connect_update_params *par);
|
||||
|
||||
struct nble_gap_connect_req_params {
|
||||
@ -379,42 +252,14 @@ struct nble_gap_disconnect_req_params {
|
||||
uint8_t reason;
|
||||
};
|
||||
|
||||
/**
|
||||
* Disconnect connection (peripheral or central role).
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_disconnect_rsp
|
||||
*
|
||||
* @param par Connection to terminate
|
||||
* @param user_data User data
|
||||
*/
|
||||
void nble_gap_disconnect_req(const struct nble_gap_disconnect_req_params *par,
|
||||
void *user_data);
|
||||
/**
|
||||
* Response to @ref nble_gap_disconnect_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
|
||||
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_nble_gap_service_read_rsp
|
||||
*
|
||||
* @param nble_gap_service_read GAP service characteristic to read
|
||||
* @param user_data Pointer to private data
|
||||
*/
|
||||
void nble_gap_service_read_req(const struct nble_gap_service_read_params *par,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* Security manager configuration parameters.
|
||||
*
|
||||
* 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 nble_gap_sm_config_params {
|
||||
/* Security options (@ref BLE_GAP_SM_OPTIONS) */
|
||||
uint8_t options;
|
||||
@ -425,14 +270,6 @@ struct nble_gap_sm_config_params {
|
||||
uint8_t oob_present;
|
||||
};
|
||||
|
||||
/**
|
||||
* Configuring the security manager.
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_sm_config_rsp
|
||||
*
|
||||
* @param par Local authentication/bonding parameters
|
||||
*/
|
||||
void nble_gap_sm_config_req(const struct nble_gap_sm_config_params *par);
|
||||
|
||||
struct nble_gap_sm_config_rsp {
|
||||
@ -441,14 +278,6 @@ struct nble_gap_sm_config_rsp {
|
||||
bool sm_bond_dev_avail;
|
||||
};
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_sm_config_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_sm_config_rsp(struct nble_gap_sm_config_rsp *par);
|
||||
|
||||
|
||||
struct nble_gap_sm_pairing_params {
|
||||
/* authentication level see @ref BLE_GAP_SM_OPTIONS */
|
||||
uint8_t auth_level;
|
||||
@ -462,14 +291,6 @@ struct nble_gap_sm_security_params {
|
||||
struct nble_gap_sm_pairing_params params;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initiate the bonding procedure (central).
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_sm_pairing_rsp
|
||||
*
|
||||
* @param par Connection to initiate with its parameters
|
||||
*/
|
||||
void nble_gap_sm_security_req(const struct nble_gap_sm_security_params *par);
|
||||
|
||||
struct nble_gap_sm_passkey {
|
||||
@ -487,29 +308,12 @@ struct nble_gap_sm_key_reply_req_params {
|
||||
struct nble_gap_sm_passkey params;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reply to an incoming passkey request event.
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_sm_passkey_reply_rsp
|
||||
*
|
||||
* @param par Connection on which bonding is going on and bonding security
|
||||
* reply
|
||||
*/
|
||||
void nble_gap_sm_passkey_reply_req(const struct nble_gap_sm_key_reply_req_params *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_nble_gap_sm_clear_bonds_rsp
|
||||
*
|
||||
* @param par Parameters
|
||||
*/
|
||||
void nble_gap_sm_clear_bonds_req(const struct nble_gap_sm_clear_bond_req_params *par);
|
||||
|
||||
struct nble_gap_sm_response {
|
||||
@ -517,9 +321,6 @@ struct nble_gap_sm_response {
|
||||
struct bt_conn *conn;
|
||||
};
|
||||
|
||||
/**
|
||||
* RSSI report parameters
|
||||
*/
|
||||
struct nble_rssi_report_params {
|
||||
uint16_t conn_handle;
|
||||
/* RSSI operation @ref BLE_GAP_RSSI_OPS */
|
||||
@ -530,31 +331,11 @@ struct nble_rssi_report_params {
|
||||
uint8_t min_count;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable or disable the reporting of the RSSI value.
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_set_rssi_report_rsp
|
||||
*
|
||||
* @param params RSSI report parameters
|
||||
* @param user_data Pointer to user data
|
||||
*/
|
||||
void nble_gap_set_rssi_report_req(const struct nble_rssi_report_params *par,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_set_rssi_report_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_set_rssi_report_rsp(const struct nble_response *par);
|
||||
|
||||
enum BLE_GAP_SCAN_OPTIONS {
|
||||
BLE_GAP_SCAN_DEFAULT = 0,
|
||||
BLE_GAP_SCAN_ACTIVE = 0x01,
|
||||
BLE_GAP_SCAN_WHITE_LISTED = 0x02,
|
||||
};
|
||||
|
||||
struct nble_gap_scan_params {
|
||||
uint16_t interval;
|
||||
uint16_t window;
|
||||
@ -562,75 +343,19 @@ struct nble_gap_scan_params {
|
||||
uint8_t use_whitelist;
|
||||
};
|
||||
|
||||
/**
|
||||
* Start scanning for BLE devices doing advertisement.
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @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 nble_gap_start_scan_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_start_scan_rsp(const struct nble_response *par);
|
||||
|
||||
/**
|
||||
* Stop scanning.
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_stop_scan_rsp
|
||||
*/
|
||||
void nble_gap_stop_scan_req(void);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_stop_scan_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_stop_scan_rsp(const struct nble_response *par);
|
||||
void on_nble_gap_scan_start_stop_rsp(const struct nble_response *par);
|
||||
|
||||
/**
|
||||
* Connect to a Remote Device.
|
||||
*
|
||||
* The response to this request is received through @ref on_nble_gap_connect_rsp
|
||||
*
|
||||
* @param req connection parameters @ref nble_gap_connect_req_params
|
||||
* @param user_data Pointer to private user data
|
||||
*/
|
||||
void nble_gap_connect_req(const struct nble_gap_connect_req_params *req,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_connect_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_connect_rsp(const struct nble_response *rsp);
|
||||
|
||||
struct nble_gap_cancel_connect_params {
|
||||
const bt_addr_le_t bd;
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel an ongoing connection attempt.
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_cancel_connect_rsp
|
||||
*
|
||||
* @param user_data Pointer to user data
|
||||
*/
|
||||
void nble_gap_cancel_connect_req(void *user_data);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_cancel_connect_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_cancel_connect_rsp(const struct nble_response *par);
|
||||
|
||||
enum BLE_GAP_SET_OPTIONS {
|
||||
@ -644,7 +369,6 @@ struct nble_gap_channel_map {
|
||||
uint8_t map[5];
|
||||
};
|
||||
|
||||
|
||||
struct nble_gap_set_option_params {
|
||||
/* Option to set @ref BLE_GAP_SET_OPTIONS */
|
||||
uint8_t op;
|
||||
@ -653,19 +377,11 @@ struct nble_gap_set_option_params {
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Set a gap option (channel map etc) on a connection.
|
||||
*
|
||||
* The response to this request is received through
|
||||
*
|
||||
* @param par Contains gap options parameters
|
||||
* @param user_data Pointer to user data
|
||||
*/
|
||||
void nble_gap_set_option_req(const struct nble_gap_set_option_params *par,
|
||||
void *user_data);
|
||||
|
||||
/*
|
||||
* Generic request op codes.
|
||||
* Generic request op codes.
|
||||
* This allows to access some non connection related commands like DTM.
|
||||
*/
|
||||
enum BLE_GAP_GEN_OPS {
|
||||
@ -679,32 +395,11 @@ struct nble_gap_gen_cmd_params {
|
||||
uint8_t op_code;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generic command
|
||||
*
|
||||
* The response to this request is received through
|
||||
* @ref on_nble_gap_generic_cmd_rsp
|
||||
*
|
||||
* @param par Contains Generic command parameters.
|
||||
* @param user_data Pointer to user data
|
||||
*/
|
||||
void nble_gap_generic_cmd_req(const struct nble_gap_gen_cmd_params *par,
|
||||
void *priv);
|
||||
|
||||
/**
|
||||
* Response to @ref nble_gap_generic_cmd_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
void on_nble_gap_generic_cmd_rsp(const struct nble_response *par);
|
||||
|
||||
/**
|
||||
* 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 nble_get_version_req(void *user_data);
|
||||
|
||||
struct nble_version_response {
|
||||
@ -712,21 +407,8 @@ struct nble_version_response {
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Response to @ref nble_get_version_req.
|
||||
*
|
||||
* @param par Response
|
||||
*/
|
||||
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_nble_gap_dtm_init_rsp
|
||||
*
|
||||
* @param user_data Pointer to response data structure
|
||||
*/
|
||||
void nble_gap_dtm_init_req(void *user_data);
|
||||
|
||||
struct nble_gap_connect_evt {
|
||||
@ -738,11 +420,6 @@ struct nble_gap_connect_evt {
|
||||
bt_addr_le_t peer_bda;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function invoked by the BLE service when a new connection is established.
|
||||
*
|
||||
* @param ev Pointer to the event structure.
|
||||
*/
|
||||
void on_nble_gap_connect_evt(const struct nble_gap_connect_evt *ev);
|
||||
|
||||
struct nble_gap_disconnect_evt {
|
||||
@ -750,27 +427,13 @@ struct nble_gap_disconnect_evt {
|
||||
uint8_t hci_reason;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function invoked by the BLE service when a connection is lost.
|
||||
*
|
||||
* @param ev Pointer to the event structure.
|
||||
*/
|
||||
void on_nble_gap_disconnect_evt(const struct nble_gap_disconnect_evt *ev);
|
||||
|
||||
|
||||
/**
|
||||
* Updated connection event.
|
||||
*/
|
||||
struct nble_gap_conn_update_evt {
|
||||
uint16_t conn_handle;
|
||||
struct nble_gap_connection_values conn_values;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function invoked by the BLE service when a connection is updated.
|
||||
*
|
||||
* @param ev Pointer to the event structure.
|
||||
*/
|
||||
void on_nble_gap_conn_update_evt(const struct nble_gap_conn_update_evt *ev);
|
||||
|
||||
struct nble_gap_adv_report_evt {
|
||||
@ -792,11 +455,6 @@ struct nble_gap_rssi_evt {
|
||||
int8_t rssi_lvl;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function invoked by the BLE service upon RSSI event.
|
||||
*
|
||||
* @param ev Pointer to the event structure.
|
||||
*/
|
||||
void on_nble_gap_rssi_evt(const struct nble_gap_rssi_evt *ev);
|
||||
|
||||
struct nble_gap_sm_passkey_req_evt {
|
||||
@ -804,12 +462,6 @@ struct nble_gap_sm_passkey_req_evt {
|
||||
uint8_t key_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function invoked by the BLE service upon security manager passkey
|
||||
* request event.
|
||||
*
|
||||
* @param ev Pointer to the event structure.
|
||||
*/
|
||||
void on_nble_gap_sm_passkey_req_evt(const struct nble_gap_sm_passkey_req_evt *);
|
||||
|
||||
struct nble_gap_sm_passkey_disp_evt {
|
||||
@ -831,11 +483,6 @@ struct nble_gap_sm_status_evt {
|
||||
struct nble_link_sec enc_link_sec;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function invoked by the BLE service upon a security manager event.
|
||||
*
|
||||
* @param ev Pointer to the event structure.
|
||||
*/
|
||||
void on_nble_gap_sm_status_evt(const struct nble_gap_sm_status_evt *ev);
|
||||
|
||||
struct nble_gap_sm_bond_info;
|
||||
|
||||
@ -409,28 +409,36 @@ int bt_gatt_discover(struct bt_conn *conn,
|
||||
BT_DBG("conn %p start 0x%04x end 0x%04x", conn, params->start_handle,
|
||||
params->end_handle);
|
||||
|
||||
memset(&discover_params, 0, sizeof(discover_params));
|
||||
|
||||
switch (params->type) {
|
||||
case BT_GATT_DISCOVER_PRIMARY:
|
||||
case BT_GATT_DISCOVER_INCLUDE:
|
||||
if (params->uuid) {
|
||||
/* Always copy a full 128 bit UUID */
|
||||
memcpy(&discover_params.uuid, BT_UUID_128(params->uuid),
|
||||
sizeof(discover_params.uuid));
|
||||
discover_params.flags = DISCOVER_FLAGS_UUID_PRESENT;
|
||||
}
|
||||
|
||||
break;
|
||||
case BT_GATT_DISCOVER_CHARACTERISTIC:
|
||||
case BT_GATT_DISCOVER_DESCRIPTOR:
|
||||
discover_params.conn_handle = conn->handle;
|
||||
discover_params.type = params->type;
|
||||
/* Always copy a full 128 bit UUID */
|
||||
memcpy(&discover_params.uuid, BT_UUID_128(params->uuid),
|
||||
sizeof(discover_params.uuid));
|
||||
discover_params.handle_range.start_handle = params->start_handle;
|
||||
discover_params.handle_range.end_handle = params->end_handle;
|
||||
|
||||
conn->gatt_private = params;
|
||||
|
||||
nble_gattc_discover_req(&discover_params);
|
||||
break;
|
||||
default:
|
||||
BT_ERR("Unknown params type %u", params->type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
discover_params.conn_handle = conn->handle;
|
||||
discover_params.type = params->type;
|
||||
discover_params.handle_range.start_handle = params->start_handle;
|
||||
discover_params.handle_range.end_handle = params->end_handle;
|
||||
|
||||
conn->gatt_private = params;
|
||||
|
||||
nble_gattc_discover_req(&discover_params);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -29,16 +29,12 @@
|
||||
* controller API
|
||||
*/
|
||||
|
||||
/**
|
||||
* GATT indication types.
|
||||
*/
|
||||
enum BLE_GATT_IND_TYPES {
|
||||
BLE_GATT_IND_TYPE_NONE = 0,
|
||||
BLE_GATT_IND_TYPE_NOTIFICATION,
|
||||
BLE_GATT_IND_TYPE_INDICATION,
|
||||
};
|
||||
|
||||
/** GATT Register structure for one service */
|
||||
struct nble_gatt_register_req {
|
||||
/* Base address of the attribute table in the Quark mem space */
|
||||
struct bt_gatt_attr *attr_base;
|
||||
@ -46,7 +42,6 @@ struct nble_gatt_register_req {
|
||||
uint8_t attr_count;
|
||||
};
|
||||
|
||||
/** GATT Register structure for one service */
|
||||
struct nble_gatt_register_rsp {
|
||||
int status;
|
||||
struct bt_gatt_attr *attr_base;
|
||||
@ -54,9 +49,6 @@ struct nble_gatt_register_rsp {
|
||||
uint8_t attr_count;
|
||||
};
|
||||
|
||||
/**
|
||||
* Write event context data structure.
|
||||
*/
|
||||
struct nble_gatt_wr_evt {
|
||||
struct bt_gatt_attr *attr;
|
||||
uint16_t conn_handle;
|
||||
@ -66,9 +58,6 @@ struct nble_gatt_wr_evt {
|
||||
uint8_t reply;
|
||||
};
|
||||
|
||||
/**
|
||||
* Read event context data structure.
|
||||
*/
|
||||
struct nble_gatt_rd_evt {
|
||||
struct bt_gatt_attr *attr;
|
||||
uint16_t conn_handle;
|
||||
@ -84,18 +73,11 @@ struct nble_gatts_rw_reply_params {
|
||||
uint8_t write_reply;
|
||||
};
|
||||
|
||||
/**
|
||||
* Notification/Indication parameters
|
||||
*/
|
||||
struct nble_gatt_notif_ind_params {
|
||||
struct bt_gatt_attr *attr;
|
||||
uint16_t offset;
|
||||
};
|
||||
|
||||
/**
|
||||
* Indication or notification.
|
||||
*/
|
||||
|
||||
struct nble_gatt_send_notif_params {
|
||||
/* Function to be invoked when buffer is freed */
|
||||
bt_gatt_notify_func_t cback;
|
||||
@ -124,9 +106,6 @@ struct nble_gatt_ind_rsp {
|
||||
struct bt_gatt_attr *attr;
|
||||
};
|
||||
|
||||
/**
|
||||
* Attribute handle range definition.
|
||||
*/
|
||||
struct nble_gatt_handle_range {
|
||||
uint16_t start_handle;
|
||||
uint16_t end_handle;
|
||||
@ -144,7 +123,6 @@ struct nble_gattc_included {
|
||||
struct bt_uuid_128 uuid;
|
||||
};
|
||||
|
||||
/* GATTC characteristic */
|
||||
struct nble_gattc_characteristic {
|
||||
uint16_t handle;
|
||||
uint8_t prop;
|
||||
@ -152,9 +130,6 @@ struct nble_gattc_characteristic {
|
||||
struct bt_uuid_128 uuid;
|
||||
};
|
||||
|
||||
/**
|
||||
* GATTC descriptor.
|
||||
*/
|
||||
struct nble_gattc_descriptor {
|
||||
uint16_t handle;
|
||||
struct bt_uuid_128 uuid;
|
||||
@ -173,111 +148,43 @@ struct nble_gatts_svc_changed_params {
|
||||
uint16_t end_handle;
|
||||
};
|
||||
|
||||
/**
|
||||
* Send a service change indication.
|
||||
*
|
||||
* The response to this request is received through @ref
|
||||
* on_ble_gatts_send_svc_changed_rsp
|
||||
*
|
||||
* @note Not yet supported
|
||||
*
|
||||
* @param par Service parameters
|
||||
* @param priv Pointer to private data
|
||||
*/
|
||||
void nble_gatts_send_svc_changed_req(const struct nble_gatts_svc_changed_params *par,
|
||||
void *priv);
|
||||
|
||||
/** Register a BLE GATT Service.
|
||||
*
|
||||
* @param par Parameters of attribute data base
|
||||
* @param attr Serialized attribute buffer
|
||||
* @param attr_len Length of buffer
|
||||
*/
|
||||
void nble_gatt_register_req(const struct nble_gatt_register_req *par,
|
||||
uint8_t *buf, uint16_t len);
|
||||
|
||||
/**
|
||||
* Reply to an authorize request.
|
||||
*
|
||||
* @param par parameters for the reply
|
||||
* @param buf read value of the attribute
|
||||
* @param len length of buf
|
||||
*/
|
||||
void nble_gatts_authorize_reply_req(const struct nble_gatts_rw_reply_params *par,
|
||||
uint8_t *buf, uint16_t len);
|
||||
|
||||
/**
|
||||
* Conversion table entry nble_core to host attr index
|
||||
*
|
||||
* This is returned as a table on registering.
|
||||
*/
|
||||
void nble_gatt_register_req(const struct nble_gatt_register_req *par,
|
||||
uint8_t *buf, uint16_t len);
|
||||
|
||||
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 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_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.
|
||||
*
|
||||
* @param ev Pointer to the event structure
|
||||
* @param buf Pointer to data buffer
|
||||
* @param len Buffer length
|
||||
*/
|
||||
void on_nble_gatts_write_evt(const struct nble_gatt_wr_evt *ev,
|
||||
const uint8_t *buf, uint8_t len);
|
||||
|
||||
/**
|
||||
* Send notification.
|
||||
*
|
||||
* The response to this request is received
|
||||
*
|
||||
* @param par Notification parameters
|
||||
* @param data Indication data to write
|
||||
* @param length Length of indication - may be 0, in this case already
|
||||
* stored data is sent
|
||||
*/
|
||||
void nble_gatt_send_notif_req(const struct nble_gatt_send_notif_params *par,
|
||||
uint8_t *data, uint16_t length);
|
||||
|
||||
/**
|
||||
* Send indication.
|
||||
*
|
||||
* The response to this request is received
|
||||
*
|
||||
* @param par Indication parameters
|
||||
* @param data Indication data to write
|
||||
* @param length Length of indication - may be 0, in this case already
|
||||
* stored data is sent
|
||||
*/
|
||||
void nble_gatt_send_ind_req(const struct nble_gatt_send_ind_params *par,
|
||||
uint8_t *data, uint8_t length);
|
||||
|
||||
/** Discover parameters. */
|
||||
#define DISCOVER_FLAGS_UUID_PRESENT 1
|
||||
|
||||
struct nble_discover_params {
|
||||
void *user_data;
|
||||
struct bt_uuid_128 uuid;
|
||||
struct nble_gatt_handle_range handle_range;
|
||||
uint16_t conn_handle;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* Discover service.
|
||||
*
|
||||
* @param req Request structure.
|
||||
*/
|
||||
void nble_gattc_discover_req(const struct nble_discover_params *req);
|
||||
|
||||
/** GATT Attribute stream structure.
|
||||
@ -326,25 +233,9 @@ struct nble_gattc_write_rsp {
|
||||
uint16_t len;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Read characteristic on remote server.
|
||||
*
|
||||
* @param params Request structure.
|
||||
* @param priv Pointer to private data.
|
||||
*/
|
||||
void nble_gattc_read_req(const struct nble_gattc_read_params *params,
|
||||
void *priv);
|
||||
|
||||
/**
|
||||
* Write characteristic on server.
|
||||
*
|
||||
* @param params Write parameters
|
||||
* @param buf Characteristic value to write.
|
||||
* @param len Characteristic value length. If length is bigger then ATT MTU
|
||||
* size, the controller fragment buffer itself.
|
||||
* @param priv Pointer to private data.
|
||||
*/
|
||||
void nble_gattc_write_req(const struct nble_gattc_write_params *params,
|
||||
const uint8_t *buf, uint8_t len, void *priv);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user