mirror of
https://github.com/espressif/esp-rainmaker.git
synced 2026-01-16 01:15:38 +00:00
IDF5.0 build fixes
1. Added requires wherever necessary 2. Use exact format specifiers 3. Updated `esp-insights` and `rmaker_common` submodules Signed-off-by: Vikram <vikram.dattu@espressif.com>
This commit is contained in:
Submodule components/esp-insights updated: 1d6bb172ef...e9ae0b75bd
@@ -14,7 +14,9 @@ set(core_srcs "src/core/esp_rmaker_core.c"
|
||||
"src/core/esp_rmaker_cmd_resp_manager.c"
|
||||
)
|
||||
|
||||
set(priv_req protobuf-c json_parser json_generator wifi_provisioning nvs_flash esp_http_client app_update esp-tls mbedtls esp_https_ota console esp_local_ctrl esp_https_server mdns esp_schedule efuse)
|
||||
set(priv_req protobuf-c json_parser json_generator wifi_provisioning
|
||||
nvs_flash esp_http_client app_update esp-tls mbedtls esp_https_ota
|
||||
console esp_local_ctrl esp_https_server mdns esp_schedule efuse driver)
|
||||
|
||||
if(CONFIG_ESP_RMAKER_ASSISTED_CLAIM)
|
||||
list(APPEND core_srcs
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <esp_tls.h>
|
||||
#include <esp_rmaker_core.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <esp_wifi.h>
|
||||
#include <esp_log.h>
|
||||
#include <esp_http_client.h>
|
||||
@@ -310,17 +311,17 @@ static esp_err_t hmac_challenge(const char* hmac_request, unsigned char *hmac_re
|
||||
mbedtls_md_context_t ctx;
|
||||
mbedtls_md_type_t md_type = MBEDTLS_MD_SHA512;
|
||||
uint32_t hmac_key[4];
|
||||
|
||||
|
||||
esp_err_t err = read_hmac_key(hmac_key, sizeof(hmac_key));
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
mbedtls_md_init(&ctx);
|
||||
int ret = mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type) ,1);
|
||||
mbedtls_md_init(&ctx);
|
||||
int ret = mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type) ,1);
|
||||
ret |= mbedtls_md_hmac_starts(&ctx, (const unsigned char *)hmac_key, sizeof(hmac_key));
|
||||
ret |= mbedtls_md_hmac_update(&ctx, (const unsigned char *)hmac_request, strlen(hmac_request));
|
||||
ret |= mbedtls_md_hmac_finish(&ctx, hmac_response);
|
||||
ret |= mbedtls_md_hmac_update(&ctx, (const unsigned char *)hmac_request, strlen(hmac_request));
|
||||
ret |= mbedtls_md_hmac_finish(&ctx, hmac_response);
|
||||
mbedtls_md_free(&ctx);
|
||||
|
||||
if(ret == 0) {
|
||||
@@ -579,7 +580,7 @@ esp_err_t esp_rmaker_assisted_claim_handle_start(RmakerClaim__RMakerClaimPayload
|
||||
ESP_LOGE(TAG, "PK not created. Cannot proceed with Assisted Claiming.");
|
||||
response->resppayload->status = RMAKER_CLAIM__RMAKER_CLAIM_STATUS__InvalidState;
|
||||
return ESP_OK;
|
||||
}
|
||||
}
|
||||
if (generate_claim_init_request(claim_data) != ESP_OK) {
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -674,7 +675,7 @@ esp_err_t esp_rmaker_assisted_claim_handle_init(RmakerClaim__RMakerClaimPayload
|
||||
claim_data->payload_offset += payload_buf->payload.len;
|
||||
|
||||
response->resppayload->status = RMAKER_CLAIM__RMAKER_CLAIM_STATUS__Success;
|
||||
|
||||
|
||||
if (claim_data->payload_offset == claim_data->payload_len) {
|
||||
ESP_LOGD(TAG, "Finished sending Claim Verify Payload.");
|
||||
claim_data->state = RMAKER_CLAIM_STATE_VERIFY;
|
||||
@@ -715,7 +716,7 @@ esp_err_t esp_rmaker_assisted_claim_handle_verify(RmakerClaim__RMakerClaimPayloa
|
||||
claim_data->payload_len += recv_payload_buf->len;
|
||||
|
||||
if ((recv_payload->offset + recv_payload_buf->len) == recv_payload->totallen) {
|
||||
ESP_LOGD(TAG, "Received complete response of len = %d bytes for Claim Verify", recv_payload->totallen);
|
||||
ESP_LOGD(TAG, "Received complete response of len = %"PRIu32" bytes for Claim Verify", recv_payload->totallen);
|
||||
if (handle_claim_verify_response(claim_data) == ESP_OK) {
|
||||
ESP_LOGI(TAG,"Assisted Claiming was Successful.");
|
||||
claim_data->state = RMAKER_CLAIM_STATE_VERIFY_DONE;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <esp_log.h>
|
||||
#include <nvs.h>
|
||||
#include <esp_event.h>
|
||||
@@ -74,7 +75,7 @@ static esp_err_t get_property_values(size_t props_count,
|
||||
esp_err_t ret = ESP_OK;
|
||||
uint32_t i;
|
||||
for (i = 0; i < props_count && ret == ESP_OK ; i++) {
|
||||
ESP_LOGD(TAG, "(%d) Reading property : %s", i, props[i].name);
|
||||
ESP_LOGD(TAG, "(%"PRIu32") Reading property : %s", i, props[i].name);
|
||||
switch (props[i].type) {
|
||||
case PROP_TYPE_NODE_CONFIG: {
|
||||
char *node_config = esp_rmaker_get_node_config();
|
||||
@@ -343,7 +344,7 @@ static esp_err_t __esp_rmaker_start_local_ctrl_service(const char *serv_name)
|
||||
static void esp_rmaker_local_ctrl_prov_event_handler(void* arg, esp_event_base_t event_base,
|
||||
int32_t event_id, void* event_data)
|
||||
{
|
||||
ESP_LOGI(TAG, "Event %d", event_id);
|
||||
ESP_LOGI(TAG, "Event %"PRIu32, event_id);
|
||||
if (event_base == WIFI_PROV_EVENT) {
|
||||
switch (event_id) {
|
||||
case WIFI_PROV_START:
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <esp_log.h>
|
||||
#include <esp_err.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
@@ -157,12 +158,12 @@ static esp_rmaker_schedule_t *esp_rmaker_schedule_get_schedule_from_index(int32_
|
||||
esp_rmaker_schedule_t *schedule = schedule_priv_data->schedule_list;
|
||||
while(schedule) {
|
||||
if (schedule->index == index) {
|
||||
ESP_LOGD(TAG, "Schedule with index %d found in list for get.", index);
|
||||
ESP_LOGD(TAG, "Schedule with index %"PRIi32" found in list for get.", index);
|
||||
return schedule;
|
||||
}
|
||||
schedule = schedule->next;
|
||||
}
|
||||
ESP_LOGD(TAG, "Schedule with index %d not found in list for get.", index);
|
||||
ESP_LOGD(TAG, "Schedule with index %"PRIi32" not found in list for get.", index);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -293,7 +294,7 @@ static void esp_rmaker_schedule_trigger_work_cb(void *priv_data)
|
||||
int32_t index = (int32_t)priv_data;
|
||||
esp_rmaker_schedule_t *schedule = esp_rmaker_schedule_get_schedule_from_index(index);
|
||||
if (!schedule) {
|
||||
ESP_LOGE(TAG, "Schedule with index %d not found for trigger work callback", index);
|
||||
ESP_LOGE(TAG, "Schedule with index %"PRIi32" not found for trigger work callback", index);
|
||||
return;
|
||||
}
|
||||
esp_rmaker_schedule_process_action(&schedule->action);
|
||||
@@ -315,7 +316,7 @@ static void esp_rmaker_schedule_timestamp_common_cb(esp_schedule_handle_t handle
|
||||
int32_t index = (int32_t)priv_data;
|
||||
esp_rmaker_schedule_t *schedule = esp_rmaker_schedule_get_schedule_from_index(index);
|
||||
if (!schedule) {
|
||||
ESP_LOGE(TAG, "Schedule with index %d not found for timestamp callback", index);
|
||||
ESP_LOGE(TAG, "Schedule with index %"PRIi32" not found for timestamp callback", index);
|
||||
return;
|
||||
}
|
||||
schedule->trigger.next_timestamp = next_timestamp;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <esp_log.h>
|
||||
#include <esp_sntp.h>
|
||||
#include "esp_schedule_internal.h"
|
||||
@@ -231,7 +232,7 @@ static uint32_t esp_schedule_get_next_schedule_time_diff(esp_schedule_t *schedul
|
||||
} else if (current_time.tm_isdst && !schedule_time.tm_isdst ) {
|
||||
dst_adjust = 3600;
|
||||
}
|
||||
ESP_LOGD(TAG, "DST adjust seconds: %ld", dst_adjust);
|
||||
ESP_LOGD(TAG, "DST adjust seconds: %lld", (long long) dst_adjust);
|
||||
schedule_time.tm_sec += dst_adjust;
|
||||
mktime(&schedule_time);
|
||||
|
||||
@@ -255,7 +256,7 @@ static bool esp_schedule_is_expired(esp_schedule_t *schedule)
|
||||
struct tm current_time = {0};
|
||||
time(¤t_timestamp);
|
||||
localtime_r(¤t_timestamp, ¤t_time);
|
||||
|
||||
|
||||
if (schedule->trigger.type == ESP_SCHEDULE_TYPE_RELATIVE) {
|
||||
if (schedule->trigger.next_scheduled_time_utc > 0 && schedule->trigger.next_scheduled_time_utc <= current_timestamp) {
|
||||
/* Relative seconds based schedule has expired */
|
||||
@@ -319,7 +320,7 @@ static void esp_schedule_start_timer(esp_schedule_t *schedule)
|
||||
}
|
||||
|
||||
schedule->next_scheduled_time_diff = esp_schedule_get_next_schedule_time_diff(schedule);
|
||||
ESP_LOGI(TAG, "Starting a timer for %u seconds for schedule %s", schedule->next_scheduled_time_diff, schedule->name);
|
||||
ESP_LOGI(TAG, "Starting a timer for %"PRIu32" seconds for schedule %s", schedule->next_scheduled_time_diff, schedule->name);
|
||||
|
||||
if (schedule->timestamp_cb) {
|
||||
schedule->timestamp_cb((esp_schedule_handle_t)schedule, schedule->trigger.next_scheduled_time_utc, schedule->priv_data);
|
||||
@@ -531,7 +532,7 @@ esp_schedule_handle_t *esp_schedule_init(bool enable_nvs, char *nvs_partition, u
|
||||
ESP_LOGI(TAG, "No schedules found in NVS");
|
||||
return NULL;
|
||||
}
|
||||
ESP_LOGI(TAG, "Schedules found in NVS: %d", *schedule_count);
|
||||
ESP_LOGI(TAG, "Schedules found in NVS: %"PRIu8, *schedule_count);
|
||||
/* Start/Delete the schedules */
|
||||
esp_schedule_t *schedule = NULL;
|
||||
for (size_t handle_count = 0; handle_count < *schedule_count; handle_count++) {
|
||||
|
||||
Submodule components/rmaker_common updated: bd3fe1494e...7f606294a1
@@ -1,6 +1,10 @@
|
||||
set(priv_req wifi_provisioning qrcode nvs_flash esp_event)
|
||||
|
||||
idf_component_register(SRCS "app_wifi.c"
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES wifi_provisioning qrcode)
|
||||
REQUIRES
|
||||
PRIV_REQUIRES ${priv_req})
|
||||
|
||||
if(CONFIG_APP_WIFI_SHOW_DEMO_INTRO_TEXT)
|
||||
target_compile_definitions(${COMPONENT_TARGET} PRIVATE "-D RMAKER_DEMO_PROJECT_NAME=\"${CMAKE_PROJECT_NAME}\"")
|
||||
endif()
|
||||
|
||||
@@ -71,7 +71,7 @@ void app_main()
|
||||
/* Initialize Wi-Fi. Note that, this should be called before esp_rmaker_node_init()
|
||||
*/
|
||||
app_wifi_init();
|
||||
|
||||
|
||||
/* Initialize the ESP RainMaker Agent.
|
||||
* Note that this should be called after app_wifi_init() but before app_wifi_start()
|
||||
* */
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
#include <esp_log.h>
|
||||
@@ -66,7 +67,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
ESP_LOGI(TAG, "RainMaker Claim Failed.");
|
||||
break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Event: %d", event_id);
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Event: %"PRIi32, event_id);
|
||||
}
|
||||
} else if (event_base == RMAKER_COMMON_EVENT) {
|
||||
switch (event_id) {
|
||||
@@ -89,7 +90,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
ESP_LOGI(TAG, "MQTT Published. Msg id: %d.", *((int *)event_data));
|
||||
break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Common Event: %d", event_id);
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Common Event: %"PRIi32, event_id);
|
||||
}
|
||||
} else if (event_base == APP_WIFI_EVENT) {
|
||||
switch (event_id) {
|
||||
@@ -103,7 +104,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
ESP_LOGI(TAG, "Provisioning has restarted due to failures.");
|
||||
break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unhandled App Wi-Fi Event: %d", event_id);
|
||||
ESP_LOGW(TAG, "Unhandled App Wi-Fi Event: %"PRIi32, event_id);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
#include <esp_log.h>
|
||||
@@ -67,7 +68,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
ESP_LOGI(TAG, "RainMaker Claim Failed.");
|
||||
break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Event: %d", event_id);
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Event: %"PRIi32, event_id);
|
||||
}
|
||||
} else if (event_base == RMAKER_COMMON_EVENT) {
|
||||
switch (event_id) {
|
||||
@@ -90,7 +91,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
ESP_LOGI(TAG, "MQTT Published. Msg id: %d.", *((int *)event_data));
|
||||
break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Common Event: %d", event_id);
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Common Event: %"PRIi32, event_id);
|
||||
}
|
||||
} else if (event_base == APP_WIFI_EVENT) {
|
||||
switch (event_id) {
|
||||
@@ -104,7 +105,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
ESP_LOGI(TAG, "Provisioning has restarted due to failures.");
|
||||
break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unhandled App Wi-Fi Event: %d", event_id);
|
||||
ESP_LOGW(TAG, "Unhandled App Wi-Fi Event: %"PRIi32, event_id);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user