mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(nimble): Address compilation issues in nimble examples
This commit is contained in:
@@ -44,6 +44,7 @@ void printtime(struct ble_svc_cts_curr_time ctime) {
|
||||
ESP_LOGI(tag, "fractions : %d\n", ctime.et_256.fractions_256);
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_GATTC)
|
||||
/**
|
||||
* Application callback. Called when the read of the cts current time
|
||||
* characteristic has completed.
|
||||
@@ -137,6 +138,7 @@ ble_cts_cent_on_disc_complete(const struct peer *peer, int status, void *arg)
|
||||
*/
|
||||
ble_cts_cent_read_time(peer);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initiates the GAP general discovery procedure.
|
||||
@@ -434,6 +436,7 @@ ble_cts_cent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#if MYNEWT_VAL(BLE_GATTC)
|
||||
/* Perform service discovery */
|
||||
rc = peer_disc_all(event->connect.conn_handle,
|
||||
ble_cts_cent_on_disc_complete, NULL);
|
||||
@@ -441,6 +444,7 @@ ble_cts_cent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif // BLE_GATT_CACHING_ASSOC_ENABLE
|
||||
#endif
|
||||
} else {
|
||||
@@ -485,6 +489,7 @@ ble_cts_cent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#if MYNEWT_VAL(BLE_GATTC)
|
||||
/*** Go for service discovery after encryption has been successfully enabled ***/
|
||||
rc = peer_disc_all(event->connect.conn_handle,
|
||||
ble_cts_cent_on_disc_complete, NULL);
|
||||
@@ -492,6 +497,7 @@ ble_cts_cent_gap_event(struct ble_gap_event *event, void *arg)
|
||||
MODLOG_DFLT(ERROR, "Failed to discover services; rc=%d\n", rc);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif // BLE_GATT_CACHING_ASSOC_ENABLE
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@@ -28,7 +28,6 @@ static uint8_t ext_adv_pattern_1[] = {
|
||||
|
||||
static const char *tag = "NimBLE_CTS_PRPH";
|
||||
static const char *device_name = "ble_cts_prph";
|
||||
|
||||
static int ble_cts_prph_gap_event(struct ble_gap_event *event, void *arg);
|
||||
|
||||
static uint8_t ble_cts_prph_addr_type;
|
||||
@@ -274,8 +273,6 @@ void ble_cts_prph_host_task(void *param)
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
/* Initialize NVS — it is used to store PHY calibration data */
|
||||
esp_err_t ret = nvs_flash_init();
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
@@ -302,12 +299,15 @@ void app_main(void)
|
||||
ble_hs_cfg.sm_sc = 1;
|
||||
ble_hs_cfg.sm_mitm = 1;
|
||||
|
||||
#if MYNEWT_VAL(BLE_GATTS)
|
||||
int rc;
|
||||
rc = gatt_svr_init();
|
||||
assert(rc == 0);
|
||||
|
||||
/* Set the default device name */
|
||||
rc = ble_svc_gap_device_name_set(device_name);
|
||||
assert(rc == 0);
|
||||
#endif
|
||||
|
||||
/* Start the task */
|
||||
nimble_port_freertos_init(ble_cts_prph_host_task);
|
||||
|
||||
Reference in New Issue
Block a user