3#if CONFIG_BT_BLE_ENABLED
16#include <esp_gap_ble_api.h>
19static bool security_initiate_encryption =
false;
22 security_initiate_encryption = security_initiate_encryption_;
26 esp_ble_gatts_cb_param_t *param) {
29 bool for_us = gatts_if == ESP_GATT_IF_NONE ||
35 case ESP_GATTS_REG_EVT:
36 esp_ble_gap_config_local_privacy(
true);
40 case ESP_GATTS_READ_EVT:
45 case ESP_GATTS_WRITE_EVT:
47 if (param->write.is_prep ==
false &&
55 case ESP_GATTS_EXEC_WRITE_EVT:
61 case ESP_GATTS_CONF_EVT:
break;
62 case ESP_GATTS_UNREG_EVT:
break;
63 case ESP_GATTS_CREATE_EVT:
break;
64 case ESP_GATTS_ADD_INCL_SRVC_EVT:
break;
65 case ESP_GATTS_ADD_CHAR_EVT:
break;
66 case ESP_GATTS_ADD_CHAR_DESCR_EVT:
break;
67 case ESP_GATTS_DELETE_EVT:
break;
68 case ESP_GATTS_START_EVT:
break;
69 case ESP_GATTS_STOP_EVT:
break;
70 case ESP_GATTS_CONNECT_EVT:
71 if (security_initiate_encryption)
72 esp_ble_set_encryption(param->connect.remote_bda,
73 ESP_BLE_SEC_ENCRYPT_MITM);
76 case ESP_GATTS_DISCONNECT_EVT:
79 case ESP_GATTS_OPEN_EVT:
break;
80 case ESP_GATTS_CANCEL_OPEN_EVT:
break;
81 case ESP_GATTS_CLOSE_EVT:
break;
82 case ESP_GATTS_LISTEN_EVT:
break;
83 case ESP_GATTS_CONGEST_EVT:
break;
84 case ESP_GATTS_RESPONSE_EVT:
break;
85 case ESP_GATTS_CREAT_ATTR_TAB_EVT:
86 if (param->add_attr_tab.status != ESP_GATT_OK) {
88 "create attribute table failed, error code=0x%x",
89 param->add_attr_tab.status);
95 case ESP_GATTS_SET_ATTR_VAL_EVT:
break;
96 case ESP_GATTS_SEND_SERVICE_CHANGE_EVT:
break;
Handling the Client Characteristic Configuration Descriptor (UUID 0x2902) for MIDI over Bluetooth Low...
void ble2902_handle_write(esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
Callback when the client writes to the descriptor.
Declarations of internal functions for the MIDI over BLE system, used in the midi-*....
void midi_handle_read_event(esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
void midi_handle_register_app_event(esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
void midi_handle_mtu_event(esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
void midi_handle_disconnect_event(esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
void midi_handle_write_event(esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
uint16_t midi_get_gatts_if(void)
void midi_handle_create_attribute_table_event(esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
void midi_handle_gatts_event(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
void midi_handle_connect_event(esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
uint16_t midi_get_descriptor_handle(void)
uint16_t midi_get_characteristic_handle(void)
void midi_handle_write_exec_event(esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param)
void set_security_initiate_encryption(bool security_initiate_encryption_)
Configure whether the Arduino should initiate the bonding/secure connection.