Skip to content

Commit 6696819

Browse files
committed
Rename connection_handle in ble_doorbell
1 parent 0fff507 commit 6696819

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

bluetooth/ble_doorbell/client.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static btstack_packet_callback_registration_t hci_event_callback_registration;
3737
static gc_state_t state = TC_OFF;
3838
static bd_addr_t server_addr;
3939
static bd_addr_type_t server_addr_type;
40-
static hci_con_handle_t connection_handle;
40+
static hci_con_handle_t con_handle;
4141
static gatt_client_service_t server_service;
4242
static gatt_client_characteristic_t server_characteristic;
4343
static bool listener_registered;
@@ -102,13 +102,13 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
102102
att_status = gatt_event_query_complete_get_att_status(packet);
103103
if (att_status != ATT_ERROR_SUCCESS){
104104
ERROR_LOG("SERVICE_QUERY_RESULT, ATT Error 0x%02x.\n", att_status);
105-
gap_disconnect(connection_handle);
105+
gap_disconnect(con_handle);
106106
break;
107107
}
108108
// service query complete, look for characteristic
109109
state = TC_W4_CHARACTERISTIC_RESULT;
110110
INFO_LOG("Search for binary sensing characteristic.\n");
111-
gatt_client_discover_characteristics_for_service_by_uuid16(handle_gatt_client_event, connection_handle, &server_service, ORG_BLUETOOTH_CHARACTERISTIC_DIGITAL_OUTPUT);
111+
gatt_client_discover_characteristics_for_service_by_uuid16(handle_gatt_client_event, con_handle, &server_service, ORG_BLUETOOTH_CHARACTERISTIC_DIGITAL_OUTPUT);
112112
break;
113113
default:
114114
break;
@@ -124,16 +124,16 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
124124
att_status = gatt_event_query_complete_get_att_status(packet);
125125
if (att_status != ATT_ERROR_SUCCESS){
126126
ERROR_LOG("CHARACTERISTIC_QUERY_RESULT, ATT Error 0x%02x.\n", att_status);
127-
gap_disconnect(connection_handle);
127+
gap_disconnect(con_handle);
128128
break;
129129
}
130130
// register handler for notifications
131131
listener_registered = true;
132-
gatt_client_listen_for_characteristic_value_updates(&notification_listener, handle_gatt_client_event, connection_handle, &server_characteristic);
132+
gatt_client_listen_for_characteristic_value_updates(&notification_listener, handle_gatt_client_event, con_handle, &server_characteristic);
133133
// enable notifications
134134
INFO_LOG("Enable notify on characteristic.\n");
135135
state = TC_W4_ENABLE_NOTIFICATIONS_COMPLETE;
136-
gatt_client_write_client_characteristic_configuration(handle_gatt_client_event, connection_handle,
136+
gatt_client_write_client_characteristic_configuration(handle_gatt_client_event, con_handle,
137137
&server_characteristic, GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION);
138138
break;
139139
default:
@@ -218,20 +218,20 @@ static void hci_event_handler(uint8_t packet_type, uint16_t channel, uint8_t *pa
218218
switch (hci_event_gap_meta_get_subevent_code(packet)) {
219219
case GAP_SUBEVENT_LE_CONNECTION_COMPLETE:
220220
if (state != TC_W4_CONNECT) return;
221-
connection_handle = gap_subevent_le_connection_complete_get_connection_handle(packet);
221+
con_handle = gap_subevent_le_connection_complete_get_connection_handle(packet);
222222
// initialize gatt client context with handle, and add it to the list of active clients
223223
// query primary services
224224
DEBUG_LOG("Search for binary sensing service.\n");
225225
state = TC_W4_SERVICE_RESULT;
226-
gatt_client_discover_primary_services_by_uuid16(handle_gatt_client_event, connection_handle, ORG_BLUETOOTH_SERVICE_BINARY_SENSOR);
226+
gatt_client_discover_primary_services_by_uuid16(handle_gatt_client_event, con_handle, ORG_BLUETOOTH_SERVICE_BINARY_SENSOR);
227227
break;
228228
default:
229229
break;
230230
}
231231
break;
232232
case HCI_EVENT_DISCONNECTION_COMPLETE:
233233
// unregister listener
234-
connection_handle = HCI_CON_HANDLE_INVALID;
234+
con_handle = HCI_CON_HANDLE_INVALID;
235235
if (listener_registered){
236236
listener_registered = false;
237237
gatt_client_stop_listening_for_characteristic_value_updates(&notification_listener);

0 commit comments

Comments
 (0)