https example: Clean up output, print cipher suite & request count

pull/928/head
Angus Gratton 2017-08-17 17:25:39 +10:00 zatwierdzone przez Angus Gratton
rodzic c0f65f6680
commit f4404ae220
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -254,6 +254,8 @@ static void https_get_task(void *pvParameters)
ESP_LOGI(TAG, "Certificate verified.");
}
ESP_LOGI(TAG, "Cipher suite is %s", mbedtls_ssl_get_ciphersuite(&ssl));
ESP_LOGI(TAG, "Writing HTTP request...");
while((ret = mbedtls_ssl_write(&ssl, (const unsigned char *)REQUEST, strlen(REQUEST))) <= 0)
@ -296,7 +298,7 @@ static void https_get_task(void *pvParameters)
}
len = ret;
ESP_LOGI(TAG, "%d bytes read", len);
ESP_LOGD(TAG, "%d bytes read", len);
/* Print response directly to stdout as it is read */
for(int i = 0; i < len; i++) {
putchar(buf[i]);
@ -315,6 +317,11 @@ static void https_get_task(void *pvParameters)
ESP_LOGE(TAG, "Last error was: -0x%x - %s", -ret, buf);
}
putchar('\n'); // JSON output doesn't have a newline at end
static int request_count;
ESP_LOGI(TAG, "Completed %d requests", ++request_count);
for(int countdown = 10; countdown >= 0; countdown--) {
ESP_LOGI(TAG, "%d...", countdown);
vTaskDelay(1000 / portTICK_PERIOD_MS);