|
|
@@ -569,7 +569,14 @@ static void transport_simple_ble_disconnect(struct ble_gap_event *event, void *a
|
|
|
if (ret != ESP_OK) {
|
|
|
ESP_LOGE(TAG, "error closing the session after disconnect");
|
|
|
} else {
|
|
|
- if (esp_event_post(PROTOCOMM_TRANSPORT_BLE_EVENT, PROTOCOMM_TRANSPORT_BLE_DISCONNECTED, NULL, 0, portMAX_DELAY) != ESP_OK) {
|
|
|
+ protocomm_ble_event_t ble_event = {};
|
|
|
+ /* Assign the event type */
|
|
|
+ ble_event.evt_type = PROTOCOMM_TRANSPORT_BLE_DISCONNECTED;
|
|
|
+ /* Set the Disconnection handle */
|
|
|
+ ble_event.conn_handle = event->disconnect.conn.conn_handle;
|
|
|
+ ble_event.disconnect_reason = event->disconnect.reason;
|
|
|
+
|
|
|
+ if (esp_event_post(PROTOCOMM_TRANSPORT_BLE_EVENT, PROTOCOMM_TRANSPORT_BLE_DISCONNECTED, &ble_event, sizeof(protocomm_ble_event_t), portMAX_DELAY) != ESP_OK) {
|
|
|
ESP_LOGE(TAG, "Failed to post transport disconnection event");
|
|
|
}
|
|
|
}
|
|
|
@@ -595,7 +602,14 @@ static void transport_simple_ble_connect(struct ble_gap_event *event, void *arg)
|
|
|
if (ret != ESP_OK) {
|
|
|
ESP_LOGE(TAG, "error creating the session");
|
|
|
} else {
|
|
|
- if (esp_event_post(PROTOCOMM_TRANSPORT_BLE_EVENT, PROTOCOMM_TRANSPORT_BLE_CONNECTED, NULL, 0, portMAX_DELAY) != ESP_OK) {
|
|
|
+ protocomm_ble_event_t ble_event = {};
|
|
|
+ /* Assign the event type */
|
|
|
+ ble_event.evt_type = PROTOCOMM_TRANSPORT_BLE_CONNECTED;
|
|
|
+ /* Set the Connection handle */
|
|
|
+ ble_event.conn_handle = event->connect.conn_handle;
|
|
|
+ ble_event.conn_status = event->connect.status;
|
|
|
+
|
|
|
+ if (esp_event_post(PROTOCOMM_TRANSPORT_BLE_EVENT, PROTOCOMM_TRANSPORT_BLE_CONNECTED, &ble_event, sizeof(protocomm_ble_event_t), portMAX_DELAY) != ESP_OK) {
|
|
|
ESP_LOGE(TAG, "Failed to post transport pairing event");
|
|
|
}
|
|
|
}
|