From a2f1d5193b51deaa14f1b1a31d7402e6f872b553 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Tue, 9 Apr 2024 20:04:29 +0545 Subject: [PATCH 01/29] refactored and completed EZPI-351_https://jira.mios.com/browse/EZPI-351 --- ezlopi-core/ezlopi-core-ble/CMakeLists.txt | 3 +- ezlopi-core/ezlopi-core-scenes/CMakeLists.txt | 2 +- .../__scene_function_operators_macros.h | 9 + .../ezlopi_core_scenes_delete.c | 23 +- .../ezlopi_core_scenes_operators.c | 6 +- .../ezlopi_core_scenes_operators.h | 7 + .../ezlopi_core_scenes_then_methods.c | 2 +- .../ezlopi_core_scenes_v2.h | 1 + .../ezlopi_core_scenes_when_methods.c | 133 ++++--- ...ore_scenes_when_methods_helper_functions.c | 364 +++++++++++++++++- ...ore_scenes_when_methods_helper_functions.h | 21 + .../sensor_0068_ENS160_gas_sensor.c | 1 - 12 files changed, 476 insertions(+), 96 deletions(-) create mode 100644 ezlopi-core/ezlopi-core-scenes/__operators_macros/__scene_function_operators_macros.h diff --git a/ezlopi-core/ezlopi-core-ble/CMakeLists.txt b/ezlopi-core/ezlopi-core-ble/CMakeLists.txt index 4116190e2..c8f0d46e9 100644 --- a/ezlopi-core/ezlopi-core-ble/CMakeLists.txt +++ b/ezlopi-core/ezlopi-core-ble/CMakeLists.txt @@ -4,10 +4,11 @@ set(ESP_IDF_COMPONENTS bt ) set(EZLOPI_COMPONENTS - ezlopi-util-trace + ezlopi-util-trace ) set(EZLOPI_CORE_COMPONENTS ezlopi-core-nvs + ezlopi-core-ble ) diff --git a/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt b/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt index 0a7e0f3b6..1d9beb2ec 100644 --- a/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt +++ b/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt @@ -2,7 +2,7 @@ file(GLOB_RECURSE config_src "*.c") -idf_component_register(SRCS "ezlopi_core_scenes_then_methods.c" "ezlopi_core_scenes_status_changed.c" "ezlopi_core_scenes_notifications.c" "ezlopi_core_scenes_expressions.c" "ezlopi_core_scenes_edit.c" "ezlopi_core_scenes_cjson.c" "ezlopi_core_scenes_v2.c" "ezlopi_core_scenes_print.c" "ezlopi_core_scenes_when_methods_helper_functions.c" "ezlopi_core_scenes_then_methods_helper_func.c" "ezlopi_core_scenes_when_methods.c" "ezlopi_core_scenes_scripts.c" "${config_src}" +idf_component_register(SRCS "ezlopi_core_scenes_populate.c" "ezlopi_core_scenes_delete.c" "ezlopi_core_scenes_operators.c" "ezlopi_core_scenes_then_methods.c" "ezlopi_core_scenes_status_changed.c" "ezlopi_core_scenes_notifications.c" "ezlopi_core_scenes_expressions.c" "ezlopi_core_scenes_edit.c" "ezlopi_core_scenes_cjson.c" "ezlopi_core_scenes_v2.c" "ezlopi_core_scenes_print.c" "ezlopi_core_scenes_when_methods_helper_functions.c" "ezlopi_core_scenes_then_methods_helper_func.c" "ezlopi_core_scenes_when_methods.c" "ezlopi_core_scenes_scripts.c" "${config_src}" INCLUDE_DIRS "." REQUIRES core ) diff --git a/ezlopi-core/ezlopi-core-scenes/__operators_macros/__scene_function_operators_macros.h b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__scene_function_operators_macros.h new file mode 100644 index 000000000..6419c9615 --- /dev/null +++ b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__scene_function_operators_macros.h @@ -0,0 +1,9 @@ +// SCENES_WHEN_FUNCTION_OPERATORS(NONE, NULL, NULL, NULL) +// ////////////////////////////////////////////////////////////////////////////// +// SCENES_WHEN_FUNCTION_OPERATORS(FOR, NULL, "for", NULL) +// SCENES_WHEN_FUNCTION_OPERATORS(REPEAT, NULL, "repeat", NULL) +// SCENES_WHEN_FUNCTION_OPERATORS(FOLLOW, NULL, "follow", NULL) +// SCENES_WHEN_FUNCTION_OPERATORS(PULSE, NULL, "pulse", NULL) +// SCENES_WHEN_FUNCTION_OPERATORS(LATCH, NULL, "latch", NULL) +// ////////////////////////////////////////////////////////////////////////////// +// SCENES_WHEN_FUNCTION_OPERATORS(MAX, NULL, NULL, NULL) \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c index b05d0384d..1eacd3201 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c @@ -38,6 +38,10 @@ void ezlopi_scenes_delete_action_blocks(l_action_block_v2_t* action_blocks) { if (action_blocks) { + if (NULL != action_blocks->block_options.cj_function) + { + cJSON_Delete(action_blocks->block_options.cj_function); + } ezlopi_scenes_delete_fields(action_blocks->fields); ezlopi_scenes_delete_action_blocks(action_blocks->next); action_blocks->next = NULL; @@ -49,6 +53,10 @@ void ezlopi_scenes_delete_when_blocks(l_when_block_v2_t* when_blocks) { if (when_blocks) { + if (NULL != when_blocks->block_options.cj_function) + { + cJSON_Delete(when_blocks->block_options.cj_function); + } ezlopi_scenes_delete_fields(when_blocks->fields); ezlopi_scenes_delete_when_blocks(when_blocks->next); when_blocks->next = NULL; @@ -80,56 +88,41 @@ void ezlopi_scenes_delete(l_scenes_list_v2_t* scenes_list) void ezlopi_scenes_delete_field_value(l_fields_v2_t* field) { switch (field->field_value.e_type) - // switch (field->value.type) { case VALUE_TYPE_NUMBER: { field->field_value.u_value.value_double = 0; - // field->field_value.u_value.value_double = 0; break; } case VALUE_TYPE_STRING: { if (field->field_value.u_value.value_string) - // if (field->field_value.u_value.value_string) { free(field->field_value.u_value.value_string); field->field_value.u_value.value_string = NULL; - - // free(field->field_value.u_value.value_string); - // field->field_value.u_value.value_string = NULL; } break; } case VALUE_TYPE_BOOL: { field->field_value.u_value.value_bool = false; - // field->field_value.u_value.value_bool = false; break; } case VALUE_TYPE_CJSON: { if (field->field_value.u_value.cj_value) - // if (field->field_value.u_value.cj_value) { cJSON_Delete(field->field_value.u_value.cj_value); field->field_value.u_value.cj_value = NULL; - - // cJSON_Delete(field->field_value.u_value.cj_value); - // field->field_value.u_value.cj_value = NULL; } break; } case VALUE_TYPE_BLOCK: { if (field->field_value.u_value.when_block) - // if (field->value.when_block) { ezlopi_scenes_delete_when_blocks(field->field_value.u_value.when_block); field->field_value.u_value.when_block = NULL; - - // ezlopi_scenes_delete_when_blocks(field->value.when_block); - // field->value.when_block = NULL; } break; } diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c index 4460648f3..0cb949bc3 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c @@ -1315,12 +1315,12 @@ int ezlopi_scenes_operators_value_number_range_operations(uint32_t item_id, l_fi } if (STR_OP_COMP(tmp_valuetype, == , str_item_type)) // 'int' == 'int'? { - //now check if scale matches + // now check if scale matches cJSON* item_scale = cJSON_GetObjectItem(cj_item_value, ezlopi_scale_str); const char* str_scale_tmp = NULL; if (item_scale && cJSON_IsString(item_scale) && (NULL != (str_scale_tmp = cJSON_GetStringValue(item_scale)))) { - if (STR_OP_COMP(start_value_field->scale, == , str_scale_tmp)) // 'NULL' == 'NULL' + if (STR_OP_COMP(start_value_field->scale, == , str_scale_tmp)) // 'NULL' == 'NULL' { cJSON* cj_value = cJSON_GetObjectItem(cj_item_value, ezlopi_value_str); // extract the value from " item " within the device if (cj_value) @@ -1565,4 +1565,4 @@ int ezlopi_scenes_operators_is_dictionary_changed_operations(l_scenes_list_v2_t* } } return ret; -} \ No newline at end of file +} diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h index 2c222c89c..a3889fa45 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h @@ -41,6 +41,13 @@ typedef enum e_scene_value_without_less_cmp_operators #undef SCENES_VALUES_WITHOUT_LESS_OPERATORS } e_scene_value_without_less_cmp_operators_t; +// typedef enum e_scene_when_function_operators +// { +// #define SCENES_WHEN_FUNCTION_OPERATORS(OPERATOR, op, name, method) SCENES_WHEN_FUNCTION_OPERATORS_##OPERATOR, +// #include "__operators_macros/__scene_function_operators_macros.h" +// #undef SCENES_WHEN_FUNCTION_OPERATORS +// } e_scene_when_function_operators_t; + // Numeric Operators e_scene_num_cmp_operators_t ezlopi_scenes_numeric_comparator_operators_get_enum(char* operator_str); const char* ezlopi_scenes_numeric_comparator_operators_get_op(e_scene_num_cmp_operators_t operator); diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 4dc17b0f7..5901bb626 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -95,7 +95,7 @@ int ezlopi_scene_then_set_item_value(l_scenes_list_v2_t* curr_scene, void* arg) } int ezlopi_scene_then_set_device_armed(l_scenes_list_v2_t* curr_scene, void* arg) { - TRACE_W("Warning: then-method not implemented!"); + // TRACE_W("Warning: then-method not implemented!"); int ret = 0; if (curr_scene) { diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_v2.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_v2.h index b533edbdd..6977b7ff5 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_v2.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_v2.h @@ -45,6 +45,7 @@ typedef struct s_method_v2 typedef struct s_block_options_v2 { s_method_v2_t method; + cJSON* cj_function; } s_block_options_v2_t; typedef struct s_action_delay_v2 diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 07b98cca0..117936bac 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -17,16 +17,16 @@ int ezlopi_scene_when_is_item_state(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" is_item_state "); + // TRACE_W(" is_item_state "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block) { uint32_t item_id = 0; l_fields_v2_t* value_field = NULL; - #warning "Warning: armed check remains [Krishna]"; + #warning "Warning: armed check remains [Krishna]" - l_fields_v2_t* curr_field = when_block->fields; + l_fields_v2_t* curr_field = when_block->fields; while (curr_field) { if (0 == strncmp(curr_field->name, "item", 4)) @@ -116,7 +116,7 @@ int ezlopi_scene_when_is_item_state(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_is_interval(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" is_interval "); + // TRACE_W(" is_interval "); int ret = 0; if (scene_node) @@ -174,9 +174,7 @@ int ezlopi_scene_when_is_button_state(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_is_sun_state(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" is_SunState "); - // TRACE_W("Warning: need sunrise and sunset timing from actual api"); - + // TRACE_W(" is_SunState "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) @@ -186,8 +184,6 @@ int ezlopi_scene_when_is_sun_state(l_scenes_list_v2_t* scene_node, void* arg) struct tm* info; info = localtime(&rawtime); - TRACE_W("%d:%d:%d ", info->tm_hour, info->tm_min, info->tm_sec); - // list of function for extracting field parameter const s_issunstate_method_t __issunstate_field[] = { {.field_name = "sunrise", .field_func = issunstate_get_suntime}, @@ -223,7 +219,7 @@ int ezlopi_scene_when_is_sun_state(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_is_date(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" isDate "); + // TRACE_W(" isDate "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) @@ -232,9 +228,6 @@ int ezlopi_scene_when_is_date(l_scenes_list_v2_t* scene_node, void* arg) time(&rawtime); struct tm* info; info = localtime(&rawtime); - - TRACE_W("%d:%d:%d ", info->tm_hour, info->tm_min, info->tm_sec); - if (2 == info->tm_sec) // nth sec mark { // list of field function to extract the respective parameters @@ -263,7 +256,7 @@ int ezlopi_scene_when_is_date(l_scenes_list_v2_t* scene_node, void* arg) } ret = isdate_check_flag_result(mode_type, flag_check); // Output Filter based on date+time of activation - TRACE_S("mode[%d], isDate:- FLAG_STATUS: %#x", mode_type, flag_check); + // TRACE_S("mode[%d], isDate:- FLAG_STATUS: %#x", mode_type, flag_check); } } return ret; @@ -271,7 +264,7 @@ int ezlopi_scene_when_is_date(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_is_once(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" isOnce "); + // TRACE_W(" isOnce "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) @@ -281,8 +274,6 @@ int ezlopi_scene_when_is_once(l_scenes_list_v2_t* scene_node, void* arg) struct tm* info; info = localtime(&rawtime); - TRACE_W("%d:%d:%d ", info->tm_hour, info->tm_min, info->tm_sec); - if (4 == info->tm_sec) // nth sec mark { // list of funciton to check validity of each field values @@ -310,7 +301,7 @@ int ezlopi_scene_when_is_once(l_scenes_list_v2_t* scene_node, void* arg) // Output Filter based on date & time ret = isonce_check_flag_result(scene_node, flag_check); - TRACE_S("isOnce :- FLAG_STATUS: 0x0%x", flag_check); + // TRACE_S("isOnce :- FLAG_STATUS: 0x0%x", flag_check); } } return ret; @@ -318,7 +309,7 @@ int ezlopi_scene_when_is_once(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_is_date_range(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" isDate_range "); + // TRACE_W(" isDate_range "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) @@ -328,8 +319,6 @@ int ezlopi_scene_when_is_date_range(l_scenes_list_v2_t* scene_node, void* arg) struct tm* info; info = localtime(&rawtime); - TRACE_W("%d:%d:%d ", info->tm_hour, info->tm_min, info->tm_sec); - if (6 == info->tm_sec) // nth sec mark { // Default values : start and end times. @@ -396,7 +385,7 @@ int ezlopi_scene_when_is_user_lock_operation(l_scenes_list_v2_t* scene_node, voi int ezlopi_scene_when_is_house_mode_changed_to(l_scenes_list_v2_t* scene_node, void* arg) { - //TRACE_W(" isHouse_mode "); + // TRACE_W(" isHouse_mode "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -445,7 +434,7 @@ int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" isDevice_state. "); + // TRACE_W(" isDevice_state. "); // TRACE_W("Warning: when-method 'is_device_state' not implemented!"); int ret = 0; @@ -515,7 +504,7 @@ int ezlopi_scene_when_is_network_state(l_scenes_list_v2_t* scene_node, void* arg int ezlopi_scene_when_is_scene_state(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" isScene_state "); + // TRACE_W(" isScene_state "); // TRACE_W("Warning: when-method 'is_scene_state' not implemented!"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -601,7 +590,7 @@ int ezlopi_scene_when_is_group_state(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_is_cloud_state(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" isCloud_state "); + // TRACE_W(" isCloud_state "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) @@ -625,7 +614,7 @@ int ezlopi_scene_when_is_cloud_state(l_scenes_list_v2_t* scene_node, void* arg) if (0 < ezlopi_event_group_wait_for_event(EZLOPI_EVENT_NMA_REG, 100, false)) { ret = (0 == strncmp(value_field->field_value.u_value.value_string, "connected", 10)); - TRACE_S("NMA_CONNECTED, ret = %d", ret); + // TRACE_S("NMA_CONNECTED, ret = %d", ret); } else { @@ -651,7 +640,7 @@ int ezlopi_scene_when_is_battery_level(l_scenes_list_v2_t* scene_node, void* arg int ezlopi_scene_when_compare_numbers(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" Compare_num "); + // TRACE_W(" Compare_num "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -738,8 +727,8 @@ int ezlopi_scene_when_compare_number_range(l_scenes_list_v2_t* scene_node, void* int ezlopi_scene_when_compare_strings(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" Compare_strings "); - // TRACE_W("Warning: when-method 'compare_strings' not implemented!"); + // TRACE_W(" Compare_strings "); + // TRACE_W("Warning: when-method 'compare_strings' not implemented!"); int ret = 0; // #if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -796,8 +785,8 @@ int ezlopi_scene_when_compare_strings(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_string_operation(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" Compare_string_op "); - // TRACE_W("Warning: when-method 'string_operation' not implemented!"); + // TRACE_W(" Compare_string_op "); + // TRACE_W("Warning: when-method 'string_operation' not implemented!"); int ret = 0; // #if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -854,7 +843,7 @@ int ezlopi_scene_when_string_operation(l_scenes_list_v2_t* scene_node, void* arg int ezlopi_scene_when_in_array(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" Compare_inArray "); + // //TRACE_W(" Compare_inArray "); // TRACE_W("Warning: when-method 'in_array' not implemented!"); int ret = 0; // #if 0 @@ -908,8 +897,8 @@ int ezlopi_scene_when_in_array(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_compare_values(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W(" Compare_values "); - // TRACE_W("Warning: when-method 'is_group_state' not implemented!"); + // TRACE_W(" Compare_values "); + // TRACE_W("Warning: when-method 'is_group_state' not implemented!"); int ret = 0; // #if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -971,10 +960,9 @@ int ezlopi_scene_when_compare_values(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_has_atleast_one_dictionary_value(l_scenes_list_v2_t* scene_node, void* arg) { - //TRACE_W(" atleast_one_diction_val "); - TRACE_W("Warning: when-method 'atleast_one_dictionary_value' not implemented!"); + // TRACE_W(" atleast_one_diction_val "); + // TRACE_W("Warning: when-method 'atleast_one_dictionary_value' not implemented!"); int ret = 0; -#if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (scene_node && when_block) { @@ -984,7 +972,7 @@ int ezlopi_scene_when_has_atleast_one_dictionary_value(l_scenes_list_v2_t* scene l_fields_v2_t* curr_field = when_block->fields; while (curr_field) { - if (0 == strncmp(curr_field->name, "item", 5)) + if (0 == strncmp(curr_field->name, ezlopi_item_str, 5)) { if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { @@ -1007,16 +995,14 @@ int ezlopi_scene_when_has_atleast_one_dictionary_value(l_scenes_list_v2_t* scene ret = ezlopi_scenes_operators_has_atleastone_dictionary_value_operations(item_id, value_field); } } -#endif return ret; } int ezlopi_scene_when_is_firmware_update_state(l_scenes_list_v2_t* scene_node, void* arg) { - //TRACE_W(" firmware_update "); - TRACE_W("Warning: when-method 'firmware_update_state' not implemented!"); + // TRACE_W(" firmware_update "); + // TRACE_W("Warning: when-method 'firmware_update_state' not implemented!"); int ret = 0; -#if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (scene_node && when_block) { @@ -1053,16 +1039,14 @@ int ezlopi_scene_when_is_firmware_update_state(l_scenes_list_v2_t* scene_node, v } } } -#endif return ret; } int ezlopi_scene_when_is_dictionary_changed(l_scenes_list_v2_t* scene_node, void* arg) { - //TRACE_W(" isDictionary_changed "); - TRACE_W("Warning: when-method 'is_dictionary_changed' not implemented!"); + // TRACE_W(" isDictionary_changed "); + // TRACE_W("Warning: when-method 'is_dictionary_changed' not implemented!"); int ret = 0; -#if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (scene_node && when_block) { @@ -1073,7 +1057,7 @@ int ezlopi_scene_when_is_dictionary_changed(l_scenes_list_v2_t* scene_node, void l_fields_v2_t* curr_field = when_block->fields; while (curr_field) { - if (0 == strncmp(curr_field->name, "item", 5)) + if (0 == strncmp(curr_field->name, ezlopi_item_str, 5)) { if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { @@ -1102,7 +1086,6 @@ int ezlopi_scene_when_is_dictionary_changed(l_scenes_list_v2_t* scene_node, void ret = ezlopi_scenes_operators_is_dictionary_changed_operations(scene_node, item_id, key_field, operation_field); } } -#endif return ret; } @@ -1118,6 +1101,7 @@ int ezlopi_scene_when_and(l_scenes_list_v2_t* scene_node, void* arg) l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block) { + ret = 1; // required for the first case l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; while (value_when_block) { @@ -1134,7 +1118,7 @@ int ezlopi_scene_when_and(l_scenes_list_v2_t* scene_node, void* arg) value_when_block = value_when_block->next; } } - TRACE_I("and => %d", ret); + return ret; } @@ -1144,21 +1128,18 @@ int ezlopi_scene_when_not(l_scenes_list_v2_t* scene_node, void* arg) l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block) { - ret = 1; // required for the starting 'not' l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; while (value_when_block) { f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); if (scene_method) { - // TRACE_E("Method Name : %s", ezlopi_scene_get_scene_method_name(value_when_block->block_options.method.type)); ret = !(scene_method(scene_node, (void*)value_when_block)); // if all the block-calls are false, then return 1; } value_when_block = value_when_block->next; } } - return ret; } @@ -1185,7 +1166,6 @@ int ezlopi_scene_when_or(l_scenes_list_v2_t* scene_node, void* arg) } } - TRACE_I("or => %d", ret); return ret; } @@ -1210,12 +1190,51 @@ int ezlopi_scene_when_xor(l_scenes_list_v2_t* scene_node, void* arg) } } - TRACE_I("xor => %d", ret); return ret; } int ezlopi_scene_when_function(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W("Warning: when-method not implemented!"); - return 0; -} \ No newline at end of file + /* This funciton can contain only one of the 1. less ,2. least*/ + + int ret = 0; + l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; + if (scene_node && when_block) + { + cJSON* function_obj = scene_node->when_block->block_options.cj_function; + if (function_obj) + { + /*fill the 'fields->user-arg' with 'function_state_info'*/ + if (NULL == scene_node->when_block->fields->user_arg) + { + s_when_function_t* function_state_info = (s_when_function_t*)malloc(sizeof(s_when_function_t)); + if (function_state_info) + { + memset(function_state_info, 0, sizeof(s_when_function_t)); + scene_node->when_block->fields->user_arg = (void*)function_state_info; + } + } + + const s_function_opr_t __when_funtion_opr[] = { + {.opr_name = "for", .opr_method = when_function_for_opr}, + {.opr_name = "repeat", .opr_method = when_function_for_repeat}, + {.opr_name = "follow", .opr_method = when_function_for_follow}, + {.opr_name = "pulse", .opr_method = when_function_for_pulse}, + {.opr_name = "latch", .opr_method = when_function_for_latch}, + {.opr_name = NULL, .opr_method = NULL}, + }; + + cJSON* cj_func_opr = NULL; + for (uint8_t i = 0; i < ((sizeof(__when_funtion_opr) / sizeof(__when_funtion_opr[i]))); i++) + { + if (NULL != (cj_func_opr = cJSON_GetObjectItem(function_obj, __when_funtion_opr[i].opr_name))) + { + ret = (__when_funtion_opr[i].opr_method)(scene_node, when_block, cj_func_opr); + break; + } + } + } + } + + return ret; +} diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c index 85824b1c3..02bf9bc2b 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c @@ -1,8 +1,7 @@ #include "ezlopi_util_trace.h" -#include "ezlopi_core_http.h" #include "ezlopi_core_nvs.h" +#include "ezlopi_core_http.h" #include "ezlopi_core_scenes_v2.h" -#include "ezlopi_core_event_group.h" #include "ezlopi_core_scenes_when_methods_helper_functions.h" //------------------------------- ezlopi_scene_when_is_date --------------------------------------------- @@ -117,7 +116,7 @@ static uint8_t isdate_check_endweek_conditon(e_isdate_modes_t mode_type, struct static uint8_t isdate_find_nth_week_curr_month(struct tm* info) { // 2. find the fisrt day in this month - uint8_t tmp_week_num = 1; // starts with 1 ; since are already in one of the week-count + uint8_t tmp_week_num = 1; // starts with 1 ; since are already in one of the week-count // for this calculation dont change default 'info->tm_wday' -> '0-6' int tmp_weekday_of_curr_month = (info->tm_wday); // 0-6 ; sun = 0 for (uint8_t i = (info->tm_mday); i > 1; i--) // total_days_in_curr_month - 1 @@ -491,7 +490,6 @@ static void issunsate_update_sunstate_tm(int tm_mday, s_sunstate_data_t* user_da }; /*Make API call here and extract the suntime[according to 'user_data->sunstate_mode']*/ - ezlopi_core_http_mbedtls_req(&tmp_config); // e.g. after valid extraction user_data->curr_tm_day = tm_mday; // this stores day for which data is extracted @@ -595,17 +593,9 @@ uint8_t issunstate_get_suntime(l_scenes_list_v2_t* scene_node, l_fields_v2_t* cu if ((EZLOPI_VALUE_TYPE_STRING == curr_field->value_type) && (NULL != curr_field->field_value.u_value.value_string)) { flag_check |= (1 << 4); // indicates 'MASK_TIME_FLAG' - // if (0 < ezlopi_event_group_wait_for_event(EZLOPI_EVENT_NMA_REG, 100, false)) - // { - // TRACE_S("NMA_CONNECTED"); - // } - // else - // { - // TRACE_S("NMA_NOTCONNECTED"); - // return flag_check; - // } // 1. check for valid data within 'user_arg' + if (NULL == (scene_node->when_block->fields->user_arg)) { s_sunstate_data_t* data = (s_sunstate_data_t*)malloc(sizeof(s_sunstate_data_t)); @@ -628,7 +618,6 @@ uint8_t issunstate_get_suntime(l_scenes_list_v2_t* scene_node, l_fields_v2_t* cu // TRACE_S("curr_day = [%d] ; [%dth]", info->tm_mday, user_data->curr_tm_day); user_data->sunstate_mode = curr_sunstate_mode; // this sets target sunstate for curr meshbot issunsate_update_sunstate_tm(info->tm_mday, user_data); // assign 'curr_day' & 'suntime' only - user_data->tmoffs_type = (0 == strncmp(curr_field->field_value.u_value.value_string, "intime", 7)) ? ISSUNSTATE_INTIME_MODE : (0 == strncmp(curr_field->field_value.u_value.value_string, "before", 7)) ? ISSUNSTATE_BEFORE_MODE : (0 == strncmp(curr_field->field_value.u_value.value_string, "after", 6)) ? ISSUNSTATE_AFTER_MODE @@ -645,10 +634,8 @@ uint8_t issunstate_get_suntime(l_scenes_list_v2_t* scene_node, l_fields_v2_t* cu TRACE_W("update_day = [%d][%dth] , offset[%d] : intime=0,before=1,after=2,undefined=3 , SunState[%d] : sunrise=1,sunset=2", info->tm_mday, user_data->curr_tm_day, user_data->tmoffs_type, user_data->sunstate_mode); } } - return flag_check; } - uint8_t issunstate_get_offs_tmval(l_scenes_list_v2_t* scene_node, l_fields_v2_t* curr_field, struct tm* info, uint8_t curr_sunstate_mode) { uint8_t flag_check = 0; @@ -977,4 +964,347 @@ int isdate_range_check_flag_result(uint8_t flag_check) } return ret; } -//------------------------------------------------------------------------------------------------------------------- \ No newline at end of file + +//------------------------------- ezlopi_scene_when_function_method ----------------------------------- + +int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) +{ + int ret = 0; + if (scene_node && when_block && cj_func_opr) + { + cJSON* for_type = cJSON_GetObjectItem(cj_func_opr, "method"); + cJSON* for_interval = cJSON_GetObjectItem(cj_func_opr, "seconds"); + if (for_type && for_interval) + { + const char* for_less_least = cJSON_GetStringValue(for_type); /*extract the type*/ + if (for_less_least) + { + /* first get the product of all children states*/ + bool transition_state = 1; // to make valid judgements + l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; + while (value_when_block) + { + f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); + if (scene_method) + { + transition_state &= scene_method(scene_node, (void*)value_when_block); + if (!transition_state) + { + break; + } + } + value_when_block = value_when_block->next; + } + + /*now compare the intervals between each transtion result*/ + s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; + + if ((transition_state == 1) && (0 == function_state_info->current_state)) + { + function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); + } + else if ((transition_state == 0) && (1 == function_state_info->current_state)) + { + if (0 != function_state_info->transtion_instant) + { + int threshold_time = cJSON_GetNumberValue(for_interval); + if (0 == strncmp(for_less_least, "less", 5)) + { + if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) < threshold_time) + { + ret = 1; + } + } + else if (0 == strncmp(for_less_least, "least", 6)) + { + if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) >= threshold_time) + { + ret = 1; + } + } + } + TRACE_S("for_Transtion_time[%d]", function_state_info->transtion_instant); + } + function_state_info->current_state = transition_state; + } + else + { + ret = -1; + } + } + } + + return ret; +} +int when_function_for_repeat(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) +{ + int ret = 0; + if (scene_node && when_block && cj_func_opr) + { + cJSON* for_times = cJSON_GetObjectItem(cj_func_opr, "times"); + cJSON* for_interval = cJSON_GetObjectItem(cj_func_opr, "seconds"); + if (for_times && for_interval) + { + int for_count = cJSON_GetNumberValue(for_times); /*extract the type*/ + if (for_count) + { + /* first get the product of all children states*/ + bool transition_state = 1; // to make valid judgements + l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; + while (value_when_block) + { + f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); + if (scene_method) + { + transition_state &= scene_method(scene_node, (void*)value_when_block); + if (!transition_state) + { + break; + } + } + value_when_block = value_when_block->next; + } + + s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; + + if ((transition_state == 1) && (0 == function_state_info->current_state)) /*previous state?*/ + { + if (0 == function_state_info->transtion_instant) + { /*store the first trigger time*/ + function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); + TRACE_S("1st_trigger_time[%d]", function_state_info->transtion_instant); + } + + int threshold_time = cJSON_GetNumberValue(for_interval); + function_state_info->transition_count++; + if (function_state_info->transition_count >= for_count) + { + if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) <= threshold_time) + { + ret = 1; + } + function_state_info->transtion_instant = 0; + function_state_info->transition_count = 0; + } + } + function_state_info->current_state = transition_state; + } + } + else + { + ret = -1; + } + } + + return ret; +} +int when_function_for_follow(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) +{ + int ret = 0; + if (scene_node && when_block && cj_func_opr) + { + cJSON* for_delay = cJSON_GetObjectItem(cj_func_opr, "delayReset"); + if (for_delay) + { + s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; + if (0 == function_state_info->transtion_instant) /* trigger phase ---> started */ + { + /* first get the product of all children states*/ + bool transition_state = 1; // to make valid judgements + l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; + while (value_when_block) + { + f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); + if (scene_method) + { + transition_state &= scene_method(scene_node, (void*)value_when_block); + if (!transition_state) + { + break; + } + } + value_when_block = value_when_block->next; + } + + if ((transition_state == 1) && (0 == function_state_info->current_state)) /*previous state?*/ + { + function_state_info->current_state = transition_state; + function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); + TRACE_S("start_follow_time[%d]", function_state_info->transtion_instant); + ret = 1; + } + } + else /* trigger phase ---> started */ + { + int threshold_time = cJSON_GetNumberValue(for_delay); + if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) <= threshold_time) + { + ret = 1; + } + else + { + ret = 0; + TRACE_S("stop_follow_time[%d]", (uint32_t)xTaskGetTickCount()); + function_state_info->transtion_instant = 0; + function_state_info->current_state = 0; + } + } + } + } + else + { + ret = -1; + } + + return ret; +} +int when_function_for_pulse(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) +{ + int ret = 0; + if (scene_node && when_block && cj_func_opr) + { + cJSON* for_trueperiod = cJSON_GetObjectItem(cj_func_opr, "truePeriod"); + cJSON* for_falseperiod = cJSON_GetObjectItem(cj_func_opr, "falsePeriod"); + cJSON* for_times = cJSON_GetObjectItem(cj_func_opr, "times"); + int true_time_dur = cJSON_GetNumberValue(for_trueperiod); + if (for_trueperiod) + { + int false_time_dur = 0; + int seq_count = 0; + if (for_times && for_falseperiod) + { + false_time_dur = cJSON_GetNumberValue(for_falseperiod); + seq_count = cJSON_GetNumberValue(for_times); + } + /*1. check for activation condition for 'pulse_flag' */ + s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; + if ((0 == function_state_info->transition_count) && + (0 == function_state_info->current_state) && + (0 == function_state_info->transtion_instant) && + (false == function_state_info->activate_pulse_seq)) + { + bool transition_state = 1; // to make valid judgements + l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; + while (value_when_block) + { + f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); + if (scene_method) + { + transition_state &= scene_method(scene_node, (void*)value_when_block); + if (!transition_state) + { + break; + } + } + value_when_block = value_when_block->next; + } + if (transition_state == 1) + { + function_state_info->activate_pulse_seq = true; + function_state_info->current_state = 1; + function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); + } + } + /*2. Activate pulse_sequence*/ + if (true == function_state_info->activate_pulse_seq) + { + if (seq_count == 0) + { + function_state_info->transition_count = seq_count; /* If 'SEQ_COUNT' == 0 ; Then loop the sequence forever. */ + } + + if (function_state_info->transition_count <= seq_count) + { + if (1 == function_state_info->current_state) + { + if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) >= true_time_dur) + { + function_state_info->current_state = !function_state_info->current_state; + function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); /*in sec*/ + } + } + else if (0 == function_state_info->current_state) + { + if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) >= false_time_dur) + { + function_state_info->current_state = !function_state_info->current_state; + function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); /*in sec*/ + } + } + + function_state_info->transition_count++; + } + else + { + TRACE_W("Excceded pulse count "); + function_state_info->activate_pulse_seq = false; + function_state_info->current_state = 0; + function_state_info->transition_count = 0; + function_state_info->transtion_instant = 0; + } + + + TRACE_S("pulse_flag=%d -> {%d}.pulse_instant[%d]", + (int)function_state_info->activate_pulse_seq, + function_state_info->transition_count, + function_state_info->transtion_instant); + } + ret = function_state_info->current_state; + } + } + + return ret; +} +int when_function_for_latch(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) +{ + int ret = 0; + if (scene_node && when_block && cj_func_opr) + { + cJSON* for_enabled = cJSON_GetObjectItem(cj_func_opr, "enabled"); + if (for_enabled) + { + s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; + if ((0 == function_state_info->current_state) && (cJSON_True == for_enabled->type)) /* if the trigger phase has not started */ + { + /* first get the product of all children states*/ + bool transition_state = 1; // to make valid judgements + l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; + while (value_when_block) + { + f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); + if (scene_method) + { + transition_state &= scene_method(scene_node, (void*)value_when_block); + if (!transition_state) + { + break; + } + } + value_when_block = value_when_block->next; + } + + if (transition_state == 1) /*if : previous state = 0*/ + { + function_state_info->current_state = 1; + function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); + TRACE_S("start_latched_time[%d]", (uint32_t)xTaskGetTickCount()); + } + } + else if ((1 == function_state_info->current_state) && (cJSON_False == for_enabled->type)) + { + function_state_info->current_state = 0; + function_state_info->transtion_instant = 0; + TRACE_S("reset_latched_time[%d]", (uint32_t)xTaskGetTickCount()); + } + else + { + TRACE_W("Latch state already achieved -> current_state = [%d]", function_state_info->current_state); + + } + ret = function_state_info->current_state; + } + } + + return ret; +} +//----------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.h index 761da23df..f70ce715f 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.h @@ -46,6 +46,21 @@ typedef struct s_isdate_range_method const char* field_name; void (*field_func)(l_fields_v2_t* curr_field, struct tm* tmp_tm); } s_isdate_range_method_t; + +typedef struct s_function_opr +{ + const char* opr_name; + int(*opr_method)(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr); +} s_function_opr_t; + +typedef struct s_when_function +{ + uint32_t transtion_instant; + uint32_t transition_count; + bool current_state; + bool activate_pulse_seq; /* used only in 'for_pulse_method' */ +} s_when_function_t; + //------------------------------- ezlopi_scene_when_is_date ----------------------------------------------- uint8_t isdate_type_check(e_isdate_modes_t* mode_type, struct tm* info, l_fields_v2_t* curr_field); uint8_t isdate_tm_check(e_isdate_modes_t* mode_type, struct tm* info, l_fields_v2_t* curr_field); @@ -84,4 +99,10 @@ uint8_t isdate_range_check_month(struct tm* start, struct tm* end, struct tm* in uint8_t isdate_range_check_year(struct tm* start, struct tm* end, struct tm* info); int isdate_range_check_flag_result(uint8_t flag_check); +//------------------------------- ezlopi_scene_when_function_method ----------------------------------------- +int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr); +int when_function_for_repeat(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr); +int when_function_for_follow(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr); +int when_function_for_pulse(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr); +int when_function_for_latch(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr); #endif /*_EZLOPI_CORE_SCENES_WHEN_METHODS_HELPER_FUNCTIONS_H_*/ \ No newline at end of file diff --git a/ezlopi-sensors-devices/sensor-0068-I2C-ENS160-gas-sensor/sensor_0068_ENS160_gas_sensor.c b/ezlopi-sensors-devices/sensor-0068-I2C-ENS160-gas-sensor/sensor_0068_ENS160_gas_sensor.c index b8bda8cbb..e80da8fc0 100644 --- a/ezlopi-sensors-devices/sensor-0068-I2C-ENS160-gas-sensor/sensor_0068_ENS160_gas_sensor.c +++ b/ezlopi-sensors-devices/sensor-0068-I2C-ENS160-gas-sensor/sensor_0068_ENS160_gas_sensor.c @@ -81,7 +81,6 @@ static int __get_cjson_value(l_ezlopi_item_t *item, void *arg) int ret = 0; cJSON *cj_params = (cJSON *)arg; - char *valueFormatted; if (cj_params) { ens160_t *ens160_sensor = (ens160_t *)item->user_arg; From d43f45210defcb448d67ba9ef1d9ddcf5bec72d7 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Tue, 9 Apr 2024 20:12:01 +0545 Subject: [PATCH 02/29] added a code to free 'fields->user_arg' --- ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c index 1eacd3201..5db8a8104 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c @@ -26,8 +26,11 @@ void ezlopi_scenes_delete_fields(l_fields_v2_t* fields) { if (fields) { - ezlopi_scenes_delete_fields(fields->next); + if (fields->user_arg) + { + free(fields->user_arg); + } fields->next = NULL; ezlopi_scenes_delete_field_value(fields); free(fields); From b3857c7edfdf4089214f1bda6938f7f03ba2bbc0 Mon Sep 17 00:00:00 2001 From: NDJ-Ezlo Date: Wed, 10 Apr 2024 12:38:20 +0545 Subject: [PATCH 03/29] Scene block status reset feature --- .../ezlopi_cloud_methods_str.c | 2 +- .../ezlopi-cloud-scenes/ezlopi_cloud_scenes.c | 34 +++++++++++++++++++ .../ezlopi-cloud-scenes/ezlopi_cloud_scenes.h | 1 + .../ezlopi-core-api/ezlopi_core_api_macros.h | 1 + .../ezlopi_core_scenes_when_methods.h | 1 + 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_methods_str.c b/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_methods_str.c index 35f0ef03a..7566ed7a4 100644 --- a/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_methods_str.c +++ b/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_methods_str.c @@ -116,7 +116,7 @@ const char *method_hub_reboot = "hub.reboot"; // const char *method_hub_network_enabled_set = "hub.network.enabled.set"; // const char *method_hub_detection_devices_scan_start = "hub.detection.devices.scan.start"; // const char *method_hub_detection_devices_scans_top = "hub.detection.devices.scan.stop"; -const char *method_hub_scene_run_progress = "hub.scene.run.progress"; +const char *method_hub_scene_run_progress = "hub.scene.run.progress"; const char *ezlopi_rpc_method_notfound_str = "rpc.method.notfound"; const char *ezlopi_hub_scene_changed_str = "hub.scene.changed"; const char *ezlopi_hub_scene_added_str = "hub.scene.added"; diff --git a/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c index f063d9cab..e7123694d 100755 --- a/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c +++ b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c @@ -14,6 +14,7 @@ #include "ezlopi_core_cjson_macros.h" #include "ezlopi_core_scenes_operators.h" #include "ezlopi_core_scenes_notifications.h" +#include "ezlopi_core_scenes_when_methods_helper_functions.h" void scenes_list(cJSON* cj_request, cJSON* cj_response) { @@ -343,6 +344,39 @@ void scenes_notification_remove(cJSON* cj_request, cJSON* cj_response) } } +void scenes_block_status_reset(cJSON* cj_request, cJSON* cj_response) +{ + cJSON* cj_result = cJSON_AddObjectToObject(cj_response, ezlopi_result_str); + cJSON* cj_params = cJSON_GetObjectItem(cj_request, ezlopi_params_str); + if (cj_result && cj_params) + { + char* scene_id_str = NULL; + CJSON_GET_VALUE_STRING(cj_params, ezlopi_sceneId_str, scene_id_str); + if (scene_id_str) + { + uint32_t scene_id = strtoul(scene_id_str, NULL, 16); + if (scene_id) + { + l_scenes_list_v2_t* scene_node = ezlopi_scenes_get_scenes_head_v2(); + while (scene_node) + { + if (scene_node->_id == scene_id) + { + s_when_function_t* function_state = (s_when_function_t*)scene_node->when_block->fields->user_arg; + if (function_state) + { + function_state->current_state = false; + } + break; + } + scene_node = scene_node->next; + } + } + } + } +} + + ////// updater for scene ////// useful for 'hub.scenes.enabled.set' void scene_changed(cJSON* cj_request, cJSON* cj_response) diff --git a/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.h b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.h index 4862e5d40..6b7811556 100755 --- a/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.h +++ b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.h @@ -21,6 +21,7 @@ extern "C" void scenes_enable_set(cJSON* cj_request, cJSON* cj_response); void scenes_notification_add(cJSON* cj_request, cJSON* cj_response); void scenes_notification_remove(cJSON* cj_request, cJSON* cj_response); + void scenes_block_status_reset(cJSON* cj_request, cJSON* cj_response); ///////////// updaters void scene_changed(cJSON* cj_request, cJSON* cj_response); diff --git a/ezlopi-core/ezlopi-core-api/ezlopi_core_api_macros.h b/ezlopi-core/ezlopi-core-api/ezlopi_core_api_macros.h index d73cee25a..229244f19 100644 --- a/ezlopi-core/ezlopi-core-api/ezlopi_core_api_macros.h +++ b/ezlopi-core/ezlopi-core-api/ezlopi_core_api_macros.h @@ -64,6 +64,7 @@ CLOUD_METHOD("hub.scenes.enabled.set", scenes_enable_set, scene_changed) CLOUD_METHOD("hub.scenes.notification.add", scenes_notification_add, scene_changed) CLOUD_METHOD("hub.scenes.notification.remove", scenes_notification_remove, scene_changed) CLOUD_METHOD("hub.scenes.status.get", scenes_status_get, NULL) // Incomplete +CLOUD_METHOD("hub.scenes.block.status.reset", scenes_block_status_reset, NULL) #endif CLOUD_METHOD("hub.room.list", room_list, NULL) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h index 54e0fe0b3..91608871b 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h @@ -37,3 +37,4 @@ int ezlopi_scene_when_or(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_xor(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_function(l_scenes_list_v2_t *scene_node, void *arg); #endif // _EZLOPI_CORE_SCENES_WHEN_METHODS_H_ + \ No newline at end of file From f78818aed3b15c588785f160014c3c4a1a50601b Mon Sep 17 00:00:00 2001 From: NDJ-Ezlo Date: Wed, 10 Apr 2024 16:32:34 +0545 Subject: [PATCH 04/29] Scene reset latch --- .../ezlopi_core_scenes_then_methods.c | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 5901bb626..cc55df574 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -12,6 +12,7 @@ #include "ezlopi_core_scenes_status_changed.h" #include "ezlopi_service_meshbot.h" #include "ezlopi_core_scenes_then_methods_helper_func.h" +#include "ezlopi_core_scenes_when_methods_helper_functions.h" #include "ezlopi_cloud_constants.h" @@ -349,10 +350,38 @@ int ezlopi_scene_then_set_scene_state(l_scenes_list_v2_t* curr_scene, void* arg) } return ret; } + int ezlopi_scene_then_reset_latch(l_scenes_list_v2_t* curr_scene, void* arg) { - TRACE_W("Warning: then-method not implemented!"); - return 0; + int ret = 0; + uint32_t sceneId = 0; + l_action_block_v2_t* curr_block = (l_action_block_v2_t*)arg; + if (curr_block && curr_scene) + { + l_fields_v2_t* curr_field = curr_block->fields; + while (curr_field) + { + if (0 == strncmp(curr_field->name, ezlopi_sceneId_str, 7)) + { + if (EZLOPI_VALUE_TYPE_SCENEID == curr_field->value_type) + { + sceneId = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + l_scenes_list_v2_t* scene_to_reset_latch = ezlopi_scenes_get_by_id_v2(sceneId); + if (scene_to_reset_latch) + { + s_when_function_t* function_state = (s_when_function_t*)scene_to_reset_latch->when_block->fields->user_arg; + if (function_state) + { + function_state->current_state = false; + } + break; + } + } + } + curr_field = curr_field->next; + } + } + return ret; } int ezlopi_scene_then_reset_scene_latches(l_scenes_list_v2_t* curr_scene, void* arg) { From fc7bcbdb0fbe415039572106d051b39d654cc4a8 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Wed, 10 Apr 2024 18:19:03 +0545 Subject: [PATCH 05/29] testing reset_latch_then_method --- .../ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index cc55df574..ffa7d843e 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -361,11 +361,12 @@ int ezlopi_scene_then_reset_latch(l_scenes_list_v2_t* curr_scene, void* arg) l_fields_v2_t* curr_field = curr_block->fields; while (curr_field) { - if (0 == strncmp(curr_field->name, ezlopi_sceneId_str, 7)) + if (0 == strncmp(curr_field->name, ezlopi_sceneId_str, 8)) { - if (EZLOPI_VALUE_TYPE_SCENEID == curr_field->value_type) + if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type) { sceneId = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + TRACE_S("reset_latch _---> sceneId[%d]", sceneId); l_scenes_list_v2_t* scene_to_reset_latch = ezlopi_scenes_get_by_id_v2(sceneId); if (scene_to_reset_latch) { From 97583577cc397f3a3dbdae309f02d9d230138f79 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Wed, 10 Apr 2024 19:29:13 +0545 Subject: [PATCH 06/29] testing min_free_heap when hub.create.scene --- .../ezlopi-cloud-scenes/ezlopi_cloud_scenes.c | 24 ++++++++++++------- .../ezlopi_core_scenes_then_methods.c | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c index e7123694d..21731decc 100755 --- a/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c +++ b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c @@ -32,15 +32,23 @@ void scenes_create(cJSON* cj_request, cJSON* cj_response) cJSON* cj_params = cJSON_GetObjectItem(cj_request, ezlopi_params_str); if (cj_params) { - uint32_t new_scene_id = ezlopi_store_new_scene_v2(cj_params); - TRACE_D("new-scene-id: %08x", new_scene_id); - - if (new_scene_id) + float curr_free_kb_heap = (float)esp_get_free_heap_size() / 1024.0; + if ((int)curr_free_kb_heap > 30)/* (>245760 bytes) = 30kb*/ + { + TRACE_E("create_scene : esp_get_free_heap_size = %f kB", curr_free_kb_heap); + uint32_t new_scene_id = ezlopi_store_new_scene_v2(cj_params); + TRACE_D("new-scene-id: %08x", new_scene_id); + if (new_scene_id) + { + char tmp_buff[32]; + snprintf(tmp_buff, sizeof(tmp_buff), "%08x", new_scene_id); + cJSON_AddStringToObject(cj_request, ezlopi__id_str, tmp_buff); + ezlopi_scenes_new_scene_populate(cj_params, new_scene_id); + } + } + else { - char tmp_buff[32]; - snprintf(tmp_buff, sizeof(tmp_buff), "%08x", new_scene_id); - cJSON_AddStringToObject(cj_request, ezlopi__id_str, tmp_buff); - ezlopi_scenes_new_scene_populate(cj_params, new_scene_id); + TRACE_E(" Error!! Not enough memory for scene creation. [Current size - %f kB (<30kb)]", curr_free_kb_heap); } } } diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index ffa7d843e..dae25875e 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -366,7 +366,7 @@ int ezlopi_scene_then_reset_latch(l_scenes_list_v2_t* curr_scene, void* arg) if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type) { sceneId = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); - TRACE_S("reset_latch _---> sceneId[%d]", sceneId); + TRACE_E("reset_latch _---> sceneId[%d]", sceneId); l_scenes_list_v2_t* scene_to_reset_latch = ezlopi_scenes_get_by_id_v2(sceneId); if (scene_to_reset_latch) { From c4dc6c719c6ee93d035f44f3e1a34a733379173d Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Thu, 11 Apr 2024 11:50:16 +0545 Subject: [PATCH 07/29] added EZPI-349_toggle_value_method ; https://jira.mios.com/browse/EZPI-349 --- .../ezlopi_core_scenes_then_methods.c | 122 +++++++++++++++++- 1 file changed, 120 insertions(+), 2 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index dae25875e..6db413c0a 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -473,6 +473,124 @@ int ezlopi_scene_then_set_variable(l_scenes_list_v2_t* curr_scene, void* arg) } int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) { - TRACE_W("Warning: then-method not implemented!"); - return 0; + TRACE_W(" toggle_value "); + int ret = 0; + + if (curr_scene) + { + int item_id = 0; /* item or expression*/ + int expression_id = 0; /* item or expression*/ + const char* __id_string = NULL; + + l_action_block_v2_t* curr_then = (l_action_block_v2_t*)arg; + if (curr_then) + { + l_fields_v2_t* curr_field = curr_then->fields; + while (curr_field) + { + if (0 == strncmp(curr_field->name, ezlopi_item_str, 5)) + { + if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type) + { + item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + __id_string = curr_field->field_value.u_value.value_string; + TRACE_D("item_id: %s", __id_string); + } + } + else if (0 == strncmp(curr_field->name, ezlopi_expressions_str, 12)) + { + if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type) + { + expression_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + __id_string = curr_field->field_value.u_value.value_string; + TRACE_D("expression_id: %s", __id_string); + } + } + curr_field = curr_field->next; + } + + if (item_id > 0) + { + uint8_t found_item = 0; + l_ezlopi_device_t* curr_device = ezlopi_device_get_head(); + while (curr_device) + { + l_ezlopi_item_t* curr_item = curr_device->items; + while (curr_item) + { + if (item_id == curr_item->cloud_properties.item_id && + EZLOPI_DEVICE_INTERFACE_DIGITAL_OUTPUT == curr_item->interface_type) + { + cJSON* cj_tmp_value = cJSON_CreateObject(); + if (cj_tmp_value) + { + curr_item->func(EZLOPI_ACTION_HUB_GET_ITEM, curr_item, (void*)cj_tmp_value, NULL); + cJSON* cj_val = cJSON_GetObjectItem(cj_tmp_value, ezlopi_value_str); + cJSON* cj_valuetype = cJSON_GetObjectItem(cj_tmp_value, ezlopi_valueType_str); + if (cj_val && cj_valuetype) + { + cJSON* cj_result_value = cJSON_CreateObject(); + if (cj_result_value) + { + ret = 1; + cJSON_AddStringToObject(cj_result_value, ezlopi__id_str, __id_string); + + if (0 == strncmp(cj_valuetype->valuestring, value_type_bool, 6)) + { + TRACE_S("1. getting 'item_id[%d]' ; bool_value = %s ", item_id, cj_val->valuestring); // "false" or "true" + if (0 == strncmp(cj_val->valuestring, "false", 6)) + { + cJSON_AddBoolToObject(cj_result_value, ezlopi_value_str, true); + } + else + { + cJSON_AddBoolToObject(cj_result_value, ezlopi_value_str, false); + } + + curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_result_value, curr_item->user_arg); + } + else if (0 == strncmp(cj_valuetype->valuestring, value_type_int, 6)) + { + TRACE_S("2. getting 'item_id[%d]' ; int_value = %d ", item_id, (int)cj_val->valuedouble); + if (cj_val->valuedouble == 0) // either '0' or '1'. + { + cJSON_AddNumberToObject(cj_result_value, ezlopi_value_str, 1); + } + else if (cj_val->valuedouble == 1) + { + cJSON_AddNumberToObject(cj_result_value, ezlopi_value_str, 0); + } + curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_result_value, curr_item->user_arg); + } + else + { + ret = -1; + TRACE_E(" 'item_id[%d]' neither 'boolean' nor 'int' ; Value-type mis-matched! ", item_id); + } + cJSON_Delete(cj_result_value); + } + } + } + found_item = 1; + cJSON_Delete(cj_tmp_value); + break; + } + curr_item = curr_item->next; + } + + if (found_item) + { + break; + } + curr_device = curr_device->next; + } + } + // else if (expression_id > 0) + // { + // #warning "need guidance" + // } + } + } + + return ret; } \ No newline at end of file From 03aeb9748a29d8624c2e72a4bcefd7a0552d7639 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Thu, 11 Apr 2024 18:00:57 +0545 Subject: [PATCH 08/29] added isHouseMode_changed_from_method --- .../ezlopi_core_scenes_when_methods.c | 61 +++++++++++++++++-- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 07b98cca0..bdcff40b8 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -409,7 +409,10 @@ int ezlopi_scene_when_is_house_mode_changed_to(l_scenes_list_v2_t* scene_node, v { if (0 == strncmp(curr_field->name, ezlopi_houseMode_str, strlen(ezlopi_houseMode_str))) { - house_mode_id_array = curr_field; + if (EZLOPI_VALUE_TYPE_HOUSE_MODE_ID_ARRAY == curr_field->value_type) + { + house_mode_id_array = curr_field; + } } curr_field = curr_field->next; @@ -418,15 +421,18 @@ int ezlopi_scene_when_is_house_mode_changed_to(l_scenes_list_v2_t* scene_node, v uint32_t idx = 0; cJSON* cj_house_mdoe_id = NULL; - while (NULL == (cj_house_mdoe_id = cJSON_GetArrayItem(house_mode_id_array->field_value.u_value.cj_value, idx++))) + while (NULL != (cj_house_mdoe_id = cJSON_GetArrayItem(house_mode_id_array->field_value.u_value.cj_value, idx++))) { if (cj_house_mdoe_id->valuestring) { uint32_t house_mode_id = strtoul(cj_house_mdoe_id->valuestring, NULL, 16); s_ezlopi_modes_t* modes = ezlopi_core_modes_get_custom_modes(); - if ((modes->current_mode_id == house_mode_id) && ((uint32_t)house_mode_id_array->user_arg != modes->current_mode_id)) + if ((uint32_t)house_mode_id_array->user_arg != modes->current_mode_id) /* first check if there is transition */ { - ret = 1; + if (modes->current_mode_id == house_mode_id) /* if : new_state == desired */ + { + ret = 1; + } house_mode_id_array->user_arg = (void*)house_mode_id; TRACE_E("house-mode-changed-to: %d", house_mode_id); } @@ -439,8 +445,51 @@ int ezlopi_scene_when_is_house_mode_changed_to(l_scenes_list_v2_t* scene_node, v int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W("Warning: when-method 'is_house_mode_changed_from' not implemented!"); - return 0; + //TRACE_W(" isHouse_mode "); + int ret = 0; + l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; + + if (when_block) + { + l_fields_v2_t* house_mode_id_array = NULL; + l_fields_v2_t* curr_field = when_block->fields; + + while (curr_field) + { + if (0 == strncmp(curr_field->name, ezlopi_houseMode_str, strlen(ezlopi_houseMode_str))) + { + if (EZLOPI_VALUE_TYPE_HOUSE_MODE_ID_ARRAY == curr_field->value_type) + { + house_mode_id_array = curr_field; + } + } + + curr_field = curr_field->next; + } + + uint32_t idx = 0; + cJSON* cj_house_mode_id = NULL; + + while (NULL != (cj_house_mode_id = cJSON_GetArrayItem(house_mode_id_array->field_value.u_value.cj_value, idx++))) + { + if (cj_house_mode_id->valuestring) + { + uint32_t house_mode_id = strtoul(cj_house_mode_id->valuestring, NULL, 16); + s_ezlopi_modes_t* modes = ezlopi_core_modes_get_custom_modes(); + if ((uint32_t)house_mode_id_array->user_arg != modes->current_mode_id) /* first check if there is transition */ + { + if ((uint32_t)house_mode_id_array->user_arg == house_mode_id) /* if : old_state == desired */ + { + ret = 1; + } + house_mode_id_array->user_arg = (void*)house_mode_id; + TRACE_E("house-mode-changed-to: %d", house_mode_id); + } + } + } + } + + return ret; } int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t* scene_node, void* arg) From e6bc7453beef064ea0d18c747eb3d67c5f708e68 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Fri, 12 Apr 2024 18:57:15 +0545 Subject: [PATCH 09/29] implemented switch_house_mode then-method; EZPI-367: https://jira.mios.com/browse/EZPI-367 --- .../ezlopi_core_scenes_then_methods.c | 52 ++++++++++++++++--- .../ezlopi_core_scenes_when_methods.c | 1 - 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 64e19b97b..537cdded9 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -2,6 +2,7 @@ #include "ezlopi_core_nvs.h" #include "ezlopi_core_http.h" +#include "ezlopi_core_modes.h" #include "ezlopi_core_reset.h" #include "ezlopi_core_devices.h" #include "ezlopi_core_scenes_v2.h" @@ -35,10 +36,6 @@ int ezlopi_scene_then_set_item_value(l_scenes_list_v2_t* curr_scene, void* arg) cJSON_AddStringToObject(cj_params, ezlopi__id_str, curr_field->field_value.u_value.value_string); item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); // TRACE_D("item_id: %s", curr_field->field_value.u_value.value_string); - - // cJSON_AddStringToObject(cj_params, ezlopi__id_str, curr_field->field_value.u_value.value_string); - // item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); - // TRACE_D("item_id: %s", curr_field->field_value.u_value.value_string); } else if (0 == strncmp(curr_field->name, ezlopi_value_str, 5)) { @@ -95,7 +92,7 @@ int ezlopi_scene_then_set_item_value(l_scenes_list_v2_t* curr_scene, void* arg) } int ezlopi_scene_then_set_device_armed(l_scenes_list_v2_t* curr_scene, void* arg) { - TRACE_W("Warning: then-method not implemented!"); + // TRACE_W("Warning: then-method not implemented!"); int ret = 0; if (curr_scene) { @@ -152,8 +149,49 @@ int ezlopi_scene_then_send_cloud_abstract_command(l_scenes_list_v2_t* curr_scene } int ezlopi_scene_then_switch_house_mode(l_scenes_list_v2_t* curr_scene, void* arg) { - TRACE_W("Warning: then-method not implemented!"); - return 0; + TRACE_W(" switch_house_mode "); + int ret = 0; + if (curr_scene) + { + uint32_t house_mode_id = 0; + l_action_block_v2_t* curr_then = (l_action_block_v2_t*)arg; + if (curr_then) + { + l_fields_v2_t* curr_field = curr_then->fields; + while (curr_field) + { + if (0 == strncmp(curr_field->name, "houseMode", 10)) + { + if (EZLOPI_VALUE_TYPE_HOUSE_MODE_ID == curr_field->value_type) + { + house_mode_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + } + } + + curr_field = curr_field->next; + } + + if (house_mode_id) + { + // first get the current + s_ezlopi_modes_t* curr_house_mode = ezlopi_core_modes_get_custom_modes(); + + // find and match the 'house_mode' you want to switch with. + s_house_modes_t* req_mode = ezlopi_core_modes_get_house_mode_by_id(house_mode_id); + if ((req_mode->_id != curr_house_mode->switch_to_mode_id)) + { + curr_house_mode->switch_to_mode_id = req_mode->_id; + ezlopi_core_modes_api_switch_mode(curr_house_mode); + ret = 1; + + TRACE_E("house-mode-changed-to: %d", house_mode_id); + } + } + } + + } + + return ret; } int ezlopi_scene_then_send_http_request(l_scenes_list_v2_t* curr_scene, void* arg) { diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 07b98cca0..86ec9763e 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -411,7 +411,6 @@ int ezlopi_scene_when_is_house_mode_changed_to(l_scenes_list_v2_t* scene_node, v { house_mode_id_array = curr_field; } - curr_field = curr_field->next; } From b96bc4143b2a5daddd975a47ceca0ef00940a89b Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Mon, 15 Apr 2024 13:40:23 +0545 Subject: [PATCH 10/29] fixed a parsing bug --- .../ezlopi_core_scenes_then_methods.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 537cdded9..195ac9235 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -164,14 +164,21 @@ int ezlopi_scene_then_switch_house_mode(l_scenes_list_v2_t* curr_scene, void* ar { if (EZLOPI_VALUE_TYPE_HOUSE_MODE_ID == curr_field->value_type) { - house_mode_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + if (NULL != curr_field->field_value.u_value.value_string) + { + house_mode_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + } + else + { + house_mode_id = (uint32_t)curr_field->field_value.u_value.value_double; + } } } curr_field = curr_field->next; } - if (house_mode_id) + if (house_mode_id > 0) { // first get the current s_ezlopi_modes_t* curr_house_mode = ezlopi_core_modes_get_custom_modes(); From a5c3af033d1edc589823664f361d61992923e4ca Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Mon, 15 Apr 2024 17:59:10 +0545 Subject: [PATCH 11/29] refactoring code --- .../ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 195ac9235..327476a3f 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -185,13 +185,13 @@ int ezlopi_scene_then_switch_house_mode(l_scenes_list_v2_t* curr_scene, void* ar // find and match the 'house_mode' you want to switch with. s_house_modes_t* req_mode = ezlopi_core_modes_get_house_mode_by_id(house_mode_id); + TRACE_E("req-house-mode-id [%d] : curr->switch_to_mode_id[%d]", + req_mode->_id, + curr_house_mode->switch_to_mode_id); if ((req_mode->_id != curr_house_mode->switch_to_mode_id)) { - curr_house_mode->switch_to_mode_id = req_mode->_id; - ezlopi_core_modes_api_switch_mode(curr_house_mode); + ezlopi_core_modes_api_switch_mode(req_mode); ret = 1; - - TRACE_E("house-mode-changed-to: %d", house_mode_id); } } } From 9c04c5b4d5fae358577dac6dfb3d31db558d1bdf Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Tue, 16 Apr 2024 11:47:11 +0545 Subject: [PATCH 12/29] added then-method_reset_Scene_latches --- .../ezlopi_core_scenes_then_methods.c | 35 +++++++++++++++++-- ...ore_scenes_when_methods_helper_functions.h | 9 +++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 64e19b97b..57ac2f3e1 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -12,6 +12,7 @@ #include "ezlopi_core_scenes_status_changed.h" #include "ezlopi_service_meshbot.h" #include "ezlopi_core_scenes_then_methods_helper_func.h" +#include "ezlopi_core_scenes_when_methods_helper_functions.h" #include "ezlopi_cloud_constants.h" @@ -356,8 +357,38 @@ int ezlopi_scene_then_reset_latch(l_scenes_list_v2_t* curr_scene, void* arg) } int ezlopi_scene_then_reset_scene_latches(l_scenes_list_v2_t* curr_scene, void* arg) { - TRACE_W("Warning: then-method not implemented!"); - return 0; + int ret = 0; + uint32_t sceneId = 0; + l_action_block_v2_t* curr_then = (l_action_block_v2_t*)arg; + if (curr_then && curr_scene) + { + l_fields_v2_t* curr_field = curr_then->fields; + while (curr_field) + { + if (0 == strncmp(curr_field->name, ezlopi_sceneId_str, 8)) + { + if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type) + { + sceneId = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + + + TRACE_E("reset_latch---> sceneId[%d]", sceneId); + l_scenes_list_v2_t* scene_to_reset_latch = ezlopi_scenes_get_by_id_v2(sceneId); + if (scene_to_reset_latch) + { + s_when_function_t* function_state = (s_when_function_t*)scene_to_reset_latch->when_block->fields->user_arg; + if (function_state) + { + function_state->current_state = false; + } + break; + } + } + } + curr_field = curr_field->next; + } + } + return ret; } int ezlopi_scene_then_reboot_hub(l_scenes_list_v2_t* curr_scene, void* arg) { diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.h index 761da23df..504a4f5a9 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.h @@ -46,6 +46,15 @@ typedef struct s_isdate_range_method const char* field_name; void (*field_func)(l_fields_v2_t* curr_field, struct tm* tmp_tm); } s_isdate_range_method_t; + +typedef struct s_when_function +{ + uint32_t transtion_instant; + uint32_t transition_count; + bool current_state; + bool activate_pulse_seq; /* used only in 'for_pulse_method' */ +} s_when_function_t; + //------------------------------- ezlopi_scene_when_is_date ----------------------------------------------- uint8_t isdate_type_check(e_isdate_modes_t* mode_type, struct tm* info, l_fields_v2_t* curr_field); uint8_t isdate_tm_check(e_isdate_modes_t* mode_type, struct tm* info, l_fields_v2_t* curr_field); From b4ba25f42f6209bfc2fbe91df154e3dffb54da81 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Tue, 16 Apr 2024 18:31:49 +0545 Subject: [PATCH 13/29] added isHouseModeAlarmPhaseRange --- .../ezlopi_core_scenes_method_types.h | 1 + .../ezlopi_core_scenes_when_methods.c | 35 +++++++++++++++++++ .../ezlopi_core_scenes_when_methods.h | 5 +-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_method_types.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_method_types.h index 4d6ffef94..03a0ddc03 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_method_types.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_method_types.h @@ -11,6 +11,7 @@ EZLOPI_SCENE(WHEN_METHOD_IS_DATE_RANGE, "isDateRange", ezlopi_scene_when_is_date EZLOPI_SCENE(WHEN_METHOD_IS_USER_LOCK_OPERATION, "isUserLockOperation", ezlopi_scene_when_is_user_lock_operation) EZLOPI_SCENE(WHEN_METHOD_IS_HOUSE_MODE_CHANGED_TO, "isHouseModeChangedTo", ezlopi_scene_when_is_house_mode_changed_to) EZLOPI_SCENE(WHEN_METHOD_IS_HOUSE_MODE_CHANGED_FROM, "isHouseModeChangedFrom", ezlopi_scene_when_is_house_mode_changed_from) +EZLOPI_SCENE(WHEN_METHOD_IS_HOUSE_MODE_ALARM_PHASE_RANGE, "isHouseModeAlarmPhaseRange", ezlopi_scene_when_is_House_Mode_Alarm_Phase_Range) EZLOPI_SCENE(WHEN_METHOD_IS_DEVICE_STATE, "isDeviceState", ezlopi_scene_when_is_device_state) EZLOPI_SCENE(WHEN_METHOD_IS_NETWORK_STATE, "isNetworkState", ezlopi_scene_when_is_network_state) EZLOPI_SCENE(WHEN_METHOD_IS_SCENE_STATE, "isSceneState", ezlopi_scene_when_is_scene_state) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 07b98cca0..1cf0169f8 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -443,6 +443,41 @@ int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, return 0; } +int ezlopi_scene_when_is_House_Mode_Alarm_Phase_Range(l_scenes_list_v2_t* scene_node, void* arg) +{ + //TRACE_W(" is_House_Mode_Alarm_Phase_Range "); + int ret = 0; + l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; + + if (when_block) + { + char* phase_name = NULL; + l_fields_v2_t* curr_field = when_block->fields; + + while (curr_field) + { + if (0 == strncmp(curr_field->name, ezlopi_houseMode_str, strlen(ezlopi_houseMode_str))) + { + if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type) + { + if (NULL != (phase_name = curr_field->field_value.u_value.value_string)) + { + s_ezlopi_modes_t* curr_mode = ezlopi_core_default_mode_get(); + + if (0 == strcmp(curr_mode->alarmed.type, phase_name)) + { + ret = 1; + } + } + } + } + curr_field = curr_field->next; + } + } + + return ret; +} + int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t* scene_node, void* arg) { TRACE_W(" isDevice_state. "); diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h index 54e0fe0b3..3ee5d9d1d 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h @@ -13,8 +13,9 @@ int ezlopi_scene_when_is_once(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_date_range(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_user_lock_operation(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_house_mode_changed_to(l_scenes_list_v2_t *scene_node, void *arg); -int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t *scene_node, void *arg); -int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t *scene_node, void *arg); +int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, void* arg); +int ezlopi_scene_when_is_House_Mode_Alarm_Phase_Range(l_scenes_list_v2_t* scene_node, void* arg); +int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t* scene_node, void* arg); int ezlopi_scene_when_is_network_state(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_scene_state(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_group_state(l_scenes_list_v2_t *scene_node, void *arg); From 616a33fe1eeeda999b808bcf6c88556a675dfcef Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Wed, 17 Apr 2024 15:36:36 +0545 Subject: [PATCH 14/29] added is_house_mode_switch_toRange --- .../ezlopi_core_scenes_method_types.h | 1 + .../ezlopi_core_scenes_when_methods.c | 23 +++++++++++++++++++ .../ezlopi_core_scenes_when_methods.h | 5 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_method_types.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_method_types.h index 4d6ffef94..50bc1bde1 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_method_types.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_method_types.h @@ -11,6 +11,7 @@ EZLOPI_SCENE(WHEN_METHOD_IS_DATE_RANGE, "isDateRange", ezlopi_scene_when_is_date EZLOPI_SCENE(WHEN_METHOD_IS_USER_LOCK_OPERATION, "isUserLockOperation", ezlopi_scene_when_is_user_lock_operation) EZLOPI_SCENE(WHEN_METHOD_IS_HOUSE_MODE_CHANGED_TO, "isHouseModeChangedTo", ezlopi_scene_when_is_house_mode_changed_to) EZLOPI_SCENE(WHEN_METHOD_IS_HOUSE_MODE_CHANGED_FROM, "isHouseModeChangedFrom", ezlopi_scene_when_is_house_mode_changed_from) +EZLOPI_SCENE(WHEN_METHOD_IS_HOUSE_MODE_SWTICH_TO_RANGE, "isHouseModeSwitchtoRange", ezlopi_scene_when_is_House_Mode_Switch_to_Range) EZLOPI_SCENE(WHEN_METHOD_IS_DEVICE_STATE, "isDeviceState", ezlopi_scene_when_is_device_state) EZLOPI_SCENE(WHEN_METHOD_IS_NETWORK_STATE, "isNetworkState", ezlopi_scene_when_is_network_state) EZLOPI_SCENE(WHEN_METHOD_IS_SCENE_STATE, "isSceneState", ezlopi_scene_when_is_scene_state) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 07b98cca0..f9f352700 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -443,6 +443,29 @@ int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, return 0; } +int ezlopi_scene_when_is_House_Mode_Switch_to_Range(l_scenes_list_v2_t* scene_node, void* arg) +{ + // TRACE_W(" is_House_Mode_Switch_to_Range "); + int ret = 0; + l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; + + if (when_block && scene_node) + { + s_ezlopi_modes_t* curr_mode = ezlopi_core_modes_get_custom_modes(); + if (curr_mode->alarmed.time_is_left_sec > 0) + { + TRACE_S(" Current HouseMode_phase has [%d]sec time before switch.(Duration confirmed) ", curr_mode->alarmed.time_is_left_sec); + ret = 1; + } + else + { + TRACE_E(" Current HouseMode_phase does not have duration "); + } + } + + return ret; +} + int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t* scene_node, void* arg) { TRACE_W(" isDevice_state. "); diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h index 54e0fe0b3..10f6a55ad 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h @@ -13,8 +13,9 @@ int ezlopi_scene_when_is_once(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_date_range(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_user_lock_operation(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_house_mode_changed_to(l_scenes_list_v2_t *scene_node, void *arg); -int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t *scene_node, void *arg); -int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t *scene_node, void *arg); +int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, void* arg); +int ezlopi_scene_when_is_House_Mode_Switch_to_Range(l_scenes_list_v2_t* scene_node, void* arg); +int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t* scene_node, void* arg); int ezlopi_scene_when_is_network_state(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_scene_state(l_scenes_list_v2_t *scene_node, void *arg); int ezlopi_scene_when_is_group_state(l_scenes_list_v2_t *scene_node, void *arg); From 5e7e3b2eba3f8f88ec8868b47bd5ccd0d7a1b07a Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Thu, 18 Apr 2024 18:34:55 +0545 Subject: [PATCH 15/29] adding expression evaluation in 'compare_number_method' --- ezlopi-core/ezlopi-core-scenes/CMakeLists.txt | 2 +- .../ezlopi_core_scenes_expressions.c | 23 ++- .../ezlopi_core_scenes_expressions.h | 41 +++-- .../ezlopi_core_scenes_operators.c | 169 ++++++++++++++---- .../ezlopi_core_scenes_operators.h | 3 +- .../ezlopi_core_scenes_when_methods.c | 74 ++++++-- 6 files changed, 236 insertions(+), 76 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt b/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt index e8b41b51e..6ed519756 100644 --- a/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt +++ b/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt @@ -1,6 +1,6 @@ file(GLOB_RECURSE scene_src "*.c") -idf_component_register(SRCS "ezlopi_core_scenes_then_methods.c" "ezlopi_core_scenes_status_changed.c" "ezlopi_core_scenes_notifications.c" "ezlopi_core_scenes_expressions.c" "ezlopi_core_scenes_edit.c" "ezlopi_core_scenes_cjson.c" "ezlopi_core_scenes_v2.c" "ezlopi_core_scenes_print.c" "ezlopi_core_scenes_when_methods_helper_functions.c" "ezlopi_core_scenes_then_methods_helper_func.c" "ezlopi_core_scenes_when_methods.c" "ezlopi_core_scenes_scripts.c" "${scene_src}" +idf_component_register(SRCS "ezlopi_core_scenes_operators.c" "ezlopi_core_scenes_then_methods.c" "ezlopi_core_scenes_status_changed.c" "ezlopi_core_scenes_notifications.c" "ezlopi_core_scenes_expressions.c" "ezlopi_core_scenes_edit.c" "ezlopi_core_scenes_cjson.c" "ezlopi_core_scenes_v2.c" "ezlopi_core_scenes_print.c" "ezlopi_core_scenes_when_methods_helper_functions.c" "ezlopi_core_scenes_then_methods_helper_func.c" "ezlopi_core_scenes_when_methods.c" "ezlopi_core_scenes_scripts.c" "${scene_src}" INCLUDE_DIRS "." REQUIRES core ) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_expressions.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_expressions.c index e314b7d25..f2137c950 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_expressions.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_expressions.c @@ -26,6 +26,27 @@ static void __add_expression_value(s_ezlopi_expressions_t* exp_node, cJSON* cj_e static void __add_expression_items(s_ezlopi_expressions_t* exp_node, cJSON* cj_params); static void __add_expression_device_item_names(s_ezlopi_expressions_t* exp_node, cJSON* cj_params); +s_ezlopi_expressions_t* ezlopi_scenes_get_expression_node_by_name(char* expression_name) +{ + s_ezlopi_expressions_t* curr_expr = l_expressions_head; + if (expression_name && curr_expr) + { + size_t req_name_len = strlen(expression_name); + while (curr_expr) + { + size_t exp_name_len = strlen(curr_expr->name); + size_t cmp_len = (req_name_len > exp_name_len) ? req_name_len : exp_name_len; + if (0 == strncmp(curr_expr->name, expression_name, cmp_len)) + { + break; + } + curr_expr = curr_expr->next; + } + } + return curr_expr; +} + + int ezlopi_scenes_expressions_delete_by_name(char* expression_name) { int ret = 0; @@ -92,7 +113,7 @@ void ezlopi_scenes_expressions_list_cjson(cJSON* cj_expresson_array, cJSON* cj_p snprintf(exp_id, sizeof(exp_id), "%08x", curr_exp->exp_id); cJSON_AddStringToObject(cj_expr, ezlopi__id_str, exp_id); cJSON_AddStringToObject(cj_expr, ezlopi_name_str, curr_exp->name); - + if (show_code && curr_exp->code) { cJSON_AddStringToObject(cj_expr, ezlopi_code_str, curr_exp->code); diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_expressions.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_expressions.h index 48d154aa8..095a3c3c9 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_expressions.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_expressions.h @@ -11,7 +11,7 @@ typedef struct s_exp_items { char name[48]; uint32_t _id; - struct s_exp_items *next; + struct s_exp_items* next; } s_exp_items_t; @@ -20,7 +20,7 @@ typedef struct s_exp_device_item_names char name[48]; char device_name[48]; char item_name[48]; - struct s_exp_device_item_names *next; + struct s_exp_device_item_names* next; } s_exp_device_item_names_t; @@ -37,8 +37,8 @@ typedef enum e_exp_value_type typedef union u_exp_value { - char *str_value; - cJSON *cj_value; + char* str_value; + cJSON* cj_value; bool boolean_value; double number_value; } u_exp_value_t; @@ -53,17 +53,17 @@ typedef struct s_ezlopi_expressions { uint32_t exp_id; char name[32]; - char *code; - s_exp_items_t *items; - s_exp_device_item_names_t *device_item_names; - cJSON *meta_data; // not used for now + char* code; + s_exp_items_t* items; + s_exp_device_item_names_t* device_item_names; + cJSON* meta_data; // not used for now bool variable; s_exp_value_t exp_value; e_scene_value_type_v2_t value_type; // value type returned by expression // e_exp_value_type_t exp_value_type; - struct s_ezlopi_expressions *next; + struct s_ezlopi_expressions* next; } s_ezlopi_expressions_t; @@ -80,49 +80,49 @@ void ezlopi_scenes_expressions_init(void); * @param cj_expression cJSON pointer to the expression * @return uint32_t expression id, if input 'exp_id' is zero then new expression-id is created and returned */ -uint32_t ezlopi_scenes_expressions_add_to_head(uint32_t exp_id, cJSON *cj_expression); +uint32_t ezlopi_scenes_expressions_add_to_head(uint32_t exp_id, cJSON* cj_expression); /** * @brief POP the expression from linklist * * @return s_ezlopi_expressions_t* */ -s_ezlopi_expressions_t *ezlopi_scenes_expressions_node_pop(void); +s_ezlopi_expressions_t* ezlopi_scenes_expressions_node_pop(void); /** * @brief Delete the expression-item and its childs * * @param exp_items */ -void ezlopi_scenes_expressions_delete_exp_item(s_exp_items_t *exp_items); +void ezlopi_scenes_expressions_delete_exp_item(s_exp_items_t* exp_items); /** * @brief Delete the expression-device item name and its childs * * @param exp_device_item_names */ -void ezlopi_scenes_expressions_delete_exp_device_item_names(s_exp_device_item_names_t *exp_device_item_names); +void ezlopi_scenes_expressions_delete_exp_device_item_names(s_exp_device_item_names_t* exp_device_item_names); /** * @brief construct expressions in cJSON and add it to cj_expression_array * * @param cj_expresson_array */ -void ezlopi_scenes_expressions_list_cjson(cJSON *cj_expresson_array, cJSON *cj_params); +void ezlopi_scenes_expressions_list_cjson(cJSON* cj_expresson_array, cJSON* cj_params); /** * @brief print the informations inside exp-node * * @param exp_node */ -void ezlopi_scenes_expressions_print(s_ezlopi_expressions_t *exp_node); +void ezlopi_scenes_expressions_print(s_ezlopi_expressions_t* exp_node); /** * @brief Delete all the expressions in the linked list * * @param exp_node */ -int ezlopi_scenes_expressions_delete_node(s_ezlopi_expressions_t *exp_node); +int ezlopi_scenes_expressions_delete_node(s_ezlopi_expressions_t* exp_node); /** * @brief Delete the expression by its name @@ -130,6 +130,13 @@ int ezlopi_scenes_expressions_delete_node(s_ezlopi_expressions_t *exp_node); * @param expression_name * @return int return 1 on suceess and 0 on failed */ -int ezlopi_scenes_expressions_delete_by_name(char *expression_name); +int ezlopi_scenes_expressions_delete_by_name(char* expression_name); +/** + * @brief return the desired experssion by its name + * + * @param expression_name + * @return s_ezlopi_expressions_t* + */ +s_ezlopi_expressions_t* ezlopi_scenes_get_expression_node_by_name(char* expression_name); #endif // _EZLOPI_CORE_SCENES_EXPRESSIONS_H_ diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c index 4460648f3..03effd535 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c @@ -6,6 +6,7 @@ #include "ezlopi_core_devices.h" #include "ezlopi_core_scenes_v2.h" #include "ezlopi_core_scenes_operators.h" +#include "ezlopi_core_scenes_expressions.h" #include "ezlopi_cloud_constants.h" @@ -200,6 +201,85 @@ int ezlopi_scenes_operators_value_number_operations(uint32_t item_id, l_fields_v return ret; } +int ezlopi_scenes_operators_value_expn_number_operations(char* expression_name_left, char* expression_name_right, l_fields_v2_t* comparator_field) +{ + int ret = 0; + if (expression_name_left && expression_name_right && comparator_field) + { + s_ezlopi_expressions_t* curr_expr_left = ezlopi_scenes_get_expression_node_by_name(expression_name_left); + s_ezlopi_expressions_t* curr_expr_right = ezlopi_scenes_get_expression_node_by_name(expression_name_right); + + #warning "incomplete !! ; need to call lua-script to evaluate and populate -> 'exp_value.type' for both L&R_expression"; + + if ((curr_expr_left->value_type == curr_expr_right->value_type) && + ((curr_expr_left->exp_value.type == EXPRESSION_VALUE_TYPE_NUMBER)) && + ((curr_expr_right->exp_value.type == EXPRESSION_VALUE_TYPE_NUMBER))) /* should have smae expression*/ + { + switch (ezlopi_scenes_numeric_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string)) + { + case SCENES_NUM_COMP_OPERATORS_LESS: + { + ret = (curr_expr_left->exp_value.u_value.number_value < curr_expr_right->exp_value.u_value.number_value); + break; + } + case SCENES_NUM_COMP_OPERATORS_LESS_EQUAL: + { + ret = (curr_expr_left->exp_value.u_value.number_value <= curr_expr_right->exp_value.u_value.number_value); + break; + } + case SCENES_NUM_COMP_OPERATORS_GREATER: + { + ret = (curr_expr_left->exp_value.u_value.number_value > curr_expr_right->exp_value.u_value.number_value); + break; + } + case SCENES_NUM_COMP_OPERATORS_GREATER_EQUAL: + { + ret = (curr_expr_left->exp_value.u_value.number_value >= curr_expr_right->exp_value.u_value.number_value); + break; + } + case SCENES_NUM_COMP_OPERATORS_EQUAL: + { + ret = (curr_expr_left->exp_value.u_value.number_value == curr_expr_right->exp_value.u_value.number_value); + break; + } + case SCENES_NUM_COMP_OPERATORS_NOT_EQUAL: + { + ret = (curr_expr_left->exp_value.u_value.number_value != curr_expr_right->exp_value.u_value.number_value); + break; + } + case SCENES_NUM_COMP_OPERATORS_BETWEEN: + { + TRACE_W("'SCENES_OPERATORS_BETWEEN' not implemented!"); + break; + } + case SCENES_NUM_COMP_OPERATORS_NOT_BETWEEN: + { + TRACE_W("'SCENES_OPERATORS_NOT_BETWEEN' not implemented!"); + break; + } +#if 0 + case SCENES_NUM_COMP_OPERATORS_ANY_OF: + { + TRACE_W("'SCENES_OPERATORS_ANY_OF' not implemented!"); + break; + } + case SCENES_NUM_COMP_OPERATORS_NONE_OF: + { + TRACE_W("'SCENES_OPERATORS_NONE_OF' not implemented!"); + break; + } +#endif + default: + { + break; + } + } + } + } + + return ret; +} + /************* Strings ************/ static const char* const ezlopi_scenes_str_cmp_operators_op[] = { #define SCENES_STRINGS_OPERATORS(OPERATOR, op, name, method) op, @@ -440,31 +520,16 @@ int ezlopi_scenes_operators_value_strings_operations(uint32_t item_id, l_fields_ return ret; } -#if 0 -int ezlopi_scenes_operators_value_expn_strings_operations(uint32_t expression_id, l_fields_v2_t* expression_field, l_fields_v2_t* comparator_field) +int ezlopi_scenes_operators_value_expn_strings_operations(char* expression_name_left, char* expression_name_right, l_fields_v2_t* comparator_field) { int ret = 0; - if (expression_id && expression_field && comparator_field) + if (expression_name_left && expression_name_right && comparator_field) { - size_t expression_name_len = strlen(expression_field->field_value.u_value.value_string); - char* expression_name = (expression_field->field_value.u_value.value_string); // get the expression_name - if (expression_name) { - s_ezlopi_expressions_t* curr_expr = ezlopi_scenes_expressions_get_head(); - while (curr_expr) - { - // find value representing 'item_id/expression_id' and then compare with value pointed by 'expression_field->field_value.u_value.value_string' ? + s_ezlopi_expressions_t* curr_expr_left = ezlopi_scenes_get_expression_node_by_name(expression_name_left); + s_ezlopi_expressions_t* curr_expr_right = ezlopi_scenes_get_expression_node_by_name(expression_name_right); - // size_t tmp_exp_name_len = strlen(curr_expr->name); - // size_t cmp_len = (expression_name_len > tmp_exp_name_len) ? expression_name_len : tmp_exp_name_len; - // if (STR_OP_COMPcurr_expr->name, expression_name, cmp_len)) - // { - // break; - // } - curr_expr = curr_expr->next; - } - - // + #warning "incomplete !! ; need to call lua-script to evaluate and populate -> 'exp_value.type' for both L&R_expression"; e_scene_str_cmp_operators_t string_operator = ezlopi_scenes_strings_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string); @@ -472,72 +537,99 @@ int ezlopi_scenes_operators_value_expn_strings_operations(uint32_t expression_id { case SCENES_STRINGS_OPERATORS_LESS: { - ret = (STR_OP_COMP(expression_name, < , expression_field->val); + ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, < , curr_expr_left->exp_value.u_value.str_value); break; } case SCENES_STRINGS_OPERATORS_GREATER: { - ret = (STR_OP_COMP(expression_name, > , expression_field->val); + ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, > , curr_expr_left->exp_value.u_value.str_value); break; } case SCENES_STRINGS_OPERATORS_LESS_EQUAL: { - ret = (STR_OP_COMP(expression_name, <= , expression_field->val); + ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, <= , curr_expr_left->exp_value.u_value.str_value); break; } case SCENES_STRINGS_OPERATORS_GREATER_EQUAL: { - ret = (STR_OP_COMP(expression_name, >= , expression_field->val); + ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, >= , curr_expr_left->exp_value.u_value.str_value); break; } case SCENES_STRINGS_OPERATORS_EQUAL: { - ret = (STR_OP_COMP(expression_name, == , expression_field->val); + ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, == , curr_expr_left->exp_value.u_value.str_value); break; } case SCENES_STRINGS_OPERATORS_NOT_EQUAL: { - ret = (STR_OP_COMP(expression_name, != , expression_field->val); + ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, != , curr_expr_left->exp_value.u_value.str_value); break; } case SCENES_STRINGS_OPERATORS_BEGINS_WITH: { - TRACE_W("'SCENES_STRINGS_OPERATORS_BEGINS_WITH' not implemented!"); + char* str_pos = strstr(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of first occurance + if (str_pos) + { + int diff = (str_pos - curr_expr_left->exp_value.u_value.str_value); + ret = (0 == diff) ? 1 : 0; + } break; } - case SCENES_STRINGS_OPERATORS_ENDS_WITH: + case SCENES_STRINGS_OPERATORS_NOT_BEGIN: { - TRACE_W("'SCENES_STRINGS_OPERATORS_ENDS_WITH' not implemented!"); + char* str_pos = strstr(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of first occurance + if (str_pos) + { + int diff = (str_pos - curr_expr_left->exp_value.u_value.str_value); + ret = (0 < diff) ? 1 : 0; + } break; } case SCENES_STRINGS_OPERATORS_CONTAINS: { - TRACE_W("'SCENES_STRINGS_OPERATORS_CONTAINS' not implemented!"); + char* str_pos = strstr(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of first occurance + if (str_pos) + { + int diff = (str_pos - curr_expr_left->exp_value.u_value.str_value); + ret = (diff <= 0) ? 1 : 0; + } break; } - case SCENES_STRINGS_OPERATORS_NOT_BEGIN: + case SCENES_STRINGS_OPERATORS_NOT_CONTAIN: { - TRACE_W("'SCENES_STRINGS_OPERATORS_NOT_BEGIN' not implemented!"); + char* str_pos = strstr(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of first occurance + if (NULL == str_pos) + { + ret = 1; + } break; } - case SCENES_STRINGS_OPERATORS_NOT_END: + case SCENES_STRINGS_OPERATORS_ENDS_WITH: { - TRACE_W("'SCENES_STRINGS_OPERATORS_NOT_END' not implemented!"); + char* last = ezlopi_scenes_laststr_comp(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of last occurance + if (NULL != last) + { + ret = (strlen(curr_expr_left->exp_value.u_value.str_value) == strlen(last)) ? 1 : 0; + } break; } - case SCENES_STRINGS_OPERATORS_NOT_CONTAIN: + case SCENES_STRINGS_OPERATORS_NOT_END: { - TRACE_W("'SCENES_STRINGS_OPERATORS_NOT_CONTAIN' not implemented!"); + char* last = ezlopi_scenes_laststr_comp(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of last occurance + if (NULL != last) + { + ret = (strlen(curr_expr_left->exp_value.u_value.str_value) != strlen(last)) ? 1 : 0; + } break; } case SCENES_STRINGS_OPERATORS_LENGTH: { - TRACE_W("'SCENES_STRINGS_OPERATORS_LENGTH' not implemented!"); // int comparision + ret = (value_field->field_value.u_value.value_double == strlen(curr_expr_left->exp_value.u_value.str_value)); // int value comparision break; } case SCENES_STRINGS_OPERATORS_NOT_LENGTH: { - TRACE_W("'SCENES_STRINGS_OPERATORS_NOT_LENGTH' not implemented!"); // int comparision + ret = (value_field->field_value.u_value.value_double != strlen(curr_expr_left->exp_value.u_value.str_value)); // int value comparision break; } default: @@ -551,7 +643,6 @@ int ezlopi_scenes_operators_value_expn_strings_operations(uint32_t expression_id return ret; } -#endif /************* Values in_array ************/ static const char* const ezlopi_scenes_inarr_cmp_operators_op[] = { diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h index 2c222c89c..297a18427 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h @@ -49,6 +49,7 @@ const char* ezlopi_scenes_numeric_comparator_operators_get_method(e_scene_num_cm double ezlopi_core_scenes_operator_get_item_double_value_current(uint32_t item_id); int ezlopi_scenes_operators_value_number_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); +int ezlopi_scenes_operators_value_expn_number_operations(char* expression_name_left, char* expression_name_right, l_fields_v2_t* comparator_field); // Strings Operators e_scene_str_cmp_operators_t ezlopi_scenes_strings_comparator_operators_get_enum(char* operator_str); @@ -57,7 +58,7 @@ const char* ezlopi_scenes_strings_comparator_operators_get_name(e_scene_str_cmp_ const char* ezlopi_scenes_strings_comparator_operators_get_method(e_scene_str_cmp_operators_t operator); int ezlopi_scenes_operators_value_strings_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); -// int ezlopi_scenes_operators_value_expn_strings_operations(uint32_t item_id, l_fields_v2_t *value_field, l_fields_v2_t *comparator_field); +int ezlopi_scenes_operators_value_expn_strings_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); // InArray Operators e_scene_inarr_cmp_operators_t ezlopi_scenes_inarr_comparator_operators_get_enum(char* operator_inarr); diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 07b98cca0..fb6cf8b0d 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -658,24 +658,40 @@ int ezlopi_scene_when_compare_numbers(l_scenes_list_v2_t* scene_node, void* arg) if (when_block && scene_node) { uint32_t item_id = 0; + char* expression_name = 0; l_fields_v2_t* value_field = NULL; l_fields_v2_t* comparator_field = NULL; + l_fields_v2_t* expression_field = NULL; l_fields_v2_t* curr_field = when_block->fields; while (curr_field) { - if (0 == strncmp(curr_field->name, ezlopi_item_str, strlen(ezlopi_item_str))) + if (0 == strncmp(curr_field->name, ezlopi_item_str, 5)) { item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); } - else if (0 == strncmp(curr_field->name, ezlopi_value_str, strlen(ezlopi_value_str))) + else if (0 == strncmp(curr_field->name, "expression", 11)) { - value_field = curr_field; + if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) + { + expression_name = curr_field->field_value.u_value.value_string; // expression_name + } } - else if (0 == strncmp(curr_field->name, ezlopi_comparator_str, strlen(ezlopi_comparator_str))) + else if (0 == strncmp(curr_field->name, ezlopi_comparator_str, 11)) { comparator_field = curr_field; } + else if (0 == strncmp(curr_field->name, ezlopi_value_str, 6)) + { + if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type && (NULL != curr_field->field_value.u_value.value_string)) + { + value_field = curr_field; + } + else if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != curr_field->field_value.u_value.value_string)) + { + expression_field = curr_field; // this field has expression_name + } + } curr_field = curr_field->next; } @@ -683,6 +699,14 @@ int ezlopi_scene_when_compare_numbers(l_scenes_list_v2_t* scene_node, void* arg) { ret = ezlopi_scenes_operators_value_number_operations(item_id, value_field, comparator_field); } + else if (item_id && expression_field && comparator_field) + { + ret = ezlopi_scenes_operators_value_number_operations(item_id, expression_field, comparator_field); + } + else if (expression_name && expression_field && comparator_field) // only for expression 'string comparisions' + { + ret = ezlopi_scenes_operators_value_expn_strings_operations(expression_name, value_field, comparator_field); + } } return ret; @@ -746,21 +770,30 @@ int ezlopi_scene_when_compare_strings(l_scenes_list_v2_t* scene_node, void* arg) if (when_block && scene_node) { uint32_t item_id = 0; - // l_fields_v2_t *expression_field = NULL; + char* expression_name = NULL; + + l_fields_v2_t* expression_field = NULL; l_fields_v2_t* value_field = NULL; l_fields_v2_t* comparator_field = NULL; l_fields_v2_t* curr_field = when_block->fields; while (curr_field) { - if (0 == strncmp(curr_field->name, "item", 5)) + if (0 == strncmp(curr_field->name, ezlopi_item_str, 5)) { if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); // item or expression_id } } - else if (0 == strncmp(curr_field->name, "comparator", 11)) + else if (0 == strncmp(curr_field->name, "expression", 11)) + { + if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) + { + expression_name = curr_field->field_value.u_value.value_string; // expression_name + } + } + else if (0 == strncmp(curr_field->name, ezlopi_comparator_str, 11)) { if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { @@ -769,26 +802,33 @@ int ezlopi_scene_when_compare_strings(l_scenes_list_v2_t* scene_node, void* arg) } else if (0 == strncmp(curr_field->name, ezlopi_value_str, 6)) { - if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type && NULL != curr_field->field_value.u_value.value_string) + if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type && (NULL != curr_field->field_value.u_value.value_string)) { value_field = curr_field; // this field has string } - // else if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && NULL != curr_field->value.value_string) - // { - // expression_field = curr_field; // this field has expression_name - // } + else if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != curr_field->field_value.u_value.value_string)) + { + expression_field = curr_field; // this field has expression_name + } } curr_field = curr_field->next; } - if (item_id && value_field && comparator_field) // only for item_value 'string comparisions' + if (item_id && value_field && comparator_field) // only for item_id vs item_value 'string comparisions' { ret = ezlopi_scenes_operators_value_strings_operations(item_id, value_field, comparator_field); } - // else if (item_id && expression_field && comparator_field) // only for expression 'string comparisions' - // { - // // ret = ezlopi_scenes_operators_value_expn_strings_operations(item_id, value_field, comparator_field); - // } + else if (item_id && expression_field && comparator_field) // only for item_id vs expression 'string comparisions' + { + #warning "need to add different function"; + ret = ezlopi_scenes_operators_value_strings_operations(item_id, expression_field, comparator_field); + } + else if (expression_name && expression_field && comparator_field) // only for expression_name vs expression 'string comparisions' + { + ret = ezlopi_scenes_operators_value_expn_strings_operations(value_field, expression_field, comparator_field); + } + + } // #endif return ret; From 3a57b397a2c309e4dbd0994c53d2035f340460c3 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Fri, 19 Apr 2024 17:38:40 +0545 Subject: [PATCH 16/29] refactoring compare_number,compare_num_range,strings,string_opr,inArray --- .../__numeric_comparision_operators_macros.h | 5 +- ...__string_op_comparision_operators_macros.h | 12 + .../__strings_comparision_operators_macros.h | 9 - .../ezlopi_core_scenes_operators.c | 583 +++++++----------- .../ezlopi_core_scenes_operators.h | 32 +- .../ezlopi_core_scenes_when_methods.c | 169 ++--- .../ezlopi_service_meshbot.c | 4 +- 7 files changed, 381 insertions(+), 433 deletions(-) create mode 100644 ezlopi-core/ezlopi-core-scenes/__operators_macros/__string_op_comparision_operators_macros.h diff --git a/ezlopi-core/ezlopi-core-scenes/__operators_macros/__numeric_comparision_operators_macros.h b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__numeric_comparision_operators_macros.h index 4467b4894..a663e79ad 100755 --- a/ezlopi-core/ezlopi-core-scenes/__operators_macros/__numeric_comparision_operators_macros.h +++ b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__numeric_comparision_operators_macros.h @@ -6,8 +6,9 @@ SCENES_NUM_COMP_OPERATORS(LESS_EQUAL, "<=", "less equal", "compareNumbers") SCENES_NUM_COMP_OPERATORS(GREATER_EQUAL, ">=", "greater equal", "compareNumbers") SCENES_NUM_COMP_OPERATORS(EQUAL, "==", "equal", "compareNumbers") SCENES_NUM_COMP_OPERATORS(NOT_EQUAL, "!=", "not equal", "compareNumbers") -SCENES_NUM_COMP_OPERATORS(BETWEEN, "between", "between", "compareNumberRange") -SCENES_NUM_COMP_OPERATORS(NOT_BETWEEN, "not_between", "not between", "compareNumberRange") + +// SCENES_NUM_COMP_OPERATORS(BETWEEN, "between", "between", "compareNumberRange") +// SCENES_NUM_COMP_OPERATORS(NOT_BETWEEN, "not_between", "not between", "compareNumberRange") // SCENES_NUM_COMP_OPERATORS(ANY_OF, "any_of", "any of", "numbersArray") // SCENES_NUM_COMP_OPERATORS(NONE_OF, "none_of", "none of", "numbersArray") ////////////////////////////////////////////////////////////////////////////// diff --git a/ezlopi-core/ezlopi-core-scenes/__operators_macros/__string_op_comparision_operators_macros.h b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__string_op_comparision_operators_macros.h new file mode 100644 index 000000000..a0459343d --- /dev/null +++ b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__string_op_comparision_operators_macros.h @@ -0,0 +1,12 @@ +SCENES_STRING_OP_COMP_OPERATORES(NONE, NULL, NULL, NULL) +////////////////////////////////////////////////////////////////////////////// +SCENES_STRING_OP_COMP_OPERATORES(BEGINS_WITH, "begin", "begins with", "stringOperation") +SCENES_STRING_OP_COMP_OPERATORES(ENDS_WITH, "end", "ends with", "stringOperation") +SCENES_STRING_OP_COMP_OPERATORES(CONTAINS, "contain", "contains", "stringOperation") +SCENES_STRING_OP_COMP_OPERATORES(LENGTH, "length", "length equal to", "stringOperation") +SCENES_STRING_OP_COMP_OPERATORES(NOT_BEGIN, "not_begin", "doesn't begin with", "stringOperation") +SCENES_STRING_OP_COMP_OPERATORES(NOT_END, "not_end", "doesn't end with", "stringOperation") +SCENES_STRING_OP_COMP_OPERATORES(NOT_CONTAIN, "not_contain", "doesn't contain", "stringOperation") +SCENES_STRING_OP_COMP_OPERATORES(NOT_LENGTH, "not_length", "length not equal to", "stringOperation") +////////////////////////////////////////////////////////////////////////////// +SCENES_STRING_OP_COMP_OPERATORES(MAX, NULL, NULL, NULL) \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-scenes/__operators_macros/__strings_comparision_operators_macros.h b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__strings_comparision_operators_macros.h index c8e4a7aa6..cbf984c2f 100644 --- a/ezlopi-core/ezlopi-core-scenes/__operators_macros/__strings_comparision_operators_macros.h +++ b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__strings_comparision_operators_macros.h @@ -6,14 +6,5 @@ SCENES_STRINGS_OPERATORS(LESS_EQUAL, "<=", "less equal", "compareStrings") SCENES_STRINGS_OPERATORS(GREATER_EQUAL, ">=", "greater equal", "compareStrings") SCENES_STRINGS_OPERATORS(EQUAL, "==", "equal", "compareStrings") SCENES_STRINGS_OPERATORS(NOT_EQUAL, "!=", "not equal", "compareStrings") - -SCENES_STRINGS_OPERATORS(BEGINS_WITH, "begin", "begins with", "stringOperation") -SCENES_STRINGS_OPERATORS(ENDS_WITH, "end", "ends with", "stringOperation") -SCENES_STRINGS_OPERATORS(CONTAINS, "contain", "contains", "stringOperation") -SCENES_STRINGS_OPERATORS(LENGTH, "length", "length equal to", "stringOperation") -SCENES_STRINGS_OPERATORS(NOT_BEGIN, "not_begin", "doesn't begin with", "stringOperation") -SCENES_STRINGS_OPERATORS(NOT_END, "not_end", "doesn't end with", "stringOperation") -SCENES_STRINGS_OPERATORS(NOT_CONTAIN, "not_contain", "doesn't contain", "stringOperation") -SCENES_STRINGS_OPERATORS(NOT_LENGTH, "not_length", "length not equal to", "stringOperation") ////////////////////////////////////////////////////////////////////////////// SCENES_STRINGS_OPERATORS(MAX, NULL, NULL, NULL) \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c index 03effd535..c8aea8496 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c @@ -130,123 +130,73 @@ double ezlopi_core_scenes_operator_get_item_double_value_current(uint32_t item_i return item_value; } -int ezlopi_scenes_operators_value_number_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field) +int ezlopi_scenes_operators_value_number_operations(l_fields_v2_t* item_exp_field, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field) { int ret = 0; - if (item_id && value_field && comparator_field) + if (item_exp_field && value_field && comparator_field) { - double item_value = ezlopi_core_scenes_operator_get_item_double_value_current(item_id); - switch (ezlopi_scenes_numeric_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string)) - { - case SCENES_NUM_COMP_OPERATORS_LESS: - { - ret = (item_value < value_field->field_value.u_value.value_double); - break; - } - case SCENES_NUM_COMP_OPERATORS_LESS_EQUAL: - { - ret = (item_value <= value_field->field_value.u_value.value_double); - break; - } - case SCENES_NUM_COMP_OPERATORS_GREATER: - { - ret = (item_value > value_field->field_value.u_value.value_double); - break; - } - case SCENES_NUM_COMP_OPERATORS_GREATER_EQUAL: + double item_exp_value = 0; + double value_to_compare_with = 0; + //---------------------- LHS ------------------------- + if (EZLOPI_VALUE_TYPE_EXPRESSION == item_exp_field->value_type) { - ret = (item_value >= value_field->field_value.u_value.value_double); - break; - } - case SCENES_NUM_COMP_OPERATORS_EQUAL: - { - ret = (item_value == value_field->field_value.u_value.value_double); - break; + s_ezlopi_expressions_t* curr_expr_left = ezlopi_scenes_get_expression_node_by_name(item_exp_field->field_value.u_value.value_string); + #warning "extract the double from expression"; + item_exp_value = 0; } - case SCENES_NUM_COMP_OPERATORS_NOT_EQUAL: + else { - ret = (item_value != value_field->field_value.u_value.value_double); - break; + uint32_t item_id = strtoul(item_exp_field->field_value.u_value.value_string, NULL, 16); + item_exp_value = ezlopi_core_scenes_operator_get_item_double_value_current(item_id); } - case SCENES_NUM_COMP_OPERATORS_BETWEEN: + //---------------------- RHS ------------------------- + if (EZLOPI_VALUE_TYPE_EXPRESSION == value_field->value_type) { - TRACE_W("'SCENES_OPERATORS_BETWEEN' not implemented!"); - break; + s_ezlopi_expressions_t* curr_expr_right = ezlopi_scenes_get_expression_node_by_name(value_field->field_value.u_value.value_string); + #warning "extract the double from expression"; + value_to_compare_with = 0; } - case SCENES_NUM_COMP_OPERATORS_NOT_BETWEEN: + else { - TRACE_W("'SCENES_OPERATORS_NOT_BETWEEN' not implemented!"); - break; + value_to_compare_with = value_field->field_value.u_value.value_double; } -#if 0 - case SCENES_NUM_COMP_OPERATORS_ANY_OF: - { - TRACE_W("'SCENES_OPERATORS_ANY_OF' not implemented!"); - break; - } - case SCENES_NUM_COMP_OPERATORS_NONE_OF: - { - TRACE_W("'SCENES_OPERATORS_NONE_OF' not implemented!"); - break; - } -#endif - default: - { - break; - } - } - } - - return ret; -} - -int ezlopi_scenes_operators_value_expn_number_operations(char* expression_name_left, char* expression_name_right, l_fields_v2_t* comparator_field) -{ - int ret = 0; - if (expression_name_left && expression_name_right && comparator_field) - { - s_ezlopi_expressions_t* curr_expr_left = ezlopi_scenes_get_expression_node_by_name(expression_name_left); - s_ezlopi_expressions_t* curr_expr_right = ezlopi_scenes_get_expression_node_by_name(expression_name_right); - - #warning "incomplete !! ; need to call lua-script to evaluate and populate -> 'exp_value.type' for both L&R_expression"; - - if ((curr_expr_left->value_type == curr_expr_right->value_type) && - ((curr_expr_left->exp_value.type == EXPRESSION_VALUE_TYPE_NUMBER)) && - ((curr_expr_right->exp_value.type == EXPRESSION_VALUE_TYPE_NUMBER))) /* should have smae expression*/ + //---------------------------------------------------- + if (item_exp_value && value_to_compare_with) { switch (ezlopi_scenes_numeric_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string)) { case SCENES_NUM_COMP_OPERATORS_LESS: { - ret = (curr_expr_left->exp_value.u_value.number_value < curr_expr_right->exp_value.u_value.number_value); + ret = (item_exp_value < value_to_compare_with); break; } case SCENES_NUM_COMP_OPERATORS_LESS_EQUAL: { - ret = (curr_expr_left->exp_value.u_value.number_value <= curr_expr_right->exp_value.u_value.number_value); + ret = (item_exp_value <= value_to_compare_with); break; } case SCENES_NUM_COMP_OPERATORS_GREATER: { - ret = (curr_expr_left->exp_value.u_value.number_value > curr_expr_right->exp_value.u_value.number_value); + ret = (item_exp_value > value_to_compare_with); break; } case SCENES_NUM_COMP_OPERATORS_GREATER_EQUAL: { - ret = (curr_expr_left->exp_value.u_value.number_value >= curr_expr_right->exp_value.u_value.number_value); + ret = (item_exp_value >= value_to_compare_with); break; } case SCENES_NUM_COMP_OPERATORS_EQUAL: { - ret = (curr_expr_left->exp_value.u_value.number_value == curr_expr_right->exp_value.u_value.number_value); + ret = (item_exp_value == value_to_compare_with); break; } case SCENES_NUM_COMP_OPERATORS_NOT_EQUAL: { - ret = (curr_expr_left->exp_value.u_value.number_value != curr_expr_right->exp_value.u_value.number_value); + ret = (item_exp_value != value_to_compare_with); break; } +#if 0 case SCENES_NUM_COMP_OPERATORS_BETWEEN: { TRACE_W("'SCENES_OPERATORS_BETWEEN' not implemented!"); @@ -257,7 +207,6 @@ int ezlopi_scenes_operators_value_expn_number_operations(char* expression_name_l TRACE_W("'SCENES_OPERATORS_NOT_BETWEEN' not implemented!"); break; } -#if 0 case SCENES_NUM_COMP_OPERATORS_ANY_OF: { TRACE_W("'SCENES_OPERATORS_ANY_OF' not implemented!"); @@ -348,155 +297,106 @@ const char* ezlopi_scenes_strings_comparator_operators_get_method(e_scene_str_cm return ret; } -static char* ezlopi_scenes_laststr_comp(const char* haystack, const char* needle) +char* ezlopi_core_scenes_operator_get_item_string_value_current_by_id(uint32_t item_id) { - char* loc = NULL; - char* found = NULL; - size_t pos = 0; - while ((found = strstr(haystack + pos, needle)) != 0) - { - loc = found; - pos = (found - haystack) + 1; - } - return loc; -} - -int ezlopi_scenes_operators_value_strings_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field) -{ - int ret = 0; - if (item_id && value_field && comparator_field) + char* item_value = NULL; + l_ezlopi_device_t* device = ezlopi_device_get_head(); + while (device) { - char* item_value = NULL; - // int item_value_size = 0; - cJSON* cj_item_value = cJSON_CreateObject(); - l_ezlopi_device_t* device = ezlopi_device_get_head(); - while (device) + l_ezlopi_item_t* item = device->items; + while (item) { - l_ezlopi_item_t* item = device->items; - while (item) + if (item->cloud_properties.item_id == item_id) { - if (item->cloud_properties.item_id == item_id) + cJSON* cj_item_value = cJSON_CreateObject(); + if (cj_item_value) { - if (cj_item_value) + item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); + cJSON* cj_value = cJSON_GetObjectItem(cj_item_value, ezlopi_value_str); + if (cj_value) { - item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); - cJSON* cj_value = cJSON_GetObjectItem(cj_item_value, ezlopi_value_str); - if (cj_value) + if (cJSON_IsString(cj_value)) { - if (cJSON_IsString(cj_value)) - { - item_value = cJSON_GetStringValue(cj_value); - } + item_value = cJSON_GetStringValue(cj_value); } } - - break; + cJSON_Delete(cj_item_value); } - item = item->next; + break; } - device = device->next; + item = item->next; } + device = device->next; + } + return item_value; +} - if (NULL != item_value) +int ezlopi_scenes_operators_value_strings_operations(l_fields_v2_t* item_exp_field, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field) +{ + int ret = 0; + if (item_exp_field && value_field && comparator_field) + { + char* item_exp_value_str = NULL; + char* value_to_compare_with = NULL; + + //---------------------- LHS ------------------------- + if (EZLOPI_VALUE_TYPE_EXPRESSION == item_exp_field->value_type) + { + s_ezlopi_expressions_t* curr_expr_left = ezlopi_scenes_get_expression_node_by_name(item_exp_field->field_value.u_value.value_string); + #warning "extract the 'string' from expression"; + item_exp_value_str = NULL; + } + else + { + uint32_t item_id = strtoul(item_exp_field->field_value.u_value.value_string, NULL, 16); + item_exp_value_str = ezlopi_core_scenes_operator_get_item_string_value_current_by_id(item_id); + } + //---------------------- RHS ------------------------- + if (EZLOPI_VALUE_TYPE_EXPRESSION == value_field->value_type) + { + s_ezlopi_expressions_t* curr_expr_right = ezlopi_scenes_get_expression_node_by_name(value_field->field_value.u_value.value_string); + #warning "extract the 'string' from expression"; + value_to_compare_with = NULL; + } + else + { + value_to_compare_with = value_field->field_value.u_value.value_string; + } + //---------------------------------------------------- + + if (item_exp_value_str && value_to_compare_with) { e_scene_str_cmp_operators_t string_operator = ezlopi_scenes_strings_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string); switch (string_operator) { case SCENES_STRINGS_OPERATORS_LESS: { - ret = STR_OP_COMP(item_value, < , value_field->field_value.u_value.value_string); + ret = STR_OP_COMP(item_exp_value_str, < , value_to_compare_with); break; } case SCENES_STRINGS_OPERATORS_GREATER: { - ret = STR_OP_COMP(item_value, > , value_field->field_value.u_value.value_string); + ret = STR_OP_COMP(item_exp_value_str, > , value_to_compare_with); break; } case SCENES_STRINGS_OPERATORS_LESS_EQUAL: { - ret = STR_OP_COMP(item_value, <= , value_field->field_value.u_value.value_string); + ret = STR_OP_COMP(item_exp_value_str, <= , value_to_compare_with); break; } case SCENES_STRINGS_OPERATORS_GREATER_EQUAL: { - ret = STR_OP_COMP(item_value, >= , value_field->field_value.u_value.value_string); + ret = STR_OP_COMP(item_exp_value_str, >= , value_to_compare_with); break; } case SCENES_STRINGS_OPERATORS_EQUAL: { - ret = STR_OP_COMP(item_value, == , value_field->field_value.u_value.value_string); + ret = STR_OP_COMP(item_exp_value_str, == , value_to_compare_with); break; } case SCENES_STRINGS_OPERATORS_NOT_EQUAL: { - ret = STR_OP_COMP(item_value, != , value_field->field_value.u_value.value_string); - break; - } - case SCENES_STRINGS_OPERATORS_BEGINS_WITH: - { - char* str_pos = strstr(item_value, value_field->field_value.u_value.value_string); // finds out the position of first occurance - if (str_pos) - { - int diff = (str_pos - item_value); - ret = (0 == diff) ? 1 : 0; - } - break; - } - case SCENES_STRINGS_OPERATORS_NOT_BEGIN: - { - char* str_pos = strstr(item_value, value_field->field_value.u_value.value_string); // finds out the position of first occurance - if (str_pos) - { - int diff = (str_pos - item_value); - ret = (0 < diff) ? 1 : 0; - } - break; - } - case SCENES_STRINGS_OPERATORS_CONTAINS: - { - char* str_pos = strstr(item_value, value_field->field_value.u_value.value_string); // finds out the position of first occurance - if (str_pos) - { - int diff = (str_pos - item_value); - ret = (diff <= 0) ? 1 : 0; - } - break; - } - case SCENES_STRINGS_OPERATORS_NOT_CONTAIN: - { - char* str_pos = strstr(item_value, value_field->field_value.u_value.value_string); // finds out the position of first occurance - if (NULL == str_pos) - { - ret = 1; - } - break; - } - case SCENES_STRINGS_OPERATORS_ENDS_WITH: - { - char* last = ezlopi_scenes_laststr_comp(item_value, value_field->field_value.u_value.value_string); // finds out the position of last occurance - if (NULL != last) - { - ret = (strlen(value_field->field_value.u_value.value_string) == strlen(last)) ? 1 : 0; - } - break; - } - case SCENES_STRINGS_OPERATORS_NOT_END: - { - char* last = ezlopi_scenes_laststr_comp(item_value, value_field->field_value.u_value.value_string); // finds out the position of last occurance - if (NULL != last) - { - ret = (strlen(value_field->field_value.u_value.value_string) != strlen(last)) ? 1 : 0; - } - break; - } - case SCENES_STRINGS_OPERATORS_LENGTH: - { - ret = (value_field->field_value.u_value.value_double == strlen(item_value)); // int value comparision - break; - } - case SCENES_STRINGS_OPERATORS_NOT_LENGTH: - { - ret = (value_field->field_value.u_value.value_double != strlen(item_value)); // int value comparision + ret = STR_OP_COMP(item_exp_value_str, != , value_to_compare_with); break; } default: @@ -507,143 +407,213 @@ int ezlopi_scenes_operators_value_strings_operations(uint32_t item_id, l_fields_ } } - if (cj_item_value) + + } + + return ret; +} + +/************* String_operations ************/ +static const char* const ezlopi_scenes_strops_cmp_operators_op[] = { +#define SCENES_STRING_OP_COMP_OPERATORES(OPERATOR, op, name, method) op, +#include "__operators_macros/__string_op_comparision_operators_macros.h" +#undef SCENES_STRING_OP_COMP_OPERATORES +}; + +static const char* const ezlopi_scenes_strops_cmp_operators_name[] = { +#define SCENES_STRING_OP_COMP_OPERATORES(OPERATOR, op, name, method) name, +#include "__operators_macros/__string_op_comparision_operators_macros.h" +#undef SCENES_STRING_OP_COMP_OPERATORES +}; + +static const char* const ezlopi_scenes_strops_cmp_operators_method[] = { +#define SCENES_STRING_OP_COMP_OPERATORES(OPERATOR, op, name, method) method, +#include "__operators_macros/__string_op_comparision_operators_macros.h" +#undef SCENES_STRING_OP_COMP_OPERATORES +}; + +e_scene_strops_cmp_operators_t ezlopi_scenes_strops_comparator_operators_get_enum(char* operator_str) +{ + e_scene_strops_cmp_operators_t ret = SCENES_STRING_OP_COMP_OPERATORES_NONE + 1; + if (operator_str) + { + while ((ret <= SCENES_STRING_OP_COMP_OPERATORES_MAX) && ezlopi_scenes_strops_cmp_operators_op[ret]) { - if (item_value) + if (0 == strcmp(ezlopi_scenes_strops_cmp_operators_op[ret], operator_str)) { - free(item_value); + break; } - cJSON_Delete(cj_item_value); + + ret++; } } + return ret; +} +const char* ezlopi_scenes_strops_comparator_operators_get_op(e_scene_strops_cmp_operators_t operator) +{ + const char* ret = NULL; + if ((operator>= SCENES_STRING_OP_COMP_OPERATORES_NONE) && (operator SCENES_STRING_OP_COMP_OPERATORES_NONE) && (operator SCENES_STRING_OP_COMP_OPERATORES_NONE) && (operator 'exp_value.type' for both L&R_expression"; + //---------------------- LHS ------------------------- + if (EZLOPI_VALUE_TYPE_EXPRESSION == item_exp_field->value_type) + { + s_ezlopi_expressions_t* curr_expr_left = ezlopi_scenes_get_expression_node_by_name(item_exp_field->field_value.u_value.value_string); + #warning "extract the 'string' from expression"; + item_exp_value_str = NULL; + } + else + { + uint32_t item_id = strtoul(item_exp_field->field_value.u_value.value_string, NULL, 16); + item_exp_value_str = ezlopi_core_scenes_operator_get_item_string_value_current_by_id(item_id); + } + //---------------------- RHS ------------------------- - e_scene_str_cmp_operators_t string_operator = ezlopi_scenes_strings_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string); + if (EZLOPI_VALUE_TYPE_STRING == value_field->value_type) + { + value_to_compare_with = value_field->field_value.u_value.value_string; + } + else if (EZLOPI_VALUE_TYPE_INT == value_field->value_type) + { + value_to_compare_with_num = value_field->field_value.u_value.value_double; + } + //---------------------------------------------------- + if (item_exp_value_str && (value_to_compare_with || (value_to_compare_with_num > 0))) + { + e_scene_str_cmp_operators_t string_operator = ezlopi_scenes_string_operations_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string); switch (string_operator) { - case SCENES_STRINGS_OPERATORS_LESS: - { - ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, < , curr_expr_left->exp_value.u_value.str_value); - break; - } - case SCENES_STRINGS_OPERATORS_GREATER: - { - ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, > , curr_expr_left->exp_value.u_value.str_value); - break; - } - case SCENES_STRINGS_OPERATORS_LESS_EQUAL: - { - ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, <= , curr_expr_left->exp_value.u_value.str_value); - break; - } - case SCENES_STRINGS_OPERATORS_GREATER_EQUAL: - { - ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, >= , curr_expr_left->exp_value.u_value.str_value); - break; - } - case SCENES_STRINGS_OPERATORS_EQUAL: - { - ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, == , curr_expr_left->exp_value.u_value.str_value); - break; - } - case SCENES_STRINGS_OPERATORS_NOT_EQUAL: - { - ret = STR_OP_COMP(curr_expr_left->exp_value.u_value.str_value, != , curr_expr_left->exp_value.u_value.str_value); - break; - } - case SCENES_STRINGS_OPERATORS_BEGINS_WITH: + + case SCENES_STRING_OP_COMP_OPERATORES_BEGINS_WITH: { - char* str_pos = strstr(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of first occurance + char* str_pos = strstr(item_exp_value_str, value_to_compare_with); // finds out the position of first occurance if (str_pos) { - int diff = (str_pos - curr_expr_left->exp_value.u_value.str_value); + int diff = (str_pos - item_exp_value_str); ret = (0 == diff) ? 1 : 0; } break; } - case SCENES_STRINGS_OPERATORS_NOT_BEGIN: + case SCENES_STRING_OP_COMP_OPERATORES_NOT_BEGIN: { - char* str_pos = strstr(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of first occurance + char* str_pos = strstr(item_exp_value_str, value_to_compare_with); // finds out the position of first occurance if (str_pos) { - int diff = (str_pos - curr_expr_left->exp_value.u_value.str_value); + int diff = (str_pos - item_exp_value_str); ret = (0 < diff) ? 1 : 0; } break; } - case SCENES_STRINGS_OPERATORS_CONTAINS: + case SCENES_STRING_OP_COMP_OPERATORES_CONTAINS: { - char* str_pos = strstr(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of first occurance + char* str_pos = strstr(item_exp_value_str, value_to_compare_with); // finds out the position of first occurance if (str_pos) { - int diff = (str_pos - curr_expr_left->exp_value.u_value.str_value); + int diff = (str_pos - item_exp_value_str); ret = (diff <= 0) ? 1 : 0; } break; } - case SCENES_STRINGS_OPERATORS_NOT_CONTAIN: + case SCENES_STRING_OP_COMP_OPERATORES_NOT_CONTAIN: { - char* str_pos = strstr(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of first occurance + char* str_pos = strstr(item_exp_value_str, value_to_compare_with); // finds out the position of first occurance if (NULL == str_pos) { ret = 1; } break; } - case SCENES_STRINGS_OPERATORS_ENDS_WITH: + case SCENES_STRING_OP_COMP_OPERATORES_ENDS_WITH: { - char* last = ezlopi_scenes_laststr_comp(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of last occurance + char* last = ezlopi_scenes_laststr_comp(item_exp_value_str, value_to_compare_with); // finds out the position of last occurance if (NULL != last) { - ret = (strlen(curr_expr_left->exp_value.u_value.str_value) == strlen(last)) ? 1 : 0; + ret = (strlen(value_to_compare_with) == strlen(last)) ? 1 : 0; } break; } - case SCENES_STRINGS_OPERATORS_NOT_END: + case SCENES_STRING_OP_COMP_OPERATORES_NOT_END: { - char* last = ezlopi_scenes_laststr_comp(curr_expr_left->exp_value.u_value.str_value, curr_expr_left->exp_value.u_value.str_value); // finds out the position of last occurance + char* last = ezlopi_scenes_laststr_comp(item_exp_value_str, value_to_compare_with); // finds out the position of last occurance if (NULL != last) { - ret = (strlen(curr_expr_left->exp_value.u_value.str_value) != strlen(last)) ? 1 : 0; + ret = (strlen(value_to_compare_with) != strlen(last)) ? 1 : 0; } break; } - case SCENES_STRINGS_OPERATORS_LENGTH: + case SCENES_STRING_OP_COMP_OPERATORES_LENGTH: { - ret = (value_field->field_value.u_value.value_double == strlen(curr_expr_left->exp_value.u_value.str_value)); // int value comparision + ret = (value_to_compare_with_num == strlen(item_exp_value_str)); // int value comparision break; } - case SCENES_STRINGS_OPERATORS_NOT_LENGTH: + case SCENES_STRING_OP_COMP_OPERATORES_NOT_LENGTH: { - ret = (value_field->field_value.u_value.value_double != strlen(curr_expr_left->exp_value.u_value.str_value)); // int value comparision + ret = (value_to_compare_with_num != strlen(item_exp_value_str)); // int value comparision break; } default: { - TRACE_E("'SCENES_STRINGS_OPERATORS_* [%d]' out of range!", string_operator); + TRACE_E("'SCENES_STRING_OP_COMP_OPERATORES_* [%d]' out of range!", string_operator); break; } } } + + } return ret; } + /************* Values in_array ************/ static const char* const ezlopi_scenes_inarr_cmp_operators_op[] = { #define SCENES_IN_ARRAY_OPERATORS(OPERATOR, op, name, method) op, @@ -710,43 +680,26 @@ const char* ezlopi_scenes_inarr_comparator_operators_get_method(e_scene_inarr_cm return ret; } -int ezlopi_scenes_operators_value_inarr_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* operation_field) +int ezlopi_scenes_operators_value_inarr_operations(l_fields_v2_t* item_exp_field, l_fields_v2_t* value_field, l_fields_v2_t* operation_field) { int ret = 0; - if (item_id && value_field && operation_field) + if (item_exp_field && value_field && operation_field) { - char* item_value = NULL; - // int item_value_size = 0; - cJSON* cj_item_value = cJSON_CreateObject(); - l_ezlopi_device_t* device = ezlopi_device_get_head(); - while (device) + char* item_exp_value_str = NULL; + //------------------------------------------------ + if (EZLOPI_VALUE_TYPE_EXPRESSION == item_exp_field->value_type) { - l_ezlopi_item_t* item = device->items; - while (item) - { - if (item->cloud_properties.item_id == item_id) - { - if (cj_item_value) - { - item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); - cJSON* cj_value = cJSON_GetObjectItem(cj_item_value, ezlopi_value_str); - if (cj_value) - { - if (cJSON_IsString(cj_value)) - { - item_value = cJSON_GetStringValue(cj_value); - } - } - } - - break; - } - item = item->next; - } - device = device->next; + s_ezlopi_expressions_t* curr_expr_left = ezlopi_scenes_get_expression_node_by_name(item_exp_field->field_value.u_value.value_string); + #warning "extract the 'string' from expression"; + item_exp_value_str = NULL; } - - if (NULL != item_value) + else + { + uint32_t item_id = strtoul(item_exp_field->field_value.u_value.value_string, NULL, 16); + item_exp_value_str = ezlopi_core_scenes_operator_get_item_string_value_current_by_id(item_id); + } + //------------------------------------------------ + if (NULL != item_exp_value_str) { cJSON* iterator = NULL; char* op_str = (NULL == operation_field) ? "in" : operation_field->field_value.u_value.value_string; @@ -762,7 +715,7 @@ int ezlopi_scenes_operators_value_inarr_operations(uint32_t item_id, l_fields_v2 const char* string_item = cJSON_GetStringValue(iterator); if (NULL != string_item) { - if (STR_OP_COMP(item_value, == , string_item)) // check for all array elements ; if exists then break + if (STR_OP_COMP(item_exp_value_str, == , string_item)) // check for all array elements ; if exists then break { ret = 1; break; @@ -782,7 +735,7 @@ int ezlopi_scenes_operators_value_inarr_operations(uint32_t item_id, l_fields_v2 const char* string_item = cJSON_GetStringValue(iterator); if (NULL != string_item) { - if (STR_OP_COMP(item_value, == , string_item)) // check for all array elements ; if exists then break + if (STR_OP_COMP(item_exp_value_str, == , string_item)) // check for all array elements ; if exists then break { ret = 0; break; @@ -805,68 +758,10 @@ int ezlopi_scenes_operators_value_inarr_operations(uint32_t item_id, l_fields_v2 } } - if (cj_item_value) - { - if (item_value) - { - free(item_value); - } - cJSON_Delete(cj_item_value); - } - } - - return ret; -} -#if 0 -int ezlopi_scenes_operators_value_expn_inarr_operations(uint32_t expression_id, l_fields_v2_t* expression_field, l_fields_v2_t* operation_field) -{ - int ret = 0; - if (expression_id && expression_field && operation_field) - { - size_t expression_name_len = strlen(expression_field->field_value.u_value.value_string); - char* expression_name = (expression_field->field_value.u_value.value_string); // get the expression_name - if (expression_name) - { - s_ezlopi_expressions_t* curr_expr = ezlopi_scenes_expressions_get_head(); - while (curr_expr) - { - // find value representing 'item_id/expression_id' and then compare with value pointed by 'expression_field->field_value.u_value.value_string' ? - - // if (STR_OP_COMP(curr_expr->name,==, expression_name)) // "string != NULL" - // { - // break; - // } - curr_expr = curr_expr->next; - } - - // - - e_scene_str_cmp_operators_t string_operator = ezlopi_scenes_inarr_comparator_operators_get_enum(operation_field->field_value.u_value.value_string); - - switch (string_operator) - { - case SCENES_STRINGS_OPERATORS_CONTAINS: - { - TRACE_W("'SCENES_STRINGS_OPERATORS_CONTAINS' not implemented!"); - break; - } - case SCENES_STRINGS_OPERATORS_NOT_CONTAIN: - { - TRACE_W("'SCENES_STRINGS_OPERATORS_NOT_CONTAIN' not implemented!"); - break; - } - default: - { - TRACE_E("'SCENES_STRINGS_OPERATORS_* [%d]' out of range!", string_operator); - break; - } - } - } } return ret; } -#endif /************* Values with Less ************/ diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h index 297a18427..35a098655 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h @@ -20,6 +20,14 @@ typedef enum e_scene_str_cmp_operators #undef SCENES_STRINGS_OPERATORS } e_scene_str_cmp_operators_t; +typedef enum e_scene_strops_cmp_operators +{ +#define SCENES_STRING_OP_COMP_OPERATORES(OPERATOR, op, name, method) SCENES_STRING_OP_COMP_OPERATORES_##OPERATOR, +#include "__operators_macros/__string_op_comparision_operators_macros.h" +#undef SCENES_STRING_OP_COMP_OPERATORES +} e_scene_strops_cmp_operators_t; + + typedef enum e_scene_inarr_cmp_operators { #define SCENES_IN_ARRAY_OPERATORS(OPERATOR, op, name, method) SCENES_IN_ARRAY_OPERATORS_##OPERATOR, @@ -48,26 +56,38 @@ const char* ezlopi_scenes_numeric_comparator_operators_get_name(e_scene_num_cmp_ const char* ezlopi_scenes_numeric_comparator_operators_get_method(e_scene_num_cmp_operators_t operator); double ezlopi_core_scenes_operator_get_item_double_value_current(uint32_t item_id); -int ezlopi_scenes_operators_value_number_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); -int ezlopi_scenes_operators_value_expn_number_operations(char* expression_name_left, char* expression_name_right, l_fields_v2_t* comparator_field); +int ezlopi_scenes_operators_value_number_operations(l_fields_v2_t* item_exp_field, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); + +//------------------------------------------------------------------- +//Numeric-Range Operators + +//------------------------------------------------------------------- // Strings Operators e_scene_str_cmp_operators_t ezlopi_scenes_strings_comparator_operators_get_enum(char* operator_str); const char* ezlopi_scenes_strings_comparator_operators_get_op(e_scene_str_cmp_operators_t operator); const char* ezlopi_scenes_strings_comparator_operators_get_name(e_scene_str_cmp_operators_t operator); const char* ezlopi_scenes_strings_comparator_operators_get_method(e_scene_str_cmp_operators_t operator); -int ezlopi_scenes_operators_value_strings_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); -int ezlopi_scenes_operators_value_expn_strings_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); +int ezlopi_scenes_operators_value_strings_operations(l_fields_v2_t* item_exp_field, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); + +//------------------------------------------------------------------- +// String-Operation Operators +e_scene_strops_cmp_operators_t ezlopi_scenes_strops_comparator_operators_get_enum(char* operator_str); +const char* ezlopi_scenes_strops_comparator_operators_get_op(e_scene_strops_cmp_operators_t operator); +const char* ezlopi_scenes_strops_comparator_operators_get_name(e_scene_strops_cmp_operators_t operator); +const char* ezlopi_scenes_strops_comparator_operators_get_method(e_scene_strops_cmp_operators_t operator); + +int ezlopi_scenes_operators_value_strops_operations(l_fields_v2_t* item_exp_field, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); +//------------------------------------------------------------------- // InArray Operators e_scene_inarr_cmp_operators_t ezlopi_scenes_inarr_comparator_operators_get_enum(char* operator_inarr); const char* ezlopi_scenes_inarr_comparator_operators_get_op(e_scene_inarr_cmp_operators_t operator); const char* ezlopi_scenes_inarr_comparator_operators_get_name(e_scene_inarr_cmp_operators_t operator); const char* ezlopi_scenes_inarr_comparator_operators_get_method(e_scene_inarr_cmp_operators_t operator); -int ezlopi_scenes_operators_value_inarr_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); -// int ezlopi_scenes_operators_value_expn_inarr_operations(uint32_t item_id, l_fields_v2_t *value_field, l_fields_v2_t *comparator_field); +int ezlopi_scenes_operators_value_inarr_operations(l_fields_v2_t* item_exp_field, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); // Value with less Operators e_scene_value_with_less_cmp_operators_t ezlopi_scenes_value_with_less_comparator_operators_get_enum(char* operator_str); diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index fb6cf8b0d..ce7154289 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -8,6 +8,7 @@ #include "ezlopi_core_devices.h" #include "ezlopi_core_event_group.h" #include "ezlopi_core_scenes_operators.h" +#include "ezlopi_core_scenes_expressions.h" #include "ezlopi_core_websocket_client.h" #include "ezlopi_core_scenes_when_methods.h" #include "ezlopi_core_scenes_status_changed.h" @@ -657,24 +658,25 @@ int ezlopi_scene_when_compare_numbers(l_scenes_list_v2_t* scene_node, void* arg) if (when_block && scene_node) { - uint32_t item_id = 0; - char* expression_name = 0; + l_fields_v2_t* item_or_expression_field = NULL; l_fields_v2_t* value_field = NULL; l_fields_v2_t* comparator_field = NULL; - l_fields_v2_t* expression_field = NULL; l_fields_v2_t* curr_field = when_block->fields; while (curr_field) { if (0 == strncmp(curr_field->name, ezlopi_item_str, 5)) { - item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) + { + item_or_expression_field = curr_field; + } } else if (0 == strncmp(curr_field->name, "expression", 11)) { if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { - expression_name = curr_field->field_value.u_value.value_string; // expression_name + item_or_expression_field = curr_field; // expression_name } } else if (0 == strncmp(curr_field->name, ezlopi_comparator_str, 11)) @@ -689,23 +691,15 @@ int ezlopi_scene_when_compare_numbers(l_scenes_list_v2_t* scene_node, void* arg) } else if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != curr_field->field_value.u_value.value_string)) { - expression_field = curr_field; // this field has expression_name + value_field = curr_field; // this field has expression_name } } curr_field = curr_field->next; } - if (item_id && value_field && comparator_field) + if (item_or_expression_field && value_field && comparator_field) // item_or_expression_field vs value_field { - ret = ezlopi_scenes_operators_value_number_operations(item_id, value_field, comparator_field); - } - else if (item_id && expression_field && comparator_field) - { - ret = ezlopi_scenes_operators_value_number_operations(item_id, expression_field, comparator_field); - } - else if (expression_name && expression_field && comparator_field) // only for expression 'string comparisions' - { - ret = ezlopi_scenes_operators_value_expn_strings_operations(expression_name, value_field, comparator_field); + ret = ezlopi_scenes_operators_value_number_operations(item_or_expression_field, value_field, comparator_field); } } @@ -720,40 +714,88 @@ int ezlopi_scene_when_compare_number_range(l_scenes_list_v2_t* scene_node, void* if (when_block && scene_node) { uint32_t item_id = 0; - l_fields_v2_t* end_vlaue_field = NULL; + char* expression_name = NULL; + l_fields_v2_t* item_exp_field = NULL; + l_fields_v2_t* end_value_field = NULL; l_fields_v2_t* start_value_field = NULL; + bool comparator_choice = 0; l_fields_v2_t* curr_field = when_block->fields; while (curr_field) { - if (0 == strncmp(curr_field->name, ezlopi_item_str, 4)) + if (0 == strncmp(curr_field->name, ezlopi_item_str, 5)) { + item_exp_field = curr_field; item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); } + else if (0 == strncmp(curr_field->name, "expression", 11)) + { + if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) + { + item_exp_field = curr_field; + expression_name = curr_field->field_value.u_value.value_string; // expression_name + } + } + else if (0 == strncmp(curr_field->name, ezlopi_comparator_str, 11)) + { + if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) + { + comparator_choice = (0 == strncmp(curr_field->field_value.u_value.value_string, "notbetween", 11)) ? 1 : 0; + } + } else if (0 == strncmp(curr_field->name, ezlopi_startValue_str, strlen(ezlopi_startValue_str))) { start_value_field = curr_field; } else if (0 == strncmp(curr_field->name, ezlopi_endValue_str, strlen(ezlopi_endValue_str))) { - end_vlaue_field = curr_field; + end_value_field = curr_field; } - curr_field = curr_field->next; } - if (item_id && end_vlaue_field && start_value_field) + if (item_id && end_value_field && start_value_field) { double double_item_value = ezlopi_core_scenes_operator_get_item_double_value_current(item_id); + if ((start_value_field->field_value.u_value.value_double <= double_item_value) && - (end_vlaue_field->field_value.u_value.value_double >= double_item_value)) + (end_value_field->field_value.u_value.value_double >= double_item_value)) { - ret = 1; + if (0 == comparator_choice) //between + { + ret = 1; + } + } + else + { + if (1 == comparator_choice) // not between + { + ret = 1; + } } } - else + else if (expression_name && end_value_field && start_value_field) { - TRACE_E("error args"); + s_ezlopi_expressions_t* curr_expr_right = ezlopi_scenes_get_expression_node_by_name(expression_name); + #warning "extract the double from expression"; + double double_expn_value = 0; + + if ((start_value_field->field_value.u_value.value_double <= double_expn_value) && + (end_value_field->field_value.u_value.value_double >= double_expn_value)) + { + + if (0 == comparator_choice) //between + { + ret = 1; + } + } + else + { + if (1 == comparator_choice) // not between + { + ret = 1; + } + } } } @@ -765,14 +807,11 @@ int ezlopi_scene_when_compare_strings(l_scenes_list_v2_t* scene_node, void* arg) TRACE_W(" Compare_strings "); // TRACE_W("Warning: when-method 'compare_strings' not implemented!"); int ret = 0; - // #if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) { - uint32_t item_id = 0; - char* expression_name = NULL; - l_fields_v2_t* expression_field = NULL; + l_fields_v2_t* item_exp_field = NULL; l_fields_v2_t* value_field = NULL; l_fields_v2_t* comparator_field = NULL; @@ -783,14 +822,14 @@ int ezlopi_scene_when_compare_strings(l_scenes_list_v2_t* scene_node, void* arg) { if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { - item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); // item or expression_id + item_exp_field = curr_field; } } else if (0 == strncmp(curr_field->name, "expression", 11)) { if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { - expression_name = curr_field->field_value.u_value.value_string; // expression_name + item_exp_field = curr_field; } } else if (0 == strncmp(curr_field->name, ezlopi_comparator_str, 11)) @@ -808,29 +847,18 @@ int ezlopi_scene_when_compare_strings(l_scenes_list_v2_t* scene_node, void* arg) } else if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != curr_field->field_value.u_value.value_string)) { - expression_field = curr_field; // this field has expression_name + value_field = curr_field; // this field has expression_name } } curr_field = curr_field->next; } - if (item_id && value_field && comparator_field) // only for item_id vs item_value 'string comparisions' - { - ret = ezlopi_scenes_operators_value_strings_operations(item_id, value_field, comparator_field); - } - else if (item_id && expression_field && comparator_field) // only for item_id vs expression 'string comparisions' - { - #warning "need to add different function"; - ret = ezlopi_scenes_operators_value_strings_operations(item_id, expression_field, comparator_field); - } - else if (expression_name && expression_field && comparator_field) // only for expression_name vs expression 'string comparisions' + if (item_exp_field && value_field && comparator_field) // only for item_id vs item_value 'string comparisions' { - ret = ezlopi_scenes_operators_value_expn_strings_operations(value_field, expression_field, comparator_field); + ret = ezlopi_scenes_operators_value_strings_operations(item_exp_field, value_field, comparator_field); } - - } - // #endif + return ret; } @@ -839,23 +867,28 @@ int ezlopi_scene_when_string_operation(l_scenes_list_v2_t* scene_node, void* arg TRACE_W(" Compare_string_op "); // TRACE_W("Warning: when-method 'string_operation' not implemented!"); int ret = 0; - // #if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) { - uint32_t item_id = 0; - // l_fields_v2_t *expression_field = NULL; + l_fields_v2_t* item_exp_field = NULL; l_fields_v2_t* value_field = NULL; l_fields_v2_t* operation_field = NULL; l_fields_v2_t* curr_field = when_block->fields; while (curr_field) { - if (0 == strncmp(curr_field->name, "item", 5)) + if (0 == strncmp(curr_field->name, ezlopi_item_str, 5)) { if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { - item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); // ID extraction [item or expression] + item_exp_field = curr_field; + } + } + else if (0 == strncmp(curr_field->name, "expression", 11)) + { + if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) + { + item_exp_field = curr_field; } } else if (0 == strncmp(curr_field->name, "operation", 10)) @@ -879,16 +912,11 @@ int ezlopi_scene_when_string_operation(l_scenes_list_v2_t* scene_node, void* arg curr_field = curr_field->next; } - if (item_id && value_field && operation_field) // only for item_value 'string comparisions' + if (item_exp_field && value_field && operation_field) // only for item_value 'string comparisions' { - ret = ezlopi_scenes_operators_value_strings_operations(item_id, value_field, operation_field); + ret = ezlopi_scenes_operators_value_strops_operations(item_exp_field, value_field, operation_field); } - // else if (item_id && expression_field && operation_field) // only for expression 'string comparisions' - // { - // // ret = ezlopi_scenes_operators_value_expn_strings_operations(item_id, value_field, operation_field); - // } } - // #endif return ret; } @@ -897,23 +925,28 @@ int ezlopi_scene_when_in_array(l_scenes_list_v2_t* scene_node, void* arg) TRACE_W(" Compare_inArray "); // TRACE_W("Warning: when-method 'in_array' not implemented!"); int ret = 0; - // #if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) { - uint32_t item_id = 0; - // l_fields_v2_t *expression_field = NULL; + l_fields_v2_t* item_exp_field = NULL; l_fields_v2_t* value_field = NULL; l_fields_v2_t* operation_field = NULL; l_fields_v2_t* curr_field = when_block->fields; while (curr_field) { - if (0 == strncmp(curr_field->name, "item", 5)) + if (0 == strncmp(curr_field->name, ezlopi_item_str, 5)) { if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { - item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); // ID extraction [item or expression] + item_exp_field = curr_field; + } + } + else if (0 == strncmp(curr_field->name, "expression", 11)) + { + if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) + { + item_exp_field = curr_field; } } else if (0 == strncmp(curr_field->name, ezlopi_value_str, 6)) @@ -933,16 +966,12 @@ int ezlopi_scene_when_in_array(l_scenes_list_v2_t* scene_node, void* arg) curr_field = curr_field->next; } - if (item_id && value_field) // only for item_value 'string comparisions' + if (item_exp_field && value_field && operation_field) // only for item_value 'string comparisions' { - ret = ezlopi_scenes_operators_value_inarr_operations(item_id, value_field, operation_field); + ret = ezlopi_scenes_operators_value_inarr_operations(item_exp_field, value_field, operation_field); } - // else if (item_id && expression_field && operation_field) // only for expression 'string comparisions' - // { - // ret = ezlopi_scenes_operators_value_expn_inarr_operations(item_id, value_field, operation_field); - // } } - // #endif + return ret; } diff --git a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c index bb9361a93..8cdf6e971 100644 --- a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c +++ b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c @@ -179,8 +179,8 @@ void ezlopi_scenes_meshbot_init(void) while (scene_node) { scene_node->status = EZLOPI_SCENE_STATUS_STOPPED; - // if (scene_node->enabled && scene_node->when_block && (scene_node->else_block || scene_node->then_block)) - if (scene_node->when_block && (scene_node->else_block || scene_node->then_block)) + if (scene_node->enabled && scene_node->when_block && (scene_node->else_block || scene_node->then_block)) + // if (scene_node->when_block && (scene_node->else_block || scene_node->then_block)) { start_thread = 1; From a78b7967014a4f72c0d5bc78a248d53054a50e2c Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Mon, 22 Apr 2024 15:45:28 +0545 Subject: [PATCH 17/29] refactored compare_value, atleast_one_dictionary_value , firmware_update , dictionary_changed --- .../__numeric_comparision_operators_macros.h | 4 +- .../ezlopi_core_scenes_operators.c | 165 ++++++++++-------- .../ezlopi_core_scenes_when_methods.c | 46 ++--- 3 files changed, 116 insertions(+), 99 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/__operators_macros/__numeric_comparision_operators_macros.h b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__numeric_comparision_operators_macros.h index a663e79ad..811ca52e0 100755 --- a/ezlopi-core/ezlopi-core-scenes/__operators_macros/__numeric_comparision_operators_macros.h +++ b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__numeric_comparision_operators_macros.h @@ -7,8 +7,8 @@ SCENES_NUM_COMP_OPERATORS(GREATER_EQUAL, ">=", "greater equal", "compareNumbers" SCENES_NUM_COMP_OPERATORS(EQUAL, "==", "equal", "compareNumbers") SCENES_NUM_COMP_OPERATORS(NOT_EQUAL, "!=", "not equal", "compareNumbers") -// SCENES_NUM_COMP_OPERATORS(BETWEEN, "between", "between", "compareNumberRange") -// SCENES_NUM_COMP_OPERATORS(NOT_BETWEEN, "not_between", "not between", "compareNumberRange") +SCENES_NUM_COMP_OPERATORS(BETWEEN, "between", "between", "compareNumberRange") +SCENES_NUM_COMP_OPERATORS(NOT_BETWEEN, "not_between", "not between", "compareNumberRange") // SCENES_NUM_COMP_OPERATORS(ANY_OF, "any_of", "any of", "numbersArray") // SCENES_NUM_COMP_OPERATORS(NONE_OF, "none_of", "none of", "numbersArray") ////////////////////////////////////////////////////////////////////////////// diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c index c8aea8496..bac54dd6c 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c @@ -838,7 +838,6 @@ int ezlopi_scenes_operators_value_with_less_operations(uint32_t item_id, l_field if (item_id && value_field && comparator_field) { double item_value = 0.0; - cJSON* cj_item_value = cJSON_CreateObject(); l_ezlopi_device_t* device = ezlopi_device_get_head(); while (device) { @@ -847,6 +846,7 @@ int ezlopi_scenes_operators_value_with_less_operations(uint32_t item_id, l_field { if (item->cloud_properties.item_id == item_id) { + cJSON* cj_item_value = cJSON_CreateObject(); if (cj_item_value) { item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); @@ -856,8 +856,8 @@ int ezlopi_scenes_operators_value_with_less_operations(uint32_t item_id, l_field #warning "Krishna needs to complete this" item_value = cj_value->valuedouble; } + cJSON_Delete(cj_item_value); } - break; } item = item->next; @@ -906,10 +906,7 @@ int ezlopi_scenes_operators_value_with_less_operations(uint32_t item_id, l_field } } - if (cj_item_value) - { - cJSON_Delete(cj_item_value); - } + } return ret; @@ -990,7 +987,6 @@ int ezlopi_scenes_operators_value_without_less_operations(uint32_t item_id, l_fi if (item_id && value_field && comparator_field) { double item_value = 0.0; - cJSON* cj_item_value = cJSON_CreateObject(); l_ezlopi_device_t* device = ezlopi_device_get_head(); while (device) { @@ -999,6 +995,7 @@ int ezlopi_scenes_operators_value_without_less_operations(uint32_t item_id, l_fi { if (item->cloud_properties.item_id == item_id) { + cJSON* cj_item_value = cJSON_CreateObject(); if (cj_item_value) { item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); @@ -1008,8 +1005,8 @@ int ezlopi_scenes_operators_value_without_less_operations(uint32_t item_id, l_fi #warning "Krishna needs to complete this" item_value = cj_value->valuedouble; } + cJSON_Delete(cj_item_value); } - break; } @@ -1040,10 +1037,7 @@ int ezlopi_scenes_operators_value_without_less_operations(uint32_t item_id, l_fi } } - if (cj_item_value) - { - cJSON_Delete(cj_item_value); - } + } return ret; @@ -1058,7 +1052,6 @@ int ezlopi_scenes_operators_value_comparevalues_without_less_operations(uint32_t { cJSON* item_value = NULL; - cJSON* cj_item_value = cJSON_CreateObject(); l_ezlopi_device_t* device = ezlopi_device_get_head(); while (device) { @@ -1069,10 +1062,12 @@ int ezlopi_scenes_operators_value_comparevalues_without_less_operations(uint32_t { if (STR_OP_COMP(value_type_field->field_value.u_value.value_string, == , item->cloud_properties.value_type)) // bool == bool? { + cJSON* cj_item_value = cJSON_CreateObject(); if (cj_item_value) { item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); item_value = cJSON_GetObjectItem(cj_item_value, ezlopi_value_str); // eg. double_type : 5.005 or string_type : "5.005" + cJSON_Delete(cj_item_value); } } else @@ -1124,51 +1119,84 @@ int ezlopi_scenes_operators_value_comparevalues_without_less_operations(uint32_t } } - if (cj_item_value) - { - cJSON_Delete(cj_item_value); - } + } return ret; } -int ezlopi_scenes_operators_value_comparevalues_with_less_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* value_type_field, l_fields_v2_t* comparator_field) +int ezlopi_scenes_operators_value_comparevalues_with_less_operations(l_fields_v2_t* item_exp_field, l_fields_v2_t* value_field, l_fields_v2_t* value_type_field, l_fields_v2_t* comparator_field) { int ret = 0; - if (item_id && value_field && value_type_field && comparator_field) + if (item_exp_field && value_field && value_type_field && comparator_field) { - cJSON* item_value = NULL; + cJSON* item_exp_value = NULL; - cJSON* cj_item_value = cJSON_CreateObject(); - l_ezlopi_device_t* device = ezlopi_device_get_head(); - while (device) + //---------------------- LHS ------------------------- + if (EZLOPI_VALUE_TYPE_EXPRESSION == item_exp_field->value_type) { - l_ezlopi_item_t* item = device->items; - while (item) + s_ezlopi_expressions_t* curr_expr_left = ezlopi_scenes_get_expression_node_by_name(item_exp_field->field_value.u_value.value_string); + + cJSON* cj_item_value = cJSON_CreateObject(); + if (cj_item_value) { - if (item->cloud_properties.item_id == item_id) // unique + if (0 == strncmp(value_type_field->field_value.u_value.value_string, "bool", 5)) { - if (STR_OP_COMP(value_type_field->field_value.u_value.value_string, == , item->cloud_properties.value_type)) // bool == bool? + item_exp_value = cJSON_AddBoolToObject(cj_item_value, ezlopi_value_str, curr_expr_left->exp_value.u_value.boolean_value); + } + else if (0 == strncmp(value_type_field->field_value.u_value.value_string, "number", 7)) + { + item_exp_value = cJSON_AddNumberToObject(cj_item_value, ezlopi_value_str, curr_expr_left->exp_value.u_value.number_value); + } + else if (0 == strncmp(value_type_field->field_value.u_value.value_string, "string", 7)) + { + item_exp_value = cJSON_AddStringToObject(cj_item_value, ezlopi_value_str, curr_expr_left->exp_value.u_value.str_value); + } + else + { + ret = 0; // SCENES_WHEN_TYPE_MISMATCH error + } + cJSON_Delete(cj_item_value); + } + + } + else + { + uint32_t item_id = 0; + item_id = strtoul(item_exp_field->field_value.u_value.value_string, NULL, 16); + + l_ezlopi_device_t* device = ezlopi_device_get_head(); + while (device) + { + l_ezlopi_item_t* item = device->items; + while (item) + { + if (item->cloud_properties.item_id == item_id) // unique { - if (cj_item_value) + if (STR_OP_COMP(value_type_field->field_value.u_value.value_string, == , item->cloud_properties.value_type)) // bool == bool? { - item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); - item_value = cJSON_GetObjectItem(cj_item_value, ezlopi_value_str); // "5.0" + cJSON* cj_item_value = cJSON_CreateObject(); + if (cj_item_value) + { + item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); + item_exp_value = cJSON_GetObjectItem(cj_item_value, ezlopi_value_str); // "5.0" + cJSON_Delete(cj_item_value); + } } + else + { + ret = 0; // SCENES_WHEN_TYPE_MISMATCH error + } + break; } - else - { - ret = 0; // SCENES_WHEN_TYPE_MISMATCH error - } - break; + item = item->next; } - item = item->next; + device = device->next; } - device = device->next; } + //---------------------------------------------------- - if (NULL != item_value) + if (NULL != item_exp_value) { // operating according to 'with-less or without-less' comparator char* op_str = (NULL == comparator_field) ? "==" : comparator_field->field_value.u_value.value_string; @@ -1179,8 +1207,8 @@ int ezlopi_scenes_operators_value_comparevalues_with_less_operations(uint32_t it case SCENES_VALUES_WITH_LESS_OPERATORS_LESS: { - ret = ((item_value->type == cJSON_Number) ? (item_value->valuedouble < value_field->field_value.u_value.value_double) - : (item_value->type == cJSON_String) ? STR_OP_COMP(item_value->valuestring, < , value_field->field_value.u_value.value_string) + ret = ((item_exp_value->type == cJSON_Number) ? (item_exp_value->valuedouble < value_field->field_value.u_value.value_double) + : (item_exp_value->type == cJSON_String) ? STR_OP_COMP(item_exp_value->valuestring, < , value_field->field_value.u_value.value_string) : 0); if (0 == ret) { @@ -1190,8 +1218,8 @@ int ezlopi_scenes_operators_value_comparevalues_with_less_operations(uint32_t it } case SCENES_VALUES_WITH_LESS_OPERATORS_GREATER: { - ret = ((item_value->type == cJSON_Number) ? (item_value->valuedouble > value_field->field_value.u_value.value_double) - : (item_value->type == cJSON_String) ? STR_OP_COMP(item_value->valuestring, > , value_field->field_value.u_value.value_string) + ret = ((item_exp_value->type == cJSON_Number) ? (item_exp_value->valuedouble > value_field->field_value.u_value.value_double) + : (item_exp_value->type == cJSON_String) ? STR_OP_COMP(item_exp_value->valuestring, > , value_field->field_value.u_value.value_string) : 0); if (0 == ret) { @@ -1202,8 +1230,8 @@ int ezlopi_scenes_operators_value_comparevalues_with_less_operations(uint32_t it } case SCENES_VALUES_WITH_LESS_OPERATORS_LESS_EQUAL: { - ret = ((item_value->type == cJSON_Number) ? (item_value->valuedouble <= value_field->field_value.u_value.value_double) - : (item_value->type == cJSON_String) ? STR_OP_COMP(item_value->valuestring, <= , value_field->field_value.u_value.value_string) + ret = ((item_exp_value->type == cJSON_Number) ? (item_exp_value->valuedouble <= value_field->field_value.u_value.value_double) + : (item_exp_value->type == cJSON_String) ? STR_OP_COMP(item_exp_value->valuestring, <= , value_field->field_value.u_value.value_string) : 0); if (0 == ret) { @@ -1214,8 +1242,8 @@ int ezlopi_scenes_operators_value_comparevalues_with_less_operations(uint32_t it } case SCENES_VALUES_WITH_LESS_OPERATORS_GREATER_EQUAL: { - ret = ((item_value->type == cJSON_Number) ? (item_value->valuedouble >= value_field->field_value.u_value.value_double) - : (item_value->type == cJSON_String) ? STR_OP_COMP(item_value->valuestring, >= , value_field->field_value.u_value.value_string) + ret = ((item_exp_value->type == cJSON_Number) ? (item_exp_value->valuedouble >= value_field->field_value.u_value.value_double) + : (item_exp_value->type == cJSON_String) ? STR_OP_COMP(item_exp_value->valuestring, >= , value_field->field_value.u_value.value_string) : 0); if (0 == ret) { @@ -1227,10 +1255,10 @@ int ezlopi_scenes_operators_value_comparevalues_with_less_operations(uint32_t it case SCENES_VALUES_WITH_LESS_OPERATORS_EQUAL: { - ret = ((item_value->type == cJSON_True) ? (true == value_field->field_value.u_value.value_bool) - : (item_value->type == cJSON_False) ? (false == value_field->field_value.u_value.value_bool) - : (item_value->type == cJSON_Number) ? (item_value->valuedouble == value_field->field_value.u_value.value_double) - : (item_value->type == cJSON_String) ? STR_OP_COMP(item_value->valuestring, == , value_field->field_value.u_value.value_string) + ret = ((item_exp_value->type == cJSON_True) ? (true == value_field->field_value.u_value.value_bool) + : (item_exp_value->type == cJSON_False) ? (false == value_field->field_value.u_value.value_bool) + : (item_exp_value->type == cJSON_Number) ? (item_exp_value->valuedouble == value_field->field_value.u_value.value_double) + : (item_exp_value->type == cJSON_String) ? STR_OP_COMP(item_exp_value->valuestring, == , value_field->field_value.u_value.value_string) : 0); if (0 == ret) { @@ -1242,10 +1270,10 @@ int ezlopi_scenes_operators_value_comparevalues_with_less_operations(uint32_t it case SCENES_VALUES_WITH_LESS_OPERATORS_NOT_EQUAL: { - ret = ((item_value->type == cJSON_True) ? (true != value_field->field_value.u_value.value_bool) - : (item_value->type == cJSON_False) ? (false != value_field->field_value.u_value.value_bool) - : (item_value->type == cJSON_Number) ? (item_value->valuedouble != value_field->field_value.u_value.value_double) - : (item_value->type == cJSON_String) ? STR_OP_COMP(item_value->valuestring, != , value_field->field_value.u_value.value_string) + ret = ((item_exp_value->type == cJSON_True) ? (true != value_field->field_value.u_value.value_bool) + : (item_exp_value->type == cJSON_False) ? (false != value_field->field_value.u_value.value_bool) + : (item_exp_value->type == cJSON_Number) ? (item_exp_value->valuedouble != value_field->field_value.u_value.value_double) + : (item_exp_value->type == cJSON_String) ? STR_OP_COMP(item_exp_value->valuestring, != , value_field->field_value.u_value.value_string) : 0); if (0 == ret) { @@ -1262,10 +1290,6 @@ int ezlopi_scenes_operators_value_comparevalues_with_less_operations(uint32_t it } } - if (cj_item_value) - { - cJSON_Delete(cj_item_value); - } } return ret; @@ -1278,7 +1302,6 @@ int ezlopi_scenes_operators_value_number_range_operations(uint32_t item_id, l_fi if (item_id && start_value_field && end_value_field) { cJSON* item_value = NULL; - cJSON* cj_item_value = cJSON_CreateObject(); l_ezlopi_device_t* device = ezlopi_device_get_head(); while (device) { @@ -1287,6 +1310,7 @@ int ezlopi_scenes_operators_value_number_range_operations(uint32_t item_id, l_fi { if (item->cloud_properties.item_id == item_id) // find the correct " item " within the device { + cJSON* cj_item_value = cJSON_CreateObject(); if (cj_item_value) { item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); @@ -1321,6 +1345,7 @@ int ezlopi_scenes_operators_value_number_range_operations(uint32_t item_id, l_fi } } } + cJSON_Delete(cj_item_value); } break; } @@ -1387,10 +1412,7 @@ int ezlopi_scenes_operators_value_number_range_operations(uint32_t item_id, l_fi } } } - if (cj_item_value) - { - cJSON_Delete(cj_item_value); - } + } return ret; @@ -1403,7 +1425,6 @@ int ezlopi_scenes_operators_has_atleastone_dictionary_value_operations(uint32_t if (item_id && value_field) { cJSON* item_value = NULL; - cJSON* cj_item_value = cJSON_CreateObject(); l_ezlopi_device_t* device = ezlopi_device_get_head(); while (device) { @@ -1412,6 +1433,7 @@ int ezlopi_scenes_operators_has_atleastone_dictionary_value_operations(uint32_t { if (item->cloud_properties.item_id == item_id) { + cJSON* cj_item_value = cJSON_CreateObject(); if (cj_item_value) { item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); @@ -1436,8 +1458,8 @@ int ezlopi_scenes_operators_has_atleastone_dictionary_value_operations(uint32_t } } } + cJSON_Delete(cj_item_value); } - break; } item = item->next; @@ -1457,10 +1479,7 @@ int ezlopi_scenes_operators_has_atleastone_dictionary_value_operations(uint32_t } } } - if (cj_item_value) - { - cJSON_Delete(cj_item_value); - } + } return ret; @@ -1473,7 +1492,6 @@ int ezlopi_scenes_operators_is_dictionary_changed_operations(l_scenes_list_v2_t* if (item_id && key_field && operation_field) { cJSON* item_value = NULL; - cJSON* cj_item_value = cJSON_CreateObject(); l_ezlopi_device_t* device = ezlopi_device_get_head(); while (device) @@ -1483,6 +1501,7 @@ int ezlopi_scenes_operators_is_dictionary_changed_operations(l_scenes_list_v2_t* { if (item->cloud_properties.item_id == item_id) { + cJSON* cj_item_value = cJSON_CreateObject(); if (cj_item_value) { item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, item, (void*)cj_item_value, NULL); @@ -1499,6 +1518,7 @@ int ezlopi_scenes_operators_is_dictionary_changed_operations(l_scenes_list_v2_t* } } } + cJSON_Delete(cj_item_value); } break; @@ -1545,10 +1565,7 @@ int ezlopi_scenes_operators_is_dictionary_changed_operations(l_scenes_list_v2_t* scene_node->when_block->fields->user_arg = (void*)item_value; } } - if (cj_item_value) - { - cJSON_Delete(cj_item_value); - } + } return ret; } \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index ce7154289..42292e696 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -718,7 +718,7 @@ int ezlopi_scene_when_compare_number_range(l_scenes_list_v2_t* scene_node, void* l_fields_v2_t* item_exp_field = NULL; l_fields_v2_t* end_value_field = NULL; l_fields_v2_t* start_value_field = NULL; - bool comparator_choice = 0; + bool comparator_choice = 0; /* 0->'between' | 1->'not_between'*/ l_fields_v2_t* curr_field = when_block->fields; while (curr_field) @@ -942,6 +942,7 @@ int ezlopi_scene_when_in_array(l_scenes_list_v2_t* scene_node, void* arg) item_exp_field = curr_field; } } + else if (0 == strncmp(curr_field->name, "expression", 11)) { if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) @@ -980,15 +981,13 @@ int ezlopi_scene_when_compare_values(l_scenes_list_v2_t* scene_node, void* arg) TRACE_W(" Compare_values "); // TRACE_W("Warning: when-method 'is_group_state' not implemented!"); int ret = 0; - // #if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) { - uint32_t item_id = 0; l_fields_v2_t* value_type_field = NULL; l_fields_v2_t* value_field = NULL; l_fields_v2_t* comparator_field = NULL; - // l_fields_v2_t *expression_field = NULL; + l_fields_v2_t* item_exp_field = NULL; l_fields_v2_t* curr_field = when_block->fields; while (curr_field) @@ -997,10 +996,17 @@ int ezlopi_scene_when_compare_values(l_scenes_list_v2_t* scene_node, void* arg) { if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { - item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); // ID extraction [item or expression] + item_exp_field = curr_field; + + } + } + else if (0 == strncmp(curr_field->name, "expression", 11)) + { + if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) + { + item_exp_field = curr_field; } } - else if (0 == strncmp(curr_field->name, ezlopi_value_type_str, 11)) { if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) @@ -1008,33 +1014,32 @@ int ezlopi_scene_when_compare_values(l_scenes_list_v2_t* scene_node, void* arg) value_type_field = curr_field; } } - else if (0 == strncmp(curr_field->name, ezlopi_value_str, 6)) + else if (0 == strncmp(curr_field->name, "comparator", 11)) { if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { - value_field = curr_field; + comparator_field = curr_field; } } - else if (0 == strncmp(curr_field->name, "comparator", 11)) + else if (0 == strncmp(curr_field->name, ezlopi_value_str, 6)) { if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type && (NULL != (curr_field->field_value.u_value.value_string))) { - comparator_field = curr_field; + value_field = curr_field; + } + else if (EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type && (NULL != curr_field->field_value.u_value.value_string)) + { + value_field = curr_field; // this field has expression_name } } curr_field = curr_field->next; } - if (item_id && value_field && value_type_field) // only for item_value 'string comparisions' + if (item_exp_field && value_field && value_type_field) // only for item_value 'string comparisions' { - ret = ezlopi_scenes_operators_value_comparevalues_with_less_operations(item_id, value_field, value_type_field, comparator_field); + ret = ezlopi_scenes_operators_value_comparevalues_with_less_operations(item_exp_field, value_field, value_type_field, comparator_field); } - // else if (item_id && expression_field ) // only for expression 'string comparisions' - // { - // ret = ezlopi_scenes_operators_expn_comparevalues_with_less_operations(item_id, value_field, comparator_field); - // } } - // #endif return ret; } @@ -1043,7 +1048,7 @@ int ezlopi_scene_when_has_atleast_one_dictionary_value(l_scenes_list_v2_t* scene //TRACE_W(" atleast_one_diction_val "); TRACE_W("Warning: when-method 'atleast_one_dictionary_value' not implemented!"); int ret = 0; -#if 0 + l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (scene_node && when_block) { @@ -1076,7 +1081,6 @@ int ezlopi_scene_when_has_atleast_one_dictionary_value(l_scenes_list_v2_t* scene ret = ezlopi_scenes_operators_has_atleastone_dictionary_value_operations(item_id, value_field); } } -#endif return ret; } @@ -1085,7 +1089,6 @@ int ezlopi_scene_when_is_firmware_update_state(l_scenes_list_v2_t* scene_node, v //TRACE_W(" firmware_update "); TRACE_W("Warning: when-method 'firmware_update_state' not implemented!"); int ret = 0; -#if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (scene_node && when_block) { @@ -1122,7 +1125,6 @@ int ezlopi_scene_when_is_firmware_update_state(l_scenes_list_v2_t* scene_node, v } } } -#endif return ret; } @@ -1131,7 +1133,6 @@ int ezlopi_scene_when_is_dictionary_changed(l_scenes_list_v2_t* scene_node, void //TRACE_W(" isDictionary_changed "); TRACE_W("Warning: when-method 'is_dictionary_changed' not implemented!"); int ret = 0; -#if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (scene_node && when_block) { @@ -1171,7 +1172,6 @@ int ezlopi_scene_when_is_dictionary_changed(l_scenes_list_v2_t* scene_node, void ret = ezlopi_scenes_operators_is_dictionary_changed_operations(scene_node, item_id, key_field, operation_field); } } -#endif return ret; } From 215c7369ea320603bb22ad9ee9163359c831e218 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Fri, 26 Apr 2024 19:05:53 +0545 Subject: [PATCH 18/29] refactored code --- .../ezlopi_core_factory_info.h | 24 +-- .../ezlopi_core_scenes_then_methods.c | 192 +++++++----------- .../ezlopi_core_scenes_when_methods.c | 148 ++++++-------- 3 files changed, 153 insertions(+), 211 deletions(-) diff --git a/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h b/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h index 5fc2cbecf..2c2a01ea2 100644 --- a/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h +++ b/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h @@ -163,19 +163,19 @@ extern "C" \"dev_detail\":\ [\ {\ - \"dev_type\": 1,\ - \"dev_name\": \"LED\",\ + \"dev_type\": 7,\ + \"dev_name\": \"temp_humi\",\ \"id_room\": \"\",\ - \"id_item\": 1,\ - \"gpio_in\": 0,\ - \"gpio_out\": 5,\ - \"pullup_ip\": false,\ - \"pullup_op\": false,\ - \"is_ip\": false,\ - \"ip_inv\": false,\ - \"op_inv\": false,\ - \"val_ip\": false,\ - \"val_op\": false\ + \"id_item\": 16,\ + \"gpio\": 18\ + },\ + {\ + \"dev_type\": 3,\ + \"dev_name\": \"pot\",\ + \"id_room\": \"\",\ + \"id_item\": 70,\ + \"gpio\": 5,\ + \"resln_bit\": 3\ }\ ], \ \"dev_total\": 5}"; diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 831102fd4..9b2504a10 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -12,11 +12,11 @@ #include "ezlopi_core_scenes_expressions.h" #include "ezlopi_core_scenes_then_methods.h" #include "ezlopi_core_scenes_status_changed.h" -#include "ezlopi_service_meshbot.h" #include "ezlopi_core_scenes_then_methods_helper_func.h" #include "ezlopi_core_scenes_when_methods_helper_functions.h" #include "ezlopi_cloud_constants.h" +#include "ezlopi_service_meshbot.h" int ezlopi_scene_then_set_item_value(l_scenes_list_v2_t* curr_scene, void* arg) { @@ -61,32 +61,15 @@ int ezlopi_scene_then_set_item_value(l_scenes_list_v2_t* curr_scene, void* arg) curr_field = curr_field->next; } - l_ezlopi_device_t* curr_device = ezlopi_device_get_head(); - uint32_t found_item = 0; - while (curr_device) + if (item_id) { - l_ezlopi_item_t* curr_item = curr_device->items; - while (curr_item) - { - if (item_id == curr_item->cloud_properties.item_id) - { - curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_params, curr_item->user_arg); - found_item = 1; - break; - } - curr_item = curr_item->next; - } - - if (found_item) + l_ezlopi_item_t* curr_item = ezlopi_device_get_item_by_id(item_id); + if (curr_item) { - // TRACE_D("\r\n\r\n FOUND DEVICE \r\n\r\n"); - break; + curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_params, curr_item->user_arg); } - - curr_device = curr_device->next; } } - cJSON_Delete(cj_params); } @@ -122,20 +105,15 @@ int ezlopi_scene_then_set_device_armed(l_scenes_list_v2_t* curr_scene, void* arg if (device_id) { - l_ezlopi_device_t* curr_device = ezlopi_device_get_head(); - while (curr_device) + l_ezlopi_device_t* curr_device = ezlopi_device_get_by_id(device_id); + if (curr_device) { - if (device_id == curr_device->cloud_properties.device_id) + s_ezlopi_cloud_controller_t* controller_info = ezlopi_device_get_controller_information(); + if (controller_info) { - s_ezlopi_cloud_controller_t* controller_info = ezlopi_device_get_controller_information(); - if (controller_info) - { - #warning "we need to change from 'controller' to device-specific [krishna]" - controller_info->armed = (device_armed) ? true : false; - } - break; + #warning "we need to change from 'controller' to device-specific [krishna]" + controller_info->armed = (device_armed) ? true : false; } - curr_device = curr_device->next; } } } @@ -468,13 +446,9 @@ int ezlopi_scene_then_reset_scene_latches(l_scenes_list_v2_t* curr_scene, void* int ezlopi_scene_then_reboot_hub(l_scenes_list_v2_t* curr_scene, void* arg) { TRACE_W(" reboot_hub "); - int ret = 0; - l_action_block_v2_t* curr_then = (l_action_block_v2_t*)arg; - if (curr_then && curr_scene) - { - TRACE_E("Rebooting ESP......................... "); - EZPI_CORE_reset_reboot(); - } + int ret = 1; + TRACE_E("Rebooting ESP......................... "); + EZPI_CORE_reset_reboot(); return ret; } int ezlopi_scene_then_reset_hub(l_scenes_list_v2_t* curr_scene, void* arg) @@ -554,9 +528,9 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) if (curr_scene) { - int item_exp_id = 0; /* item */ + int item_id = 0; /* item */ const char* __id_string = NULL; - char * expression_name = NULL; /* expression */ + char* expression_name = NULL; /* expression */ l_action_block_v2_t* curr_then = (l_action_block_v2_t*)arg; if (curr_then) @@ -568,113 +542,97 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) { if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type) { - item_exp_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); + item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); __id_string = curr_field->field_value.u_value.value_string; - TRACE_D("item_id: %s", __id_string); + TRACE_W("item_id: %s", __id_string); } } - else if (0 == strncmp(curr_field->name, ezlopi_expressions_str, 12)) + else if (0 == strncmp(curr_field->name, "expression", 11)) /*need to add in str*/ { - if ((EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type) && (NULL !=curr_field->field_value.u_value.value_string)) + if ((EZLOPI_VALUE_TYPE_EXPRESSION == curr_field->value_type) && (NULL != curr_field->field_value.u_value.value_string)) { - expression_name = curr_field->field_value.u_value.value_string; + expression_name = curr_field->field_value.u_value.value_string; + TRACE_W("expn_name : '%s'", expression_name); } } curr_field = curr_field->next; } - if (item_exp_id > 0) + if (item_id > 0) { - uint8_t found_item = 0; - l_ezlopi_device_t* curr_device = ezlopi_device_get_head(); - while (curr_device) + + l_ezlopi_item_t* curr_item = ezlopi_device_get_item_by_id(item_id); + if ((curr_item) && (EZLOPI_DEVICE_INTERFACE_DIGITAL_OUTPUT == curr_item->interface_type)) { - l_ezlopi_item_t* curr_item = curr_device->items; - while (curr_item) + cJSON* cj_tmp_value = cJSON_CreateObject(); + if (cj_tmp_value) { - if (item_exp_id == curr_item->cloud_properties.item_id && - EZLOPI_DEVICE_INTERFACE_DIGITAL_OUTPUT == curr_item->interface_type) + curr_item->func(EZLOPI_ACTION_HUB_GET_ITEM, curr_item, (void*)cj_tmp_value, NULL); + cJSON* cj_val = cJSON_GetObjectItem(cj_tmp_value, ezlopi_value_str); + cJSON* cj_valuetype = cJSON_GetObjectItem(cj_tmp_value, ezlopi_valueType_str); + if (cj_val && cj_valuetype) { - cJSON* cj_tmp_value = cJSON_CreateObject(); - if (cj_tmp_value) + cJSON* cj_result_value = cJSON_CreateObject(); + if (cj_result_value) { - curr_item->func(EZLOPI_ACTION_HUB_GET_ITEM, curr_item, (void*)cj_tmp_value, NULL); - cJSON* cj_val = cJSON_GetObjectItem(cj_tmp_value, ezlopi_value_str); - cJSON* cj_valuetype = cJSON_GetObjectItem(cj_tmp_value, ezlopi_valueType_str); - if (cj_val && cj_valuetype) + ret = 1; + cJSON_AddStringToObject(cj_result_value, ezlopi__id_str, __id_string); + + if (0 == strncmp(cj_valuetype->valuestring, value_type_bool, 6)) { - cJSON* cj_result_value = cJSON_CreateObject(); - if (cj_result_value) + TRACE_S("1. getting 'item_id[%d]' ; bool_value = %s ", item_id, cj_val->valuestring); // "false" or "true" + if (0 == strncmp(cj_val->valuestring, "false", 6)) + { + cJSON_AddBoolToObject(cj_result_value, ezlopi_value_str, true); + } + else { - ret = 1; - cJSON_AddStringToObject(cj_result_value, ezlopi__id_str, __id_string); - - if (0 == strncmp(cj_valuetype->valuestring, value_type_bool, 6)) - { - TRACE_S("1. getting 'item_id[%d]' ; bool_value = %s ", item_id, cj_val->valuestring); // "false" or "true" - if (0 == strncmp(cj_val->valuestring, "false", 6)) - { - cJSON_AddBoolToObject(cj_result_value, ezlopi_value_str, true); - } - else - { - cJSON_AddBoolToObject(cj_result_value, ezlopi_value_str, false); - } - - curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_result_value, curr_item->user_arg); - } - else if (0 == strncmp(cj_valuetype->valuestring, value_type_int, 6)) - { - TRACE_S("2. getting 'item_id[%d]' ; int_value = %d ", item_id, (int)cj_val->valuedouble); - if (cj_val->valuedouble == 0) // either '0' or '1'. - { - cJSON_AddNumberToObject(cj_result_value, ezlopi_value_str, 1); - } - else if (cj_val->valuedouble == 1) - { - cJSON_AddNumberToObject(cj_result_value, ezlopi_value_str, 0); - } - - curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_result_value, curr_item->user_arg); - } - else - { - ret = -1; - TRACE_E(" 'item_id[%d]' neither 'boolean' nor 'int' ; Value-type mis-matched! ", item_id); - } - cJSON_Delete(cj_result_value); + cJSON_AddBoolToObject(cj_result_value, ezlopi_value_str, false); } + + curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_result_value, curr_item->user_arg); } + else if (0 == strncmp(cj_valuetype->valuestring, value_type_int, 6)) + { + TRACE_S("2. getting 'item_id[%d]' ; int_value = %d ", item_id, (int)cj_val->valuedouble); + if (cj_val->valuedouble == 0) // either '0' or '1'. + { + cJSON_AddNumberToObject(cj_result_value, ezlopi_value_str, 1); + } + else if (cj_val->valuedouble == 1) + { + cJSON_AddNumberToObject(cj_result_value, ezlopi_value_str, 0); + } + + curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_result_value, curr_item->user_arg); + } + else + { + ret = -1; + TRACE_E(" 'item_id[%d]' neither 'boolean' nor 'int' ; Value-type mis-matched! ", item_id); + } + cJSON_Delete(cj_result_value); } - found_item = 1; - cJSON_Delete(cj_tmp_value); - break; } - curr_item = curr_item->next; } - - if (found_item) - { - break; - } - curr_device = curr_device->next; + cJSON_Delete(cj_tmp_value); } } - else if (NULL !=expression_name) + else if (NULL != expression_name) { s_ezlopi_expressions_t* curr_exp = ezlopi_scenes_get_expression_node_by_name(expression_name); - if(curr_exp) + if (curr_exp) { if (EXPRESSION_VALUE_TYPE_NUMBER == curr_exp->exp_value.type) { - curr_exp->exp_value.u_value.number_value = (0 == curr_exp->exp_value.u_value.number_value)?1:0; + curr_exp->exp_value.u_value.number_value = (0 == curr_exp->exp_value.u_value.number_value) ? 1 : 0; } - else if(EXPRESSION_VALUE_TYPE_BOOL) + else if (EXPRESSION_VALUE_TYPE_BOOL) { - curr_exp->exp_value.u_value.boolean_value = (false == curr_exp->exp_value.u_value.boolean_value)?true:false; + curr_exp->exp_value.u_value.boolean_value = (false == curr_exp->exp_value.u_value.boolean_value) ? true : false; } - } - + } + } } } diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 6c29bd41a..9a162f52f 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -43,71 +43,59 @@ int ezlopi_scene_when_is_item_state(l_scenes_list_v2_t* scene_node, void* arg) if (item_id && value_field) { - l_ezlopi_device_t* curr_device = ezlopi_device_get_head(); - while (curr_device) + l_ezlopi_item_t* curr_item = ezlopi_device_get_item_by_id(item_id); + if (curr_item) { - l_ezlopi_item_t* curr_item = curr_device->items; - while (curr_item) + cJSON* cj_tmp_value = cJSON_CreateObject(); + if (cj_tmp_value) { - if (item_id == curr_item->cloud_properties.item_id) + curr_item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, curr_item, (void*)cj_tmp_value, NULL); + cJSON* cj_value = cJSON_GetObjectItem(cj_tmp_value, ezlopi_value_str); + if (cj_value) { - cJSON* cj_tmp_value = cJSON_CreateObject(); - if (cj_tmp_value) + switch (cj_value->type) { - curr_item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, curr_item, (void*)cj_tmp_value, NULL); - cJSON* cj_value = cJSON_GetObjectItem(cj_tmp_value, ezlopi_value_str); - if (cj_value) + case cJSON_True: + { + if (true == value_field->field_value.u_value.value_bool) { - switch (cj_value->type) - { - case cJSON_True: - { - if (true == value_field->field_value.u_value.value_bool) - { - ret = 1; - } - break; - } - case cJSON_False: - { - if (false == value_field->field_value.u_value.value_bool) - { - ret = 1; - } - break; - } - case cJSON_Number: - { - if (cj_value->valuedouble == value_field->field_value.u_value.value_double) - { - ret = 1; - } - break; - } - case cJSON_String: - { - uint32_t cmp_size = (strlen(cj_value->valuestring) > strlen(value_field->field_value.u_value.value_string)) ? strlen(cj_value->valuestring) : strlen(value_field->field_value.u_value.value_string); - if (0 == strncmp(cj_value->valuestring, value_field->field_value.u_value.value_string, cmp_size)) - { - ret = 1; - } - break; - } - default: - { - TRACE_E("Value type mis-matched!"); - } - } + ret = 1; } - - cJSON_Delete(cj_tmp_value); + break; + } + case cJSON_False: + { + if (false == value_field->field_value.u_value.value_bool) + { + ret = 1; + } + break; + } + case cJSON_Number: + { + if (cj_value->valuedouble == value_field->field_value.u_value.value_double) + { + ret = 1; + } + break; + } + case cJSON_String: + { + uint32_t cmp_size = (strlen(cj_value->valuestring) > strlen(value_field->field_value.u_value.value_string)) ? strlen(cj_value->valuestring) : strlen(value_field->field_value.u_value.value_string); + if (0 == strncmp(cj_value->valuestring, value_field->field_value.u_value.value_string, cmp_size)) + { + ret = 1; + } + break; + } + default: + { + TRACE_E("Value type mis-matched!"); + } } - break; } - curr_item = curr_item->next; + cJSON_Delete(cj_tmp_value); } - - curr_device = curr_device->next; } } } @@ -386,7 +374,7 @@ int ezlopi_scene_when_is_user_lock_operation(l_scenes_list_v2_t* scene_node, voi int ezlopi_scene_when_is_house_mode_changed_to(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" isHouse_modechanged_to"); + TRACE_W(" isHouse_modechanged_to"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -435,7 +423,7 @@ int ezlopi_scene_when_is_house_mode_changed_to(l_scenes_list_v2_t* scene_node, v int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, void* arg) { - //TRACE_W(" isHouse_mode_changed_from"); + TRACE_W(" isHouse_mode_changed_from"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -483,7 +471,7 @@ int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, int ezlopi_scene_when_is_House_Mode_Alarm_Phase_Range(l_scenes_list_v2_t* scene_node, void* arg) { - //TRACE_W(" is_House_Mode_Alarm_Phase_Range "); + TRACE_W(" is_House_Mode_Alarm_Phase_Range "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -518,7 +506,7 @@ int ezlopi_scene_when_is_House_Mode_Alarm_Phase_Range(l_scenes_list_v2_t* scene_ int ezlopi_scene_when_is_House_Mode_Switch_to_Range(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" is_House_Mode_Switch_to_Range "); + TRACE_W(" is_House_Mode_Switch_to_Range "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -541,7 +529,7 @@ int ezlopi_scene_when_is_House_Mode_Switch_to_Range(l_scenes_list_v2_t* scene_no int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" isDevice_state. "); + TRACE_W(" isDevice_state. "); // TRACE_W("Warning: when-method 'is_device_state' not implemented!"); int ret = 0; @@ -580,21 +568,17 @@ int ezlopi_scene_when_is_device_state(l_scenes_list_v2_t* scene_node, void* arg) } if (device_id) { - l_ezlopi_device_t* curr_device = ezlopi_device_get_head(); - while (curr_device) + l_ezlopi_device_t* curr_device = ezlopi_device_get_by_id(device_id); + if (curr_device) { - if (device_id == curr_device->cloud_properties.device_id) + s_ezlopi_cloud_controller_t* controller_info = ezlopi_device_get_controller_information(); + if (controller_info) { - s_ezlopi_cloud_controller_t* controller_info = ezlopi_device_get_controller_information(); - if (controller_info) - { - #warning "we need to change from 'controller' to 'device_id' specific"; - ret = ((value_armed == controller_info->armed) ? 1 : 0); - ret = ((value_reachable == controller_info->service_notification) ? 1 : 0); - } + #warning "we need to change from 'controller' to 'device_id' specific"; + ret = ((value_armed == controller_info->armed) ? 1 : 0); + ret = ((value_reachable == controller_info->service_notification) ? 1 : 0); } - curr_device = curr_device->next; } } #warning "need to check device_group condition"; @@ -611,7 +595,7 @@ int ezlopi_scene_when_is_network_state(l_scenes_list_v2_t* scene_node, void* arg int ezlopi_scene_when_is_scene_state(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" isScene_state "); + TRACE_W(" isScene_state "); // TRACE_W("Warning: when-method 'is_scene_state' not implemented!"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -747,7 +731,7 @@ int ezlopi_scene_when_is_battery_level(l_scenes_list_v2_t* scene_node, void* arg int ezlopi_scene_when_compare_numbers(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" Compare_num "); + TRACE_W(" Compare_num "); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -803,6 +787,7 @@ int ezlopi_scene_when_compare_numbers(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_compare_number_range(l_scenes_list_v2_t* scene_node, void* arg) { + TRACE_W(" Compare_num_range"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -899,7 +884,7 @@ int ezlopi_scene_when_compare_number_range(l_scenes_list_v2_t* scene_node, void* int ezlopi_scene_when_compare_strings(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" Compare_strings "); + TRACE_W(" Compare_strings "); // TRACE_W("Warning: when-method 'compare_strings' not implemented!"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -959,7 +944,7 @@ int ezlopi_scene_when_compare_strings(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_string_operation(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" Compare_string_op "); + TRACE_W(" Compare_string_op "); // TRACE_W("Warning: when-method 'string_operation' not implemented!"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -1017,7 +1002,7 @@ int ezlopi_scene_when_string_operation(l_scenes_list_v2_t* scene_node, void* arg int ezlopi_scene_when_in_array(l_scenes_list_v2_t* scene_node, void* arg) { - // //TRACE_W(" Compare_inArray "); + TRACE_W(" Compare_inArray "); // TRACE_W("Warning: when-method 'in_array' not implemented!"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -1073,7 +1058,7 @@ int ezlopi_scene_when_in_array(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_compare_values(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" Compare_values "); + TRACE_W(" Compare_values "); // TRACE_W("Warning: when-method 'is_group_state' not implemented!"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -1140,7 +1125,7 @@ int ezlopi_scene_when_compare_values(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_has_atleast_one_dictionary_value(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" atleast_one_diction_val "); + TRACE_W(" atleast_one_diction_val "); // TRACE_W("Warning: when-method 'atleast_one_dictionary_value' not implemented!"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -1180,7 +1165,7 @@ int ezlopi_scene_when_has_atleast_one_dictionary_value(l_scenes_list_v2_t* scene int ezlopi_scene_when_is_firmware_update_state(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" firmware_update "); + TRACE_W(" firmware_update "); // TRACE_W("Warning: when-method 'firmware_update_state' not implemented!"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -1224,7 +1209,7 @@ int ezlopi_scene_when_is_firmware_update_state(l_scenes_list_v2_t* scene_node, v int ezlopi_scene_when_is_dictionary_changed(l_scenes_list_v2_t* scene_node, void* arg) { - // TRACE_W(" isDictionary_changed "); + TRACE_W(" isDictionary_changed "); // TRACE_W("Warning: when-method 'is_dictionary_changed' not implemented!"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -1376,7 +1361,6 @@ int ezlopi_scene_when_xor(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_function(l_scenes_list_v2_t* scene_node, void* arg) { /* This funciton can contain only one of the 1. less ,2. least*/ - int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (scene_node && when_block) From c4d410c0f91c31eb5d56b29b24ced9af3743d0e3 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Sun, 28 Apr 2024 12:11:21 +0545 Subject: [PATCH 19/29] refactoring code --- ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c | 4 ++-- ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c index bac54dd6c..a8b02de6c 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.c @@ -500,7 +500,7 @@ int ezlopi_scenes_operators_value_strops_operations(l_fields_v2_t* item_exp_fiel { char* item_exp_value_str = NULL; char* value_to_compare_with = NULL; - uint32_t value_to_compare_with_num = NULL; + uint32_t value_to_compare_with_num = 0; //---------------------- LHS ------------------------- if (EZLOPI_VALUE_TYPE_EXPRESSION == item_exp_field->value_type) @@ -528,7 +528,7 @@ int ezlopi_scenes_operators_value_strops_operations(l_fields_v2_t* item_exp_fiel if (item_exp_value_str && (value_to_compare_with || (value_to_compare_with_num > 0))) { - e_scene_str_cmp_operators_t string_operator = ezlopi_scenes_string_operations_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string); + e_scene_strops_cmp_operators_t string_operator = ezlopi_scenes_strops_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string); switch (string_operator) { diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h index 35a098655..c9e97958c 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h @@ -107,7 +107,7 @@ int ezlopi_scenes_operators_value_without_less_operations(uint32_t item_id, l_fi // CompareValues Operators 'without-less' (default) int ezlopi_scenes_operators_value_comparevalues_without_less_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* value_type_field, l_fields_v2_t* comparator_field); -int ezlopi_scenes_operators_value_comparevalues_with_less_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* value_type_field, l_fields_v2_t* comparator_field); +int ezlopi_scenes_operators_value_comparevalues_with_less_operations(l_fields_v2_t* item_exp_field, l_fields_v2_t* value_field, l_fields_v2_t* value_type_field, l_fields_v2_t* comparator_field); // CompareNumberRange Operators int ezlopi_scenes_operators_value_number_range_operations(uint32_t item_id, l_fields_v2_t* start_value_field, l_fields_v2_t* end_value_field, l_fields_v2_t* comparator_field); From b8618ff99c246876f66bd9099b70038d8bf24f43 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Mon, 29 Apr 2024 12:24:28 +0545 Subject: [PATCH 20/29] need to fix missing function_cj_population --- .../ezlopi-cloud-scenes/CMakeLists.txt | 2 +- .../ezlopi_cloud_scenes_block_list.c | 6 +-- .../ezlopi-core-devices/ezlopi_core_devices.c | 2 + .../ezlopi_core_factory_info.h | 40 ++++++++++++++----- ezlopi-core/ezlopi-core-modes/CMakeLists.txt | 2 +- ezlopi-core/ezlopi-core-scenes/CMakeLists.txt | 2 +- .../ezlopi_core_scenes_delete.c | 1 + .../ezlopi_core_scenes_then_methods.c | 3 +- .../ezlopi_core_scenes_when_methods.c | 3 +- ...ore_scenes_when_methods_helper_functions.c | 8 +++- .../device_0001_digitalOut_generic.c | 2 + .../device_0002_digitalOut_relay.c | 2 + .../device_0003_digitalOut_plug.c | 2 + .../device_0009_other_RMT_SK6812.c | 3 ++ .../device_0022_PWM_dimmable_lamp.c | 2 + .../device_0036_PWM_servo_MG996R.c | 1 + .../device_0038_other_RGB.c | 3 ++ .../ezlopi_service_meshbot.c | 29 +++++++++++++- 18 files changed, 93 insertions(+), 20 deletions(-) diff --git a/ezlopi-cloud/ezlopi-cloud-scenes/CMakeLists.txt b/ezlopi-cloud/ezlopi-cloud-scenes/CMakeLists.txt index 5e7b6f1c7..f0100a51a 100644 --- a/ezlopi-cloud/ezlopi-cloud-scenes/CMakeLists.txt +++ b/ezlopi-cloud/ezlopi-cloud-scenes/CMakeLists.txt @@ -21,7 +21,7 @@ set(EZLOPI_CLOUD_COMPONENTS ) -idf_component_register(SRCS "ezlopi_cloud_scenes.c" "ezlopi_cloud_scenes_block_list.c" "ezlopi_cloud_scenes_block_data_list.c" "${src_files}" +idf_component_register(SRCS "ezlopi_cloud_scenes_scripts.c" "ezlopi_cloud_scenes.c" "ezlopi_cloud_scenes_block_list.c" "ezlopi_cloud_scenes_block_data_list.c" "${src_files}" INCLUDE_DIRS "." REQUIRES ${ESP_COMPONENTS} diff --git a/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes_block_list.c b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes_block_list.c index 477af1aa2..147cfa5f4 100644 --- a/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes_block_list.c +++ b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes_block_list.c @@ -169,16 +169,16 @@ static cJSON* __add_scenes_blocks_by_item_ids(e_scenes_block_type_v2_t block_typ l_scenes_list_v2_t* scene_node = ezlopi_scenes_get_scenes_head_v2(); while (scene_node) { - TRACE_D("Here"); + // TRACE_D("Here"); switch (block_type) { case SCENE_BLOCK_TYPE_WHEN: { - TRACE_D("Here"); + // TRACE_D("Here"); if (scene_node->when_block) { - TRACE_D("Here"); + // TRACE_D("Here"); if (__found_item_in_field(scene_node->when_block->fields, item_list->cloud_properties.item_id)) { TRACE_D("Here"); diff --git a/ezlopi-core/ezlopi-core-devices/ezlopi_core_devices.c b/ezlopi-core/ezlopi-core-devices/ezlopi_core_devices.c index 2c56ea39d..4787d7bcb 100644 --- a/ezlopi-core/ezlopi-core-devices/ezlopi_core_devices.c +++ b/ezlopi-core/ezlopi-core-devices/ezlopi_core_devices.c @@ -160,6 +160,8 @@ l_ezlopi_device_t* ezlopi_device_add_device(cJSON* cj_device, const char* last_n } TRACE_D("Device Id (after): %08x", new_device->cloud_properties.device_id); + TRACE_S("") + if (NULL == l_device_head) { diff --git a/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h b/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h index 2c2a01ea2..b44f8c1f5 100644 --- a/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h +++ b/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h @@ -162,23 +162,45 @@ extern "C" \"cmd\": 3,\ \"dev_detail\":\ [\ + {\ + \"dev_type\": 1,\ + \"dev_name\": \"switch_temp\",\ + \"id_room\": \"\",\ + \"id_item\": 2,\ + \"gpio_in\": 0,\ + \"gpio_out\": 5,\ + \"pullup_ip\": false,\ + \"pullup_op\": false,\ + \"is_ip\": false,\ + \"ip_inv\": false,\ + \"op_inv\": false,\ + \"val_ip\": false,\ + \"val_op\": false\ + },\ + {\ + \"dev_type\": 1,\ + \"dev_name\": \"for_test\",\ + \"id_room\": \"\",\ + \"id_item\": 2,\ + \"gpio_in\": 0,\ + \"gpio_out\": 8,\ + \"pullup_ip\": false,\ + \"pullup_op\": false,\ + \"is_ip\": false,\ + \"ip_inv\": false,\ + \"op_inv\": false,\ + \"val_ip\": false,\ + \"val_op\": false\ + },\ {\ \"dev_type\": 7,\ \"dev_name\": \"temp_humi\",\ \"id_room\": \"\",\ \"id_item\": 16,\ \"gpio\": 18\ - },\ - {\ - \"dev_type\": 3,\ - \"dev_name\": \"pot\",\ - \"id_room\": \"\",\ - \"id_item\": 70,\ - \"gpio\": 5,\ - \"resln_bit\": 3\ }\ ], \ - \"dev_total\": 5}"; + \"dev_total\": 2}"; #endif diff --git a/ezlopi-core/ezlopi-core-modes/CMakeLists.txt b/ezlopi-core/ezlopi-core-modes/CMakeLists.txt index 1fbc876d4..ccb4e250e 100644 --- a/ezlopi-core/ezlopi-core-modes/CMakeLists.txt +++ b/ezlopi-core/ezlopi-core-modes/CMakeLists.txt @@ -19,7 +19,7 @@ set(EZLOPI_SERVICE_COMPONENTS ) -idf_component_register(SRCS "ezlopi_core_modes_cjson.c" "ezlopi_core_modes.c" "${config_src}" +idf_component_register(SRCS "ezlopi_core_default_modes.c" "ezlopi_core_modes_cjson.c" "ezlopi_core_modes.c" "${config_src}" INCLUDE_DIRS "." REQUIRES ${EZLOPI_CORE_COMPONENTS} ${EZLOPI_HAL_COMPONENTS} diff --git a/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt b/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt index 6ed519756..15595d731 100644 --- a/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt +++ b/ezlopi-core/ezlopi-core-scenes/CMakeLists.txt @@ -1,6 +1,6 @@ file(GLOB_RECURSE scene_src "*.c") -idf_component_register(SRCS "ezlopi_core_scenes_operators.c" "ezlopi_core_scenes_then_methods.c" "ezlopi_core_scenes_status_changed.c" "ezlopi_core_scenes_notifications.c" "ezlopi_core_scenes_expressions.c" "ezlopi_core_scenes_edit.c" "ezlopi_core_scenes_cjson.c" "ezlopi_core_scenes_v2.c" "ezlopi_core_scenes_print.c" "ezlopi_core_scenes_when_methods_helper_functions.c" "ezlopi_core_scenes_then_methods_helper_func.c" "ezlopi_core_scenes_when_methods.c" "ezlopi_core_scenes_scripts.c" "${scene_src}" +idf_component_register(SRCS "ezlopi_core_scenes_delete.c" "ezlopi_core_scenes_operators.c" "ezlopi_core_scenes_then_methods.c" "ezlopi_core_scenes_status_changed.c" "ezlopi_core_scenes_notifications.c" "ezlopi_core_scenes_expressions.c" "ezlopi_core_scenes_edit.c" "ezlopi_core_scenes_cjson.c" "ezlopi_core_scenes_v2.c" "ezlopi_core_scenes_print.c" "ezlopi_core_scenes_when_methods_helper_functions.c" "ezlopi_core_scenes_then_methods_helper_func.c" "ezlopi_core_scenes_when_methods.c" "ezlopi_core_scenes_scripts.c" "${scene_src}" INCLUDE_DIRS "." REQUIRES core ) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c index 5db8a8104..6d3af71c1 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c @@ -77,6 +77,7 @@ void ezlopi_scenes_delete(l_scenes_list_v2_t* scenes_list) ezlopi_scenes_delete_action_blocks(scenes_list->else_block); ezlopi_scenes_delete_when_blocks(scenes_list->when_block); + #warning "void* thread_ctx" need to be freed here; ezlopi_scenes_delete(scenes_list->next); scenes_list->next = NULL; free(scenes_list); diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 9b2504a10..f4e58754b 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -67,12 +67,13 @@ int ezlopi_scene_then_set_item_value(l_scenes_list_v2_t* curr_scene, void* arg) if (curr_item) { curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_params, curr_item->user_arg); + ret = 1; } } } cJSON_Delete(cj_params); } - + TRACE_W(" Set_item_value -> ret = %d", ret); return ret; } int ezlopi_scene_then_set_device_armed(l_scenes_list_v2_t* curr_scene, void* arg) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 9a162f52f..8dddaaff4 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -1360,6 +1360,7 @@ int ezlopi_scene_when_xor(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_function(l_scenes_list_v2_t* scene_node, void* arg) { + TRACE_W("when_func_here!"); /* This funciton can contain only one of the 1. less ,2. least*/ int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -1378,7 +1379,6 @@ int ezlopi_scene_when_function(l_scenes_list_v2_t* scene_node, void* arg) scene_node->when_block->fields->user_arg = (void*)function_state_info; } } - const s_function_opr_t __when_funtion_opr[] = { {.opr_name = "for", .opr_method = when_function_for_opr}, {.opr_name = "repeat", .opr_method = when_function_for_repeat}, @@ -1393,6 +1393,7 @@ int ezlopi_scene_when_function(l_scenes_list_v2_t* scene_node, void* arg) { if (NULL != (cj_func_opr = cJSON_GetObjectItem(function_obj, __when_funtion_opr[i].opr_name))) { + TRACE_D("when_func_here![%d]", i); ret = (__when_funtion_opr[i].opr_method)(scene_node, when_block, cj_func_opr); break; } diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c index 02bf9bc2b..8bae1d3de 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c @@ -969,6 +969,7 @@ int isdate_range_check_flag_result(uint8_t flag_check) int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) { + TRACE_W("for_least"); int ret = 0; if (scene_node && when_block && cj_func_opr) { @@ -1001,17 +1002,21 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe if ((transition_state == 1) && (0 == function_state_info->current_state)) { + TRACE_W("Here-1"); function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); } else if ((transition_state == 0) && (1 == function_state_info->current_state)) { + TRACE_W("Here-2"); if (0 != function_state_info->transtion_instant) { + TRACE_W("Here-3"); int threshold_time = cJSON_GetNumberValue(for_interval); if (0 == strncmp(for_less_least, "less", 5)) { if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) < threshold_time) { + TRACE_W("Here-less"); ret = 1; } } @@ -1019,6 +1024,7 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe { if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) >= threshold_time) { + TRACE_W("Here-alleast"); ret = 1; } } @@ -1033,7 +1039,7 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe } } } - + TRACE_W("for_least -> ret = %d", ret); return ret; } int when_function_for_repeat(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) diff --git a/ezlopi-sensors-devices/device-0001-digitalOut-generic/device_0001_digitalOut_generic.c b/ezlopi-sensors-devices/device-0001-digitalOut-generic/device_0001_digitalOut_generic.c index 3df7d028d..c0e07805f 100644 --- a/ezlopi-sensors-devices/device-0001-digitalOut-generic/device_0001_digitalOut_generic.c +++ b/ezlopi-sensors-devices/device-0001-digitalOut-generic/device_0001_digitalOut_generic.c @@ -529,6 +529,7 @@ static int __set_value(l_ezlopi_item_t* item, void* arg) { __set_gpio_value(item, value); ezlopi_device_value_updated_from_device_v3(item); + ret = 1; } } else @@ -545,6 +546,7 @@ static int __set_value(l_ezlopi_item_t* item, void* arg) TRACE_D("value: %d", value); __set_gpio_value(curr_item, value); ezlopi_device_value_updated_from_device_v3(curr_item); + ret = 1; } curr_item = curr_item->next; } diff --git a/ezlopi-sensors-devices/device-0002-digitalOut-relay/device_0002_digitalOut_relay.c b/ezlopi-sensors-devices/device-0002-digitalOut-relay/device_0002_digitalOut_relay.c index b512321f4..f342bca75 100644 --- a/ezlopi-sensors-devices/device-0002-digitalOut-relay/device_0002_digitalOut_relay.c +++ b/ezlopi-sensors-devices/device-0002-digitalOut-relay/device_0002_digitalOut_relay.c @@ -269,6 +269,7 @@ static int __set_value(l_ezlopi_item_t* item, void* arg) { __set_gpio_value(item, value); ezlopi_device_value_updated_from_device_v3(item); + ret = 1; } } else @@ -286,6 +287,7 @@ static int __set_value(l_ezlopi_item_t* item, void* arg) TRACE_D("value: %d", value); __set_gpio_value(curr_item, value); ezlopi_device_value_updated_from_device_v3(curr_item); + ret = 1; } curr_item = curr_item->next; } diff --git a/ezlopi-sensors-devices/device-0003-digitalOut-plug/device_0003_digitalOut_plug.c b/ezlopi-sensors-devices/device-0003-digitalOut-plug/device_0003_digitalOut_plug.c index e38a2a01f..d4a0b2f48 100644 --- a/ezlopi-sensors-devices/device-0003-digitalOut-plug/device_0003_digitalOut_plug.c +++ b/ezlopi-sensors-devices/device-0003-digitalOut-plug/device_0003_digitalOut_plug.c @@ -272,6 +272,7 @@ static int __set_value(l_ezlopi_item_t* item, void* arg) { __set_gpio_value(item, value); ezlopi_device_value_updated_from_device_v3(item); + ret = 1; } } else @@ -288,6 +289,7 @@ static int __set_value(l_ezlopi_item_t* item, void* arg) TRACE_D("value: %d", value); __set_gpio_value(curr_item, value); ezlopi_device_value_updated_from_device_v3(curr_item); + ret = 1; } curr_item = curr_item->next; } diff --git a/ezlopi-sensors-devices/device-0009-other-RMT-SK6812/device_0009_other_RMT_SK6812.c b/ezlopi-sensors-devices/device-0009-other-RMT-SK6812/device_0009_other_RMT_SK6812.c index e72467f81..cd9ffa03d 100644 --- a/ezlopi-sensors-devices/device-0009-other-RMT-SK6812/device_0009_other_RMT_SK6812.c +++ b/ezlopi-sensors-devices/device-0009-other-RMT-SK6812/device_0009_other_RMT_SK6812.c @@ -144,6 +144,7 @@ static int __set_cjson_value(l_ezlopi_item_t* item, void* arg) led_strip_flush(&dimmer_args->sk6812_strip); ezlopi_device_value_updated_from_device_v3(dimmer_args->dimmer_item); + ret = 1; } else if (ezlopi_item_name_dimmer == item->cloud_properties.item_name) { @@ -154,6 +155,7 @@ static int __set_cjson_value(l_ezlopi_item_t* item, void* arg) led_strip_flush(&dimmer_args->sk6812_strip); ezlopi_device_value_updated_from_device_v3(dimmer_args->switch_item); + ret = 1; } else if (ezlopi_item_name_switch == item->cloud_properties.item_name) { @@ -165,6 +167,7 @@ static int __set_cjson_value(l_ezlopi_item_t* item, void* arg) led_strip_flush(&dimmer_args->sk6812_strip); ezlopi_device_value_updated_from_device_v3(dimmer_args->dimmer_item); + ret = 1; } else { diff --git a/ezlopi-sensors-devices/device-0022-PWM-dimmable-lamp/device_0022_PWM_dimmable_lamp.c b/ezlopi-sensors-devices/device-0022-PWM-dimmable-lamp/device_0022_PWM_dimmable_lamp.c index d08ebbfb9..ccb9e4e4c 100644 --- a/ezlopi-sensors-devices/device-0022-PWM-dimmable-lamp/device_0022_PWM_dimmable_lamp.c +++ b/ezlopi-sensors-devices/device-0022-PWM-dimmable-lamp/device_0022_PWM_dimmable_lamp.c @@ -91,6 +91,7 @@ static int __set_cjson_value(l_ezlopi_item_t* item, void* arg) dimmable_bulb_arg->current_brightness_value = target_value; ezlopi_device_value_updated_from_device_v3(dimmable_bulb_arg->item_dimmer); ezlopi_device_value_updated_from_device_v3(dimmable_bulb_arg->item_dimmer_switch); + ret = 1; } else if (ezlopi_item_name_switch == item->cloud_properties.item_name) { @@ -101,6 +102,7 @@ static int __set_cjson_value(l_ezlopi_item_t* item, void* arg) ezlopi_pwm_change_duty(dimmable_bulb_arg->item_dimmer->interface.pwm.channel, dimmable_bulb_arg->item_dimmer->interface.pwm.speed_mode, dimmable_bulb_arg->current_brightness_value); ezlopi_device_value_updated_from_device_v3(dimmable_bulb_arg->item_dimmer); ezlopi_device_value_updated_from_device_v3(dimmable_bulb_arg->item_dimmer_switch); + ret = 1; } } } diff --git a/ezlopi-sensors-devices/device-0036-PWM-servo-MG996R/device_0036_PWM_servo_MG996R.c b/ezlopi-sensors-devices/device-0036-PWM-servo-MG996R/device_0036_PWM_servo_MG996R.c index 30df748dd..641e56eb2 100644 --- a/ezlopi-sensors-devices/device-0036-PWM-servo-MG996R/device_0036_PWM_servo_MG996R.c +++ b/ezlopi-sensors-devices/device-0036-PWM-servo-MG996R/device_0036_PWM_servo_MG996R.c @@ -166,6 +166,7 @@ static int __set_cjson_value(l_ezlopi_item_t* item, void* arg) int target_value = (int)(((value * 17) / 100) + 13); TRACE_I("target value: %d", target_value); ezlopi_pwm_change_duty(item->interface.pwm.channel, item->interface.pwm.speed_mode, target_value); + ret = 1; } } } diff --git a/ezlopi-sensors-devices/device-0038-other-RGB/device_0038_other_RGB.c b/ezlopi-sensors-devices/device-0038-other-RGB/device_0038_other_RGB.c index 0f1921868..fb3778220 100644 --- a/ezlopi-sensors-devices/device-0038-other-RGB/device_0038_other_RGB.c +++ b/ezlopi-sensors-devices/device-0038-other-RGB/device_0038_other_RGB.c @@ -141,6 +141,7 @@ static int __set_cjson_value(l_ezlopi_item_t* item, void* arg) CJSON_GET_VALUE_DOUBLE(cjson_params_rgb_values, ezlopi_blue_str, rgb_args->blue_struct.value); RGB_LED_change_color_value(rgb_args); + ret = 1; } if (ezlopi_item_name_switch == item->cloud_properties.item_name) { @@ -152,6 +153,7 @@ static int __set_cjson_value(l_ezlopi_item_t* item, void* arg) (uint8_t)(rgb_args->blue_struct.value * rgb_args->brightness)); RGB_LED_change_color_value(rgb_args); ezlopi_device_value_updated_from_device_v3(rgb_args->RGB_LED_dimmer_item); + ret = 1; } if (ezlopi_item_name_dimmer == item->cloud_properties.item_name) { @@ -162,6 +164,7 @@ static int __set_cjson_value(l_ezlopi_item_t* item, void* arg) rgb_args->brightness = dim_brightness_factor; RGB_LED_change_color_value(rgb_args); ezlopi_device_value_updated_from_device_v3(rgb_args->RGB_LED_onoff_switch_item); + ret = 1; } } } diff --git a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c index 8cdf6e971..819731786 100644 --- a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c +++ b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c @@ -13,6 +13,7 @@ typedef struct s_thread_ctx { + char* scene_name; struct pt pt; uint32_t curr_ticks; uint32_t start_cond; @@ -178,9 +179,10 @@ void ezlopi_scenes_meshbot_init(void) l_scenes_list_v2_t* scene_node = ezlopi_scenes_get_scenes_head_v2(); while (scene_node) { + scene_node->status = EZLOPI_SCENE_STATUS_STOPPED; if (scene_node->enabled && scene_node->when_block && (scene_node->else_block || scene_node->then_block)) - // if (scene_node->when_block && (scene_node->else_block || scene_node->then_block)) + // if (scene_node->when_block && (scene_node->else_block || scene_node->then_block)) { start_thread = 1; @@ -195,8 +197,29 @@ void ezlopi_scenes_meshbot_init(void) } else { + TRACE_Dw("scene_en->%s , scene_node->when:%s , (scene_node->then:%s | scene_node->else:%s)", + (scene_node->enabled) ? "true" : "false", + (NULL == scene_node->when_block) ? "empty" : scene_node->when_block->block_options.method.name, + (NULL == scene_node->then_block) ? "empty" : scene_node->then_block->block_options.method.name, + (NULL == scene_node->else_block) ? "empty" : scene_node->else_block->block_options.method.name); + + if (NULL != scene_node->when_block->block_options) + { + char* str = cJSON_Print(scene_node->when_block->block_options); + if (str) + { + TRACE_D(" function_cjson : %s", str); + free(str); + } + + } + else + { + TRACE_E("functions_missing in when_block"); + } scene_node->status = EZLOPI_SCENE_STATUS_STOPPED; } + TRACE_W("scenes_meshbot init process, [%d]", start_thread); scene_node = scene_node->next; } @@ -231,9 +254,11 @@ PT_THREAD(__scene_proto_thread(l_scenes_list_v2_t* scene_node, uint32_t routine_ f_scene_method_v2_t when_method = ezlopi_scene_get_method_v2(when_condition_node->block_options.method.type); if (when_method) { + TRACE_S("when_block_name {%s}", scene_node->when_block->block_options.method.name); when_condition_returned = when_method(scene_node, (void*)when_condition_node); if (when_condition_returned) { + TRACE_S("when_ret=>1"); if (ctx->start_cond < 2) { ctx->stopped_cond = 0; @@ -374,7 +399,7 @@ PT_THREAD(__scene_proto_thread(l_scenes_list_v2_t* scene_node, uint32_t routine_ TRACE_D("entering delay: %d", ctx->curr_ticks); PT_WAIT_UNTIL(&ctx->pt, (xTaskGetTickCount() - ctx->curr_ticks) > routine_delay_ms); - + TRACE_D("waited for: %d", (xTaskGetTickCount() - ctx->curr_ticks)); TRACE_D("exiting delay: %d", xTaskGetTickCount()); } From 23ed1384b6e09d45cacd629d70e69a2f3b7bfd8c Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Mon, 29 Apr 2024 18:40:48 +0545 Subject: [PATCH 21/29] refactored tested code --- .../ezlopi_cloud_keywords.c | 1 + .../ezlopi_cloud_keywords.h | 1 + .../ezlopi_core_scenes_print.c | 18 +++++++++++----- .../ezlopi_core_scenes_v2.c | 21 ++++++++++++++++--- .../ezlopi_core_scenes_when_methods.c | 4 +--- ...ore_scenes_when_methods_helper_functions.c | 8 ++----- .../ezlopi_service_meshbot.c | 18 +++++----------- 7 files changed, 41 insertions(+), 30 deletions(-) diff --git a/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.c b/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.c index ad60b7e79..389500eda 100644 --- a/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.c +++ b/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.c @@ -13,6 +13,7 @@ const char* ezlopi_sender_str = "sender"; const char* ezlopi_name_str = "name"; const char* ezlopi_value_str = "value"; const char* ezlopi_method_str = "method"; +const char* ezlopi_function_str = "function"; const char* ezlopi_msg_id_str = "msg_id"; // message counter, number of data transferred to ezlopi-cloud const char* ezlopi_msg_subclass_str = "msg_subclass"; const char* ezlopi_ui_broadcast_str = "ui_broadcast"; diff --git a/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.h b/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.h index cb7e71e5a..2989cb814 100644 --- a/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.h +++ b/ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.h @@ -14,6 +14,7 @@ extern const char* ezlopi_sender_str; extern const char* ezlopi_name_str; extern const char* ezlopi_value_str; extern const char* ezlopi_method_str; +extern const char* ezlopi_function_str; extern const char* ezlopi_msg_id_str; // message counter, number of data transferred to ezlopi-cloud extern const char* ezlopi_msg_subclass_str; extern const char* ezlopi_ui_broadcast_str; diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_print.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_print.c index e8ca01d94..6892b8971 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_print.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_print.c @@ -22,6 +22,14 @@ void ezlopi_print_block_options(s_block_options_v2_t* block_options, l_fields_v2 TRACE_D("\t\t\t\t\t|-- %s: %s", fields->name, fields->name); fields = fields->next; } + + if (0 == strncmp(ezlopi_function_str, block_options->method.name, 9) && (NULL != block_options->cj_function)) + { + TRACE_D("\t\t\t|-- function"); + CJSON_TRACE("\t\t\t\t|-- ", block_options->cj_function); + } + + #endif } @@ -180,7 +188,7 @@ void ezlopi_print_house_modes(l_house_modes_v2_t* house_modes) { TRACE_D("\t\t|-- %s", house_modes->house_mode); house_modes = house_modes->next; -} + } #endif } @@ -192,7 +200,7 @@ void ezlopi_print_user_notifications(l_user_notification_v2_t* user_notification { TRACE_D("\t\t|-- %s", user_notification->user_id); user_notification = user_notification->next; -} + } #endif } @@ -206,7 +214,7 @@ void ezlopi_print_when_blocks(l_when_block_v2_t* when_blocks) TRACE_D("\t\t|-- blockType: when"); ezlopi_print_fields(when_blocks->fields); when_blocks = when_blocks->next; -} + } #endif } @@ -229,7 +237,7 @@ void ezlopi_print_action_blocks(l_action_block_v2_t* action_block) { TRACE_D("\t\t|--"); } -} + } #endif } @@ -256,6 +264,6 @@ void ezlopi_scenes_print(l_scenes_list_v2_t* scene_link_list) vTaskDelay(10); scene_link_list = scene_link_list->next; -} + } #endif } \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_v2.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_v2.c index 61c80a943..267c66339 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_v2.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_v2.c @@ -11,6 +11,7 @@ #include "ezlopi_core_factory_info.h" #include "ezlopi_core_scenes_value.h" #include "ezlopi_core_scenes_print.h" +#include "ezlopi_core_scenes_methods.h" #include "ezlopi_core_scenes_when_methods.h" #include "ezlopi_core_scenes_then_methods.h" #include "ezlopi_core_scenes_status_changed.h" @@ -500,7 +501,12 @@ static l_scenes_list_v2_t* __new_scene_populate(cJSON* cj_scene, uint32_t scene_ new_scene->task_handle = NULL; new_scene->status = EZLOPI_SCENE_STATUS_STOPPED; - CJSON_GET_VALUE_DOUBLE(cj_scene, ezlopi_enabled_str, new_scene->enabled); + CJSON_GET_VALUE_BOOL(cj_scene, ezlopi_enabled_str, new_scene->enabled); + #warning " remove if statement ; only for testing purpose "; + if (false == new_scene->enabled) { + new_scene->enabled = true; + } + CJSON_GET_VALUE_DOUBLE(cj_scene, ezlopi_is_group_str, new_scene->is_group); { @@ -782,6 +788,16 @@ static void _____new_block_options_populate(s_block_options_v2_t* p_block_option { __new_method_populate(&p_block_options->method, cj_method); } + + if (0 == strncmp(ezlopi_function_str, p_block_options->method.name, 9)) + { + cJSON* cj_func = cJSON_GetObjectItem(cj_block_options, ezlopi_function_str); + if (cj_func) + { + p_block_options->cj_function = cJSON_Duplicate(cj_func, cJSON_True); + } + } + } static void __new_method_populate(s_method_v2_t* p_method, cJSON* cj_method) @@ -915,7 +931,6 @@ static void _______fields_get_value(l_fields_v2_t* field, cJSON* cj_value) { int block_idx = 0; cJSON* cj_block = NULL; - CJSON_TRACE("value", cj_value); switch (field->value_type) { @@ -935,7 +950,7 @@ static void _______fields_get_value(l_fields_v2_t* field, cJSON* cj_value) field->field_value.e_type = VALUE_TYPE_BLOCK; while (NULL != (cj_block = cJSON_GetArrayItem(cj_value, block_idx++))) { - CJSON_TRACE("cj_block", cj_block); + // CJSON_TRACE("cj_block", cj_block); if (field->field_value.u_value.when_block) { diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 8dddaaff4..3a8317c83 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -1360,8 +1360,6 @@ int ezlopi_scene_when_xor(l_scenes_list_v2_t* scene_node, void* arg) int ezlopi_scene_when_function(l_scenes_list_v2_t* scene_node, void* arg) { - TRACE_W("when_func_here!"); - /* This funciton can contain only one of the 1. less ,2. least*/ int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (scene_node && when_block) @@ -1393,7 +1391,7 @@ int ezlopi_scene_when_function(l_scenes_list_v2_t* scene_node, void* arg) { if (NULL != (cj_func_opr = cJSON_GetObjectItem(function_obj, __when_funtion_opr[i].opr_name))) { - TRACE_D("when_func_here![%d]", i); + TRACE_S("when_func_here->[%d]", i); ret = (__when_funtion_opr[i].opr_method)(scene_node, when_block, cj_func_opr); break; } diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c index 8bae1d3de..d0663fff5 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c @@ -969,7 +969,7 @@ int isdate_range_check_flag_result(uint8_t flag_check) int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) { - TRACE_W("for_least"); + // TRACE_W("for_least"); int ret = 0; if (scene_node && when_block && cj_func_opr) { @@ -1002,15 +1002,12 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe if ((transition_state == 1) && (0 == function_state_info->current_state)) { - TRACE_W("Here-1"); function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); } else if ((transition_state == 0) && (1 == function_state_info->current_state)) { - TRACE_W("Here-2"); if (0 != function_state_info->transtion_instant) { - TRACE_W("Here-3"); int threshold_time = cJSON_GetNumberValue(for_interval); if (0 == strncmp(for_less_least, "less", 5)) { @@ -1028,8 +1025,8 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe ret = 1; } } + // TRACE_I("end_Transtion_time[%d] , duration_time[%d] , threshold[%d]", function_state_info->transtion_instant / 1000, (uint32_t)xTaskGetTickCount() / 1000, threshold_time); } - TRACE_S("for_Transtion_time[%d]", function_state_info->transtion_instant); } function_state_info->current_state = transition_state; } @@ -1039,7 +1036,6 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe } } } - TRACE_W("for_least -> ret = %d", ret); return ret; } int when_function_for_repeat(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) diff --git a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c index 819731786..ddae2961b 100644 --- a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c +++ b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c @@ -13,7 +13,6 @@ typedef struct s_thread_ctx { - char* scene_name; struct pt pt; uint32_t curr_ticks; uint32_t start_cond; @@ -179,7 +178,6 @@ void ezlopi_scenes_meshbot_init(void) l_scenes_list_v2_t* scene_node = ezlopi_scenes_get_scenes_head_v2(); while (scene_node) { - scene_node->status = EZLOPI_SCENE_STATUS_STOPPED; if (scene_node->enabled && scene_node->when_block && (scene_node->else_block || scene_node->then_block)) // if (scene_node->when_block && (scene_node->else_block || scene_node->then_block)) @@ -197,25 +195,20 @@ void ezlopi_scenes_meshbot_init(void) } else { - TRACE_Dw("scene_en->%s , scene_node->when:%s , (scene_node->then:%s | scene_node->else:%s)", + TRACE_S("scene_en ->%s , scene_node->when:%s , (scene_node->then:%s | scene_node->else:%s)", (scene_node->enabled) ? "true" : "false", (NULL == scene_node->when_block) ? "empty" : scene_node->when_block->block_options.method.name, (NULL == scene_node->then_block) ? "empty" : scene_node->then_block->block_options.method.name, (NULL == scene_node->else_block) ? "empty" : scene_node->else_block->block_options.method.name); - if (NULL != scene_node->when_block->block_options) + if (NULL != scene_node->when_block->block_options.cj_function) { - char* str = cJSON_Print(scene_node->when_block->block_options); + char* str = cJSON_Print(scene_node->when_block->block_options.cj_function); if (str) { - TRACE_D(" function_cjson : %s", str); + TRACE_D("function_cjson : %s", str); free(str); } - - } - else - { - TRACE_E("functions_missing in when_block"); } scene_node->status = EZLOPI_SCENE_STATUS_STOPPED; } @@ -254,11 +247,10 @@ PT_THREAD(__scene_proto_thread(l_scenes_list_v2_t* scene_node, uint32_t routine_ f_scene_method_v2_t when_method = ezlopi_scene_get_method_v2(when_condition_node->block_options.method.type); if (when_method) { - TRACE_S("when_block_name {%s}", scene_node->when_block->block_options.method.name); when_condition_returned = when_method(scene_node, (void*)when_condition_node); if (when_condition_returned) { - TRACE_S("when_ret=>1"); + TRACE_S("when_ret => 1"); if (ctx->start_cond < 2) { ctx->stopped_cond = 0; From 7fd02ebbb0f4cd7b06f019a0cba46be98c47345f Mon Sep 17 00:00:00 2001 From: lomasSE89 Date: Mon, 29 Apr 2024 23:28:35 +0545 Subject: [PATCH 22/29] added cJSON fix and other. --- ezlopi-components/cjext/cjext.c | 618 +++++++----------- ezlopi-components/cjext/cjext.h | 340 +++------- ezlopi-components/cjext/cjext_utils.c | 87 ++- ezlopi-components/cjext/cjext_utils.h | 29 +- .../ezlopi_core_factory_info.h | 18 +- ezlopi-main/CMakeLists.txt | 1 + ezlopi-main/Kconfig.projbuild | 20 +- ezlopi-main/ezlopi_main.c | 58 +- .../ezlopi_service_ble_security.c | 4 +- .../ezlopi-service-uart/ezlopi_service_uart.c | 33 +- .../ezlopi-service-uart/ezlopi_service_uart.h | 4 +- ezlopi-user-config/CMakeLists.txt | 1 + ezlopi-user-config/EZLOPI_USER_CONFIG.h | 26 +- ezlopi-util/ezlopi-util-heap/CMakeLists.txt | 10 + .../ezlopi-util-heap/ezlopi_util_heap.c | 185 ++++++ .../ezlopi-util-heap/ezlopi_util_heap.h | 16 + sdkconfig | 7 +- sdkconfig.old | 11 +- 18 files changed, 706 insertions(+), 762 deletions(-) create mode 100644 ezlopi-util/ezlopi-util-heap/CMakeLists.txt create mode 100644 ezlopi-util/ezlopi-util-heap/ezlopi_util_heap.c create mode 100644 ezlopi-util/ezlopi-util-heap/ezlopi_util_heap.h diff --git a/ezlopi-components/cjext/cjext.c b/ezlopi-components/cjext/cjext.c index ebf91c165..dd9c4f795 100644 --- a/ezlopi-components/cjext/cjext.c +++ b/ezlopi-components/cjext/cjext.c @@ -22,42 +22,24 @@ /* cJSON */ /* JSON parser in C. */ - -/* disable warnings about old C89 functions in MSVC */ -#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) -#define _CRT_SECURE_NO_DEPRECATE -#endif - -#ifdef __GNUC__ -#pragma GCC visibility push(default) -#endif -#if defined(_MSC_VER) -#pragma warning(push) -/* disable warning about single line comments in system headers */ -#pragma warning(disable : 4001) -#endif - #include #include #include -#include #include #include #include -#ifdef ENABLE_LOCALES -#include -#endif - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif -#ifdef __GNUC__ -#pragma GCC visibility pop -#endif - #include "cjext.h" #include "ezlopi_util_trace.h" +#include "EZLOPI_USER_CONFIG.h" + + +typedef struct +{ + const unsigned char* json; + size_t position; +} error; + /* define our own boolean type */ #ifdef true @@ -86,21 +68,19 @@ #endif #endif -typedef struct -{ - const unsigned char* json; - size_t position; -} error; +/* strlen of character literals resolved at compile time */ +#define static_strlen(string_literal) (sizeof(string_literal) - 1) static error global_error = { NULL, 0 }; -CJSON_PUBLIC(const char*) -cJSON_GetErrorPtr(void) + + + +const char *cJSON_GetErrorPtr(void) { return (const char*)(global_error.json + global_error.position); } -CJSON_PUBLIC(char*) -cJSON_GetStringValue(const cJSON* const item) +char *cJSON_GetStringValue(const cJSON* const item) { if (!cJSON_IsString(item)) { @@ -110,8 +90,7 @@ cJSON_GetStringValue(const cJSON* const item) return item->valuestring; } -CJSON_PUBLIC(double) -cJSON_GetNumberValue(const cJSON* const item) +double cJSON_GetNumberValue(const cJSON* const item) { if (!cJSON_IsNumber(item)) { @@ -121,13 +100,7 @@ cJSON_GetNumberValue(const cJSON* const item) return item->valuedouble; } -/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ -#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 17) -#error cJSON.h and cJSON.c have different versions. Make sure that both have the same. -#endif - -CJSON_PUBLIC(const char*) -cJSON_Version(void) +const char *cJSON_Version(void) { static char version[15]; sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); @@ -159,39 +132,9 @@ static int case_insensitive_strcmp(const unsigned char* string1, const unsigned return tolower(*string1) - tolower(*string2); } -typedef struct internal_hooks -{ - void* (CJSON_CDECL* allocate)(size_t size); - void(CJSON_CDECL* deallocate)(void* pointer); - void* (CJSON_CDECL* reallocate)(void* pointer, size_t size); -} internal_hooks; - -#if defined(_MSC_VER) -/* work around MSVC error C2322: '...' address of dllimport '...' is not static */ -static void* CJSON_CDECL internal_malloc(size_t size) -{ - return malloc(size); -} -static void CJSON_CDECL internal_free(void* pointer) -{ - free(pointer); -} -static void* CJSON_CDECL internal_realloc(void* pointer, size_t size) -{ - return realloc(pointer, size); -} -#else -#define internal_malloc malloc -#define internal_free free -#define internal_realloc realloc -#endif - -/* strlen of character literals resolved at compile time */ -#define static_strlen(string_literal) (sizeof(string_literal) - sizeof("")) - -static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; +// static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; -static unsigned char* cJSON_strdup(const unsigned char* string, size_t string_len, const internal_hooks* const hooks) +static unsigned char* cJSON_strdup(const unsigned char* string, size_t string_len) { size_t length = 0; unsigned char* copy = NULL; @@ -201,8 +144,8 @@ static unsigned char* cJSON_strdup(const unsigned char* string, size_t string_le return NULL; } - length = string_len + sizeof(""); - copy = (unsigned char*)hooks->allocate(length); + length = string_len + 1; + copy = (unsigned char*)malloc(length); if (copy == NULL) { return NULL; @@ -213,42 +156,10 @@ static unsigned char* cJSON_strdup(const unsigned char* string, size_t string_le return copy; } -CJSON_PUBLIC(void) -cJSON_InitHooks(cJSON_Hooks* hooks) -{ - if (hooks == NULL) - { - /* Reset hooks */ - global_hooks.allocate = malloc; - global_hooks.deallocate = free; - global_hooks.reallocate = realloc; - return; - } - - global_hooks.allocate = malloc; - if (hooks->malloc_fn != NULL) - { - global_hooks.allocate = hooks->malloc_fn; - } - - global_hooks.deallocate = free; - if (hooks->free_fn != NULL) - { - global_hooks.deallocate = hooks->free_fn; - } - - /* use realloc only if both free and malloc are used */ - global_hooks.reallocate = NULL; - if ((global_hooks.allocate == malloc) && (global_hooks.deallocate == free)) - { - global_hooks.reallocate = realloc; - } -} - /* Internal constructor. */ -static cJSON* cJSON_New_Item(const internal_hooks* const hooks) +static cJSON* cJSON_New_Item(void) { - cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON)); + cJSON* node = (cJSON*)malloc(sizeof(cJSON)); if (node) { memset(node, '\0', sizeof(cJSON)); @@ -258,8 +169,7 @@ static cJSON* cJSON_New_Item(const internal_hooks* const hooks) } /* Delete a cJSON structure. */ -CJSON_PUBLIC(void) -cJSON_Delete(cJSON* item) +void cJSON_Delete(cJSON* item) { cJSON* next = NULL; while (item != NULL) @@ -274,7 +184,7 @@ cJSON_Delete(cJSON* item) { if (cJSON_False == item->is_ref) { - global_hooks.deallocate(item->valuestring); + free(item->valuestring); } } @@ -282,11 +192,11 @@ cJSON_Delete(cJSON* item) { if (cJSON_False == item->is_ref) { - global_hooks.deallocate(item->string); + free(item->string); } } - global_hooks.deallocate(item); + free(item); item = next; } } @@ -308,7 +218,6 @@ typedef struct size_t length; size_t offset; size_t depth; /* How deeply nested (in arrays/objects) is the input at the current offset. */ - internal_hooks hooks; } parse_buffer; /* check if the given size is left to read in a given parse buffer (starting with 1) */ @@ -397,8 +306,7 @@ static cJSON_bool parse_number(cJSON* const item, parse_buffer* const input_buff } /* don't ask me, but the original cJSON_SetNumberValue returns an integer or double */ -CJSON_PUBLIC(double) -cJSON_SetNumberHelper(cJSON* object, double number) +double cJSON_SetNumberHelper(cJSON* object, double number) { if (number >= INT_MAX) { @@ -416,8 +324,7 @@ cJSON_SetNumberHelper(cJSON* object, double number) return object->valuedouble = number; } -CJSON_PUBLIC(char*) -cJSON_SetValuestring(cJSON* object, const char* valuestring) +char *cJSON_SetValuestring(cJSON* object, const char* valuestring) { char* copy = NULL; /* if object's type is not cJSON_String or is cJSON_IsReference, it should not set valuestring */ @@ -439,14 +346,14 @@ cJSON_SetValuestring(cJSON* object, const char* valuestring) return object->valuestring; } - copy = (char*)cJSON_strdup((const unsigned char*)valuestring, object->str_value_len, &global_hooks); + copy = (char*)cJSON_strdup((const unsigned char*)valuestring, object->str_value_len); if (copy == NULL) { return NULL; } if (object->valuestring != NULL) { - cJSON_free(object->valuestring); + free(object->valuestring); } object->valuestring = copy; @@ -462,7 +369,6 @@ typedef struct size_t depth; /* current nesting depth (for formatted printing) */ cJSON_bool noalloc; cJSON_bool format; /* is this print a formatted print */ - internal_hooks hooks; } printbuffer; /* realloc printbuffer if necessary to have at least "needed" bytes more */ @@ -517,35 +423,17 @@ static unsigned char* ensure(printbuffer* const p, size_t needed) newsize = needed * 2; } - if (p->hooks.reallocate != NULL) + /* reallocate with realloc if available */ + newbuffer = (unsigned char*)realloc(p->buffer, newsize); + if (newbuffer == NULL) { - /* reallocate with realloc if available */ - newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize); - if (newbuffer == NULL) - { - p->hooks.deallocate(p->buffer); - p->length = 0; - p->buffer = NULL; + free(p->buffer); + p->length = 0; + p->buffer = NULL; - return NULL; - } - } - else - { - /* otherwise reallocate manually */ - newbuffer = (unsigned char*)p->hooks.allocate(newsize); - if (!newbuffer) - { - p->hooks.deallocate(p->buffer); - p->length = 0; - p->buffer = NULL; - - return NULL; - } - - memcpy(newbuffer, p->buffer, p->offset + 1); - p->hooks.deallocate(p->buffer); + return NULL; } + p->length = newsize; p->buffer = newbuffer; @@ -617,7 +505,7 @@ static cJSON_bool print_number(const cJSON* const item, printbuffer* const outpu } /* reserve appropriate space in the output */ - output_pointer = ensure(output_buffer, (size_t)length + sizeof("")); + output_pointer = ensure(output_buffer, (size_t)length + 1); if (output_pointer == NULL) { return false; @@ -841,7 +729,7 @@ static cJSON_bool parse_string(cJSON* const item, parse_buffer* const input_buff /* This is at most how much we need for the output */ allocation_length = (size_t)(input_end - buffer_at_offset(input_buffer)) - skipped_bytes; item->str_value_len = allocation_length; - output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof("")); + output = (unsigned char*)malloc(allocation_length + 1); if (output == NULL) { goto fail; /* allocation failure */ @@ -920,7 +808,7 @@ static cJSON_bool parse_string(cJSON* const item, parse_buffer* const input_buff fail: if (output != NULL) { - input_buffer->hooks.deallocate(output); + free(output); } if (input_pointer != NULL) @@ -1114,8 +1002,7 @@ static parse_buffer* skip_utf8_bom(parse_buffer* const buffer) return buffer; } -CJSON_PUBLIC(cJSON*) -cJSON_ParseWithOpts(const char* value, const char** return_parse_end, cJSON_bool require_null_terminated) +cJSON *cJSON_ParseWithOpts(const char* value, const char** return_parse_end, cJSON_bool require_null_terminated) { size_t buffer_length; @@ -1125,16 +1012,15 @@ cJSON_ParseWithOpts(const char* value, const char** return_parse_end, cJSON_bool } /* Adding null character size due to require_null_terminated. */ - buffer_length = strlen(value) + sizeof(""); + buffer_length = strlen(value) + 1; return cJSON_ParseWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated); } /* Parse an object - create a new root, and populate. */ -CJSON_PUBLIC(cJSON*) -cJSON_ParseWithLengthOpts(const char* value, size_t buffer_length, const char** return_parse_end, cJSON_bool require_null_terminated) +cJSON *cJSON_ParseWithLengthOpts(const char* value, size_t buffer_length, const char** return_parse_end, cJSON_bool require_null_terminated) { - parse_buffer buffer = { 0, 0, 0, 0, {0, 0, 0} }; + parse_buffer buffer = { 0, 0, 0, 0 }; cJSON* item = NULL; /* reset error position */ @@ -1149,9 +1035,8 @@ cJSON_ParseWithLengthOpts(const char* value, size_t buffer_length, const char** buffer.content = (const unsigned char*)value; buffer.length = buffer_length; buffer.offset = 0; - buffer.hooks = global_hooks; - item = cJSON_New_Item(&global_hooks); + item = cJSON_New_Item(); if (item == NULL) /* memory fail */ { goto fail; @@ -1212,14 +1097,12 @@ cJSON_ParseWithLengthOpts(const char* value, size_t buffer_length, const char** } /* Default options for cJSON_Parse */ -CJSON_PUBLIC(cJSON*) -cJSON_Parse(const char* value) +cJSON *cJSON_Parse(const char* value) { return cJSON_ParseWithOpts(value, 0, 0); } -CJSON_PUBLIC(cJSON*) -cJSON_ParseWithRefOpts(const char* value, const char** return_parse_end, cJSON_bool require_null_terminated) +cJSON *cJSON_ParseWithRefOpts(const char* value, const char** return_parse_end, cJSON_bool require_null_terminated) { size_t buffer_length; @@ -1229,7 +1112,7 @@ cJSON_ParseWithRefOpts(const char* value, const char** return_parse_end, cJSON_b } /* Adding null character size due to require_null_terminated. */ - buffer_length = strlen(value) + sizeof(""); + buffer_length = strlen(value) + 1; return cJSON_ParseWithRefWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated); } @@ -1353,10 +1236,9 @@ static cJSON_bool parse_value_with_ref(cJSON* const item, parse_buffer* const in return false; } -CJSON_PUBLIC(cJSON*) -cJSON_ParseWithRefWithLengthOpts(const char* value, size_t buffer_length, const char** return_parse_end, cJSON_bool require_null_terminated) +cJSON *cJSON_ParseWithRefWithLengthOpts(const char* value, size_t buffer_length, const char** return_parse_end, cJSON_bool require_null_terminated) { - parse_buffer buffer = { 0, 0, 0, 0, {0, 0, 0} }; + parse_buffer buffer = { 0, 0, 0, 0 }; cJSON* item = NULL; /* reset error position */ @@ -1371,9 +1253,8 @@ cJSON_ParseWithRefWithLengthOpts(const char* value, size_t buffer_length, const buffer.content = (const unsigned char*)value; buffer.length = buffer_length; buffer.offset = 0; - buffer.hooks = global_hooks; - item = cJSON_New_Item(&global_hooks); + item = cJSON_New_Item(); if (item == NULL) /* memory fail */ { goto fail; @@ -1434,21 +1315,19 @@ cJSON_ParseWithRefWithLengthOpts(const char* value, size_t buffer_length, const return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_ParseWithRef(const char* value) +cJSON *cJSON_ParseWithRef(const char* value) { return cJSON_ParseWithRefOpts(value, 0, 0); } -CJSON_PUBLIC(cJSON*) -cJSON_ParseWithLength(const char* value, size_t buffer_length) +cJSON *cJSON_ParseWithLength(const char* value, size_t buffer_length) { return cJSON_ParseWithLengthOpts(value, buffer_length, 0, 0); } #define cjson_min(a, b) (((a) < (b)) ? (a) : (b)) -static unsigned char* print(const cJSON* const item, cJSON_bool format, const internal_hooks* const hooks) +static unsigned char* print(const cJSON* const item, cJSON_bool format) { static const size_t default_buffer_size = 256; printbuffer buffer[1]; @@ -1457,10 +1336,10 @@ static unsigned char* print(const cJSON* const item, cJSON_bool format, const in memset(buffer, 0, sizeof(buffer)); /* create buffer */ - buffer->buffer = (unsigned char*)hooks->allocate(default_buffer_size); + buffer->buffer = (unsigned char*)malloc(default_buffer_size); buffer->length = default_buffer_size; buffer->format = format; - buffer->hooks = *hooks; + if (buffer->buffer == NULL) { goto fail; @@ -1473,70 +1352,51 @@ static unsigned char* print(const cJSON* const item, cJSON_bool format, const in } update_offset(buffer); - /* check if reallocate is available */ - if (hooks->reallocate != NULL) + + printed = (unsigned char*)realloc(buffer->buffer, buffer->offset + 1); + if (printed == NULL) { - printed = (unsigned char*)hooks->reallocate(buffer->buffer, buffer->offset + 1); - if (printed == NULL) - { - goto fail; - } - buffer->buffer = NULL; - } - else /* otherwise copy the JSON over to a new buffer */ - { - printed = (unsigned char*)hooks->allocate(buffer->offset + 1); - if (printed == NULL) - { - goto fail; - } - memcpy(printed, buffer->buffer, cjson_min(buffer->length, buffer->offset + 1)); - printed[buffer->offset] = '\0'; /* just to be sure */ - - /* free the buffer */ - hooks->deallocate(buffer->buffer); + goto fail; } + buffer->buffer = NULL; return printed; fail: if (buffer->buffer != NULL) { - hooks->deallocate(buffer->buffer); + free(buffer->buffer); } if (printed != NULL) { - hooks->deallocate(printed); + free(printed); } return NULL; } /* Render a cJSON item/entity/structure to text. */ -CJSON_PUBLIC(char*) -cJSON_Print(const cJSON* item) +char *cJSON_Print(const cJSON* item) { - return (char*)print(item, true, &global_hooks); + return (char*)print(item, true); } -CJSON_PUBLIC(char*) -cJSON_PrintUnformatted(const cJSON* item) +char *cJSON_PrintUnformatted(const cJSON* item) { - return (char*)print(item, false, &global_hooks); + return (char*)print(item, false); } -CJSON_PUBLIC(char*) -cJSON_PrintBuffered(const cJSON* item, int prebuffer, cJSON_bool fmt) +char *cJSON_PrintBuffered(const cJSON* item, int prebuffer, cJSON_bool fmt) { - printbuffer p = { 0, 0, 0, 0, 0, 0, {0, 0, 0} }; + printbuffer p = { 0, 0, 0, 0, 0, 0}; if (prebuffer < 0) { return NULL; } - p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer); + p.buffer = (unsigned char*)malloc((size_t)prebuffer); if (!p.buffer) { return NULL; @@ -1546,21 +1406,19 @@ cJSON_PrintBuffered(const cJSON* item, int prebuffer, cJSON_bool fmt) p.offset = 0; p.noalloc = false; p.format = fmt; - p.hooks = global_hooks; if (!print_value(item, &p)) { - global_hooks.deallocate(p.buffer); + free(p.buffer); return NULL; } return (char*)p.buffer; } -CJSON_PUBLIC(cJSON_bool) -cJSON_PrintPreallocated(cJSON* item, char* buffer, const int length, const cJSON_bool format) +cJSON_bool cJSON_PrintPreallocated(cJSON* item, char* buffer, const int length, const cJSON_bool format) { - printbuffer p = { 0, 0, 0, 0, 0, 0, {0, 0, 0} }; + printbuffer p = { 0, 0, 0, 0, 0, 0}; if ((length < 0) || (buffer == NULL)) { @@ -1572,7 +1430,6 @@ cJSON_PrintPreallocated(cJSON* item, char* buffer, const int length, const cJSON p.offset = 0; p.noalloc = true; p.format = format; - p.hooks = global_hooks; return print_value(item, &p); } @@ -1682,7 +1539,7 @@ static cJSON_bool print_value(const cJSON* const item, printbuffer* const output return false; } - raw_length = strlen(item->valuestring) + sizeof(""); + raw_length = strlen(item->valuestring) + 1; output = ensure(output_buffer, raw_length); if (output == NULL) { @@ -1753,7 +1610,7 @@ static cJSON_bool parse_array(cJSON* const item, parse_buffer* const input_buffe do { /* allocate next item */ - cJSON* new_item = cJSON_New_Item(&(input_buffer->hooks)); + cJSON* new_item = cJSON_New_Item(); if (new_item == NULL) { goto fail; /* allocation failure */ @@ -1851,7 +1708,7 @@ static cJSON_bool parse_array_with_ref(cJSON* const item, parse_buffer* const in do { /* allocate next item */ - cJSON* new_item = cJSON_New_Item(&(input_buffer->hooks)); + cJSON* new_item = cJSON_New_Item(); if (new_item == NULL) { goto fail; /* allocation failure */ @@ -2011,7 +1868,7 @@ static cJSON_bool parse_object(cJSON* const item, parse_buffer* const input_buff do { /* allocate next item */ - cJSON* new_item = cJSON_New_Item(&(input_buffer->hooks)); + cJSON* new_item = cJSON_New_Item(); if (new_item == NULL) { goto fail; /* allocation failure */ @@ -2129,7 +1986,7 @@ static cJSON_bool parse_object_with_ref(cJSON* const item, parse_buffer* const i do { /* allocate next item */ - cJSON* new_item = cJSON_New_Item(&(input_buffer->hooks)); + cJSON* new_item = cJSON_New_Item(); if (new_item == NULL) { goto fail; /* allocation failure */ @@ -2325,8 +2182,7 @@ static cJSON_bool print_object(const cJSON* const item, printbuffer* const outpu } /* Get Array size/item / object item. */ -CJSON_PUBLIC(int) -cJSON_GetArraySize(const cJSON* array) +int cJSON_GetArraySize(const cJSON* array) { cJSON* child = NULL; size_t size = 0; @@ -2368,8 +2224,7 @@ static cJSON* get_array_item(const cJSON* array, size_t index) return current_child; } -CJSON_PUBLIC(cJSON*) -cJSON_GetArrayItem(const cJSON* array, int index) +cJSON *cJSON_GetArrayItem(const cJSON* array, int index) { if (index < 0) { @@ -2416,20 +2271,17 @@ static cJSON* get_object_item(const cJSON* const object, const char* const name, return current_element; } -CJSON_PUBLIC(cJSON*) -cJSON_GetObjectItem(const cJSON* const object, const char* const string) +cJSON *cJSON_GetObjectItem(const cJSON* const object, const char* const string) { return get_object_item(object, string, false); } -CJSON_PUBLIC(cJSON*) -cJSON_GetObjectItemCaseSensitive(const cJSON* const object, const char* const string) +cJSON *cJSON_GetObjectItemCaseSensitive(const cJSON* const object, const char* const string) { return get_object_item(object, string, true); } -CJSON_PUBLIC(cJSON_bool) -cJSON_HasObjectItem(const cJSON* object, const char* string) +cJSON_bool cJSON_HasObjectItem(const cJSON* object, const char* string) { return cJSON_GetObjectItem(object, string) ? 1 : 0; } @@ -2442,7 +2294,7 @@ static void suffix_object(cJSON* prev, cJSON* item) } /* Utility for handling references. */ -static cJSON* create_reference(const cJSON* item, const internal_hooks* const hooks) +static cJSON* create_reference(const cJSON* item) { cJSON* reference = NULL; if (item == NULL) @@ -2450,7 +2302,7 @@ static cJSON* create_reference(const cJSON* item, const internal_hooks* const ho return NULL; } - reference = cJSON_New_Item(hooks); + reference = cJSON_New_Item(); if (reference == NULL) { return NULL; @@ -2497,8 +2349,7 @@ static cJSON_bool add_item_to_array(cJSON* array, cJSON* item) } /* Add item to array/object. */ -CJSON_PUBLIC(cJSON_bool) -cJSON_AddItemToArray(cJSON* array, cJSON* item) +cJSON_bool cJSON_AddItemToArray(cJSON* array, cJSON* item) { return add_item_to_array(array, item); } @@ -2518,7 +2369,7 @@ static void* cast_away_const(const void* string) #pragma GCC diagnostic pop #endif -static cJSON_bool add_item_to_object(cJSON* const object, const char* const string, cJSON* const item, const internal_hooks* const hooks, const cJSON_bool constant_key) +static cJSON_bool add_item_to_object(cJSON* const object, const char* const string, cJSON* const item, const cJSON_bool constant_key) { char* new_key = NULL; int new_type = cJSON_Invalid; @@ -2537,7 +2388,7 @@ static cJSON_bool add_item_to_object(cJSON* const object, const char* const stri } else { - new_key = (char*)cJSON_strdup((const unsigned char*)string, item->str_key_len, hooks); + new_key = (char*)cJSON_strdup((const unsigned char*)string, item->str_key_len); if (new_key == NULL) { item->str_key_len = 0; @@ -2549,7 +2400,7 @@ static cJSON_bool add_item_to_object(cJSON* const object, const char* const stri if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) { - hooks->deallocate(item->string); + free(item->string); } item->string = new_key; @@ -2558,46 +2409,42 @@ static cJSON_bool add_item_to_object(cJSON* const object, const char* const stri return add_item_to_array(object, item); } -CJSON_PUBLIC(cJSON_bool) -cJSON_AddItemToObject(cJSON* object, const char* string, cJSON* item) + +cJSON_bool cJSON_AddItemToObject(cJSON* object, const char* string, cJSON* item) { - return add_item_to_object(object, string, item, &global_hooks, false); + return add_item_to_object(object, string, item, false); } /* Add an item to an object with constant string as key */ -CJSON_PUBLIC(cJSON_bool) -cJSON_AddItemToObjectCS(cJSON* object, const char* string, cJSON* item) +cJSON_bool cJSON_AddItemToObjectCS(cJSON* object, const char* string, cJSON* item) { - return add_item_to_object(object, string, item, &global_hooks, true); + return add_item_to_object(object, string, item, true); } -CJSON_PUBLIC(cJSON_bool) -cJSON_AddItemReferenceToArray(cJSON* array, cJSON* item) +cJSON_bool cJSON_AddItemReferenceToArray(cJSON* array, cJSON* item) { if (array == NULL) { return false; } - return add_item_to_array(array, create_reference(item, &global_hooks)); + return add_item_to_array(array, create_reference(item)); } -CJSON_PUBLIC(cJSON_bool) -cJSON_AddItemReferenceToObject(cJSON* object, const char* string, cJSON* item) +cJSON_bool cJSON_AddItemReferenceToObject(cJSON* object, const char* string, cJSON* item) { if ((object == NULL) || (string == NULL)) { return false; } - return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); + return add_item_to_object(object, string, create_reference(item), false); } -CJSON_PUBLIC(cJSON*) -cJSON_AddNullToObject(cJSON* const object, const char* const name) +cJSON *cJSON_AddNullToObject(cJSON* const object, const char* const name) { cJSON* null = cJSON_CreateNull(); - if (add_item_to_object(object, name, null, &global_hooks, false)) + if (add_item_to_object(object, name, null, false)) { return null; } @@ -2606,11 +2453,10 @@ cJSON_AddNullToObject(cJSON* const object, const char* const name) return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_AddTrueToObject(cJSON* const object, const char* const name) +cJSON *cJSON_AddTrueToObject(cJSON* const object, const char* const name) { cJSON* true_item = cJSON_CreateTrue(); - if (add_item_to_object(object, name, true_item, &global_hooks, false)) + if (add_item_to_object(object, name, true_item, false)) { return true_item; } @@ -2619,11 +2465,10 @@ cJSON_AddTrueToObject(cJSON* const object, const char* const name) return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_AddFalseToObject(cJSON* const object, const char* const name) +cJSON *cJSON_AddFalseToObject(cJSON* const object, const char* const name) { cJSON* false_item = cJSON_CreateFalse(); - if (add_item_to_object(object, name, false_item, &global_hooks, false)) + if (add_item_to_object(object, name, false_item, false)) { return false_item; } @@ -2632,11 +2477,10 @@ cJSON_AddFalseToObject(cJSON* const object, const char* const name) return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_AddBoolToObject(cJSON* const object, const char* const name, const cJSON_bool boolean) +cJSON *cJSON_AddBoolToObject(cJSON* const object, const char* const name, const cJSON_bool boolean) { cJSON* bool_item = cJSON_CreateBool(boolean); - if (add_item_to_object(object, name, bool_item, &global_hooks, false)) + if (add_item_to_object(object, name, bool_item, false)) { return bool_item; } @@ -2645,11 +2489,10 @@ cJSON_AddBoolToObject(cJSON* const object, const char* const name, const cJSON_b return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_AddNumberToObject(cJSON* const object, const char* const name, const double number) +cJSON *cJSON_AddNumberToObject(cJSON* const object, const char* const name, const double number) { cJSON* number_item = cJSON_CreateNumber(number); - if (add_item_to_object(object, name, number_item, &global_hooks, false)) + if (add_item_to_object(object, name, number_item, false)) { return number_item; } @@ -2658,11 +2501,23 @@ cJSON_AddNumberToObject(cJSON* const object, const char* const name, const doubl return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_AddStringToObject(cJSON* const object, const char* const name, const char* const string) + +cJSON *cJSON_AddNumberToObjectWithRef(cJSON* const object, const char* const name, const double number) +{ + cJSON* number_item = cJSON_CreateNumber(number); + if (add_item_to_object(object, name, number_item, true)) + { + return number_item; + } + + cJSON_Delete(number_item); + return NULL; +} + +cJSON *cJSON_AddStringToObject(cJSON* const object, const char* const name, const char* const string) { cJSON* string_item = cJSON_CreateString(string); - if (add_item_to_object(object, name, string_item, &global_hooks, false)) + if (add_item_to_object(object, name, string_item, false)) { return string_item; } @@ -2671,11 +2526,22 @@ cJSON_AddStringToObject(cJSON* const object, const char* const name, const char* return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_AddRawToObject(cJSON* const object, const char* const name, const char* const raw) +cJSON *cJSON_AddStringToObjectWithRef(cJSON* const object, const char* const name, const char* const string) +{ + cJSON* string_item = cJSON_CreateStringReference(string); + if (add_item_to_object(object, name, string_item, true)) + { + return string_item; + } + + cJSON_Delete(string_item); + return NULL; +} + +cJSON *cJSON_AddRawToObject(cJSON* const object, const char* const name, const char* const raw) { cJSON* raw_item = cJSON_CreateRaw(raw); - if (add_item_to_object(object, name, raw_item, &global_hooks, false)) + if (add_item_to_object(object, name, raw_item, false)) { return raw_item; } @@ -2684,11 +2550,22 @@ cJSON_AddRawToObject(cJSON* const object, const char* const name, const char* co return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_AddObjectToObject(cJSON* const object, const char* const name) +cJSON *cJSON_AddObjectToObject(cJSON* const object, const char* const name) +{ + cJSON* object_item = cJSON_CreateObject(); + if (add_item_to_object(object, name, object_item, false)) + { + return object_item; + } + + cJSON_Delete(object_item); + return NULL; +} + +cJSON *cJSON_AddObjectToObjectWithRef(cJSON* const object, const char* const name) { cJSON* object_item = cJSON_CreateObject(); - if (add_item_to_object(object, name, object_item, &global_hooks, false)) + if (add_item_to_object(object, name, object_item, true)) { return object_item; } @@ -2697,11 +2574,10 @@ cJSON_AddObjectToObject(cJSON* const object, const char* const name) return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_AddArrayToObject(cJSON* const object, const char* const name) +cJSON *cJSON_AddArrayToObject(cJSON* const object, const char* const name) { cJSON* array = cJSON_CreateArray(); - if (add_item_to_object(object, name, array, &global_hooks, false)) + if (add_item_to_object(object, name, array, false)) { return array; } @@ -2710,8 +2586,7 @@ cJSON_AddArrayToObject(cJSON* const object, const char* const name) return NULL; } -CJSON_PUBLIC(cJSON*) -cJSON_DetachItemViaPointer(cJSON* parent, cJSON* const item) +cJSON *cJSON_DetachItemViaPointer(cJSON* parent, cJSON* const item) { if ((parent == NULL) || (item == NULL)) { @@ -2747,8 +2622,7 @@ cJSON_DetachItemViaPointer(cJSON* parent, cJSON* const item) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_DetachItemFromArray(cJSON* array, int which) +cJSON *cJSON_DetachItemFromArray(cJSON* array, int which) { if (which < 0) { @@ -2758,43 +2632,37 @@ cJSON_DetachItemFromArray(cJSON* array, int which) return cJSON_DetachItemViaPointer(array, get_array_item(array, (size_t)which)); } -CJSON_PUBLIC(void) -cJSON_DeleteItemFromArray(cJSON* array, int which) +void cJSON_DeleteItemFromArray(cJSON* array, int which) { cJSON_Delete(cJSON_DetachItemFromArray(array, which)); } -CJSON_PUBLIC(cJSON*) -cJSON_DetachItemFromObject(cJSON* object, const char* string) +cJSON *cJSON_DetachItemFromObject(cJSON* object, const char* string) { cJSON* to_detach = cJSON_GetObjectItem(object, string); return cJSON_DetachItemViaPointer(object, to_detach); } -CJSON_PUBLIC(cJSON*) -cJSON_DetachItemFromObjectCaseSensitive(cJSON* object, const char* string) +cJSON *cJSON_DetachItemFromObjectCaseSensitive(cJSON* object, const char* string) { cJSON* to_detach = cJSON_GetObjectItemCaseSensitive(object, string); return cJSON_DetachItemViaPointer(object, to_detach); } -CJSON_PUBLIC(void) -cJSON_DeleteItemFromObject(cJSON* object, const char* string) +void cJSON_DeleteItemFromObject(cJSON* object, const char* string) { cJSON_Delete(cJSON_DetachItemFromObject(object, string)); } -CJSON_PUBLIC(void) -cJSON_DeleteItemFromObjectCaseSensitive(cJSON* object, const char* string) +void cJSON_DeleteItemFromObjectCaseSensitive(cJSON* object, const char* string) { cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string)); } /* Replace array/object items with new ones. */ -CJSON_PUBLIC(cJSON_bool) -cJSON_InsertItemInArray(cJSON* array, int which, cJSON* newitem) +cJSON_bool cJSON_InsertItemInArray(cJSON* array, int which, cJSON* newitem) { cJSON* after_inserted = NULL; @@ -2829,8 +2697,7 @@ cJSON_InsertItemInArray(cJSON* array, int which, cJSON* newitem) return true; } -CJSON_PUBLIC(cJSON_bool) -cJSON_ReplaceItemViaPointer(cJSON* const parent, cJSON* const item, cJSON* replacement) +cJSON_bool cJSON_ReplaceItemViaPointer(cJSON* const parent, cJSON* const item, cJSON* replacement) { if ((parent == NULL) || (parent->child == NULL) || (replacement == NULL) || (item == NULL)) { @@ -2879,8 +2746,7 @@ cJSON_ReplaceItemViaPointer(cJSON* const parent, cJSON* const item, cJSON* repla return true; } -CJSON_PUBLIC(cJSON_bool) -cJSON_ReplaceItemInArray(cJSON* array, int which, cJSON* newitem) +cJSON_bool cJSON_ReplaceItemInArray(cJSON* array, int which, cJSON* newitem) { if (which < 0) { @@ -2900,10 +2766,10 @@ static cJSON_bool replace_item_in_object(cJSON* object, const char* string, cJSO /* replace the name in the replacement */ if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL)) { - cJSON_free(replacement->string); + free(replacement->string); } replacement->str_key_len = strlen(string); - replacement->string = (char*)cJSON_strdup((const unsigned char*)string, replacement->str_key_len, &global_hooks); + replacement->string = (char*)cJSON_strdup((const unsigned char*)string, replacement->str_key_len); if (replacement->string == NULL) { return false; @@ -2914,23 +2780,20 @@ static cJSON_bool replace_item_in_object(cJSON* object, const char* string, cJSO return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); } -CJSON_PUBLIC(cJSON_bool) -cJSON_ReplaceItemInObject(cJSON* object, const char* string, cJSON* newitem) +cJSON_bool cJSON_ReplaceItemInObject(cJSON* object, const char* string, cJSON* newitem) { return replace_item_in_object(object, string, newitem, false); } -CJSON_PUBLIC(cJSON_bool) -cJSON_ReplaceItemInObjectCaseSensitive(cJSON* object, const char* string, cJSON* newitem) +cJSON_bool cJSON_ReplaceItemInObjectCaseSensitive(cJSON* object, const char* string, cJSON* newitem) { return replace_item_in_object(object, string, newitem, true); } /* Create basic types: */ -CJSON_PUBLIC(cJSON*) -cJSON_CreateNull(void) +cJSON *cJSON_CreateNull(void) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item) { item->type = cJSON_NULL; @@ -2939,10 +2802,9 @@ cJSON_CreateNull(void) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateTrue(void) +cJSON *cJSON_CreateTrue(void) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item) { item->type = cJSON_True; @@ -2951,10 +2813,9 @@ cJSON_CreateTrue(void) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateFalse(void) +cJSON *cJSON_CreateFalse(void) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item) { item->type = cJSON_False; @@ -2963,10 +2824,9 @@ cJSON_CreateFalse(void) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateBool(cJSON_bool boolean) +cJSON *cJSON_CreateBool(cJSON_bool boolean) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item) { item->type = boolean ? cJSON_True : cJSON_False; @@ -2975,10 +2835,9 @@ cJSON_CreateBool(cJSON_bool boolean) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateNumber(double num) +cJSON *cJSON_CreateNumber(double num) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item) { item->type = cJSON_Number; @@ -3002,15 +2861,14 @@ cJSON_CreateNumber(double num) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateString(const char* string) +cJSON *cJSON_CreateString(const char* string) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item) { item->type = cJSON_String; item->str_value_len = strlen(string); - item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, item->str_value_len, &global_hooks); + item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, item->str_value_len); if (!item->valuestring) { cJSON_Delete(item); @@ -3021,23 +2879,22 @@ cJSON_CreateString(const char* string) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateStringReference(const char* string) +cJSON *cJSON_CreateStringReference(const char* string) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item != NULL) { item->type = cJSON_String | cJSON_IsReference; - item->valuestring = (char*)cast_away_const(string); + item->valuestring = (char *)string; + item->str_value_len = strlen(string); } return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateObjectReference(const cJSON* child) +cJSON *cJSON_CreateObjectReference(const cJSON* child) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item != NULL) { item->type = cJSON_Object | cJSON_IsReference; @@ -3047,10 +2904,9 @@ cJSON_CreateObjectReference(const cJSON* child) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateArrayReference(const cJSON* child) +cJSON *cJSON_CreateArrayReference(const cJSON* child) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item != NULL) { item->type = cJSON_Array | cJSON_IsReference; @@ -3060,15 +2916,14 @@ cJSON_CreateArrayReference(const cJSON* child) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateRaw(const char* raw) +cJSON *cJSON_CreateRaw(const char* raw) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item) { item->type = cJSON_Raw; item->str_value_len = strlen(raw); - item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, item->str_value_len, &global_hooks); + item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, item->str_value_len); if (!item->valuestring) { cJSON_Delete(item); @@ -3079,10 +2934,9 @@ cJSON_CreateRaw(const char* raw) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateArray(void) +cJSON *cJSON_CreateArray(void) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item) { item->type = cJSON_Array; @@ -3091,10 +2945,9 @@ cJSON_CreateArray(void) return item; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateObject(void) +cJSON *cJSON_CreateObject(void) { - cJSON* item = cJSON_New_Item(&global_hooks); + cJSON* item = cJSON_New_Item(); if (item) { item->type = cJSON_Object; @@ -3104,8 +2957,7 @@ cJSON_CreateObject(void) } /* Create Arrays: */ -CJSON_PUBLIC(cJSON*) -cJSON_CreateIntArray(const int* numbers, int count) +cJSON *cJSON_CreateIntArray(const int* numbers, int count) { size_t i = 0; cJSON* n = NULL; @@ -3146,8 +2998,7 @@ cJSON_CreateIntArray(const int* numbers, int count) return a; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateFloatArray(const float* numbers, int count) +cJSON *cJSON_CreateFloatArray(const float* numbers, int count) { size_t i = 0; cJSON* n = NULL; @@ -3188,8 +3039,7 @@ cJSON_CreateFloatArray(const float* numbers, int count) return a; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateDoubleArray(const double* numbers, int count) +cJSON *cJSON_CreateDoubleArray(const double* numbers, int count) { size_t i = 0; cJSON* n = NULL; @@ -3230,8 +3080,7 @@ cJSON_CreateDoubleArray(const double* numbers, int count) return a; } -CJSON_PUBLIC(cJSON*) -cJSON_CreateStringArray(const char* const* strings, int count) +cJSON *cJSON_CreateStringArray(const char* const* strings, int count) { size_t i = 0; cJSON* n = NULL; @@ -3273,8 +3122,7 @@ cJSON_CreateStringArray(const char* const* strings, int count) } /* Duplication */ -CJSON_PUBLIC(cJSON*) -cJSON_Duplicate(const cJSON* item, cJSON_bool recurse) +cJSON *cJSON_Duplicate(const cJSON* item, cJSON_bool recurse) { cJSON* newitem = NULL; cJSON* child = NULL; @@ -3287,7 +3135,7 @@ cJSON_Duplicate(const cJSON* item, cJSON_bool recurse) goto fail; } /* Create new item */ - newitem = cJSON_New_Item(&global_hooks); + newitem = cJSON_New_Item(); if (!newitem) { goto fail; @@ -3299,7 +3147,7 @@ cJSON_Duplicate(const cJSON* item, cJSON_bool recurse) if (item->valuestring) { newitem->str_value_len = item->str_value_len; - newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, item->str_value_len, &global_hooks); + newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, item->str_value_len); if (!newitem->valuestring) { goto fail; @@ -3309,7 +3157,7 @@ cJSON_Duplicate(const cJSON* item, cJSON_bool recurse) if (item->string) { newitem->str_key_len = item->str_key_len; - newitem->string = (item->type & cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, item->str_key_len, &global_hooks); + newitem->string = (item->type & cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, item->str_key_len); if (!newitem->string) { goto fail; @@ -3414,8 +3262,7 @@ static void minify_string(char** input, char** output) } } -CJSON_PUBLIC(void) -cJSON_Minify(char* json) +void cJSON_Minify(char* json) { char* into = json; @@ -3465,8 +3312,7 @@ cJSON_Minify(char* json) *into = '\0'; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsInvalid(const cJSON* const item) +cJSON_bool cJSON_IsInvalid(const cJSON* const item) { if (item == NULL) { @@ -3476,8 +3322,7 @@ cJSON_IsInvalid(const cJSON* const item) return (item->type & 0xFF) == cJSON_Invalid; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsFalse(const cJSON* const item) +cJSON_bool cJSON_IsFalse(const cJSON* const item) { if (item == NULL) { @@ -3487,8 +3332,7 @@ cJSON_IsFalse(const cJSON* const item) return (item->type & 0xFF) == cJSON_False; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsTrue(const cJSON* const item) +cJSON_bool cJSON_IsTrue(const cJSON* const item) { if (item == NULL) { @@ -3498,8 +3342,7 @@ cJSON_IsTrue(const cJSON* const item) return (item->type & 0xff) == cJSON_True; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsBool(const cJSON* const item) +cJSON_bool cJSON_IsBool(const cJSON* const item) { if (item == NULL) { @@ -3508,8 +3351,7 @@ cJSON_IsBool(const cJSON* const item) return (item->type & (cJSON_True | cJSON_False)) != 0; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsNull(const cJSON* const item) +cJSON_bool cJSON_IsNull(const cJSON* const item) { if (item == NULL) { @@ -3519,8 +3361,7 @@ cJSON_IsNull(const cJSON* const item) return (item->type & 0xFF) == cJSON_NULL; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsNumber(const cJSON* const item) +cJSON_bool cJSON_IsNumber(const cJSON* const item) { if (item == NULL) { @@ -3530,8 +3371,7 @@ cJSON_IsNumber(const cJSON* const item) return (item->type & 0xFF) == cJSON_Number; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsString(const cJSON* const item) +cJSON_bool cJSON_IsString(const cJSON* const item) { if (item == NULL) { @@ -3541,8 +3381,7 @@ cJSON_IsString(const cJSON* const item) return (item->type & 0xFF) == cJSON_String; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsArray(const cJSON* const item) +cJSON_bool cJSON_IsArray(const cJSON* const item) { if (item == NULL) { @@ -3552,8 +3391,7 @@ cJSON_IsArray(const cJSON* const item) return (item->type & 0xFF) == cJSON_Array; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsObject(const cJSON* const item) +cJSON_bool cJSON_IsObject(const cJSON* const item) { if (item == NULL) { @@ -3563,8 +3401,7 @@ cJSON_IsObject(const cJSON* const item) return (item->type & 0xFF) == cJSON_Object; } -CJSON_PUBLIC(cJSON_bool) -cJSON_IsRaw(const cJSON* const item) +cJSON_bool cJSON_IsRaw(const cJSON* const item) { if (item == NULL) { @@ -3574,8 +3411,7 @@ cJSON_IsRaw(const cJSON* const item) return (item->type & 0xFF) == cJSON_Raw; } -CJSON_PUBLIC(cJSON_bool) -cJSON_Compare(const cJSON* const a, const cJSON* const b, const cJSON_bool case_sensitive) +cJSON_bool cJSON_Compare(const cJSON* const a, const cJSON* const b, const cJSON_bool case_sensitive) { if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF))) { @@ -3701,18 +3537,6 @@ cJSON_Compare(const cJSON* const a, const cJSON* const b, const cJSON_bool case_ } } -CJSON_PUBLIC(void*) -cJSON_malloc(size_t size) -{ - return global_hooks.allocate(size); -} - -CJSON_PUBLIC(void) -cJSON_free(void* object) -{ - global_hooks.deallocate(object); -} - static int __estimateFromatedPrintLength(cJSON* item, uint32_t child_offset) { int ret = 0; @@ -3751,7 +3575,6 @@ static int __estimateFromatedPrintLength(cJSON* item, uint32_t child_offset) .depth = 0, .noalloc = cJSON_True, .format = cJSON_False, - .hooks = {NULL, NULL, NULL}, }; print_number(item, &prt_buffer); @@ -3829,8 +3652,7 @@ static int __estimateFromatedPrintLength(cJSON* item, uint32_t child_offset) return ret; } -CJSON_PUBLIC(int) -cJSON_EstimatePrintLength(cJSON* item) +int cJSON_EstimatePrintLength(cJSON* item) { return (__estimateFromatedPrintLength(item, 0)); -} \ No newline at end of file +} diff --git a/ezlopi-components/cjext/cjext.h b/ezlopi-components/cjext/cjext.h index a0e6aa649..b2fbb50dd 100644 --- a/ezlopi-components/cjext/cjext.h +++ b/ezlopi-components/cjext/cjext.h @@ -26,56 +26,6 @@ #ifdef __cplusplus extern "C" { -#endif - -#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) -#define __WINDOWS__ -#endif - -#ifdef __WINDOWS__ - - /* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options: - - CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols - CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default) - CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol - - For *nix builds that support visibility attribute, you can define similar behavior by - - setting default visibility to hidden by adding - -fvisibility=hidden (for gcc) - or - -xldscope=hidden (for sun cc) - to CFLAGS - - then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does - - */ - -#define CJSON_CDECL __cdecl -#define CJSON_STDCALL __stdcall - - /* export symbols by default, this is necessary for copy pasting the C and header file */ -#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS) -#define CJSON_EXPORT_SYMBOLS -#endif - -#if defined(CJSON_HIDE_SYMBOLS) -#define CJSON_PUBLIC(type) type CJSON_STDCALL -#elif defined(CJSON_EXPORT_SYMBOLS) -#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL -#elif defined(CJSON_IMPORT_SYMBOLS) -#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL -#endif -#else /* !__WINDOWS__ */ -#define CJSON_CDECL -#define CJSON_STDCALL - -#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__SUNPRO_C)) && defined(CJSON_API_VISIBILITY) -#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type -#else -#define CJSON_PUBLIC(type) type -#endif #endif /* project version */ @@ -84,6 +34,21 @@ extern "C" #define CJSON_VERSION_PATCH 17 #include +#include +#include +#include + +#include "ezlopi_util_trace.h" +#include "EZLOPI_USER_CONFIG.h" + +#ifndef __FILENAME__ +#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) +#endif + +/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */ +// #define cJSON_free free +// #define cJSON_malloc malloc +// #define cJSON_realloc realloc /* cJSON Types: */ #define cJSON_Invalid (0) @@ -99,6 +64,12 @@ extern "C" #define cJSON_IsReference 256 #define cJSON_StringIsConst 512 +typedef int cJSON_bool; + + /* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them. + * This is to prevent stack overflows. */ +#define CJSON_NESTING_LIMIT 1000 + /* The cJSON structure: */ typedef struct cJSON { @@ -129,238 +100,145 @@ extern "C" } cJSON; - typedef struct cJSON_Hooks - { - /* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */ - void *(CJSON_CDECL *malloc_fn)(size_t sz); - void(CJSON_CDECL *free_fn)(void *ptr); - } cJSON_Hooks; - - typedef int cJSON_bool; - - /* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them. - * This is to prevent stack overflows. */ -#ifndef CJSON_NESTING_LIMIT -#define CJSON_NESTING_LIMIT 1000 -#endif /* returns the version of cJSON as a string */ - CJSON_PUBLIC(const char *) - cJSON_Version(void); - - /* Supply malloc, realloc and free functions to cJSON */ - CJSON_PUBLIC(void) - cJSON_InitHooks(cJSON_Hooks *hooks); + const char *cJSON_Version(void); /* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */ /* Supply a block of JSON, and this returns a cJSON object you can interrogate. */ - CJSON_PUBLIC(cJSON *) - cJSON_Parse(const char *value); - CJSON_PUBLIC(cJSON *) - cJSON_ParseWithLength(const char *value, size_t buffer_length); + cJSON * cJSON_Parse(const char *value); + cJSON * cJSON_ParseWithLength(const char *value, size_t buffer_length); /* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */ /* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */ - CJSON_PUBLIC(cJSON *) - cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); - CJSON_PUBLIC(cJSON *) - cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); + cJSON * cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); + cJSON * cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); /* Render a cJSON entity to text for transfer/storage. */ - CJSON_PUBLIC(char *) - cJSON_Print(const cJSON *item); + char * cJSON_Print(const cJSON *item); /* Render a cJSON entity to text for transfer/storage without any formatting. */ - CJSON_PUBLIC(char *) - cJSON_PrintUnformatted(const cJSON *item); + char * cJSON_PrintUnformatted(const cJSON *item); /* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */ - CJSON_PUBLIC(char *) - cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); + char * cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt); /* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */ /* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */ - CJSON_PUBLIC(cJSON_bool) - cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); + cJSON_bool cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format); /* Delete a cJSON entity and all subentities. */ - CJSON_PUBLIC(void) - cJSON_Delete(cJSON *item); + void cJSON_Delete(cJSON *item); /* Returns the number of items in an array (or object). */ - CJSON_PUBLIC(int) - cJSON_GetArraySize(const cJSON *array); + int cJSON_GetArraySize(const cJSON *array); /* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */ - CJSON_PUBLIC(cJSON *) - cJSON_GetArrayItem(const cJSON *array, int index); + cJSON * cJSON_GetArrayItem(const cJSON *array, int index); /* Get item "string" from object. Case insensitive. */ - CJSON_PUBLIC(cJSON *) - cJSON_GetObjectItem(const cJSON *const object, const char *const string); - CJSON_PUBLIC(cJSON *) - cJSON_GetObjectItemCaseSensitive(const cJSON *const object, const char *const string); - CJSON_PUBLIC(cJSON_bool) - cJSON_HasObjectItem(const cJSON *object, const char *string); + cJSON * cJSON_GetObjectItem(const cJSON *const object, const char *const string); + cJSON * cJSON_GetObjectItemCaseSensitive(const cJSON *const object, const char *const string); + cJSON_bool cJSON_HasObjectItem(const cJSON *object, const char *string); /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ - CJSON_PUBLIC(const char *) - cJSON_GetErrorPtr(void); + const char * cJSON_GetErrorPtr(void); /* Check item type and return its value */ - CJSON_PUBLIC(char *) - cJSON_GetStringValue(const cJSON *const item); - CJSON_PUBLIC(double) - cJSON_GetNumberValue(const cJSON *const item); + char * cJSON_GetStringValue(const cJSON *const item); + double cJSON_GetNumberValue(const cJSON *const item); /* These functions check the type of an item */ - CJSON_PUBLIC(cJSON_bool) - cJSON_IsInvalid(const cJSON *const item); - CJSON_PUBLIC(cJSON_bool) - cJSON_IsFalse(const cJSON *const item); - CJSON_PUBLIC(cJSON_bool) - cJSON_IsTrue(const cJSON *const item); - CJSON_PUBLIC(cJSON_bool) - cJSON_IsBool(const cJSON *const item); - CJSON_PUBLIC(cJSON_bool) - cJSON_IsNull(const cJSON *const item); - CJSON_PUBLIC(cJSON_bool) - cJSON_IsNumber(const cJSON *const item); - CJSON_PUBLIC(cJSON_bool) - cJSON_IsString(const cJSON *const item); - CJSON_PUBLIC(cJSON_bool) - cJSON_IsArray(const cJSON *const item); - CJSON_PUBLIC(cJSON_bool) - cJSON_IsObject(const cJSON *const item); - CJSON_PUBLIC(cJSON_bool) - cJSON_IsRaw(const cJSON *const item); + cJSON_bool cJSON_IsInvalid(const cJSON *const item); + cJSON_bool cJSON_IsFalse(const cJSON *const item); + cJSON_bool cJSON_IsTrue(const cJSON *const item); + cJSON_bool cJSON_IsBool(const cJSON *const item); + cJSON_bool cJSON_IsNull(const cJSON *const item); + cJSON_bool cJSON_IsNumber(const cJSON *const item); + cJSON_bool cJSON_IsString(const cJSON *const item); + cJSON_bool cJSON_IsArray(const cJSON *const item); + cJSON_bool cJSON_IsObject(const cJSON *const item); + cJSON_bool cJSON_IsRaw(const cJSON *const item); /* These calls create a cJSON item of the appropriate type. */ - CJSON_PUBLIC(cJSON *) - cJSON_CreateNull(void); - CJSON_PUBLIC(cJSON *) - cJSON_CreateTrue(void); - CJSON_PUBLIC(cJSON *) - cJSON_CreateFalse(void); - CJSON_PUBLIC(cJSON *) - cJSON_CreateBool(cJSON_bool boolean); - CJSON_PUBLIC(cJSON *) - cJSON_CreateNumber(double num); - CJSON_PUBLIC(cJSON *) - cJSON_CreateString(const char *string); + cJSON * cJSON_CreateNull(void); + cJSON * cJSON_CreateTrue(void); + cJSON * cJSON_CreateFalse(void); + cJSON * cJSON_CreateBool(cJSON_bool boolean); + cJSON * cJSON_CreateNumber(double num); + cJSON * cJSON_CreateString(const char *string); /* raw json */ - CJSON_PUBLIC(cJSON *) - cJSON_CreateRaw(const char *raw); - CJSON_PUBLIC(cJSON *) - cJSON_CreateArray(void); - CJSON_PUBLIC(cJSON *) - cJSON_CreateObject(void); + cJSON * cJSON_CreateRaw(const char *raw); + cJSON * cJSON_CreateArray(void); + cJSON * cJSON_CreateObject(void); /* Create a string where valuestring references a string so * it will not be freed by cJSON_Delete */ - CJSON_PUBLIC(cJSON *) - cJSON_CreateStringReference(const char *string); + cJSON * cJSON_CreateStringReference(const char *string); /* Create an object/array that only references it's elements so * they will not be freed by cJSON_Delete */ - CJSON_PUBLIC(cJSON *) - cJSON_CreateObjectReference(const cJSON *child); - CJSON_PUBLIC(cJSON *) - cJSON_CreateArrayReference(const cJSON *child); + cJSON * cJSON_CreateObjectReference(const cJSON *child); + cJSON * cJSON_CreateArrayReference(const cJSON *child); /* These utilities create an Array of count items. * The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/ - CJSON_PUBLIC(cJSON *) - cJSON_CreateIntArray(const int *numbers, int count); - CJSON_PUBLIC(cJSON *) - cJSON_CreateFloatArray(const float *numbers, int count); - CJSON_PUBLIC(cJSON *) - cJSON_CreateDoubleArray(const double *numbers, int count); - CJSON_PUBLIC(cJSON *) - cJSON_CreateStringArray(const char *const *strings, int count); + cJSON * cJSON_CreateIntArray(const int *numbers, int count); + cJSON * cJSON_CreateFloatArray(const float *numbers, int count); + cJSON * cJSON_CreateDoubleArray(const double *numbers, int count); + cJSON * cJSON_CreateStringArray(const char *const *strings, int count); /* Append item to the specified array/object. */ - CJSON_PUBLIC(cJSON_bool) - cJSON_AddItemToArray(cJSON *array, cJSON *item); - CJSON_PUBLIC(cJSON_bool) - cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); + cJSON_bool cJSON_AddItemToArray(cJSON *array, cJSON *item); + cJSON_bool cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object. * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before * writing to `item->string` */ - CJSON_PUBLIC(cJSON_bool) - cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); + cJSON_bool cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item); /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ - CJSON_PUBLIC(cJSON_bool) - cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); - CJSON_PUBLIC(cJSON_bool) - cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); + cJSON_bool cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); + cJSON_bool cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); /* Remove/Detach items from Arrays/Objects. */ - CJSON_PUBLIC(cJSON *) - cJSON_DetachItemViaPointer(cJSON *parent, cJSON *const item); - CJSON_PUBLIC(cJSON *) - cJSON_DetachItemFromArray(cJSON *array, int which); - CJSON_PUBLIC(void) - cJSON_DeleteItemFromArray(cJSON *array, int which); - CJSON_PUBLIC(cJSON *) - cJSON_DetachItemFromObject(cJSON *object, const char *string); - CJSON_PUBLIC(cJSON *) - cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); - CJSON_PUBLIC(void) - cJSON_DeleteItemFromObject(cJSON *object, const char *string); - CJSON_PUBLIC(void) - cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); + cJSON * cJSON_DetachItemViaPointer(cJSON *parent, cJSON *const item); + cJSON * cJSON_DetachItemFromArray(cJSON *array, int which); + void cJSON_DeleteItemFromArray(cJSON *array, int which); + cJSON * cJSON_DetachItemFromObject(cJSON *object, const char *string); + cJSON * cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string); + void cJSON_DeleteItemFromObject(cJSON *object, const char *string); + void cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string); /* Update array items. */ - CJSON_PUBLIC(cJSON_bool) - cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ - CJSON_PUBLIC(cJSON_bool) - cJSON_ReplaceItemViaPointer(cJSON *const parent, cJSON *const item, cJSON *replacement); - CJSON_PUBLIC(cJSON_bool) - cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); - CJSON_PUBLIC(cJSON_bool) - cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem); - CJSON_PUBLIC(cJSON_bool) - cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem); + cJSON_bool cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ + cJSON_bool cJSON_ReplaceItemViaPointer(cJSON *const parent, cJSON *const item, cJSON *replacement); + cJSON_bool cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); + cJSON_bool cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem); + cJSON_bool cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem); /* Duplicate a cJSON item */ - CJSON_PUBLIC(cJSON *) - cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); + cJSON * cJSON_Duplicate(const cJSON *item, cJSON_bool recurse); /* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will * need to be released. With recurse!=0, it will duplicate any children connected to the item. * The item->next and ->prev pointers are always zero on return from Duplicate. */ /* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal. * case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */ - CJSON_PUBLIC(cJSON_bool) - cJSON_Compare(const cJSON *const a, const cJSON *const b, const cJSON_bool case_sensitive); + cJSON_bool cJSON_Compare(const cJSON *const a, const cJSON *const b, const cJSON_bool case_sensitive); /* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings. * The input pointer json cannot point to a read-only address area, such as a string constant, * but should point to a readable and writable address area. */ - CJSON_PUBLIC(void) - cJSON_Minify(char *json); + void cJSON_Minify(char *json); /* Helper functions for creating and adding items to an object at the same time. * They return the added item or NULL on failure. */ - CJSON_PUBLIC(cJSON *) - cJSON_AddNullToObject(cJSON *const object, const char *const name); - CJSON_PUBLIC(cJSON *) - cJSON_AddTrueToObject(cJSON *const object, const char *const name); - CJSON_PUBLIC(cJSON *) - cJSON_AddFalseToObject(cJSON *const object, const char *const name); - CJSON_PUBLIC(cJSON *) - cJSON_AddBoolToObject(cJSON *const object, const char *const name, const cJSON_bool boolean); - CJSON_PUBLIC(cJSON *) - cJSON_AddNumberToObject(cJSON *const object, const char *const name, const double number); - CJSON_PUBLIC(cJSON *) - cJSON_AddStringToObject(cJSON *const object, const char *const name, const char *const string); - CJSON_PUBLIC(cJSON *) - cJSON_AddRawToObject(cJSON *const object, const char *const name, const char *const raw); - CJSON_PUBLIC(cJSON *) - cJSON_AddObjectToObject(cJSON *const object, const char *const name); - CJSON_PUBLIC(cJSON *) - cJSON_AddArrayToObject(cJSON *const object, const char *const name); + cJSON * cJSON_AddNullToObject(cJSON *const object, const char *const name); + cJSON * cJSON_AddTrueToObject(cJSON *const object, const char *const name); + cJSON * cJSON_AddFalseToObject(cJSON *const object, const char *const name); + cJSON * cJSON_AddBoolToObject(cJSON *const object, const char *const name, const cJSON_bool boolean); + cJSON * cJSON_AddNumberToObject(cJSON *const object, const char *const name, const double number); + cJSON * cJSON_AddStringToObject(cJSON *const object, const char *const name, const char *const string); + cJSON * cJSON_AddRawToObject(cJSON *const object, const char *const name, const char *const raw); + cJSON * cJSON_AddObjectToObject(cJSON *const object, const char *const name); + cJSON * cJSON_AddArrayToObject(cJSON *const object, const char *const name); /* When assigning an integer value, it needs to be propagated to valuedouble too. */ #define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number)) /* helper for the cJSON_SetNumberValue macro */ - CJSON_PUBLIC(double) - cJSON_SetNumberHelper(cJSON *object, double number); + double cJSON_SetNumberHelper(cJSON *object, double number); #define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number)) /* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */ - CJSON_PUBLIC(char *) - cJSON_SetValuestring(cJSON *object, const char *valuestring); + char * cJSON_SetValuestring(cJSON *object, const char *valuestring); /* If the object is not a boolean type this does nothing and returns cJSON_Invalid else it returns the new type*/ #define cJSON_SetBoolValue(object, boolValue) ( \ @@ -369,22 +247,18 @@ extern "C" /* Macro for iterating over an array or object */ #define cJSON_ArrayForEach(element, array) for (element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next) - /* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */ - CJSON_PUBLIC(void *) - cJSON_malloc(size_t size); - CJSON_PUBLIC(void) - cJSON_free(void *object); - /* Krishna */ - CJSON_PUBLIC(cJSON *) - cJSON_ParseWithRef(const char *value); - CJSON_PUBLIC(cJSON *) - cJSON_ParseWithRefOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); - CJSON_PUBLIC(cJSON *) - cJSON_ParseWithRefWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); - - CJSON_PUBLIC(int) - cJSON_EstimatePrintLength(cJSON *item); + cJSON * cJSON_ParseWithRef(const char *value); + cJSON * cJSON_ParseWithRefOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated); + cJSON * cJSON_ParseWithRefWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated); + + int cJSON_EstimatePrintLength(cJSON *item); + + + +cJSON * cJSON_AddStringToObjectWithRef(cJSON* const object, const char* const name, const char* const string); +cJSON * cJSON_AddNumberToObjectWithRef(cJSON* const object, const char* const name, const double number); +cJSON * cJSON_AddObjectToObjectWithRef(cJSON* const object, const char* const name); #ifdef __cplusplus } diff --git a/ezlopi-components/cjext/cjext_utils.c b/ezlopi-components/cjext/cjext_utils.c index 0a76430f4..2dc8bc884 100644 --- a/ezlopi-components/cjext/cjext_utils.c +++ b/ezlopi-components/cjext/cjext_utils.c @@ -51,6 +51,7 @@ #endif #include "cjext_utils.h" +#include "EZLOPI_USER_CONFIG.h" /* define our own boolean type */ #ifdef true @@ -69,7 +70,7 @@ static unsigned char *cJSONUtils_strdup(const unsigned char *const string) unsigned char *copy = NULL; length = strlen((const char *)string) + sizeof(""); - copy = (unsigned char *)cJSON_malloc(length); + copy = (unsigned char *)malloc(length); if (copy == NULL) { return NULL; @@ -195,8 +196,7 @@ static void encode_string_as_pointer(unsigned char *destination, const unsigned destination[0] = '\0'; } -CJSON_PUBLIC(char *) -cJSONUtils_FindPointerFromObjectTo(const cJSON *const object, const cJSON *const target) +char * cJSONUtils_FindPointerFromObjectTo(const cJSON *const object, const cJSON *const target) { size_t child_index = 0; cJSON *current_child = 0; @@ -222,35 +222,35 @@ cJSONUtils_FindPointerFromObjectTo(const cJSON *const object, const cJSON *const if (cJSON_IsArray(object)) { /* reserve enough memory for a 64 bit integer + '/' and '\0' */ - unsigned char *full_pointer = (unsigned char *)cJSON_malloc(strlen((char *)target_pointer) + 20 + sizeof("/")); + unsigned char *full_pointer = (unsigned char *)malloc(strlen((char *)target_pointer) + 20 + sizeof("/")); /* check if conversion to unsigned long is valid * This should be eliminated at compile time by dead code elimination * if size_t is an alias of unsigned long, or if it is bigger */ if (child_index > ULONG_MAX) { - cJSON_free(target_pointer); - cJSON_free(full_pointer); + free(target_pointer); + free(full_pointer); return NULL; } sprintf((char *)full_pointer, "/%lu%s", (unsigned long)child_index, target_pointer); /* / */ - cJSON_free(target_pointer); + free(target_pointer); return (char *)full_pointer; } if (cJSON_IsObject(object)) { - unsigned char *full_pointer = (unsigned char *)cJSON_malloc(strlen((char *)target_pointer) + pointer_encoded_length((unsigned char *)current_child->string) + 2); + unsigned char *full_pointer = (unsigned char *)malloc(strlen((char *)target_pointer) + pointer_encoded_length((unsigned char *)current_child->string) + 2); full_pointer[0] = '/'; encode_string_as_pointer(full_pointer + 1, (unsigned char *)current_child->string); strcat((char *)full_pointer, (char *)target_pointer); - cJSON_free(target_pointer); + free(target_pointer); return (char *)full_pointer; } /* reached leaf of the tree, found nothing */ - cJSON_free(target_pointer); + free(target_pointer); return NULL; } } @@ -345,14 +345,12 @@ static cJSON *get_item_from_pointer(cJSON *const object, const char *pointer, co return current_element; } -CJSON_PUBLIC(cJSON *) -cJSONUtils_GetPointer(cJSON *const object, const char *pointer) +cJSON * cJSONUtils_GetPointer(cJSON *const object, const char *pointer) { return get_item_from_pointer(object, pointer, false); } -CJSON_PUBLIC(cJSON *) -cJSONUtils_GetPointerCaseSensitive(cJSON *const object, const char *pointer) +cJSON * cJSONUtils_GetPointerCaseSensitive(cJSON *const object, const char *pointer) { return get_item_from_pointer(object, pointer, true); } @@ -478,7 +476,7 @@ static cJSON *detach_path(cJSON *object, const unsigned char *path, const cJSON_ cleanup: if (parent_pointer != NULL) { - cJSON_free(parent_pointer); + free(parent_pointer); } return detached_item; @@ -803,11 +801,11 @@ static void overwrite_item(cJSON *const root, const cJSON replacement) if (root->string != NULL) { - cJSON_free(root->string); + free(root->string); } if (root->valuestring != NULL) { - cJSON_free(root->valuestring); + free(root->valuestring); } if (root->child != NULL) { @@ -883,13 +881,13 @@ static int apply_patch(cJSON *object, const cJSON *patch, const cJSON_bool case_ overwrite_item(object, *value); /* delete the duplicated value */ - cJSON_free(value); + free(value); value = NULL; /* the string "value" isn't needed */ if (object->string != NULL) { - cJSON_free(object->string); + free(object->string); object->string = NULL; } @@ -1044,14 +1042,13 @@ static int apply_patch(cJSON *object, const cJSON *patch, const cJSON_bool case_ } if (parent_pointer != NULL) { - cJSON_free(parent_pointer); + free(parent_pointer); } return status; } -CJSON_PUBLIC(int) -cJSONUtils_ApplyPatches(cJSON *const object, const cJSON *const patches) +int cJSONUtils_ApplyPatches(cJSON *const object, const cJSON *const patches) { const cJSON *current_patch = NULL; int status = 0; @@ -1080,8 +1077,7 @@ cJSONUtils_ApplyPatches(cJSON *const object, const cJSON *const patches) return 0; } -CJSON_PUBLIC(int) -cJSONUtils_ApplyPatchesCaseSensitive(cJSON *const object, const cJSON *const patches) +int cJSONUtils_ApplyPatchesCaseSensitive(cJSON *const object, const cJSON *const patches) { const cJSON *current_patch = NULL; int status = 0; @@ -1134,13 +1130,13 @@ static void compose_patch(cJSON *const patches, const unsigned char *const opera { size_t suffix_length = pointer_encoded_length(suffix); size_t path_length = strlen((const char *)path); - unsigned char *full_path = (unsigned char *)cJSON_malloc(path_length + suffix_length + sizeof("/")); + unsigned char *full_path = (unsigned char *)malloc(path_length + suffix_length + sizeof("/")); sprintf((char *)full_path, "%s/", (const char *)path); encode_string_as_pointer(full_path + path_length + 1, suffix); cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char *)full_path)); - cJSON_free(full_path); + free(full_path); } if (value != NULL) @@ -1150,8 +1146,7 @@ static void compose_patch(cJSON *const patches, const unsigned char *const opera cJSON_AddItemToArray(patches, patch); } -CJSON_PUBLIC(void) -cJSONUtils_AddPatchToArray(cJSON *const array, const char *const operation, const char *const path, const cJSON *const value) +void cJSONUtils_AddPatchToArray(cJSON *const array, const char *const operation, const char *const path, const cJSON *const value) { compose_patch(array, (const unsigned char *)operation, (const unsigned char *)path, NULL, value); } @@ -1190,7 +1185,7 @@ static void create_patches(cJSON *const patches, const unsigned char *const path size_t index = 0; cJSON *from_child = from->child; cJSON *to_child = to->child; - unsigned char *new_path = (unsigned char *)cJSON_malloc(strlen((const char *)path) + 20 + sizeof("/")); /* Allow space for 64bit int. log10(2^64) = 20 */ + unsigned char *new_path = (unsigned char *)malloc(strlen((const char *)path) + 20 + sizeof("/")); /* Allow space for 64bit int. log10(2^64) = 20 */ /* generate patches for all array elements that exist in both "from" and "to" */ for (index = 0; (from_child != NULL) && (to_child != NULL); (void)(from_child = from_child->next), (void)(to_child = to_child->next), index++) @@ -1200,7 +1195,7 @@ static void create_patches(cJSON *const patches, const unsigned char *const path * if size_t is an alias of unsigned long, or if it is bigger */ if (index > ULONG_MAX) { - cJSON_free(new_path); + free(new_path); return; } sprintf((char *)new_path, "%s/%lu", path, (unsigned long)index); /* path of the current array element */ @@ -1215,7 +1210,7 @@ static void create_patches(cJSON *const patches, const unsigned char *const path * if size_t is an alias of unsigned long, or if it is bigger */ if (index > ULONG_MAX) { - cJSON_free(new_path); + free(new_path); return; } sprintf((char *)new_path, "%lu", (unsigned long)index); @@ -1226,7 +1221,7 @@ static void create_patches(cJSON *const patches, const unsigned char *const path { compose_patch(patches, (const unsigned char *)"add", path, (const unsigned char *)"-", to_child); } - cJSON_free(new_path); + free(new_path); return; } @@ -1261,14 +1256,14 @@ static void create_patches(cJSON *const patches, const unsigned char *const path /* both object keys are the same */ size_t path_length = strlen((const char *)path); size_t from_child_name_length = pointer_encoded_length((unsigned char *)from_child->string); - unsigned char *new_path = (unsigned char *)cJSON_malloc(path_length + from_child_name_length + sizeof("/")); + unsigned char *new_path = (unsigned char *)malloc(path_length + from_child_name_length + sizeof("/")); sprintf((char *)new_path, "%s/", path); encode_string_as_pointer(new_path + path_length + 1, (unsigned char *)from_child->string); /* create a patch for the element */ create_patches(patches, new_path, from_child, to_child, case_sensitive); - cJSON_free(new_path); + free(new_path); from_child = from_child->next; to_child = to_child->next; @@ -1296,8 +1291,7 @@ static void create_patches(cJSON *const patches, const unsigned char *const path } } -CJSON_PUBLIC(cJSON *) -cJSONUtils_GeneratePatches(cJSON *const from, cJSON *const to) +cJSON * cJSONUtils_GeneratePatches(cJSON *const from, cJSON *const to) { cJSON *patches = NULL; @@ -1312,8 +1306,7 @@ cJSONUtils_GeneratePatches(cJSON *const from, cJSON *const to) return patches; } -CJSON_PUBLIC(cJSON *) -cJSONUtils_GeneratePatchesCaseSensitive(cJSON *const from, cJSON *const to) +cJSON * cJSONUtils_GeneratePatchesCaseSensitive(cJSON *const from, cJSON *const to) { cJSON *patches = NULL; @@ -1328,14 +1321,12 @@ cJSONUtils_GeneratePatchesCaseSensitive(cJSON *const from, cJSON *const to) return patches; } -CJSON_PUBLIC(void) -cJSONUtils_SortObject(cJSON *const object) +void cJSONUtils_SortObject(cJSON *const object) { sort_object(object, false); } -CJSON_PUBLIC(void) -cJSONUtils_SortObjectCaseSensitive(cJSON *const object) +void cJSONUtils_SortObjectCaseSensitive(cJSON *const object) { sort_object(object, true); } @@ -1400,14 +1391,12 @@ static cJSON *merge_patch(cJSON *target, const cJSON *const patch, const cJSON_b return target; } -CJSON_PUBLIC(cJSON *) -cJSONUtils_MergePatch(cJSON *target, const cJSON *const patch) +cJSON * cJSONUtils_MergePatch(cJSON *target, const cJSON *const patch) { return merge_patch(target, patch, false); } -CJSON_PUBLIC(cJSON *) -cJSONUtils_MergePatchCaseSensitive(cJSON *target, const cJSON *const patch) +cJSON * cJSONUtils_MergePatchCaseSensitive(cJSON *target, const cJSON *const patch) { return merge_patch(target, patch, true); } @@ -1494,14 +1483,12 @@ static cJSON *generate_merge_patch(cJSON *const from, cJSON *const to, const cJS return patch; } -CJSON_PUBLIC(cJSON *) -cJSONUtils_GenerateMergePatch(cJSON *const from, cJSON *const to) +cJSON * cJSONUtils_GenerateMergePatch(cJSON *const from, cJSON *const to) { return generate_merge_patch(from, to, false); } -CJSON_PUBLIC(cJSON *) -cJSONUtils_GenerateMergePatchCaseSensitive(cJSON *const from, cJSON *const to) +cJSON * cJSONUtils_GenerateMergePatchCaseSensitive(cJSON *const from, cJSON *const to) { return generate_merge_patch(from, to, true); } diff --git a/ezlopi-components/cjext/cjext_utils.h b/ezlopi-components/cjext/cjext_utils.h index f2eeed6b0..61bf37b8d 100644 --- a/ezlopi-components/cjext/cjext_utils.h +++ b/ezlopi-components/cjext/cjext_utils.h @@ -29,20 +29,21 @@ extern "C" #endif #include "cjext.h" +#include "EZLOPI_USER_CONFIG.h" /* Implement RFC6901 (https://tools.ietf.org/html/rfc6901) JSON Pointer spec. */ - CJSON_PUBLIC(cJSON*) cJSONUtils_GetPointer(cJSON* const object, const char* pointer); - CJSON_PUBLIC(cJSON*) cJSONUtils_GetPointerCaseSensitive(cJSON* const object, const char* pointer); + cJSON * cJSONUtils_GetPointer(cJSON* const object, const char* pointer); + cJSON * cJSONUtils_GetPointerCaseSensitive(cJSON* const object, const char* pointer); /* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */ /* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */ - CJSON_PUBLIC(cJSON*) cJSONUtils_GeneratePatches(cJSON* const from, cJSON* const to); - CJSON_PUBLIC(cJSON*) cJSONUtils_GeneratePatchesCaseSensitive(cJSON* const from, cJSON* const to); + cJSON * cJSONUtils_GeneratePatches(cJSON* const from, cJSON* const to); + cJSON * cJSONUtils_GeneratePatchesCaseSensitive(cJSON* const from, cJSON* const to); /* Utility for generating patch array entries. */ - CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON* const array, const char* const operation, const char* const path, const cJSON* const value); + void cJSONUtils_AddPatchToArray(cJSON* const array, const char* const operation, const char* const path, const cJSON* const value); /* Returns 0 for success. */ - CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON* const object, const cJSON* const patches); - CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON* const object, const cJSON* const patches); + int cJSONUtils_ApplyPatches(cJSON* const object, const cJSON* const patches); + int cJSONUtils_ApplyPatchesCaseSensitive(cJSON* const object, const cJSON* const patches); /* // Note that ApplyPatches is NOT atomic on failure. To implement an atomic ApplyPatches, use: @@ -67,19 +68,19 @@ extern "C" /* Implement RFC7386 (https://tools.ietf.org/html/rfc7396) JSON Merge Patch spec. */ /* target will be modified by patch. return value is new ptr for target. */ - CJSON_PUBLIC(cJSON*) cJSONUtils_MergePatch(cJSON* target, const cJSON* const patch); - CJSON_PUBLIC(cJSON*) cJSONUtils_MergePatchCaseSensitive(cJSON* target, const cJSON* const patch); + cJSON * cJSONUtils_MergePatch(cJSON* target, const cJSON* const patch); + cJSON * cJSONUtils_MergePatchCaseSensitive(cJSON* target, const cJSON* const patch); /* generates a patch to move from -> to */ /* NOTE: This modifies objects in 'from' and 'to' by sorting the elements by their key */ - CJSON_PUBLIC(cJSON*) cJSONUtils_GenerateMergePatch(cJSON* const from, cJSON* const to); - CJSON_PUBLIC(cJSON*) cJSONUtils_GenerateMergePatchCaseSensitive(cJSON* const from, cJSON* const to); + cJSON * cJSONUtils_GenerateMergePatch(cJSON* const from, cJSON* const to); + cJSON * cJSONUtils_GenerateMergePatchCaseSensitive(cJSON* const from, cJSON* const to); /* Given a root object and a target object, construct a pointer from one to the other. */ - CJSON_PUBLIC(char*) cJSONUtils_FindPointerFromObjectTo(const cJSON* const object, const cJSON* const target); + char *cJSONUtils_FindPointerFromObjectTo(const cJSON* const object, const cJSON* const target); /* Sorts the members of the object into alphabetical order. */ - CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON* const object); - CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON* const object); + void cJSONUtils_SortObject(cJSON* const object); + void cJSONUtils_SortObjectCaseSensitive(cJSON* const object); #ifdef __cplusplus } diff --git a/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h b/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h index 5fc2cbecf..379f5d728 100644 --- a/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h +++ b/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h @@ -163,19 +163,11 @@ extern "C" \"dev_detail\":\ [\ {\ - \"dev_type\": 1,\ - \"dev_name\": \"LED\",\ - \"id_room\": \"\",\ - \"id_item\": 1,\ - \"gpio_in\": 0,\ - \"gpio_out\": 5,\ - \"pullup_ip\": false,\ - \"pullup_op\": false,\ - \"is_ip\": false,\ - \"ip_inv\": false,\ - \"op_inv\": false,\ - \"val_ip\": false,\ - \"val_op\": false\ + \"dev_type\": 7,\ + \"dev_name\": \"DHT 22\",\ + \"id_room\": \"\",\ + \"id_item\": 16,\ + \"gpio\": 18\ }\ ], \ \"dev_total\": 5}"; diff --git a/ezlopi-main/CMakeLists.txt b/ezlopi-main/CMakeLists.txt index dde3b6f7e..edc5e50ec 100644 --- a/ezlopi-main/CMakeLists.txt +++ b/ezlopi-main/CMakeLists.txt @@ -13,6 +13,7 @@ set(EZLOPI_SDK_COMPONENTS set(EZLOPI_COMPONENTS pt ezlopi-util-trace + ezlopi-util-heap ) # Define core components diff --git a/ezlopi-main/Kconfig.projbuild b/ezlopi-main/Kconfig.projbuild index 1b353b4e6..73c637c06 100644 --- a/ezlopi-main/Kconfig.projbuild +++ b/ezlopi-main/Kconfig.projbuild @@ -35,6 +35,12 @@ menu "EzloPi User Config" endchoice + config EZPI_HEAP_ENABLE + bool "Enable ezlopi heap" + default n + help + Enables the allocation and free via ezlopi-util, helpful to track-down any memory leak in the stack + config EZPI_DEV_TYPE_TEST bool "Run device in test mode" default n @@ -130,7 +136,12 @@ menu "EzloPi User Config" default n help Enable mode services - + + config EZPI_ENABLE_LED_INDICATOR + bool "Enable indicator LED available in the device" + default y + help + Enable indicator LED available in the device config EZPI_ENABLE_MDNS_SERVICE depends on EZPI_DISTRO_FULL_OPTION || EZLOPI_DISTRO_LOCAL || EZLOPI_DISTRO_LOCAL_MESHBOT @@ -188,15 +199,8 @@ menu "EzloPi User Config" default n help Enable name extra service in ezlopi mDNS - endmenu - config EZPI_ENABLE_LED_INDICATOR - bool "Enable indicator LED available in the device" - default y - help - Enable indicator LED available in the device - endmenu diff --git a/ezlopi-main/ezlopi_main.c b/ezlopi-main/ezlopi_main.c index 2f26ea4cb..c9a50e55b 100644 --- a/ezlopi-main/ezlopi_main.c +++ b/ezlopi-main/ezlopi_main.c @@ -29,6 +29,7 @@ #include "pt.h" #include "ezlopi_core_ble_config.h" #include "ezlopi_core_processes.h" +#include "ezlopi_util_heap.h" static void blinky(void* pv); @@ -45,7 +46,7 @@ void app_main(void) ezlopi_init(); #if defined(CONFIG_EZPI_ENABLE_UART_PROVISIONING) - EZPI_SERVICE_uart_init(); + EZPI_SERV_uart_init(); #endif timer_service_init(); @@ -93,30 +94,57 @@ static void blinky(void* pv) while (1) { - if (count++ > 1000) - { - count = 0; + uint32_t low_heap_start_time = xTaskGetTickCount(); + float free_heap_kb = esp_get_free_heap_size() / 1024.0; + + UBaseType_t total_task_numbers = uxTaskGetNumberOfTasks(); + TaskStatus_t task_array[total_task_numbers]; + + TRACE_D("----------------------------------------------"); + TRACE_D("Free Heap Size: %.2f KB", esp_get_free_heap_size() / 1024.0); + TRACE_D("Minimum Free Heap Size: %.2f KB", esp_get_minimum_free_heap_size() / 1024.0); - UBaseType_t total_task_numbers = uxTaskGetNumberOfTasks(); - TaskStatus_t task_array[total_task_numbers]; +#ifdef CONFIG_EZPI_HEAP_ENABLE + ezlopi_util_heap_trace(); + + if (free_heap_kb <= 10) + { + TRACE_W("CRITICAL-WARNING: low heap detected.."); + ezlopi_util_heap_trace(); + } + else if ((xTaskGetTickCount() - low_heap_start_time) > (15000 / portTICK_PERIOD_MS)) + { + ezlopi_util_heap_trace(); + vTaskDelay(2000 / portTICK_RATE_MS); + TRACE_E("CRITICAL-ERROR: low heap time-out detected!"); + TRACE_W("Rebooting....."); + esp_restart(); + } + else + { + low_heap_start_time = xTaskGetTickCount(); + } +#endif // CONFIG_EZPI_HEAP_ENABLE - TRACE_D("----------------------------------------------"); - TRACE_D("Free Heap Size: %.2f KB", esp_get_free_heap_size() / 1024.0); - TRACE_D("Minimum Free Heap Size: %.2f KB", esp_get_minimum_free_heap_size() / 1024.0); +#if 0 - uxTaskGetSystemState(task_array, total_task_numbers, NULL); + uxTaskGetSystemState(task_array, total_task_numbers, NULL); - for (int i = 0; i < total_task_numbers; i++) { + for (int i = 0; i < total_task_numbers; i++) { + if (task_array[i].pcTaskName) + { TRACE_D("Process Name: %s, \tPID: %d, \tBase: %p, \tWatermark: %.2f KB", task_array[i].pcTaskName, task_array[i].xTaskNumber, task_array[i].pxStackBase, task_array[i].usStackHighWaterMark / 1024.0); } - - TRACE_D("----------------------------------------------"); - } - vTaskDelay(1000 / portTICK_PERIOD_MS); +#endif + TRACE_D("----------------------------------------------"); +#ifdef CONFIG_EZPI_HEAP_ENABLE + ezlopi_util_heap_flush(); +#endif // CONFIG_EZPI_HEAP_ENABLE + vTaskDelay(5000 / portTICK_PERIOD_MS); } } diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c index 86ae0b75d..2b393e120 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c @@ -136,7 +136,7 @@ static void factory_reset_write_func(esp_gatt_value_t* value, esp_ble_gatts_cb_p } } - cJSON_free(root); + cJSON_Delete(root); } } } @@ -174,7 +174,7 @@ static void ezlopi_serv_ble_factory_reset_write_func(esp_gatt_value_t* value, es cJSON_Delete(cj_sub_cmd); } - cJSON_free(root); + cJSON_Delete(root); } } } diff --git a/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.c b/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.c index ab884b8b5..c5ecdab40 100644 --- a/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.c +++ b/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.c @@ -41,9 +41,6 @@ #if defined (CONFIG_EZPI_ENABLE_UART_PROVISIONING) -static const int RX_BUF_SIZE = 3096; -static const uint8_t EZPI_UART_FLW_CTRL_STR_MAX = 10; - #if defined(CONFIG_IDF_TARGET_ESP32) #define TXD_PIN (GPIO_NUM_1) #define RXD_PIN (GPIO_NUM_3) @@ -77,7 +74,7 @@ static int ezlopi_service_uart_reset(cJSON* root) { TRACE_E("Factory restore command"); const static char* reboot_response = "{\"cmd\":0, \"sub_cmd\":0,\"status\":1}"; - EZPI_SERVICE_uart_tx_data(strlen(reboot_response), (uint8_t*)reboot_response); + EZPI_SERV_uart_tx_data(strlen(reboot_response), (uint8_t*)reboot_response); EZPI_CORE_reset_factory_restore(); break; } @@ -85,7 +82,7 @@ static int ezlopi_service_uart_reset(cJSON* root) { TRACE_E("Reboot only command"); const static char* reboot_response = "{\"cmd\":0, \"sub_cmd\":1, \"status\":1}"; - EZPI_SERVICE_uart_tx_data(strlen(reboot_response), (uint8_t*)reboot_response); + EZPI_SERV_uart_tx_data(strlen(reboot_response), (uint8_t*)reboot_response); EZPI_CORE_reset_reboot(); break; } @@ -203,7 +200,7 @@ static int ezlopi_service_uart_set_uart_config(const cJSON* root) const static char* reboot_response = "{\"cmd\":5, \"status\":1}"; - EZPI_SERVICE_uart_tx_data(strlen(reboot_response), (uint8_t*)reboot_response); + EZPI_SERV_uart_tx_data(strlen(reboot_response), (uint8_t*)reboot_response); TRACE_W("New config has been applied, device rebooting"); vTaskDelay(10); @@ -212,7 +209,7 @@ static int ezlopi_service_uart_set_uart_config(const cJSON* root) else { const static char* reboot_response = "{\"cmd\":5, \"status\":0}"; - EZPI_SERVICE_uart_tx_data(strlen(reboot_response), (uint8_t*)reboot_response); + EZPI_SERV_uart_tx_data(strlen(reboot_response), (uint8_t*)reboot_response); TRACE_W("Configuration unchanged !"); vTaskDelay(10); @@ -412,8 +409,9 @@ static int ezlopi_service_uart_config_info(cJSON* parent) cJSON_AddNumberToObject(cj_serial_config, ezlopi_baud_str, baud); EZPI_CORE_nvs_read_parity((uint32_t*)&parity_val); - char parity = get_parity(parity_val); - cJSON_AddStringToObject(cj_serial_config, "parity", &parity); + parity[0] = EZPI_CORE_info_parity_to_name(parity_val); + parity[1] = 0; + cJSON_AddStringToObject(cj_serial_config, ezlopi_parity_str, parity); EZPI_CORE_nvs_read_start_bits(&start_bits); cJSON_AddNumberToObject(cj_serial_config, ezlopi_start_bits_str, start_bits); @@ -552,7 +550,7 @@ static void ezlopi_service_uart_get_info() if (serial_data_json_string) { cJSON_Minify(serial_data_json_string); - EZPI_SERVICE_uart_tx_data(strlen(serial_data_json_string), (uint8_t*)serial_data_json_string); + EZPI_SERV_uart_tx_data(strlen(serial_data_json_string), (uint8_t*)serial_data_json_string); free(serial_data_json_string); } @@ -644,8 +642,8 @@ static void ezlopi_service_uart_response(uint8_t cmd, uint8_t status_write, uint if (my_json_string) { cJSON_Minify(my_json_string); - EZPI_SERVICE_uart_tx_data(strlen(my_json_string), (uint8_t*)my_json_string); - cJSON_free(my_json_string); + EZPI_SERV_uart_tx_data(strlen(my_json_string), (uint8_t*)my_json_string); + free(my_json_string); } } } @@ -713,15 +711,14 @@ static void ezlopi_service_uart_get_config(void) cJSON_Minify(my_json_string); cJSON_Delete(root); // free Json string const int len = strlen(my_json_string); - EZPI_SERVICE_uart_tx_data(len, (uint8_t*)my_json_string); // Send the data over uart + EZPI_SERV_uart_tx_data(len, (uint8_t*)my_json_string); // Send the data over uart // TRACE_D("Sending: %s", my_json_string); - cJSON_free(my_json_string); + free(my_json_string); } } } -int EZPI_SERVICE_uart_tx_data(int len, uint8_t* data) -int EZPI_SERVICE_uart_tx_data(int len, uint8_t* data) +int EZPI_SERV_uart_tx_data(int len, uint8_t* data) { int ret = 0; ret = uart_write_bytes(EZPI_SERV_UART_NUM_DEFAULT, data, len); @@ -729,10 +726,10 @@ int EZPI_SERVICE_uart_tx_data(int len, uint8_t* data) return ret; } -int EZPI_SERV_uart_init(int len, uint8_t* data) +void EZPI_SERV_uart_init(void) { TaskHandle_t ezlopi_service_uart_task_handle = NULL; - xTaskCreate(ezlopi_service_uart_rx_task, "ezlopi_service_uart_rx_task", EZLOPI_SERVICE_UART_TASK_DEPTH, NULL, configMAX_PRIORITIES, &ezlopi_service_uart_task_handle); + xTaskCreate(ezlopi_service_uart_task, "ezlopi_service_uart_task", EZLOPI_SERVICE_UART_TASK_DEPTH, NULL, configMAX_PRIORITIES, &ezlopi_service_uart_task_handle); ezlopi_core_process_set_process_info(ENUM_EZLOPI_SERVICE_UART_TASK, &ezlopi_service_uart_task_handle, EZLOPI_SERVICE_UART_TASK_DEPTH); } diff --git a/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.h b/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.h index 4d9d8b8a7..0c9c9f089 100644 --- a/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.h +++ b/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.h @@ -30,8 +30,8 @@ extern "C" #define EZLOPI_WIFI_CONN_RETRY_ATTEMPT 2 #define EZLOPI_WIFI_CONN_ATTEMPT_INTERVAL 5000 - void EZPI_SERVICE_uart_init(void); - int EZPI_SERVICE_uart_tx_data(int len, uint8_t* data); + void EZPI_SERV_uart_init(void); + int EZPI_SERV_uart_tx_data(int len, uint8_t* data); #endif diff --git a/ezlopi-user-config/CMakeLists.txt b/ezlopi-user-config/CMakeLists.txt index 97774200d..b02eddd4c 100644 --- a/ezlopi-user-config/CMakeLists.txt +++ b/ezlopi-user-config/CMakeLists.txt @@ -1,4 +1,5 @@ idf_component_register(SRCS INCLUDE_DIRS "." + REQUIRES ezlopi-util-heap ) diff --git a/ezlopi-user-config/EZLOPI_USER_CONFIG.h b/ezlopi-user-config/EZLOPI_USER_CONFIG.h index 3d5b157c4..ee0428f5e 100644 --- a/ezlopi-user-config/EZLOPI_USER_CONFIG.h +++ b/ezlopi-user-config/EZLOPI_USER_CONFIG.h @@ -1,8 +1,8 @@ #ifndef _EZLOPI_USER_CONFIG_H_ #define _EZLOPI_USER_CONFIG_H_ -// #if 1 #include "../build/config/sdkconfig.h" +#include "ezlopi_util_heap.h" #if defined(CONFIG_EZPI_DISTRO_FULL_OPTION) #define CONFIG_EZPI_DISTRO_NAME "EZPI_DISTRO_FULL_OPTION" @@ -27,7 +27,29 @@ #endif -// #define EZLOPI_SERIAL_API_VERSION "1.0.0" +#if defined(CONFIG_EZPI_HEAP_ENABLE) +#ifdef malloc +#undef malloc +#endif +#define malloc(x) ezlopi_util_heap_malloc(x, __FILENAME__, __LINE__) + +#ifdef calloc +#undef calloc +#endif +#define calloc(x, y) ezlopi_util_heap_calloc(x, y, __FILENAME__, __LINE__) + +#ifdef free +#undef free +#endif +#define free(x) ezlopi_util_heap_free(x, __FILENAME__, __LINE__) + +#ifdef realloc +#undef realloc +#endif +#define realloc(x, y) ezlopi_util_heap_realloc(x, y, __FILENAME__, __LINE__) + +#endif + // #else ///////////////////////////////////////////////////////////// diff --git a/ezlopi-util/ezlopi-util-heap/CMakeLists.txt b/ezlopi-util/ezlopi-util-heap/CMakeLists.txt new file mode 100644 index 000000000..bf76c9a25 --- /dev/null +++ b/ezlopi-util/ezlopi-util-heap/CMakeLists.txt @@ -0,0 +1,10 @@ +# set(config_src "config.cpp") + +file(GLOB_RECURSE config_src "./*.c") + +idf_component_register(SRCS "${config_src}" + INCLUDE_DIRS "." + REQUIRES + ezlopi-util-trace + ezlopi-user-config +) \ No newline at end of file diff --git a/ezlopi-util/ezlopi-util-heap/ezlopi_util_heap.c b/ezlopi-util/ezlopi-util-heap/ezlopi_util_heap.c new file mode 100644 index 000000000..535568f85 --- /dev/null +++ b/ezlopi-util/ezlopi-util-heap/ezlopi_util_heap.c @@ -0,0 +1,185 @@ +#include +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "ezlopi_util_heap.h" + +typedef struct s_initiator { + const char * file_name; + uint32_t line_number; +} s_initiator_t; + +typedef struct s_heap_trace { + void* ptr; + bool freed; + uint32_t size; + uint32_t time_ms; + s_initiator_t freer; + s_initiator_t allocator; + + struct s_heap_trace* next; + +} s_heap_trace_t; + + +static s_heap_trace_t* heap_head = NULL; + +static s_heap_trace_t * __create_list(void); +static void __remove_free_node(s_heap_trace_t * heap_node); + +void ezlopi_util_heap_free(void *ptr, const char * __file_name, uint32_t line_number) +{ + if (ptr) + { + s_heap_trace_t* curr_node = heap_head; + while (curr_node) + { + if ((curr_node->ptr == ptr) && (0 == curr_node->freed)) + { + printf("\x1B[34m*** freed at %s:%u, size: %u ***\x1B[0m\r\n", __file_name, line_number, curr_node->size); + free(curr_node->ptr); + + curr_node->freed = true; + curr_node->time_ms = (xTaskGetTickCount() - curr_node->time_ms); + curr_node->freer.file_name = __file_name; + curr_node->freer.line_number = line_number; + break; + } + curr_node = curr_node->next; + } + + } +} + +void* ezlopi_util_heap_malloc(size_t size, const char * file_name, uint32_t line_no) +{ + void* ret = NULL; + + if (size) + { + s_heap_trace_t * new_heap = __create_list(); + if (new_heap) + { + // \x1B[%sm %s[%d]:" X "\x1B[0m\r\n" + printf("\x1B[34m### malloc at %s:%u, size: %u ###\x1B[0m\r\n", file_name, line_no, size); + ret = malloc(size); + if (ret) + { + new_heap->ptr = ret; + new_heap->size = size; + new_heap->allocator.file_name = file_name; + new_heap->allocator.line_number = line_no; + new_heap->time_ms = xTaskGetTickCount(); + } + } + } + + return ret; +} + +void* ezlopi_util_heap_calloc(size_t count, size_t size, const char * file_name, uint32_t line_no) +{ + return ezlopi_util_heap_malloc((count * size), file_name, line_no); +} + +void* ezlopi_util_heap_realloc(void *ptr, size_t new_size, const char * file_name, uint32_t line_no) +{ + printf("REALLOC\r\n"); + ezlopi_util_heap_free(ptr, file_name, line_no); + return ezlopi_util_heap_malloc(new_size, file_name, line_no); +} + +void ezlopi_util_heap_flush(void) +{ + __remove_free_node(heap_head); + + if (heap_head->freed) + { + s_heap_trace_t * free_node = heap_head; + heap_head = heap_head->next; + free(free_node); + } +} + +void ezlopi_util_heap_trace(void) +{ + s_heap_trace_t * curr_node = heap_head; + + printf("\r\n\r\n**************************************************************************\r\n"); + printf("****************************** CURRENT HEAP ******************************\r\n"); + + uint32_t count = 0; + uint32_t total_allocated_memory = 0; + + while (curr_node) + { + if (curr_node->freed) + { + printf("%d. --\r\n", count); + printf("%s(%d): ptr: %u, size %u, hold-time-ms: %u\r\n", curr_node->allocator.file_name, curr_node->allocator.line_number, (uint32_t)curr_node->ptr, curr_node->size, curr_node->time_ms); + printf("%s(%d): freed.\r\n", curr_node->freer.file_name, curr_node->freer.line_number); + } + else + { + total_allocated_memory += curr_node->size; + // printf("\033[38:2:255:165:0m%d. --\x1B[0m\r\n", count); + printf("\033[38:2:255:165:0m%d -> %s(%d): ptr: %u, size %u, hold-time-ms: %u\x1B[0m\r\n", count, curr_node->allocator.file_name, curr_node->allocator.line_number, (uint32_t)curr_node->ptr, curr_node->size, (xTaskGetTickCount() - curr_node->time_ms)); + } + + curr_node = curr_node->next; + count++; + } + + printf("--------> total allocated ram: %u\r\n", total_allocated_memory); + printf("**************************************************************************\r\n\r\n\r\n"); +} + +/// @brief /////////////// +/// @param +/// @return +static s_heap_trace_t * __create_list(void) +{ + s_heap_trace_t* new_node = (s_heap_trace_t*)malloc(sizeof(s_heap_trace_t)); + + if (new_node) + { + memset(new_node, 0, sizeof(s_heap_trace_t)); + + if (heap_head) + { + s_heap_trace_t* curr_node = heap_head; + while (curr_node->next) + { + curr_node = curr_node->next; + } + + curr_node->next = new_node; + } + else + { + heap_head = new_node; + } + } + + return new_node; +} + + +static void __remove_free_node(s_heap_trace_t * heap_node) +{ + if (heap_node->next) + { + __remove_free_node(heap_node->next); + + if ( heap_node->next->freed) + { + s_heap_trace_t * free_node = heap_node->next; + heap_node->next = heap_node->next->next; + free(free_node); + } + } +} \ No newline at end of file diff --git a/ezlopi-util/ezlopi-util-heap/ezlopi_util_heap.h b/ezlopi-util/ezlopi-util-heap/ezlopi_util_heap.h new file mode 100644 index 000000000..0097d5cba --- /dev/null +++ b/ezlopi-util/ezlopi-util-heap/ezlopi_util_heap.h @@ -0,0 +1,16 @@ +#ifndef __EZLOPI_UTIL_HEAP_TRACE_H__ +#define __EZLOPI_UTIL_HEAP_TRACE_H__ + +#include +#include +#include + +void ezlopi_util_heap_flush(void); +void ezlopi_util_heap_trace(void); + +void ezlopi_util_heap_free(void *ptr, const char * __file_name, uint32_t line_number); +void* ezlopi_util_heap_malloc(size_t size, const char * file_name, uint32_t line_no); +void* ezlopi_util_heap_calloc(size_t count, size_t size, const char * file_name, uint32_t line_no); +void* ezlopi_util_heap_realloc(void *ptr, size_t new_size, const char * file_name, uint32_t line_no); + +#endif // __EZLOPI_UTIL_HEAP_TRACE_H__ diff --git a/sdkconfig b/sdkconfig index 9efed4f52..dd9647ff1 100644 --- a/sdkconfig +++ b/sdkconfig @@ -144,20 +144,21 @@ CONFIG_EZPI_DISTRO_FULL_OPTION=y # CONFIG_EZLOPI_DISTRO_WIFI_HUB is not set # CONFIG_EZLOPI_DISTRO_BLE_HUB is not set # CONFIG_EZLOPI_DISTRO_MINIMAL is not set +# CONFIG_EZPI_HEAP_ENABLE is not set CONFIG_EZPI_DEV_TYPE_TEST=y CONFIG_EZPI_UTIL_TRACE_EN=y # CONFIG_EZLOPI_BLE_ENABLE is not set # CONFIG_EZPI_CORE_ENABLE_ETH is not set CONFIG_EZPI_ENABLE_WIFI=y -# CONFIG_EZPI_ENABLE_OTA is not set -# CONFIG_EZPI_ENABLE_UART_PROVISIONING is not set +CONFIG_EZPI_ENABLE_OTA=y +CONFIG_EZPI_ENABLE_UART_PROVISIONING=y # CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER is not set CONFIG_EZPI_WEBSOCKET_CLIENT=y CONFIG_EZPI_CORE_STATIC_BUFFER_SIZE=10240 CONFIG_EZPI_SERV_ENABLE_MESHBOTS=y CONFIG_EZLPI_SERV_ENABLE_MODES=y +CONFIG_EZPI_ENABLE_LED_INDICATOR=y # CONFIG_EZPI_ENABLE_MDNS_SERVICE is not set -# CONFIG_EZPI_ENABLE_LED_INDICATOR is not set # end of EzloPi User Config # diff --git a/sdkconfig.old b/sdkconfig.old index 999fc68ba..87c96fd5b 100644 --- a/sdkconfig.old +++ b/sdkconfig.old @@ -144,20 +144,23 @@ CONFIG_EZPI_DISTRO_FULL_OPTION=y # CONFIG_EZLOPI_DISTRO_WIFI_HUB is not set # CONFIG_EZLOPI_DISTRO_BLE_HUB is not set # CONFIG_EZLOPI_DISTRO_MINIMAL is not set +# CONFIG_EZPI_HEAP_ENABLE is not set CONFIG_EZPI_DEV_TYPE_TEST=y CONFIG_EZPI_UTIL_TRACE_EN=y -# CONFIG_EZLOPI_BLE_ENABLE is not set +CONFIG_EZLOPI_BLE_ENABLE=y +CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y +# CONFIG_EZLOPI_BLE_ENALBE_PASSKEY is not set # CONFIG_EZPI_CORE_ENABLE_ETH is not set CONFIG_EZPI_ENABLE_WIFI=y -# CONFIG_EZPI_ENABLE_OTA is not set -# CONFIG_EZPI_ENABLE_UART_PROVISIONING is not set +CONFIG_EZPI_ENABLE_OTA=y +CONFIG_EZPI_ENABLE_UART_PROVISIONING=y # CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER is not set CONFIG_EZPI_WEBSOCKET_CLIENT=y CONFIG_EZPI_CORE_STATIC_BUFFER_SIZE=10240 CONFIG_EZPI_SERV_ENABLE_MESHBOTS=y CONFIG_EZLPI_SERV_ENABLE_MODES=y -# CONFIG_EZPI_ENABLE_MDNS_SERVICE is not set CONFIG_EZPI_ENABLE_LED_INDICATOR=y +# CONFIG_EZPI_ENABLE_MDNS_SERVICE is not set # end of EzloPi User Config # From 306a248ba299f02ef7ab5f8d566aa17a7a5adb38 Mon Sep 17 00:00:00 2001 From: lomasSE89 Date: Tue, 30 Apr 2024 00:25:10 +0545 Subject: [PATCH 23/29] test and tweak on progress. --- .../ezlopi-core-ble/ezlopi_core_ble_buffer.c | 20 +- .../ezlopi-core-ble/ezlopi_core_ble_buffer.h | 16 +- .../ezlopi-core-ble/ezlopi_core_ble_config.h | 4 + .../ezlopi-core-ble/ezlopi_core_ble_gap.c | 3 + .../ezlopi-core-ble/ezlopi_core_ble_gap.h | 6 +- .../ezlopi-core-ble/ezlopi_core_ble_gatt.c | 5 + .../ezlopi-core-ble/ezlopi_core_ble_gatt.h | 8 +- .../ezlopi-core-ble/ezlopi_core_ble_profile.c | 5 + .../ezlopi-core-ble/ezlopi_core_ble_profile.h | 35 +- .../ezlopi_core_ethernet.c | 31 +- .../ezlopi_core_ethernet.h | 6 +- .../ezlopi-core-info/ezlopi_core_info.c | 13 +- .../ezlopi-core-info/ezlopi_core_info.h | 1 + ezlopi-core/ezlopi-core-net/ezlopi_core_net.c | 8 +- ezlopi-core/ezlopi-core-net/ezlopi_core_net.h | 9 +- .../ezlopi_core_processes.c | 10 +- .../ezlopi-service-ble/ezlopi_service_ble.c | 3 + .../ezlopi-service-ble/ezlopi_service_ble.h | 5 + .../ezlopi_service_ble_ble_auth.c | 14 +- .../ezlopi_service_ble_ble_auth.h | 9 +- .../ezlopi_service_ble_device_info.c | 4 + .../ezlopi_service_ble_dynamic_config.c | 4 + .../ezlopi_service_ble_provisioning.c | 5 + .../ezlopi_service_ble_security.c | 5 +- .../ezlopi_service_ble_wifi.c | 3 + .../ezlopi-service-uart/CMakeLists.txt | 1 + .../ezlopi-service-uart/ezlopi_service_uart.c | 3 +- sdkconfig | 602 ++---------------- sdkconfig.old | 598 ++--------------- 29 files changed, 298 insertions(+), 1138 deletions(-) diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c index a9ab5c140..0e6fb4566 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c @@ -1,10 +1,13 @@ + +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include "ezlopi_core_ble_buffer.h" -s_linked_buffer_t *ezlopi_ble_buffer_create(esp_ble_gatts_cb_param_t *param) +s_linked_buffer_t* ezlopi_ble_buffer_create(esp_ble_gatts_cb_param_t* param) { - s_linked_buffer_t *linked_buffer = malloc(sizeof(s_linked_buffer_t)); + s_linked_buffer_t* linked_buffer = malloc(sizeof(s_linked_buffer_t)); if (linked_buffer) { memset(linked_buffer, 0, sizeof(s_linked_buffer_t)); @@ -32,7 +35,7 @@ s_linked_buffer_t *ezlopi_ble_buffer_create(esp_ble_gatts_cb_param_t *param) return linked_buffer; } -void ezlopi_ble_buffer_add_to_buffer(s_linked_buffer_t *buffer, esp_ble_gatts_cb_param_t *param) +void ezlopi_ble_buffer_add_to_buffer(s_linked_buffer_t* buffer, esp_ble_gatts_cb_param_t* param) { while (buffer->next) { @@ -42,7 +45,7 @@ void ezlopi_ble_buffer_add_to_buffer(s_linked_buffer_t *buffer, esp_ble_gatts_cb buffer->next = ezlopi_ble_buffer_create(param); } -void ezlopi_ble_buffer_free_buffer(s_linked_buffer_t *l_buffer) +void ezlopi_ble_buffer_free_buffer(s_linked_buffer_t* l_buffer) { if (l_buffer) { @@ -57,19 +60,19 @@ void ezlopi_ble_buffer_free_buffer(s_linked_buffer_t *l_buffer) } } -void ezlopi_ble_buffer_accumulate_to_start(s_linked_buffer_t *l_buffer) +void ezlopi_ble_buffer_accumulate_to_start(s_linked_buffer_t* l_buffer) { if (l_buffer) { uint32_t tot_len = 0; - s_linked_buffer_t *tmp_buffer = l_buffer; + s_linked_buffer_t* tmp_buffer = l_buffer; while (tmp_buffer) { tot_len += tmp_buffer->len; tmp_buffer = tmp_buffer->next; } - uint8_t *tot_buffer = malloc(tot_len + 1); + uint8_t* tot_buffer = malloc(tot_len + 1); if (tot_buffer) { memset(tot_buffer, 0, tot_len + 1); @@ -95,4 +98,5 @@ void ezlopi_ble_buffer_accumulate_to_start(s_linked_buffer_t *l_buffer) ezlopi_ble_buffer_free_buffer(l_buffer->next); l_buffer->next = NULL; } -} \ No newline at end of file +} +#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.h index d008f520f..3bad3253a 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.h @@ -1,18 +1,22 @@ #ifndef _EZLOPI_CORE_BLE_BUFFER_H_ #define _EZLOPI_CORE_BLE_BUFFER_H_ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include "esp_gatts_api.h" typedef struct s_linked_buffer { - struct s_linked_buffer *next; + struct s_linked_buffer* next; uint32_t len; - uint8_t *buffer; + uint8_t* buffer; } s_linked_buffer_t; -s_linked_buffer_t *ezlopi_ble_buffer_create(esp_ble_gatts_cb_param_t *param); -void ezlopi_ble_buffer_add_to_buffer(s_linked_buffer_t *buffer, esp_ble_gatts_cb_param_t *param); -void ezlopi_ble_buffer_free_buffer(s_linked_buffer_t *l_buffer); -void ezlopi_ble_buffer_accumulate_to_start(s_linked_buffer_t *l_buffer); +s_linked_buffer_t* ezlopi_ble_buffer_create(esp_ble_gatts_cb_param_t* param); +void ezlopi_ble_buffer_add_to_buffer(s_linked_buffer_t* buffer, esp_ble_gatts_cb_param_t* param); +void ezlopi_ble_buffer_free_buffer(s_linked_buffer_t* l_buffer); +void ezlopi_ble_buffer_accumulate_to_start(s_linked_buffer_t* l_buffer); + +#endif // CONFIG_EZLOPI_BLE_ENABLE #endif // _EZLOPI_CORE_BLE_BUFFER_H_ \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_config.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_config.h index e12a8e40b..3c557a71f 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_config.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_config.h @@ -1,6 +1,8 @@ #ifndef _EZLOPI_CORE_BLE_CONFIG_H_ #define _EZLOPI_CORE_BLE_CONFIG_H_ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include "esp_gatts_api.h" typedef enum e_gatt_status @@ -56,4 +58,6 @@ typedef struct s_gatt_service struct s_gatt_service* next; } s_gatt_service_t; +#endif // CONFIG_EZLOPI_BLE_ENABLE + #endif // _EZLOPI_CORE_BLE_CONFIG_H_ \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c index b7494de99..6564d9b2d 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include "ezlopi_util_trace.h" @@ -848,3 +850,4 @@ static void ezlopi_ble_setup_service_uuid(void) // dump("complete-uuid", (all_service_uuid ? (void *)all_service_uuid : (void *)ezlopi__str), 0, all_service_uuid_len); } +#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.h index 5ac77a927..6c796d070 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.h @@ -1,6 +1,8 @@ #ifndef _EZLOPI_CORE_BLE_GAP_H_ #define _EZLOPI_CORE_BLE_GAP_H_ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include "esp_gap_ble_api.h" #include "ezlopi_core_ble_config.h" @@ -10,6 +12,8 @@ void ezlopi_ble_gap_dissociate_bonded_devices(void); void ezlopi_ble_gap_config_adv_data(void); void ezlopi_ble_gap_config_scan_rsp_data(void); void ezlopi_ble_gap_start_advertising(void); -void ezlopi_ble_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param); +void ezlopi_ble_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* param); + +#endif // CONFIG_EZLOPI_BLE_ENABLE #endif // _EZLOPI_CORE_BLE_GAP_H_ \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c index b35f3bd61..0f2bd7c2b 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include "esp_gatt_common_api.h" @@ -499,4 +501,7 @@ static char* ezlopi_ble_gatt_event_to_string(esp_gatts_cb_event_t event) } return ret; } + +#endif // CONFIG_EZLOPI_BLE_ENABLE + #endif // 1 == ENABLE_TRACE \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.h index 96227fdd6..304e3c5b0 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.h @@ -1,10 +1,14 @@ #ifndef _EZLOPI_CORE_BLE_GATT_H_ #define _EZLOPI_CORE_BLE_GATT_H_ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include "ezlopi_core_ble_config.h" uint16_t ezlopi_ble_gatt_get_max_data_size(void); -void ezlopi_ble_gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param); -void ezlopi_ble_gatts_characteristic_notify(s_gatt_service_t *service, s_gatt_char_t *characteristics, esp_gatt_value_t *value); +void ezlopi_ble_gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t* param); +void ezlopi_ble_gatts_characteristic_notify(s_gatt_service_t* service, s_gatt_char_t* characteristics, esp_gatt_value_t* value); + +#endif // CONFIG_EZLOPI_BLE_ENABLE #endif // _EZLOPI_CORE_BLE_GATT_H_ diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c index 34797950d..63720fc33 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c @@ -1,3 +1,6 @@ + +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include "ezlopi_util_trace.h" @@ -436,3 +439,5 @@ void ezlopi_ble_gatt_print_uuid(esp_bt_uuid_t* uuid, char* msg) } #endif } + +#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.h index 64f1f9e6b..34cc58298 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.h @@ -1,31 +1,34 @@ #ifndef _EZLOPI_CORE_BLE_PROFILE_H_ #define _EZLOPI_CORE_BLE_PROFILE_H_ +#ifdef CONFIG_EZLOPI_BLE_ENABLE -s_gatt_service_t *ezlopi_ble_profile_get_by_app_id(uint16_t app_id); -s_gatt_service_t *ezlopi_ble_profile_get_service_by_gatts_if(uint16_t gatts_if); +s_gatt_service_t* ezlopi_ble_profile_get_by_app_id(uint16_t app_id); +s_gatt_service_t* ezlopi_ble_profile_get_service_by_gatts_if(uint16_t gatts_if); -s_gatt_descr_t *ezlopi_ble_profile_get_initiating_descriptor(s_gatt_char_t *characteristic); +s_gatt_descr_t* ezlopi_ble_profile_get_initiating_descriptor(s_gatt_char_t* characteristic); // s_gatt_descr_t *ezlopi_ble_profile_get_initiating_descriptor(s_gatt_service_t *service); -s_gatt_descr_t *ezlopi_ble_profile_get_descriptor_to_init(s_gatt_char_t *characteristic); +s_gatt_descr_t* ezlopi_ble_profile_get_descriptor_to_init(s_gatt_char_t* characteristic); // s_gatt_char_t *ezlopi_ble_profile_get_characterstics_to_init(void); -s_gatt_char_t *ezlopi_ble_profile_get_initiating_characterstics(s_gatt_service_t *service); -s_gatt_char_t *ezlopi_ble_profile_get_characterstics_to_init(s_gatt_service_t *service); +s_gatt_char_t* ezlopi_ble_profile_get_initiating_characterstics(s_gatt_service_t* service); +s_gatt_char_t* ezlopi_ble_profile_get_characterstics_to_init(s_gatt_service_t* service); -s_gatt_service_t *ezlopi_ble_gatt_create_service(uint16_t app_id, esp_bt_uuid_t *service_uuid); -s_gatt_descr_t *ezlopi_ble_gatt_add_descriptor(s_gatt_char_t *charcteristic, esp_bt_uuid_t *uuid, esp_gatt_perm_t permission, - f_upcall_t read_func, f_upcall_t write_func, f_upcall_t write_exec_func); -s_gatt_char_t *ezlopi_ble_gatt_add_characteristic(s_gatt_service_t *service_obj, esp_bt_uuid_t *uuid, esp_gatt_perm_t permission, esp_gatt_char_prop_t properties, - f_upcall_t read_func, f_upcall_t write_func, f_upcall_t write_exec_func); -s_gatt_service_t *ezlopi_ble_profile_get_head(void); +s_gatt_service_t* ezlopi_ble_gatt_create_service(uint16_t app_id, esp_bt_uuid_t* service_uuid); +s_gatt_descr_t* ezlopi_ble_gatt_add_descriptor(s_gatt_char_t* charcteristic, esp_bt_uuid_t* uuid, esp_gatt_perm_t permission, + f_upcall_t read_func, f_upcall_t write_func, f_upcall_t write_exec_func); +s_gatt_char_t* ezlopi_ble_gatt_add_characteristic(s_gatt_service_t* service_obj, esp_bt_uuid_t* uuid, esp_gatt_perm_t permission, esp_gatt_char_prop_t properties, + f_upcall_t read_func, f_upcall_t write_func, f_upcall_t write_exec_func); +s_gatt_service_t* ezlopi_ble_profile_get_head(void); int ezlopi_ble_gatt_number_of_services(void); -void ezlopi_ble_gatt_print_descriptor(s_gatt_descr_t *descriptor); -void ezlopi_ble_gatt_print_characteristic(s_gatt_char_t *characteristic); -void ezlopi_ble_gatt_print_service(s_gatt_service_t *service); -void ezlopi_ble_gatt_print_uuid(esp_bt_uuid_t *uuid, char *msg); +void ezlopi_ble_gatt_print_descriptor(s_gatt_descr_t* descriptor); +void ezlopi_ble_gatt_print_characteristic(s_gatt_char_t* characteristic); +void ezlopi_ble_gatt_print_service(s_gatt_service_t* service); +void ezlopi_ble_gatt_print_uuid(esp_bt_uuid_t* uuid, char* msg); void ezlopi_ble_profile_print(void); +#endif // CONFIG_EZLOPI_BLE_ENABLE + #endif // _EZLOPI_CORE_BLE_PROFILE_H_ \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ethernet/ezlopi_core_ethernet.c b/ezlopi-core/ezlopi-core-ethernet/ezlopi_core_ethernet.c index 4cfeef6e0..aa7f5757e 100644 --- a/ezlopi-core/ezlopi-core-ethernet/ezlopi_core_ethernet.c +++ b/ezlopi-core/ezlopi-core-ethernet/ezlopi_core_ethernet.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZPI_CORE_ENABLE_ETH + #include #include "esp_event.h" @@ -9,10 +11,10 @@ #include "ezlopi_hal_spi_master.h" -static const char *eth_key_desc_str = "ezlopi_eth"; -static esp_netif_t *eth_netif_spi = NULL; -static esp_eth_mac_t *eth_mac_spi = NULL; -static esp_eth_phy_t *eth_phy_spi = NULL; +static const char* eth_key_desc_str = "ezlopi_eth"; +static esp_netif_t* eth_netif_spi = NULL; +static esp_eth_mac_t* eth_mac_spi = NULL; +static esp_eth_phy_t* eth_phy_spi = NULL; static esp_eth_handle_t eth_handle_spi = NULL; static esp_eth_netif_glue_handle_t eth_glue = NULL; static e_ethernet_status_t eth_last_status = ETHERNET_STATUS_UNKNOWN; @@ -37,15 +39,15 @@ static s_ezlopi_spi_master_t spi_config = { static void ezlopi_ethernet_reset(void); static void ezlopi_ethernet_gpio_setup(void); static void ezlopi_ethernet_setup_basic(void); -static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data); -static void __ip_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data); +static void eth_event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data); +static void __ip_event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data); e_ethernet_status_t ezlopi_ethernet_get_status(void) { return eth_last_status; } -esp_netif_ip_info_t *ezlopi_ethernet_get_ip_info(void) +esp_netif_ip_info_t* ezlopi_ethernet_get_ip_info(void) { memset(ð_ip_info, 0, sizeof(esp_netif_ip_info_t)); @@ -89,11 +91,11 @@ void ezlopi_ethernet_init(void) ezlopi_ethernet_setup_basic(); } -static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) +static void eth_event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data) { - uint8_t mac_addr[6] = {0}; + uint8_t mac_addr[6] = { 0 }; /* we can get the ethernet driver handle from event data */ - esp_eth_handle_t eth_handle = *(esp_eth_handle_t *)event_data; + esp_eth_handle_t eth_handle = *(esp_eth_handle_t*)event_data; switch (event_id) { @@ -102,7 +104,7 @@ static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t ev esp_eth_ioctl(eth_handle, ETH_CMD_G_MAC_ADDR, mac_addr); TRACE_I("Ethernet Link Up"); TRACE_I("Ethernet HW Addr %02x:%02x:%02x:%02x:%02x:%02x", - mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); + mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); eth_last_status = ETHERNET_STATUS_LINK_UP; break; } @@ -132,9 +134,9 @@ static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t ev } } -static void __ip_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) +static void __ip_event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data) { - ip_event_got_ip_t *event = (ip_event_got_ip_t *)event_data; + ip_event_got_ip_t* event = (ip_event_got_ip_t*)event_data; switch (event_id) { @@ -222,4 +224,5 @@ static void ezlopi_ethernet_reset(void) /* 4. Pull reset high, wait 10mS */ gpio_set_level(EZLOPI_ETHERNET_W5500_RST_PIN, 1); vTaskDelay(10 / portTICK_RATE_MS); -} \ No newline at end of file +} +#endif // CONFIG_EZPI_CORE_ENABLE_ETH \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ethernet/ezlopi_core_ethernet.h b/ezlopi-core/ezlopi-core-ethernet/ezlopi_core_ethernet.h index 118315c81..2fcd858ee 100644 --- a/ezlopi-core/ezlopi-core-ethernet/ezlopi_core_ethernet.h +++ b/ezlopi-core/ezlopi-core-ethernet/ezlopi_core_ethernet.h @@ -1,6 +1,8 @@ #ifndef _EZLOPI_CORE_ETHERNET_H_ #define _EZLOPI_CORE_ETHERNET_H_ +#ifdef CONFIG_EZPI_CORE_ENABLE_ETH + #if (EZLOPI_AMBIENT_TRACKER_PRO_REV_A == EZLOPI_BOARD_TYPE) #define EZLOPI_ETHERNET_W5500_EN_PIN 13 #define EZLOPI_ETHERNET_W5500_RST_PIN 11 @@ -31,6 +33,8 @@ typedef enum e_ethernet_status void ezlopi_ethernet_init(void); void ezlopi_ethernet_deinit(void); e_ethernet_status_t ezlopi_ethernet_get_status(void); -esp_netif_ip_info_t *ezlopi_ethernet_get_ip_info(void); +esp_netif_ip_info_t* ezlopi_ethernet_get_ip_info(void); + +#endif // CONFIG_EZPI_CORE_ENABLE_ETH #endif // _EZLOPI_CORE_ETHERNET_H_ diff --git a/ezlopi-core/ezlopi-core-info/ezlopi_core_info.c b/ezlopi-core/ezlopi-core-info/ezlopi_core_info.c index 55e76a60d..226afca58 100644 --- a/ezlopi-core/ezlopi-core-info/ezlopi_core_info.c +++ b/ezlopi-core/ezlopi-core-info/ezlopi_core_info.c @@ -228,4 +228,15 @@ void EZPI_CORE_info_get_tick_to_time_name(char* time_buff, uint32_t buff_len, ui memset(time_buff, 0, buff_len); snprintf(time_buff, buff_len, "%dd %dh %dm %ds", days, hours, minutes, seconds); } -} \ No newline at end of file +} + +int EZPI_CORE_info_get_ble_mac(uint8_t mac[6]) +{ + int ret = 0; + if (ESP_OK == esp_read_mac(mac, ESP_MAC_BT)) + { + ret = 1; + } + return ret; +} + diff --git a/ezlopi-core/ezlopi-core-info/ezlopi_core_info.h b/ezlopi-core/ezlopi-core-info/ezlopi_core_info.h index 8d6f9140b..0a192a8bb 100644 --- a/ezlopi-core/ezlopi-core-info/ezlopi_core_info.h +++ b/ezlopi-core/ezlopi-core-info/ezlopi_core_info.h @@ -18,5 +18,6 @@ char* EZPI_CORE_info_get_esp_reset_reason_to_name(esp_reset_reason_t reason); char* EZPI_CORE_info_get_chip_type_to_name(int chip_type); char* EZPI_CORE_info_get_wifi_mode_to_name(const wifi_mode_t mode_val); void EZPI_CORE_info_get_tick_to_time_name(char* time_buff, uint32_t buff_len, uint32_t ms); +int EZPI_CORE_info_get_ble_mac(uint8_t mac[6]); #endif // EZLOPI_CORE_INFO_H diff --git a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c index 303c16243..93516a0c7 100644 --- a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c +++ b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c @@ -1,5 +1,7 @@ #include "ezlopi_core_net.h" +#ifdef CONFIG_EZPI_CORE_ENABLE_ETH + static s_ezlopi_net_status_t net_stat; void ezlopi_net_init(void) @@ -8,7 +10,7 @@ void ezlopi_net_init(void) ezlopi_ethernet_init(); } -s_ezlopi_net_status_t *ezlopi_get_net_status(void) +s_ezlopi_net_status_t* ezlopi_get_net_status(void) { net_stat.wifi_status = ezlopi_wifi_status(); @@ -16,4 +18,6 @@ s_ezlopi_net_status_t *ezlopi_get_net_status(void) net_stat.nma_cloud_connection_status = ezlopi_websocket_client_is_connected(); return &net_stat; -} \ No newline at end of file +} + +#endif // CONFIG_EZPI_CORE_ENABLE_ETH \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h index b5de2d5b7..cbaf8be65 100644 --- a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h +++ b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h @@ -1,6 +1,8 @@ #ifndef _EZLOPI_CORE_NET_H_ #define _EZLOPI_CORE_NET_H_ +#ifdef CONFIG_EZPI_CORE_ENABLE_ETH + #include #include "ezlopi_core_wifi.h" @@ -10,10 +12,13 @@ typedef struct s_ezlopi_net_status { - ezlopi_wifi_status_t *wifi_status; + ezlopi_wifi_status_t* wifi_status; e_ping_status_t internet_status; bool nma_cloud_connection_status; } s_ezlopi_net_status_t; -s_ezlopi_net_status_t *ezlopi_get_net_status(void); +s_ezlopi_net_status_t* ezlopi_get_net_status(void); + +#endif // CONFIG_EZPI_CORE_ENABLE_ETH + #endif // _EZLOPI_CORE_NET_H_ diff --git a/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c b/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c index ecd922cea..b66c9eb77 100755 --- a/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c +++ b/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c @@ -2,7 +2,7 @@ #include "stdlib.h" #include "stdbool.h" #include "string.h" - +#include "sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "sdkconfig.h" @@ -42,14 +42,18 @@ static size_t set_default_task_memory_usage(const char* default_task_name) { stack_size = CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH; } +#ifdef CONFIG_EZLOPI_BLE_ENABLE else if (0 == strncmp("BTU_TASK", default_task_name, 9)) { - stack_size = CONFIG_BTU_TASK_STACK_SIZE; + // stack_size = CONFIG_BTU_TASK_STACK_SIZE; + stack_size = 4096; } else if (0 == strncmp("BTC_TASK", default_task_name, 9)) { - stack_size = CONFIG_BT_BTC_TASK_STACK_SIZE; + // stack_size = CONFIG_BT_BTC_TASK_STACK_SIZE; + stack_size = 4096; } +#endif // CONFIG_EZLOPI_BLE_ENABLE else if (0 == strncmp("sys_evt", default_task_name, 8)) { stack_size = CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE; diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c index a24753ea5..20d963d39 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include #include @@ -175,3 +177,4 @@ int ezlopi_ble_service_get_ble_mac(uint8_t mac[6]) } return ret; } +#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.h b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.h index 23f2af10f..32d3e2335 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.h +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.h @@ -1,6 +1,9 @@ + #ifndef _EZLOPI_SERVICE_BLE_H_ #define _EZLOPI_SERVICE_BLE_H_ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #define CHECK_PRINT_ERROR(x, msg) \ { \ if (x) \ @@ -49,4 +52,6 @@ void ezlopi_ble_service_init(void); int ezlopi_ble_service_get_ble_mac(uint8_t mac[6]); +#endif // CONFIG_EZLOPI_BLE_ENABLE + #endif // _EZLOPI_SERVICE_BLE_H_ diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c index 5036de56b..e9539354c 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include "ezlopi_util_trace.h" @@ -13,7 +15,7 @@ e_auth_status_t ezlopi_ble_auth_last_status(void) return sg_last_auth_status; } -e_auth_status_t ezlopi_ble_auth_store_user_id(char *user_id) +e_auth_status_t ezlopi_ble_auth_store_user_id(char* user_id) { if (user_id) { @@ -33,9 +35,9 @@ e_auth_status_t ezlopi_ble_auth_store_user_id(char *user_id) return sg_last_auth_status; } -e_auth_status_t ezlopi_ble_auth_check_user_id(char *user_id) +e_auth_status_t ezlopi_ble_auth_check_user_id(char* user_id) { - char *stored_user_id = ezlopi_nvs_read_user_id_str(); + char* stored_user_id = ezlopi_nvs_read_user_id_str(); if (NULL != stored_user_id) { @@ -65,9 +67,9 @@ e_auth_status_t ezlopi_ble_auth_check_user_id(char *user_id) return sg_last_auth_status; } -char *ezlopi_ble_auth_status_to_string(e_auth_status_t status) +char* ezlopi_ble_auth_status_to_string(e_auth_status_t status) { - char *ret = "BLE_AUTH_STATUS_UNKNOWN"; + char* ret = "BLE_AUTH_STATUS_UNKNOWN"; switch (status) { @@ -106,4 +108,4 @@ char *ezlopi_ble_auth_status_to_string(e_auth_status_t status) return ret; } -// int ezlopi_ble_auth_ +#endif // CONFIG_EZLOPI_BLE_ENABLE diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.h b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.h index ccac2312e..36d70ac38 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.h +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.h @@ -1,6 +1,7 @@ #ifndef _EZLOPI_SERVICE_BLE_BLE_AUT_H_ #define _EZLOPI_SERVICE_BLE_BLE_AUT_H_ +#ifdef CONFIG_EZLOPI_BLE_ENABLE typedef enum e_auth_status { BLE_AUTH_SUCCESS = 1, @@ -12,8 +13,10 @@ typedef enum e_auth_status } e_auth_status_t; e_auth_status_t ezlopi_ble_auth_last_status(void); -e_auth_status_t ezlopi_ble_auth_store_user_id(char *user_id); -e_auth_status_t ezlopi_ble_auth_check_user_id(char *user_id); -char *ezlopi_ble_auth_status_to_string(e_auth_status_t status); +e_auth_status_t ezlopi_ble_auth_store_user_id(char* user_id); +e_auth_status_t ezlopi_ble_auth_check_user_id(char* user_id); +char* ezlopi_ble_auth_status_to_string(e_auth_status_t status); + +#endif //CONFIG_EZLOPI_BLE_ENABLE #endif // _EZLOPI_SERVICE_BLE_BLE_AUT_H_ diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c index a36632a2f..868e38b77 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include @@ -744,3 +746,5 @@ void __add_factory_info_to_root(cJSON* root, char* key, char* value) free(value); } } + +#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c index 86b87bafd..cddcef720 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include @@ -342,3 +344,5 @@ static char* __dynamic_config_base64(void) return base64_data; } + +#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c index 0f321d433..1a795d307 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include @@ -557,4 +559,7 @@ static char* __provisioning_info_base64(void) return base64_data; } + +#endif // CONFIG_EZLOPI_BLE_ENABLE + #endif // EZPI_SERV_BLE_ENABLE_READ_PROV \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c index 2b393e120..69e791fc1 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include "lwip/ip_addr.h" @@ -220,4 +222,5 @@ static void __process_auth_command(cJSON* root) TRACE_W("Not authenticated!"); } #endif -} \ No newline at end of file +} +#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c index 265125bcd..4291e0344 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c @@ -1,3 +1,5 @@ +#ifdef CONFIG_EZLOPI_BLE_ENABLE + #include #include "cjext.h" @@ -119,3 +121,4 @@ static void wifi_creds_parse_and_connect(uint8_t* value, uint32_t len) } } } +#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-uart/CMakeLists.txt b/ezlopi-services/ezlopi-service-uart/CMakeLists.txt index 962c21b20..a4efcd392 100644 --- a/ezlopi-services/ezlopi-service-uart/CMakeLists.txt +++ b/ezlopi-services/ezlopi-service-uart/CMakeLists.txt @@ -12,6 +12,7 @@ set(EZLOPI_CORE_COMPONENTS ezlopi-core-sntp ezlopi-core-info ezlopi-core-processes + ezlopi-core-ping ) set(EZLOPI_HAL_COMPONENTS ezlopi-hal-sysinfo diff --git a/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.c b/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.c index c5ecdab40..0b08dcfba 100644 --- a/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.c +++ b/ezlopi-services/ezlopi-service-uart/ezlopi_service_uart.c @@ -30,6 +30,7 @@ #include "ezlopi_core_sntp.h" #include "ezlopi_core_info.h" #include "ezlopi_core_processes.h" +#include "ezlopi_core_ping.h" #include "ezlopi_hal_system_info.h" @@ -379,7 +380,7 @@ static int ezlopi_service_uart_device_status_info(cJSON* parent) cJSON_AddStringToObject(cj_device_state, "wifi_mac", mac_str); memset(mac, 0, sizeof(mac)); - ezlopi_ble_service_get_ble_mac(mac); + EZPI_CORE_info_get_ble_mac(mac); memset(mac_str, 0, sizeof(mac_str)); snprintf(mac_str, 20, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); cJSON_AddStringToObject(cj_device_state, "ble_mac", mac_str); diff --git a/sdkconfig b/sdkconfig index dd9647ff1..d01603c52 100644 --- a/sdkconfig +++ b/sdkconfig @@ -11,7 +11,7 @@ CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 # # SDK tool configuration # -CONFIG_SDK_TOOLPREFIX="xtensa-esp32s3-elf-" +CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" # CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set # end of SDK tool configuration @@ -43,13 +43,13 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set -CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set # CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set # CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set +CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=0 +CONFIG_BOOTLOADER_LOG_LEVEL=3 # CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set @@ -92,14 +92,14 @@ CONFIG_ESPTOOLPY_FLASHFREQ_40M=y # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set CONFIG_ESPTOOLPY_FLASHFREQ="40m" # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE="8MB" +CONFIG_ESPTOOLPY_FLASHSIZE="2MB" CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y CONFIG_ESPTOOLPY_BEFORE_RESET=y # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set @@ -122,12 +122,12 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # # Partition Table # -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set +CONFIG_PARTITION_TABLE_SINGLE_APP=y # CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="ezlopi_partitions_v3_1_4_181_4mb.csv" -CONFIG_PARTITION_TABLE_FILENAME="ezlopi_partitions_v3_1_4_181_4mb.csv" +# CONFIG_PARTITION_TABLE_CUSTOM is not set +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table @@ -144,21 +144,31 @@ CONFIG_EZPI_DISTRO_FULL_OPTION=y # CONFIG_EZLOPI_DISTRO_WIFI_HUB is not set # CONFIG_EZLOPI_DISTRO_BLE_HUB is not set # CONFIG_EZLOPI_DISTRO_MINIMAL is not set -# CONFIG_EZPI_HEAP_ENABLE is not set -CONFIG_EZPI_DEV_TYPE_TEST=y +CONFIG_EZPI_HEAP_ENABLE=y +# CONFIG_EZPI_DEV_TYPE_TEST is not set CONFIG_EZPI_UTIL_TRACE_EN=y -# CONFIG_EZLOPI_BLE_ENABLE is not set +CONFIG_EZLOPI_BLE_ENABLE=y +CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y +# CONFIG_EZLOPI_BLE_ENALBE_PASSKEY is not set # CONFIG_EZPI_CORE_ENABLE_ETH is not set CONFIG_EZPI_ENABLE_WIFI=y CONFIG_EZPI_ENABLE_OTA=y CONFIG_EZPI_ENABLE_UART_PROVISIONING=y -# CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER is not set +CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER=y CONFIG_EZPI_WEBSOCKET_CLIENT=y CONFIG_EZPI_CORE_STATIC_BUFFER_SIZE=10240 CONFIG_EZPI_SERV_ENABLE_MESHBOTS=y CONFIG_EZLPI_SERV_ENABLE_MODES=y CONFIG_EZPI_ENABLE_LED_INDICATOR=y -# CONFIG_EZPI_ENABLE_MDNS_SERVICE is not set +CONFIG_EZPI_ENABLE_MDNS_SERVICE=y + +# +# EzloPi mDNS config +# +CONFIG_EZPI_MDNS_HOSTNAME="ezlopi_device" +CONFIG_EZPI_MDNS_INSTANCE_NAME="ezlopi_serial" +# CONFIG_EZPI_MDNS_ENABLE_EXTRA_SERVICES is not set +# end of EzloPi mDNS config # end of EzloPi User Config # @@ -206,278 +216,9 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # # Bluetooth # -CONFIG_BT_ENABLED=y - -# -# Bluetooth controller -# -CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y -# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set -# CONFIG_BTDM_CTRL_MODE_BTDM is not set -CONFIG_BTDM_CTRL_BLE_MAX_CONN=3 -CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0 -CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 -CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 -CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3 -CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0 -CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 -CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y -# CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set -CONFIG_BTDM_CTRL_PINNED_TO_CORE=0 -CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y -# CONFIG_BTDM_CTRL_HCI_MODE_UART_H4 is not set - -# -# MODEM SLEEP Options -# -CONFIG_BTDM_CTRL_MODEM_SLEEP=y -CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG=y -# CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_EVED is not set -CONFIG_BTDM_CTRL_LPCLK_SEL_MAIN_XTAL=y -# end of MODEM SLEEP Options - -CONFIG_BTDM_BLE_DEFAULT_SCA_250PPM=y -CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1 -CONFIG_BTDM_BLE_SCAN_DUPL=y -CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE=y -# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA is not set -# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE is not set -CONFIG_BTDM_SCAN_DUPL_TYPE=0 -CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=100 -CONFIG_BTDM_SCAN_DUPL_CACHE_REFRESH_PERIOD=0 -# CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set -CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y -CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y -CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 -CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 -CONFIG_BTDM_RESERVE_DRAM=0xdb5c -CONFIG_BTDM_CTRL_HLI=y -# end of Bluetooth controller - -CONFIG_BT_BLUEDROID_ENABLED=y -# CONFIG_BT_NIMBLE_ENABLED is not set -# CONFIG_BT_CONTROLLER_ONLY is not set - -# -# Bluedroid Options -# -CONFIG_BT_BTC_TASK_STACK_SIZE=4096 -CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y -# CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1 is not set -CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0 -CONFIG_BT_BTU_TASK_STACK_SIZE=4096 -# CONFIG_BT_BLUEDROID_MEM_DEBUG is not set -# CONFIG_BT_CLASSIC_ENABLED is not set -CONFIG_BT_BLE_ENABLED=y -CONFIG_BT_GATTS_ENABLE=y -# CONFIG_BT_GATTS_PPCP_CHAR_GAP is not set -# CONFIG_BT_BLE_BLUFI_ENABLE is not set -CONFIG_BT_GATT_MAX_SR_PROFILES=8 -CONFIG_BT_GATT_MAX_SR_ATTRIBUTES=100 -# CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set -CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_AUTO=y -CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 -# CONFIG_BT_GATTS_ROBUST_CACHING_ENABLED is not set -# CONFIG_BT_GATTS_DEVICE_NAME_WRITABLE is not set -# CONFIG_BT_GATTS_APPEARANCE_WRITABLE is not set -CONFIG_BT_GATTC_ENABLE=y -CONFIG_BT_GATTC_MAX_CACHE_CHAR=40 -# CONFIG_BT_GATTC_CACHE_NVS_FLASH is not set -CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3 -CONFIG_BT_BLE_SMP_ENABLE=y -# CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set -# CONFIG_BT_STACK_NO_LOG is not set - -# -# BT DEBUG LOG LEVEL -# -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_HCI_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_HCI_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BTM_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BTM_TRACE_LEVEL=2 -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_L2CAP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL=2 -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_SDP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_SDP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_GAP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_GAP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BNEP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BNEP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_PAN_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_PAN_TRACE_LEVEL=2 -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_A2D_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_A2D_TRACE_LEVEL=2 -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_AVDT_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_AVDT_TRACE_LEVEL=2 -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_AVCT_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_AVCT_TRACE_LEVEL=2 -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_AVRC_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_AVRC_TRACE_LEVEL=2 -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_MCA_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_MCA_TRACE_LEVEL=2 -# CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_HID_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_HID_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_HID_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_HID_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_HID_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_HID_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_HID_TRACE_LEVEL=2 -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_APPL_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_APPL_TRACE_LEVEL=2 -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_GATT_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_GATT_TRACE_LEVEL=2 -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_SMP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_SMP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BTIF_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BTIF_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BTC_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BTC_TRACE_LEVEL=2 -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_OSI_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_OSI_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BLUFI_TRACE_LEVEL=2 -# end of BT DEBUG LOG LEVEL - -CONFIG_BT_ACL_CONNECTIONS=4 -CONFIG_BT_MULTI_CONNECTION_ENBALE=y -CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y -# CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY is not set -# CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK is not set -CONFIG_BT_SMP_ENABLE=y -# CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN is not set -CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT=30 -CONFIG_BT_MAX_DEVICE_NAME_LEN=32 -# CONFIG_BT_BLE_RPA_SUPPORTED is not set -CONFIG_BT_BLE_RPA_TIMEOUT=900 -# CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL is not set -# end of Bluedroid Options +# CONFIG_BT_ENABLED is not set # end of Bluetooth -# CONFIG_BLE_MESH is not set - # # CoAP Configuration # @@ -527,7 +268,7 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y # # UART configuration # -CONFIG_UART_ISR_IN_IRAM=y +# CONFIG_UART_ISR_IN_IRAM is not set # end of UART configuration # @@ -623,6 +364,7 @@ CONFIG_ESP32_XTAL_FREQ_40=y # CONFIG_ESP32_XTAL_FREQ_AUTO is not set CONFIG_ESP32_XTAL_FREQ=40 # CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_ESP32_NO_BLOBS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set @@ -657,7 +399,7 @@ CONFIG_ETH_DMA_RX_BUFFER_NUM=10 CONFIG_ETH_DMA_TX_BUFFER_NUM=10 CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set -CONFIG_ETH_SPI_ETHERNET_W5500=y +# CONFIG_ETH_SPI_ETHERNET_W5500 is not set # CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set # CONFIG_ETH_USE_OPENETH is not set # end of Ethernet @@ -691,7 +433,7 @@ CONFIG_HTTPD_MAX_URI_LEN=512 CONFIG_HTTPD_ERR_RESP_NO_DELAY=y CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_HTTPD_LOG_PURGE_DATA is not set -CONFIG_HTTPD_WS_SUPPORT=y +# CONFIG_HTTPD_WS_SUPPORT is not set # end of HTTP Server # @@ -726,10 +468,11 @@ CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 # # Sleep Config # -CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y +# CONFIG_ESP_SLEEP_POWER_DOWN_FLASH is not set CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y -CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y -# CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set +CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y +# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set # end of Sleep Config # @@ -808,7 +551,7 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # end of Memory protection CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y # CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set @@ -832,7 +575,8 @@ CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y # CONFIG_ESP_PANIC_HANDLER_IRAM is not set # CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5=y +# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y # end of ESP System Settings # @@ -852,13 +596,12 @@ CONFIG_ESP_TIMER_IMPL_TG0_LAC=y # Wi-Fi # CONFIG_ESP32_WIFI_ENABLED=y -CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 # CONFIG_ESP32_WIFI_CSI_ENABLED is not set CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP32_WIFI_TX_BA_WIN=6 @@ -963,7 +706,7 @@ CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y CONFIG_FREERTOS_CORETIMER_0=y # CONFIG_FREERTOS_CORETIMER_1 is not set CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y -CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_HZ=100 CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set @@ -984,8 +727,7 @@ CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -CONFIG_FREERTOS_USE_TRACE_FACILITY=y -# CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS is not set +# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y @@ -1034,20 +776,17 @@ CONFIG_HEAP_TRACING_OFF=y # # Log output # -CONFIG_LOG_DEFAULT_LEVEL_NONE=y +# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set # CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set # CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set +CONFIG_LOG_DEFAULT_LEVEL_INFO=y # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=0 +CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y -# CONFIG_LOG_MAXIMUM_LEVEL_ERROR is not set -# CONFIG_LOG_MAXIMUM_LEVEL_WARN is not set -# CONFIG_LOG_MAXIMUM_LEVEL_INFO is not set # CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set # CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set -CONFIG_LOG_MAXIMUM_LEVEL=0 +CONFIG_LOG_MAXIMUM_LEVEL=3 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set @@ -1062,7 +801,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set -CONFIG_LWIP_IRAM_OPTIMIZATION=y +# CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y CONFIG_LWIP_MAX_SOCKETS=10 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set @@ -1082,7 +821,7 @@ CONFIG_LWIP_ESP_GRATUITOUS_ARP=y CONFIG_LWIP_GARP_TMR_INTERVAL=60 CONFIG_LWIP_ESP_MLDV6_REPORT=y CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y @@ -1208,20 +947,17 @@ CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y # CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 -CONFIG_MBEDTLS_DYNAMIC_BUFFER=y -CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y -CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y -CONFIG_MBEDTLS_DYNAMIC_FREE_CA_CERT=y +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 +# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set # CONFIG_MBEDTLS_DEBUG is not set # # mbedTLS v2.28.x related # # CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set -CONFIG_MBEDTLS_ECDH_LEGACY_CONTEXT=y # CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set # CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set +CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y # end of mbedTLS v2.28.x related # @@ -1235,8 +971,8 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 # end of Certificate Bundle -CONFIG_MBEDTLS_ECP_RESTARTABLE=y -CONFIG_MBEDTLS_CMAC_C=y +# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set +# CONFIG_MBEDTLS_CMAC_C is not set CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_HARDWARE_MPI=y CONFIG_MBEDTLS_HARDWARE_SHA=y @@ -1438,8 +1174,8 @@ CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y +# CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP is not set +# CONFIG_SPI_FLASH_SUPPORT_TH_CHIP is not set # end of Auto-detect flash chips CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y @@ -1539,9 +1275,7 @@ CONFIG_WL_SECTOR_SIZE=4096 # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 -CONFIG_WIFI_PROV_BLE_BONDING=y -CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION=y -# CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV is not set +# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set # end of Wi-Fi Provisioning Manager # @@ -1581,14 +1315,14 @@ CONFIG_LUA_ROOT="/lua" # end of Compatibility options # Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32s3-elf-" -CONFIG_LOG_BOOTLOADER_LEVEL_NONE=y +CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set # CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set # CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set +CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=0 +CONFIG_LOG_BOOTLOADER_LEVEL=3 # CONFIG_APP_ROLLBACK_ENABLE is not set # CONFIG_FLASH_ENCRYPTION_ENABLED is not set # CONFIG_FLASHMODE_QIO is not set @@ -1620,210 +1354,6 @@ CONFIG_STACK_CHECK_NONE=y # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y -# CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY is not set -# CONFIG_BTDM_CONTROLLER_MODE_BTDM is not set -CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3 -CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3 -CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0 -CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 -CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 -CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y -# CONFIG_BTDM_CONTROLLER_HCI_MODE_UART_H4 is not set -CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=y -CONFIG_BLE_SCAN_DUPLICATE=y -CONFIG_SCAN_DUPLICATE_BY_DEVICE_ADDR=y -# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA is not set -# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR is not set -CONFIG_SCAN_DUPLICATE_TYPE=0 -CONFIG_DUPLICATE_SCAN_CACHE_SIZE=100 -# CONFIG_BLE_MESH_SCAN_DUPLICATE_EN is not set -CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y -CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=y -CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM=100 -CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 -CONFIG_BLUEDROID_ENABLED=y -# CONFIG_NIMBLE_ENABLED is not set -CONFIG_BTC_TASK_STACK_SIZE=4096 -CONFIG_BLUEDROID_PINNED_TO_CORE_0=y -# CONFIG_BLUEDROID_PINNED_TO_CORE_1 is not set -CONFIG_BLUEDROID_PINNED_TO_CORE=0 -CONFIG_BTU_TASK_STACK_SIZE=4096 -# CONFIG_BLUEDROID_MEM_DEBUG is not set -# CONFIG_CLASSIC_BT_ENABLED is not set -CONFIG_GATTS_ENABLE=y -# CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set -CONFIG_GATTS_SEND_SERVICE_CHANGE_AUTO=y -CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE=0 -CONFIG_GATTC_ENABLE=y -# CONFIG_GATTC_CACHE_NVS_FLASH is not set -CONFIG_BLE_SMP_ENABLE=y -# CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set -# CONFIG_HCI_TRACE_LEVEL_NONE is not set -# CONFIG_HCI_TRACE_LEVEL_ERROR is not set -CONFIG_HCI_TRACE_LEVEL_WARNING=y -# CONFIG_HCI_TRACE_LEVEL_API is not set -# CONFIG_HCI_TRACE_LEVEL_EVENT is not set -# CONFIG_HCI_TRACE_LEVEL_DEBUG is not set -# CONFIG_HCI_TRACE_LEVEL_VERBOSE is not set -CONFIG_HCI_INITIAL_TRACE_LEVEL=2 -# CONFIG_BTM_TRACE_LEVEL_NONE is not set -# CONFIG_BTM_TRACE_LEVEL_ERROR is not set -CONFIG_BTM_TRACE_LEVEL_WARNING=y -# CONFIG_BTM_TRACE_LEVEL_API is not set -# CONFIG_BTM_TRACE_LEVEL_EVENT is not set -# CONFIG_BTM_TRACE_LEVEL_DEBUG is not set -# CONFIG_BTM_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTM_INITIAL_TRACE_LEVEL=2 -# CONFIG_L2CAP_TRACE_LEVEL_NONE is not set -# CONFIG_L2CAP_TRACE_LEVEL_ERROR is not set -CONFIG_L2CAP_TRACE_LEVEL_WARNING=y -# CONFIG_L2CAP_TRACE_LEVEL_API is not set -# CONFIG_L2CAP_TRACE_LEVEL_EVENT is not set -# CONFIG_L2CAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_L2CAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_L2CAP_INITIAL_TRACE_LEVEL=2 -# CONFIG_RFCOMM_TRACE_LEVEL_NONE is not set -# CONFIG_RFCOMM_TRACE_LEVEL_ERROR is not set -CONFIG_RFCOMM_TRACE_LEVEL_WARNING=y -# CONFIG_RFCOMM_TRACE_LEVEL_API is not set -# CONFIG_RFCOMM_TRACE_LEVEL_EVENT is not set -# CONFIG_RFCOMM_TRACE_LEVEL_DEBUG is not set -# CONFIG_RFCOMM_TRACE_LEVEL_VERBOSE is not set -CONFIG_RFCOMM_INITIAL_TRACE_LEVEL=2 -# CONFIG_SDP_TRACE_LEVEL_NONE is not set -# CONFIG_SDP_TRACE_LEVEL_ERROR is not set -CONFIG_SDP_TRACE_LEVEL_WARNING=y -# CONFIG_SDP_TRACE_LEVEL_API is not set -# CONFIG_SDP_TRACE_LEVEL_EVENT is not set -# CONFIG_SDP_TRACE_LEVEL_DEBUG is not set -# CONFIG_SDP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTH_LOG_SDP_INITIAL_TRACE_LEVEL=2 -# CONFIG_GAP_TRACE_LEVEL_NONE is not set -# CONFIG_GAP_TRACE_LEVEL_ERROR is not set -CONFIG_GAP_TRACE_LEVEL_WARNING=y -# CONFIG_GAP_TRACE_LEVEL_API is not set -# CONFIG_GAP_TRACE_LEVEL_EVENT is not set -# CONFIG_GAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_GAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_GAP_INITIAL_TRACE_LEVEL=2 -CONFIG_BNEP_INITIAL_TRACE_LEVEL=2 -# CONFIG_PAN_TRACE_LEVEL_NONE is not set -# CONFIG_PAN_TRACE_LEVEL_ERROR is not set -CONFIG_PAN_TRACE_LEVEL_WARNING=y -# CONFIG_PAN_TRACE_LEVEL_API is not set -# CONFIG_PAN_TRACE_LEVEL_EVENT is not set -# CONFIG_PAN_TRACE_LEVEL_DEBUG is not set -# CONFIG_PAN_TRACE_LEVEL_VERBOSE is not set -CONFIG_PAN_INITIAL_TRACE_LEVEL=2 -# CONFIG_A2D_TRACE_LEVEL_NONE is not set -# CONFIG_A2D_TRACE_LEVEL_ERROR is not set -CONFIG_A2D_TRACE_LEVEL_WARNING=y -# CONFIG_A2D_TRACE_LEVEL_API is not set -# CONFIG_A2D_TRACE_LEVEL_EVENT is not set -# CONFIG_A2D_TRACE_LEVEL_DEBUG is not set -# CONFIG_A2D_TRACE_LEVEL_VERBOSE is not set -CONFIG_A2D_INITIAL_TRACE_LEVEL=2 -# CONFIG_AVDT_TRACE_LEVEL_NONE is not set -# CONFIG_AVDT_TRACE_LEVEL_ERROR is not set -CONFIG_AVDT_TRACE_LEVEL_WARNING=y -# CONFIG_AVDT_TRACE_LEVEL_API is not set -# CONFIG_AVDT_TRACE_LEVEL_EVENT is not set -# CONFIG_AVDT_TRACE_LEVEL_DEBUG is not set -# CONFIG_AVDT_TRACE_LEVEL_VERBOSE is not set -CONFIG_AVDT_INITIAL_TRACE_LEVEL=2 -# CONFIG_AVCT_TRACE_LEVEL_NONE is not set -# CONFIG_AVCT_TRACE_LEVEL_ERROR is not set -CONFIG_AVCT_TRACE_LEVEL_WARNING=y -# CONFIG_AVCT_TRACE_LEVEL_API is not set -# CONFIG_AVCT_TRACE_LEVEL_EVENT is not set -# CONFIG_AVCT_TRACE_LEVEL_DEBUG is not set -# CONFIG_AVCT_TRACE_LEVEL_VERBOSE is not set -CONFIG_AVCT_INITIAL_TRACE_LEVEL=2 -# CONFIG_AVRC_TRACE_LEVEL_NONE is not set -# CONFIG_AVRC_TRACE_LEVEL_ERROR is not set -CONFIG_AVRC_TRACE_LEVEL_WARNING=y -# CONFIG_AVRC_TRACE_LEVEL_API is not set -# CONFIG_AVRC_TRACE_LEVEL_EVENT is not set -# CONFIG_AVRC_TRACE_LEVEL_DEBUG is not set -# CONFIG_AVRC_TRACE_LEVEL_VERBOSE is not set -CONFIG_AVRC_INITIAL_TRACE_LEVEL=2 -# CONFIG_MCA_TRACE_LEVEL_NONE is not set -# CONFIG_MCA_TRACE_LEVEL_ERROR is not set -CONFIG_MCA_TRACE_LEVEL_WARNING=y -# CONFIG_MCA_TRACE_LEVEL_API is not set -# CONFIG_MCA_TRACE_LEVEL_EVENT is not set -# CONFIG_MCA_TRACE_LEVEL_DEBUG is not set -# CONFIG_MCA_TRACE_LEVEL_VERBOSE is not set -CONFIG_MCA_INITIAL_TRACE_LEVEL=2 -# CONFIG_HID_TRACE_LEVEL_NONE is not set -# CONFIG_HID_TRACE_LEVEL_ERROR is not set -CONFIG_HID_TRACE_LEVEL_WARNING=y -# CONFIG_HID_TRACE_LEVEL_API is not set -# CONFIG_HID_TRACE_LEVEL_EVENT is not set -# CONFIG_HID_TRACE_LEVEL_DEBUG is not set -# CONFIG_HID_TRACE_LEVEL_VERBOSE is not set -CONFIG_HID_INITIAL_TRACE_LEVEL=2 -# CONFIG_APPL_TRACE_LEVEL_NONE is not set -# CONFIG_APPL_TRACE_LEVEL_ERROR is not set -CONFIG_APPL_TRACE_LEVEL_WARNING=y -# CONFIG_APPL_TRACE_LEVEL_API is not set -# CONFIG_APPL_TRACE_LEVEL_EVENT is not set -# CONFIG_APPL_TRACE_LEVEL_DEBUG is not set -# CONFIG_APPL_TRACE_LEVEL_VERBOSE is not set -CONFIG_APPL_INITIAL_TRACE_LEVEL=2 -# CONFIG_GATT_TRACE_LEVEL_NONE is not set -# CONFIG_GATT_TRACE_LEVEL_ERROR is not set -CONFIG_GATT_TRACE_LEVEL_WARNING=y -# CONFIG_GATT_TRACE_LEVEL_API is not set -# CONFIG_GATT_TRACE_LEVEL_EVENT is not set -# CONFIG_GATT_TRACE_LEVEL_DEBUG is not set -# CONFIG_GATT_TRACE_LEVEL_VERBOSE is not set -CONFIG_GATT_INITIAL_TRACE_LEVEL=2 -# CONFIG_SMP_TRACE_LEVEL_NONE is not set -# CONFIG_SMP_TRACE_LEVEL_ERROR is not set -CONFIG_SMP_TRACE_LEVEL_WARNING=y -# CONFIG_SMP_TRACE_LEVEL_API is not set -# CONFIG_SMP_TRACE_LEVEL_EVENT is not set -# CONFIG_SMP_TRACE_LEVEL_DEBUG is not set -# CONFIG_SMP_TRACE_LEVEL_VERBOSE is not set -CONFIG_SMP_INITIAL_TRACE_LEVEL=2 -# CONFIG_BTIF_TRACE_LEVEL_NONE is not set -# CONFIG_BTIF_TRACE_LEVEL_ERROR is not set -CONFIG_BTIF_TRACE_LEVEL_WARNING=y -# CONFIG_BTIF_TRACE_LEVEL_API is not set -# CONFIG_BTIF_TRACE_LEVEL_EVENT is not set -# CONFIG_BTIF_TRACE_LEVEL_DEBUG is not set -# CONFIG_BTIF_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTIF_INITIAL_TRACE_LEVEL=2 -# CONFIG_BTC_TRACE_LEVEL_NONE is not set -# CONFIG_BTC_TRACE_LEVEL_ERROR is not set -CONFIG_BTC_TRACE_LEVEL_WARNING=y -# CONFIG_BTC_TRACE_LEVEL_API is not set -# CONFIG_BTC_TRACE_LEVEL_EVENT is not set -# CONFIG_BTC_TRACE_LEVEL_DEBUG is not set -# CONFIG_BTC_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTC_INITIAL_TRACE_LEVEL=2 -# CONFIG_OSI_TRACE_LEVEL_NONE is not set -# CONFIG_OSI_TRACE_LEVEL_ERROR is not set -CONFIG_OSI_TRACE_LEVEL_WARNING=y -# CONFIG_OSI_TRACE_LEVEL_API is not set -# CONFIG_OSI_TRACE_LEVEL_EVENT is not set -# CONFIG_OSI_TRACE_LEVEL_DEBUG is not set -# CONFIG_OSI_TRACE_LEVEL_VERBOSE is not set -CONFIG_OSI_INITIAL_TRACE_LEVEL=2 -# CONFIG_BLUFI_TRACE_LEVEL_NONE is not set -# CONFIG_BLUFI_TRACE_LEVEL_ERROR is not set -CONFIG_BLUFI_TRACE_LEVEL_WARNING=y -# CONFIG_BLUFI_TRACE_LEVEL_API is not set -# CONFIG_BLUFI_TRACE_LEVEL_EVENT is not set -# CONFIG_BLUFI_TRACE_LEVEL_DEBUG is not set -# CONFIG_BLUFI_TRACE_LEVEL_VERBOSE is not set -CONFIG_BLUFI_INITIAL_TRACE_LEVEL=2 -# CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK is not set -CONFIG_SMP_ENABLE=y -# CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY is not set -CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30 CONFIG_ADC2_DISABLE_DAC=y # CONFIG_SPIRAM_SUPPORT is not set CONFIG_TRACEMEM_RESERVE_DRAM=0x0 @@ -1844,6 +1374,7 @@ CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set # CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_NO_BLOBS is not set # CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set # CONFIG_EVENT_LOOP_PROFILING is not set CONFIG_POST_EVENTS_FROM_ISR=y @@ -1851,8 +1382,8 @@ CONFIG_POST_EVENTS_FROM_IRAM_ISR=y # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 -CONFIG_ESP_SYSTEM_PD_FLASH=y -CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND=y +# CONFIG_ESP_SYSTEM_PD_FLASH is not set +# CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND is not set CONFIG_IPC_TASK_STACK_SIZE=1536 CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y # CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set @@ -1864,7 +1395,7 @@ CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y # CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set # CONFIG_ESP32S2_PANIC_GDBSTUB is not set CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=3072 +CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 CONFIG_MAIN_TASK_STACK_SIZE=3584 CONFIG_CONSOLE_UART_DEFAULT=y # CONFIG_CONSOLE_UART_CUSTOM is not set @@ -1882,7 +1413,6 @@ CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y # CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set CONFIG_TIMER_TASK_STACK_SIZE=3584 -CONFIG_SW_COEXIST_ENABLE=y # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y @@ -1907,7 +1437,7 @@ CONFIG_TIMER_QUEUE_LENGTH=10 # CONFIG_USE_ONLY_LWIP_SELECT is not set CONFIG_ESP_GRATUITOUS_ARP=y CONFIG_GARP_TMR_INTERVAL=60 -CONFIG_TCPIP_RECVMBOX_SIZE=16 +CONFIG_TCPIP_RECVMBOX_SIZE=32 CONFIG_TCP_MAXRTX=12 CONFIG_TCP_SYNMAXRTX=12 CONFIG_TCP_MSS=1440 diff --git a/sdkconfig.old b/sdkconfig.old index 87c96fd5b..d01603c52 100644 --- a/sdkconfig.old +++ b/sdkconfig.old @@ -11,7 +11,7 @@ CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 # # SDK tool configuration # -CONFIG_SDK_TOOLPREFIX="xtensa-esp32s3-elf-" +CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" # CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set # end of SDK tool configuration @@ -43,13 +43,13 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set -CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set # CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set # CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set +CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=0 +CONFIG_BOOTLOADER_LOG_LEVEL=3 # CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set @@ -92,14 +92,14 @@ CONFIG_ESPTOOLPY_FLASHFREQ_40M=y # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set CONFIG_ESPTOOLPY_FLASHFREQ="40m" # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE="8MB" +CONFIG_ESPTOOLPY_FLASHSIZE="2MB" CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y CONFIG_ESPTOOLPY_BEFORE_RESET=y # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set @@ -122,12 +122,12 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # # Partition Table # -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set +CONFIG_PARTITION_TABLE_SINGLE_APP=y # CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="ezlopi_partitions_v3_1_4_181_4mb.csv" -CONFIG_PARTITION_TABLE_FILENAME="ezlopi_partitions_v3_1_4_181_4mb.csv" +# CONFIG_PARTITION_TABLE_CUSTOM is not set +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table @@ -144,8 +144,8 @@ CONFIG_EZPI_DISTRO_FULL_OPTION=y # CONFIG_EZLOPI_DISTRO_WIFI_HUB is not set # CONFIG_EZLOPI_DISTRO_BLE_HUB is not set # CONFIG_EZLOPI_DISTRO_MINIMAL is not set -# CONFIG_EZPI_HEAP_ENABLE is not set -CONFIG_EZPI_DEV_TYPE_TEST=y +CONFIG_EZPI_HEAP_ENABLE=y +# CONFIG_EZPI_DEV_TYPE_TEST is not set CONFIG_EZPI_UTIL_TRACE_EN=y CONFIG_EZLOPI_BLE_ENABLE=y CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y @@ -154,13 +154,21 @@ CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y CONFIG_EZPI_ENABLE_WIFI=y CONFIG_EZPI_ENABLE_OTA=y CONFIG_EZPI_ENABLE_UART_PROVISIONING=y -# CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER is not set +CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER=y CONFIG_EZPI_WEBSOCKET_CLIENT=y CONFIG_EZPI_CORE_STATIC_BUFFER_SIZE=10240 CONFIG_EZPI_SERV_ENABLE_MESHBOTS=y CONFIG_EZLPI_SERV_ENABLE_MODES=y CONFIG_EZPI_ENABLE_LED_INDICATOR=y -# CONFIG_EZPI_ENABLE_MDNS_SERVICE is not set +CONFIG_EZPI_ENABLE_MDNS_SERVICE=y + +# +# EzloPi mDNS config +# +CONFIG_EZPI_MDNS_HOSTNAME="ezlopi_device" +CONFIG_EZPI_MDNS_INSTANCE_NAME="ezlopi_serial" +# CONFIG_EZPI_MDNS_ENABLE_EXTRA_SERVICES is not set +# end of EzloPi mDNS config # end of EzloPi User Config # @@ -208,278 +216,9 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # # Bluetooth # -CONFIG_BT_ENABLED=y - -# -# Bluetooth controller -# -CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y -# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set -# CONFIG_BTDM_CTRL_MODE_BTDM is not set -CONFIG_BTDM_CTRL_BLE_MAX_CONN=3 -CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0 -CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 -CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 -CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3 -CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0 -CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 -CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y -# CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set -CONFIG_BTDM_CTRL_PINNED_TO_CORE=0 -CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y -# CONFIG_BTDM_CTRL_HCI_MODE_UART_H4 is not set - -# -# MODEM SLEEP Options -# -CONFIG_BTDM_CTRL_MODEM_SLEEP=y -CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG=y -# CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_EVED is not set -CONFIG_BTDM_CTRL_LPCLK_SEL_MAIN_XTAL=y -# end of MODEM SLEEP Options - -CONFIG_BTDM_BLE_DEFAULT_SCA_250PPM=y -CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1 -CONFIG_BTDM_BLE_SCAN_DUPL=y -CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE=y -# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA is not set -# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE is not set -CONFIG_BTDM_SCAN_DUPL_TYPE=0 -CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=100 -CONFIG_BTDM_SCAN_DUPL_CACHE_REFRESH_PERIOD=0 -# CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set -CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y -CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y -CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 -CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 -CONFIG_BTDM_RESERVE_DRAM=0xdb5c -CONFIG_BTDM_CTRL_HLI=y -# end of Bluetooth controller - -CONFIG_BT_BLUEDROID_ENABLED=y -# CONFIG_BT_NIMBLE_ENABLED is not set -# CONFIG_BT_CONTROLLER_ONLY is not set - -# -# Bluedroid Options -# -CONFIG_BT_BTC_TASK_STACK_SIZE=4096 -CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y -# CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1 is not set -CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0 -CONFIG_BT_BTU_TASK_STACK_SIZE=4096 -# CONFIG_BT_BLUEDROID_MEM_DEBUG is not set -# CONFIG_BT_CLASSIC_ENABLED is not set -CONFIG_BT_BLE_ENABLED=y -CONFIG_BT_GATTS_ENABLE=y -# CONFIG_BT_GATTS_PPCP_CHAR_GAP is not set -# CONFIG_BT_BLE_BLUFI_ENABLE is not set -CONFIG_BT_GATT_MAX_SR_PROFILES=8 -CONFIG_BT_GATT_MAX_SR_ATTRIBUTES=100 -# CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set -CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_AUTO=y -CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 -# CONFIG_BT_GATTS_ROBUST_CACHING_ENABLED is not set -# CONFIG_BT_GATTS_DEVICE_NAME_WRITABLE is not set -# CONFIG_BT_GATTS_APPEARANCE_WRITABLE is not set -CONFIG_BT_GATTC_ENABLE=y -CONFIG_BT_GATTC_MAX_CACHE_CHAR=40 -# CONFIG_BT_GATTC_CACHE_NVS_FLASH is not set -CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3 -CONFIG_BT_BLE_SMP_ENABLE=y -# CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set -# CONFIG_BT_STACK_NO_LOG is not set - -# -# BT DEBUG LOG LEVEL -# -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_HCI_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_HCI_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_HCI_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BTM_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BTM_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BTM_TRACE_LEVEL=2 -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_L2CAP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL=2 -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_SDP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_SDP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_SDP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_GAP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_GAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_GAP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BNEP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BNEP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_PAN_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_PAN_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_PAN_TRACE_LEVEL=2 -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_A2D_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_A2D_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_A2D_TRACE_LEVEL=2 -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_AVDT_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_AVDT_TRACE_LEVEL=2 -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_AVCT_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_AVCT_TRACE_LEVEL=2 -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_AVRC_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_AVRC_TRACE_LEVEL=2 -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_MCA_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_MCA_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_MCA_TRACE_LEVEL=2 -# CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_HID_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_HID_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_HID_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_HID_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_HID_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_HID_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_HID_TRACE_LEVEL=2 -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_APPL_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_APPL_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_APPL_TRACE_LEVEL=2 -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_GATT_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_GATT_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_GATT_TRACE_LEVEL=2 -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_SMP_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_SMP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_SMP_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BTIF_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BTIF_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BTC_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BTC_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BTC_TRACE_LEVEL=2 -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_OSI_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_OSI_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_OSI_TRACE_LEVEL=2 -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE is not set -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_ERROR is not set -CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_WARNING=y -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_API is not set -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_EVENT is not set -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_DEBUG is not set -# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_VERBOSE is not set -CONFIG_BT_LOG_BLUFI_TRACE_LEVEL=2 -# end of BT DEBUG LOG LEVEL - -CONFIG_BT_ACL_CONNECTIONS=4 -CONFIG_BT_MULTI_CONNECTION_ENBALE=y -CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y -# CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY is not set -# CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK is not set -CONFIG_BT_SMP_ENABLE=y -# CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN is not set -CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT=30 -CONFIG_BT_MAX_DEVICE_NAME_LEN=32 -# CONFIG_BT_BLE_RPA_SUPPORTED is not set -CONFIG_BT_BLE_RPA_TIMEOUT=900 -# CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL is not set -# end of Bluedroid Options +# CONFIG_BT_ENABLED is not set # end of Bluetooth -# CONFIG_BLE_MESH is not set - # # CoAP Configuration # @@ -529,7 +268,7 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y # # UART configuration # -CONFIG_UART_ISR_IN_IRAM=y +# CONFIG_UART_ISR_IN_IRAM is not set # end of UART configuration # @@ -625,6 +364,7 @@ CONFIG_ESP32_XTAL_FREQ_40=y # CONFIG_ESP32_XTAL_FREQ_AUTO is not set CONFIG_ESP32_XTAL_FREQ=40 # CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_ESP32_NO_BLOBS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set @@ -659,7 +399,7 @@ CONFIG_ETH_DMA_RX_BUFFER_NUM=10 CONFIG_ETH_DMA_TX_BUFFER_NUM=10 CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set -CONFIG_ETH_SPI_ETHERNET_W5500=y +# CONFIG_ETH_SPI_ETHERNET_W5500 is not set # CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set # CONFIG_ETH_USE_OPENETH is not set # end of Ethernet @@ -693,7 +433,7 @@ CONFIG_HTTPD_MAX_URI_LEN=512 CONFIG_HTTPD_ERR_RESP_NO_DELAY=y CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_HTTPD_LOG_PURGE_DATA is not set -CONFIG_HTTPD_WS_SUPPORT=y +# CONFIG_HTTPD_WS_SUPPORT is not set # end of HTTP Server # @@ -728,10 +468,11 @@ CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 # # Sleep Config # -CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y +# CONFIG_ESP_SLEEP_POWER_DOWN_FLASH is not set CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y -CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y -# CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set +CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y +# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set # end of Sleep Config # @@ -810,7 +551,7 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # end of Memory protection CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y # CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set @@ -834,7 +575,8 @@ CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y # CONFIG_ESP_PANIC_HANDLER_IRAM is not set # CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5=y +# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y # end of ESP System Settings # @@ -854,13 +596,12 @@ CONFIG_ESP_TIMER_IMPL_TG0_LAC=y # Wi-Fi # CONFIG_ESP32_WIFI_ENABLED=y -CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 # CONFIG_ESP32_WIFI_CSI_ENABLED is not set CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP32_WIFI_TX_BA_WIN=6 @@ -965,7 +706,7 @@ CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y CONFIG_FREERTOS_CORETIMER_0=y # CONFIG_FREERTOS_CORETIMER_1 is not set CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y -CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_HZ=100 CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set @@ -986,8 +727,7 @@ CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -CONFIG_FREERTOS_USE_TRACE_FACILITY=y -# CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS is not set +# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y @@ -1036,20 +776,17 @@ CONFIG_HEAP_TRACING_OFF=y # # Log output # -CONFIG_LOG_DEFAULT_LEVEL_NONE=y +# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set # CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set # CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set +CONFIG_LOG_DEFAULT_LEVEL_INFO=y # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=0 +CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y -# CONFIG_LOG_MAXIMUM_LEVEL_ERROR is not set -# CONFIG_LOG_MAXIMUM_LEVEL_WARN is not set -# CONFIG_LOG_MAXIMUM_LEVEL_INFO is not set # CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set # CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set -CONFIG_LOG_MAXIMUM_LEVEL=0 +CONFIG_LOG_MAXIMUM_LEVEL=3 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set @@ -1064,7 +801,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set -CONFIG_LWIP_IRAM_OPTIMIZATION=y +# CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y CONFIG_LWIP_MAX_SOCKETS=10 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set @@ -1084,7 +821,7 @@ CONFIG_LWIP_ESP_GRATUITOUS_ARP=y CONFIG_LWIP_GARP_TMR_INTERVAL=60 CONFIG_LWIP_ESP_MLDV6_REPORT=y CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y @@ -1210,20 +947,17 @@ CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y # CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 -CONFIG_MBEDTLS_DYNAMIC_BUFFER=y -CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y -CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y -CONFIG_MBEDTLS_DYNAMIC_FREE_CA_CERT=y +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 +# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set # CONFIG_MBEDTLS_DEBUG is not set # # mbedTLS v2.28.x related # # CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set -CONFIG_MBEDTLS_ECDH_LEGACY_CONTEXT=y # CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set # CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set +CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y # end of mbedTLS v2.28.x related # @@ -1237,8 +971,8 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 # end of Certificate Bundle -CONFIG_MBEDTLS_ECP_RESTARTABLE=y -CONFIG_MBEDTLS_CMAC_C=y +# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set +# CONFIG_MBEDTLS_CMAC_C is not set CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_HARDWARE_MPI=y CONFIG_MBEDTLS_HARDWARE_SHA=y @@ -1440,8 +1174,8 @@ CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y +# CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP is not set +# CONFIG_SPI_FLASH_SUPPORT_TH_CHIP is not set # end of Auto-detect flash chips CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y @@ -1541,9 +1275,7 @@ CONFIG_WL_SECTOR_SIZE=4096 # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 -CONFIG_WIFI_PROV_BLE_BONDING=y -CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION=y -# CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV is not set +# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set # end of Wi-Fi Provisioning Manager # @@ -1583,14 +1315,14 @@ CONFIG_LUA_ROOT="/lua" # end of Compatibility options # Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32s3-elf-" -CONFIG_LOG_BOOTLOADER_LEVEL_NONE=y +CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set # CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set # CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set +CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=0 +CONFIG_LOG_BOOTLOADER_LEVEL=3 # CONFIG_APP_ROLLBACK_ENABLE is not set # CONFIG_FLASH_ENCRYPTION_ENABLED is not set # CONFIG_FLASHMODE_QIO is not set @@ -1622,210 +1354,6 @@ CONFIG_STACK_CHECK_NONE=y # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y -# CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY is not set -# CONFIG_BTDM_CONTROLLER_MODE_BTDM is not set -CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3 -CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3 -CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0 -CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 -CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 -CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y -# CONFIG_BTDM_CONTROLLER_HCI_MODE_UART_H4 is not set -CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=y -CONFIG_BLE_SCAN_DUPLICATE=y -CONFIG_SCAN_DUPLICATE_BY_DEVICE_ADDR=y -# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA is not set -# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR is not set -CONFIG_SCAN_DUPLICATE_TYPE=0 -CONFIG_DUPLICATE_SCAN_CACHE_SIZE=100 -# CONFIG_BLE_MESH_SCAN_DUPLICATE_EN is not set -CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y -CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=y -CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM=100 -CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 -CONFIG_BLUEDROID_ENABLED=y -# CONFIG_NIMBLE_ENABLED is not set -CONFIG_BTC_TASK_STACK_SIZE=4096 -CONFIG_BLUEDROID_PINNED_TO_CORE_0=y -# CONFIG_BLUEDROID_PINNED_TO_CORE_1 is not set -CONFIG_BLUEDROID_PINNED_TO_CORE=0 -CONFIG_BTU_TASK_STACK_SIZE=4096 -# CONFIG_BLUEDROID_MEM_DEBUG is not set -# CONFIG_CLASSIC_BT_ENABLED is not set -CONFIG_GATTS_ENABLE=y -# CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set -CONFIG_GATTS_SEND_SERVICE_CHANGE_AUTO=y -CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE=0 -CONFIG_GATTC_ENABLE=y -# CONFIG_GATTC_CACHE_NVS_FLASH is not set -CONFIG_BLE_SMP_ENABLE=y -# CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set -# CONFIG_HCI_TRACE_LEVEL_NONE is not set -# CONFIG_HCI_TRACE_LEVEL_ERROR is not set -CONFIG_HCI_TRACE_LEVEL_WARNING=y -# CONFIG_HCI_TRACE_LEVEL_API is not set -# CONFIG_HCI_TRACE_LEVEL_EVENT is not set -# CONFIG_HCI_TRACE_LEVEL_DEBUG is not set -# CONFIG_HCI_TRACE_LEVEL_VERBOSE is not set -CONFIG_HCI_INITIAL_TRACE_LEVEL=2 -# CONFIG_BTM_TRACE_LEVEL_NONE is not set -# CONFIG_BTM_TRACE_LEVEL_ERROR is not set -CONFIG_BTM_TRACE_LEVEL_WARNING=y -# CONFIG_BTM_TRACE_LEVEL_API is not set -# CONFIG_BTM_TRACE_LEVEL_EVENT is not set -# CONFIG_BTM_TRACE_LEVEL_DEBUG is not set -# CONFIG_BTM_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTM_INITIAL_TRACE_LEVEL=2 -# CONFIG_L2CAP_TRACE_LEVEL_NONE is not set -# CONFIG_L2CAP_TRACE_LEVEL_ERROR is not set -CONFIG_L2CAP_TRACE_LEVEL_WARNING=y -# CONFIG_L2CAP_TRACE_LEVEL_API is not set -# CONFIG_L2CAP_TRACE_LEVEL_EVENT is not set -# CONFIG_L2CAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_L2CAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_L2CAP_INITIAL_TRACE_LEVEL=2 -# CONFIG_RFCOMM_TRACE_LEVEL_NONE is not set -# CONFIG_RFCOMM_TRACE_LEVEL_ERROR is not set -CONFIG_RFCOMM_TRACE_LEVEL_WARNING=y -# CONFIG_RFCOMM_TRACE_LEVEL_API is not set -# CONFIG_RFCOMM_TRACE_LEVEL_EVENT is not set -# CONFIG_RFCOMM_TRACE_LEVEL_DEBUG is not set -# CONFIG_RFCOMM_TRACE_LEVEL_VERBOSE is not set -CONFIG_RFCOMM_INITIAL_TRACE_LEVEL=2 -# CONFIG_SDP_TRACE_LEVEL_NONE is not set -# CONFIG_SDP_TRACE_LEVEL_ERROR is not set -CONFIG_SDP_TRACE_LEVEL_WARNING=y -# CONFIG_SDP_TRACE_LEVEL_API is not set -# CONFIG_SDP_TRACE_LEVEL_EVENT is not set -# CONFIG_SDP_TRACE_LEVEL_DEBUG is not set -# CONFIG_SDP_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTH_LOG_SDP_INITIAL_TRACE_LEVEL=2 -# CONFIG_GAP_TRACE_LEVEL_NONE is not set -# CONFIG_GAP_TRACE_LEVEL_ERROR is not set -CONFIG_GAP_TRACE_LEVEL_WARNING=y -# CONFIG_GAP_TRACE_LEVEL_API is not set -# CONFIG_GAP_TRACE_LEVEL_EVENT is not set -# CONFIG_GAP_TRACE_LEVEL_DEBUG is not set -# CONFIG_GAP_TRACE_LEVEL_VERBOSE is not set -CONFIG_GAP_INITIAL_TRACE_LEVEL=2 -CONFIG_BNEP_INITIAL_TRACE_LEVEL=2 -# CONFIG_PAN_TRACE_LEVEL_NONE is not set -# CONFIG_PAN_TRACE_LEVEL_ERROR is not set -CONFIG_PAN_TRACE_LEVEL_WARNING=y -# CONFIG_PAN_TRACE_LEVEL_API is not set -# CONFIG_PAN_TRACE_LEVEL_EVENT is not set -# CONFIG_PAN_TRACE_LEVEL_DEBUG is not set -# CONFIG_PAN_TRACE_LEVEL_VERBOSE is not set -CONFIG_PAN_INITIAL_TRACE_LEVEL=2 -# CONFIG_A2D_TRACE_LEVEL_NONE is not set -# CONFIG_A2D_TRACE_LEVEL_ERROR is not set -CONFIG_A2D_TRACE_LEVEL_WARNING=y -# CONFIG_A2D_TRACE_LEVEL_API is not set -# CONFIG_A2D_TRACE_LEVEL_EVENT is not set -# CONFIG_A2D_TRACE_LEVEL_DEBUG is not set -# CONFIG_A2D_TRACE_LEVEL_VERBOSE is not set -CONFIG_A2D_INITIAL_TRACE_LEVEL=2 -# CONFIG_AVDT_TRACE_LEVEL_NONE is not set -# CONFIG_AVDT_TRACE_LEVEL_ERROR is not set -CONFIG_AVDT_TRACE_LEVEL_WARNING=y -# CONFIG_AVDT_TRACE_LEVEL_API is not set -# CONFIG_AVDT_TRACE_LEVEL_EVENT is not set -# CONFIG_AVDT_TRACE_LEVEL_DEBUG is not set -# CONFIG_AVDT_TRACE_LEVEL_VERBOSE is not set -CONFIG_AVDT_INITIAL_TRACE_LEVEL=2 -# CONFIG_AVCT_TRACE_LEVEL_NONE is not set -# CONFIG_AVCT_TRACE_LEVEL_ERROR is not set -CONFIG_AVCT_TRACE_LEVEL_WARNING=y -# CONFIG_AVCT_TRACE_LEVEL_API is not set -# CONFIG_AVCT_TRACE_LEVEL_EVENT is not set -# CONFIG_AVCT_TRACE_LEVEL_DEBUG is not set -# CONFIG_AVCT_TRACE_LEVEL_VERBOSE is not set -CONFIG_AVCT_INITIAL_TRACE_LEVEL=2 -# CONFIG_AVRC_TRACE_LEVEL_NONE is not set -# CONFIG_AVRC_TRACE_LEVEL_ERROR is not set -CONFIG_AVRC_TRACE_LEVEL_WARNING=y -# CONFIG_AVRC_TRACE_LEVEL_API is not set -# CONFIG_AVRC_TRACE_LEVEL_EVENT is not set -# CONFIG_AVRC_TRACE_LEVEL_DEBUG is not set -# CONFIG_AVRC_TRACE_LEVEL_VERBOSE is not set -CONFIG_AVRC_INITIAL_TRACE_LEVEL=2 -# CONFIG_MCA_TRACE_LEVEL_NONE is not set -# CONFIG_MCA_TRACE_LEVEL_ERROR is not set -CONFIG_MCA_TRACE_LEVEL_WARNING=y -# CONFIG_MCA_TRACE_LEVEL_API is not set -# CONFIG_MCA_TRACE_LEVEL_EVENT is not set -# CONFIG_MCA_TRACE_LEVEL_DEBUG is not set -# CONFIG_MCA_TRACE_LEVEL_VERBOSE is not set -CONFIG_MCA_INITIAL_TRACE_LEVEL=2 -# CONFIG_HID_TRACE_LEVEL_NONE is not set -# CONFIG_HID_TRACE_LEVEL_ERROR is not set -CONFIG_HID_TRACE_LEVEL_WARNING=y -# CONFIG_HID_TRACE_LEVEL_API is not set -# CONFIG_HID_TRACE_LEVEL_EVENT is not set -# CONFIG_HID_TRACE_LEVEL_DEBUG is not set -# CONFIG_HID_TRACE_LEVEL_VERBOSE is not set -CONFIG_HID_INITIAL_TRACE_LEVEL=2 -# CONFIG_APPL_TRACE_LEVEL_NONE is not set -# CONFIG_APPL_TRACE_LEVEL_ERROR is not set -CONFIG_APPL_TRACE_LEVEL_WARNING=y -# CONFIG_APPL_TRACE_LEVEL_API is not set -# CONFIG_APPL_TRACE_LEVEL_EVENT is not set -# CONFIG_APPL_TRACE_LEVEL_DEBUG is not set -# CONFIG_APPL_TRACE_LEVEL_VERBOSE is not set -CONFIG_APPL_INITIAL_TRACE_LEVEL=2 -# CONFIG_GATT_TRACE_LEVEL_NONE is not set -# CONFIG_GATT_TRACE_LEVEL_ERROR is not set -CONFIG_GATT_TRACE_LEVEL_WARNING=y -# CONFIG_GATT_TRACE_LEVEL_API is not set -# CONFIG_GATT_TRACE_LEVEL_EVENT is not set -# CONFIG_GATT_TRACE_LEVEL_DEBUG is not set -# CONFIG_GATT_TRACE_LEVEL_VERBOSE is not set -CONFIG_GATT_INITIAL_TRACE_LEVEL=2 -# CONFIG_SMP_TRACE_LEVEL_NONE is not set -# CONFIG_SMP_TRACE_LEVEL_ERROR is not set -CONFIG_SMP_TRACE_LEVEL_WARNING=y -# CONFIG_SMP_TRACE_LEVEL_API is not set -# CONFIG_SMP_TRACE_LEVEL_EVENT is not set -# CONFIG_SMP_TRACE_LEVEL_DEBUG is not set -# CONFIG_SMP_TRACE_LEVEL_VERBOSE is not set -CONFIG_SMP_INITIAL_TRACE_LEVEL=2 -# CONFIG_BTIF_TRACE_LEVEL_NONE is not set -# CONFIG_BTIF_TRACE_LEVEL_ERROR is not set -CONFIG_BTIF_TRACE_LEVEL_WARNING=y -# CONFIG_BTIF_TRACE_LEVEL_API is not set -# CONFIG_BTIF_TRACE_LEVEL_EVENT is not set -# CONFIG_BTIF_TRACE_LEVEL_DEBUG is not set -# CONFIG_BTIF_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTIF_INITIAL_TRACE_LEVEL=2 -# CONFIG_BTC_TRACE_LEVEL_NONE is not set -# CONFIG_BTC_TRACE_LEVEL_ERROR is not set -CONFIG_BTC_TRACE_LEVEL_WARNING=y -# CONFIG_BTC_TRACE_LEVEL_API is not set -# CONFIG_BTC_TRACE_LEVEL_EVENT is not set -# CONFIG_BTC_TRACE_LEVEL_DEBUG is not set -# CONFIG_BTC_TRACE_LEVEL_VERBOSE is not set -CONFIG_BTC_INITIAL_TRACE_LEVEL=2 -# CONFIG_OSI_TRACE_LEVEL_NONE is not set -# CONFIG_OSI_TRACE_LEVEL_ERROR is not set -CONFIG_OSI_TRACE_LEVEL_WARNING=y -# CONFIG_OSI_TRACE_LEVEL_API is not set -# CONFIG_OSI_TRACE_LEVEL_EVENT is not set -# CONFIG_OSI_TRACE_LEVEL_DEBUG is not set -# CONFIG_OSI_TRACE_LEVEL_VERBOSE is not set -CONFIG_OSI_INITIAL_TRACE_LEVEL=2 -# CONFIG_BLUFI_TRACE_LEVEL_NONE is not set -# CONFIG_BLUFI_TRACE_LEVEL_ERROR is not set -CONFIG_BLUFI_TRACE_LEVEL_WARNING=y -# CONFIG_BLUFI_TRACE_LEVEL_API is not set -# CONFIG_BLUFI_TRACE_LEVEL_EVENT is not set -# CONFIG_BLUFI_TRACE_LEVEL_DEBUG is not set -# CONFIG_BLUFI_TRACE_LEVEL_VERBOSE is not set -CONFIG_BLUFI_INITIAL_TRACE_LEVEL=2 -# CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK is not set -CONFIG_SMP_ENABLE=y -# CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY is not set -CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30 CONFIG_ADC2_DISABLE_DAC=y # CONFIG_SPIRAM_SUPPORT is not set CONFIG_TRACEMEM_RESERVE_DRAM=0x0 @@ -1846,6 +1374,7 @@ CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set # CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_NO_BLOBS is not set # CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set # CONFIG_EVENT_LOOP_PROFILING is not set CONFIG_POST_EVENTS_FROM_ISR=y @@ -1853,8 +1382,8 @@ CONFIG_POST_EVENTS_FROM_IRAM_ISR=y # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 -CONFIG_ESP_SYSTEM_PD_FLASH=y -CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND=y +# CONFIG_ESP_SYSTEM_PD_FLASH is not set +# CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND is not set CONFIG_IPC_TASK_STACK_SIZE=1536 CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y # CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set @@ -1866,7 +1395,7 @@ CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y # CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set # CONFIG_ESP32S2_PANIC_GDBSTUB is not set CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=3072 +CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 CONFIG_MAIN_TASK_STACK_SIZE=3584 CONFIG_CONSOLE_UART_DEFAULT=y # CONFIG_CONSOLE_UART_CUSTOM is not set @@ -1884,7 +1413,6 @@ CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y # CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set CONFIG_TIMER_TASK_STACK_SIZE=3584 -CONFIG_SW_COEXIST_ENABLE=y # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y @@ -1909,7 +1437,7 @@ CONFIG_TIMER_QUEUE_LENGTH=10 # CONFIG_USE_ONLY_LWIP_SELECT is not set CONFIG_ESP_GRATUITOUS_ARP=y CONFIG_GARP_TMR_INTERVAL=60 -CONFIG_TCPIP_RECVMBOX_SIZE=16 +CONFIG_TCPIP_RECVMBOX_SIZE=32 CONFIG_TCP_MAXRTX=12 CONFIG_TCP_SYNMAXRTX=12 CONFIG_TCP_MSS=1440 From 0f56ef3683aa3e06c97a784baede2edde35975a9 Mon Sep 17 00:00:00 2001 From: lomasSE89 Date: Tue, 30 Apr 2024 00:53:22 +0545 Subject: [PATCH 24/29] issue on different libs. --- .../ezlopi-cloud-info/ezlopi_cloud_info.c | 2 +- .../ezlopi-cloud-items/ezlopi_cloud_items.c | 2 +- .../ezlopi-core-info/ezlopi_core_info.h | 2 +- .../ezlopi_core_processes.c | 4 +-- .../ezlopi-core-sntp/ezlopi_core_sntp.c | 22 ++++++------ .../ezlopi-core-timer/ezlopi_core_timer.h | 8 ++--- .../ezlopi_core_websocket_client.h | 2 +- .../ezlopi-hal-spi/ezlopi_hal_spi_master.c | 8 ++--- .../device_0001_digitalOut_generic.c | 2 +- .../device_0002_digitalOut_relay.c | 2 +- .../device_0003_digitalOut_plug.c | 2 +- .../device_0004_digitalIn_generic.c | 2 +- .../device_0009_other_RMT_SK6812.c | 2 +- .../sensor_0008_I2C_LTR303ALS.c | 2 +- .../sensor-0015-oneWire-DHT11/dht11.c | 4 +-- .../sensor-0016-oneWire-DHT22/dht22.c | 2 +- .../sensor_0018_other_internal_hall_effect.c | 2 +- .../sensor-0031-other-JSNSR04T/jsn_sr04t.h | 2 +- .../sensor_0033_ADC_turbidity.h | 4 +-- .../sensor_0067_hilink_presence_sensor.c | 2 +- .../ezlopi-service-ble/ezlopi_service_ble.c | 2 +- .../ezlopi_service_gpioisr..c | 34 +++++++++---------- .../ezlopi_service_led_indicator.c | 2 +- .../ezlopi_service_timer.c | 2 +- .../ezlopi-service-ws-server/CMakeLists.txt | 4 +++ .../ezlopi-util-trace/ezlopi_util_trace.h | 2 +- 26 files changed, 64 insertions(+), 60 deletions(-) diff --git a/ezlopi-cloud/ezlopi-cloud-info/ezlopi_cloud_info.c b/ezlopi-cloud/ezlopi-cloud-info/ezlopi_cloud_info.c index b905c6b3c..be92bd6a4 100644 --- a/ezlopi-cloud/ezlopi-cloud-info/ezlopi_cloud_info.c +++ b/ezlopi-cloud/ezlopi-cloud-info/ezlopi_cloud_info.c @@ -4,7 +4,7 @@ #include "freertos/FreeRTOS.h" -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "ezlopi_core_factory_info.h" #include "ezlopi_cloud_info.h" #include "ezlopi_util_trace.h" diff --git a/ezlopi-cloud/ezlopi-cloud-items/ezlopi_cloud_items.c b/ezlopi-cloud/ezlopi-cloud-items/ezlopi_cloud_items.c index 076e5722d..9112939b6 100644 --- a/ezlopi-cloud/ezlopi-cloud-items/ezlopi_cloud_items.c +++ b/ezlopi-cloud/ezlopi-cloud-items/ezlopi_cloud_items.c @@ -4,7 +4,7 @@ #include "ezlopi_cloud_items.h" #include "ezlopi_util_trace.h" -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "cjext.h" #include "ezlopi_core_cjson_macros.h" diff --git a/ezlopi-core/ezlopi-core-info/ezlopi_core_info.h b/ezlopi-core/ezlopi-core-info/ezlopi_core_info.h index 0a192a8bb..4467d542f 100644 --- a/ezlopi-core/ezlopi-core-info/ezlopi_core_info.h +++ b/ezlopi-core/ezlopi-core-info/ezlopi_core_info.h @@ -7,7 +7,7 @@ #include "driver/gpio.h" #include "esp_idf_version.h" #include "ezlopi_util_version.h" -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" uart_parity_t EZPI_CORE_info_name_to_parity(const char* parity); char EZPI_CORE_info_parity_to_name(const uart_parity_t parity_val); diff --git a/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c b/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c index b66c9eb77..e806f59ff 100755 --- a/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c +++ b/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c @@ -2,10 +2,10 @@ #include "stdlib.h" #include "stdbool.h" #include "string.h" -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "ezlopi_util_trace.h" diff --git a/ezlopi-core/ezlopi-core-sntp/ezlopi_core_sntp.c b/ezlopi-core/ezlopi-core-sntp/ezlopi_core_sntp.c index a6b5d74e8..865e187ac 100644 --- a/ezlopi-core/ezlopi-core-sntp/ezlopi_core_sntp.c +++ b/ezlopi-core/ezlopi-core-sntp/ezlopi_core_sntp.c @@ -3,7 +3,7 @@ #include #include -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "esp_sntp.h" #include "zones.h" @@ -13,7 +13,7 @@ static time_t start_time = 0; -static void sntp_sync_time_call_back(struct timeval *tv) +static void sntp_sync_time_call_back(struct timeval* tv) { char strftime_buf[64]; @@ -59,7 +59,7 @@ void EZPI_CORE_sntp_init(void) } } -int EZPI_CORE_sntp_set_location(const char *location) +int EZPI_CORE_sntp_set_location(const char* location) { int ret = 1; if (location) @@ -67,7 +67,7 @@ int EZPI_CORE_sntp_set_location(const char *location) if (EZPI_CORE_nvs_write_time_location(location, strlen(location))) { - const char *posix_str = micro_tz_db_get_posix_str(location); + const char* posix_str = micro_tz_db_get_posix_str(location); if (NULL == posix_str) { @@ -87,17 +87,17 @@ int EZPI_CORE_sntp_set_location(const char *location) return ret; } -char *EZPI_CORE_sntp_get_location(void) +char* EZPI_CORE_sntp_get_location(void) { return EZPI_CORE_nvs_read_time_location(); } -void EZPI_CORE_sntp_get_local_time(char *time_buf, uint32_t buf_len) +void EZPI_CORE_sntp_get_local_time(char* time_buf, uint32_t buf_len) { if (time_buf && buf_len) { - char *location = EZPI_CORE_nvs_read_time_location(); - const char *posix_str = (location) ? micro_tz_db_get_posix_str(location) : NULL; + char* location = EZPI_CORE_nvs_read_time_location(); + const char* posix_str = (location) ? micro_tz_db_get_posix_str(location) : NULL; if (!posix_str) { @@ -139,7 +139,7 @@ void EZPI_CORE_sntp_get_local_time(char *time_buf, uint32_t buf_len) } } -void EZPI_CORE_sntp_get_up_time(char *up_time_buf, uint32_t buf_len) +void EZPI_CORE_sntp_get_up_time(char* up_time_buf, uint32_t buf_len) { if (up_time_buf && buf_len) { @@ -149,11 +149,11 @@ void EZPI_CORE_sntp_get_up_time(char *up_time_buf, uint32_t buf_len) } } -void EZPI_CORE_sntp_epoch_to_iso8601(char *time_buf, uint32_t buf_len, time_t t) +void EZPI_CORE_sntp_epoch_to_iso8601(char* time_buf, uint32_t buf_len, time_t t) { if (time_buf && buf_len) { - struct tm *timeinfo; + struct tm* timeinfo; timeinfo = gmtime(&t); strftime(time_buf, buf_len, "%Y-%m-%dT%H:%M:%S+545", timeinfo); TRACE_I("Build Time: %s", time_buf); diff --git a/ezlopi-core/ezlopi-core-timer/ezlopi_core_timer.h b/ezlopi-core/ezlopi-core-timer/ezlopi_core_timer.h index 5b894b08f..bb8352b69 100644 --- a/ezlopi-core/ezlopi-core-timer/ezlopi_core_timer.h +++ b/ezlopi-core/ezlopi-core-timer/ezlopi_core_timer.h @@ -36,7 +36,7 @@ /******************************************************************************* * Include Files *******************************************************************************/ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/queue.h" @@ -44,9 +44,9 @@ #include "esp_err.h" #include "esp_log.h" -/******************************************************************************* - * Type & Macro Declarations - *******************************************************************************/ + /******************************************************************************* + * Type & Macro Declarations + *******************************************************************************/ #define EZLOPI_TIMER_TAG "EZLOPI TIMER TAG" #define EZLOPI_TIMER_GRP_0 TIMER_GROUP_0 diff --git a/ezlopi-core/ezlopi-core-websocket_client/ezlopi_core_websocket_client.h b/ezlopi-core/ezlopi-core-websocket_client/ezlopi_core_websocket_client.h index f1d426f39..2ac768afe 100644 --- a/ezlopi-core/ezlopi-core-websocket_client/ezlopi_core_websocket_client.h +++ b/ezlopi-core/ezlopi-core-websocket_client/ezlopi_core_websocket_client.h @@ -10,7 +10,7 @@ #include "nvs_flash.h" #include "esp_event.h" #include "esp_log.h" -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "cjext.h" #include "esp_websocket_client.h" diff --git a/ezlopi-hal/ezlopi-hal-spi/ezlopi_hal_spi_master.c b/ezlopi-hal/ezlopi-hal-spi/ezlopi_hal_spi_master.c index 53fed1dfb..675680eb0 100644 --- a/ezlopi-hal/ezlopi-hal-spi/ezlopi_hal_spi_master.c +++ b/ezlopi-hal/ezlopi-hal-spi/ezlopi_hal_spi_master.c @@ -1,5 +1,5 @@ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "esp_intr_alloc.h" #include "ezlopi_util_trace.h" @@ -21,9 +21,9 @@ typedef enum e_spi_state } \ } -static e_spi_state_t spi_port_status[3] = {SPI_UNINITIALIZED, SPI_UNINITIALIZED, SPI_UNINITIALIZED}; +static e_spi_state_t spi_port_status[3] = { SPI_UNINITIALIZED, SPI_UNINITIALIZED, SPI_UNINITIALIZED }; -int ezlopi_spi_master_init(s_ezlopi_spi_master_t *spi_config) +int ezlopi_spi_master_init(s_ezlopi_spi_master_t* spi_config) { int ret = 0; @@ -72,7 +72,7 @@ int ezlopi_spi_master_init(s_ezlopi_spi_master_t *spi_config) return ret; } -int ezlopi_spi_master_deinit(s_ezlopi_spi_master_t *spi_config) +int ezlopi_spi_master_deinit(s_ezlopi_spi_master_t* spi_config) { int ret = 0; diff --git a/ezlopi-sensors-devices/device-0001-digitalOut-generic/device_0001_digitalOut_generic.c b/ezlopi-sensors-devices/device-0001-digitalOut-generic/device_0001_digitalOut_generic.c index f394e439e..6af0fa8a0 100644 --- a/ezlopi-sensors-devices/device-0001-digitalOut-generic/device_0001_digitalOut_generic.c +++ b/ezlopi-sensors-devices/device-0001-digitalOut-generic/device_0001_digitalOut_generic.c @@ -1,4 +1,4 @@ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "ezlopi_util_trace.h" #include "ezlopi_core_nvs.h" diff --git a/ezlopi-sensors-devices/device-0002-digitalOut-relay/device_0002_digitalOut_relay.c b/ezlopi-sensors-devices/device-0002-digitalOut-relay/device_0002_digitalOut_relay.c index bd588aa2c..d6aad6e25 100644 --- a/ezlopi-sensors-devices/device-0002-digitalOut-relay/device_0002_digitalOut_relay.c +++ b/ezlopi-sensors-devices/device-0002-digitalOut-relay/device_0002_digitalOut_relay.c @@ -1,4 +1,4 @@ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "ezlopi_util_trace.h" #include "ezlopi_core_timer.h" diff --git a/ezlopi-sensors-devices/device-0003-digitalOut-plug/device_0003_digitalOut_plug.c b/ezlopi-sensors-devices/device-0003-digitalOut-plug/device_0003_digitalOut_plug.c index b90338948..93d2a9439 100644 --- a/ezlopi-sensors-devices/device-0003-digitalOut-plug/device_0003_digitalOut_plug.c +++ b/ezlopi-sensors-devices/device-0003-digitalOut-plug/device_0003_digitalOut_plug.c @@ -1,5 +1,5 @@ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "ezlopi_util_trace.h" #include "ezlopi_core_timer.h" diff --git a/ezlopi-sensors-devices/device-0004-digitalIn-generic/device_0004_digitalIn_generic.c b/ezlopi-sensors-devices/device-0004-digitalIn-generic/device_0004_digitalIn_generic.c index 4ef5b08ea..b3acc8425 100644 --- a/ezlopi-sensors-devices/device-0004-digitalIn-generic/device_0004_digitalIn_generic.c +++ b/ezlopi-sensors-devices/device-0004-digitalIn-generic/device_0004_digitalIn_generic.c @@ -1,4 +1,4 @@ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "ezlopi_util_trace.h" #include "ezlopi_core_timer.h" diff --git a/ezlopi-sensors-devices/device-0009-other-RMT-SK6812/device_0009_other_RMT_SK6812.c b/ezlopi-sensors-devices/device-0009-other-RMT-SK6812/device_0009_other_RMT_SK6812.c index 453094ec1..5fbf3d6ba 100644 --- a/ezlopi-sensors-devices/device-0009-other-RMT-SK6812/device_0009_other_RMT_SK6812.c +++ b/ezlopi-sensors-devices/device-0009-other-RMT-SK6812/device_0009_other_RMT_SK6812.c @@ -1,5 +1,5 @@ #include -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "driver/gpio.h" #include "ezlopi_util_trace.h" diff --git a/ezlopi-sensors-devices/sensor-0008-I2C-LTR303ALS/sensor_0008_I2C_LTR303ALS.c b/ezlopi-sensors-devices/sensor-0008-I2C-LTR303ALS/sensor_0008_I2C_LTR303ALS.c index fcc92fb20..9699f708b 100644 --- a/ezlopi-sensors-devices/sensor-0008-I2C-LTR303ALS/sensor_0008_I2C_LTR303ALS.c +++ b/ezlopi-sensors-devices/sensor-0008-I2C-LTR303ALS/sensor_0008_I2C_LTR303ALS.c @@ -1,5 +1,5 @@ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include #include "ezlopi_util_trace.h" diff --git a/ezlopi-sensors-devices/sensor-0015-oneWire-DHT11/dht11.c b/ezlopi-sensors-devices/sensor-0015-oneWire-DHT11/dht11.c index c1a77f6b6..c362fcdee 100644 --- a/ezlopi-sensors-devices/sensor-0015-oneWire-DHT11/dht11.c +++ b/ezlopi-sensors-devices/sensor-0015-oneWire-DHT11/dht11.c @@ -28,10 +28,10 @@ #define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #if (CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32) -// #include "esp_log.h" + // #include "esp_log.h" #include "driver/gpio.h" #if CONFIG_IDF_TARGET_ESP32S3 diff --git a/ezlopi-sensors-devices/sensor-0016-oneWire-DHT22/dht22.c b/ezlopi-sensors-devices/sensor-0016-oneWire-DHT22/dht22.c index a0d4376e7..0c0fddcd3 100644 --- a/ezlopi-sensors-devices/sensor-0016-oneWire-DHT22/dht22.c +++ b/ezlopi-sensors-devices/sensor-0016-oneWire-DHT22/dht22.c @@ -21,7 +21,7 @@ #define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #if (CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32) // #include "esp_log.h" diff --git a/ezlopi-sensors-devices/sensor-0018-other-internal-hall-effect/sensor_0018_other_internal_hall_effect.c b/ezlopi-sensors-devices/sensor-0018-other-internal-hall-effect/sensor_0018_other_internal_hall_effect.c index e9a9d1728..2a635a029 100644 --- a/ezlopi-sensors-devices/sensor-0018-other-internal-hall-effect/sensor_0018_other_internal_hall_effect.c +++ b/ezlopi-sensors-devices/sensor-0018-other-internal-hall-effect/sensor_0018_other_internal_hall_effect.c @@ -1,6 +1,6 @@ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #ifdef CONFIG_IDF_TARGET_ESP32 diff --git a/ezlopi-sensors-devices/sensor-0031-other-JSNSR04T/jsn_sr04t.h b/ezlopi-sensors-devices/sensor-0031-other-JSNSR04T/jsn_sr04t.h index 15a32ae62..c24a0178f 100644 --- a/ezlopi-sensors-devices/sensor-0031-other-JSNSR04T/jsn_sr04t.h +++ b/ezlopi-sensors-devices/sensor-0031-other-JSNSR04T/jsn_sr04t.h @@ -13,7 +13,7 @@ // #include "ezlopi_cloud_value_type_str.h" #include "ezlopi_cloud_device_types_str.h" #include "ezlopi_cloud_item_name_str.h" -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "cjext.h" #define minimum_detection_value_in_cm 25 diff --git a/ezlopi-sensors-devices/sensor-0033-ADC-turbidity/sensor_0033_ADC_turbidity.h b/ezlopi-sensors-devices/sensor-0033-ADC-turbidity/sensor_0033_ADC_turbidity.h index ac2a9c7a1..b0c91e4f9 100644 --- a/ezlopi-sensors-devices/sensor-0033-ADC-turbidity/sensor_0033_ADC_turbidity.h +++ b/ezlopi-sensors-devices/sensor-0033-ADC-turbidity/sensor_0033_ADC_turbidity.h @@ -2,7 +2,7 @@ #define SENSOR_0033_ADC_TURBIDITY_H #include -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" // #include "driver/gpio.h" // #include "freertos/FreeRTOS.h" // #include "freertos/task.h" @@ -18,6 +18,6 @@ typedef enum TURBIDITY__MAX } e_water_filter_replacement_alarm_states_t; -int sensor_0033_ADC_turbidity(e_ezlopi_actions_t action, l_ezlopi_item_t *item, void *arg, void *user_arg); +int sensor_0033_ADC_turbidity(e_ezlopi_actions_t action, l_ezlopi_item_t* item, void* arg, void* user_arg); #endif // SENSOR_0033_ADC_TURBIDITY_H diff --git a/ezlopi-sensors-devices/sensor-0067-UART-hilink-presence-sensor/sensor_0067_hilink_presence_sensor.c b/ezlopi-sensors-devices/sensor-0067-UART-hilink-presence-sensor/sensor_0067_hilink_presence_sensor.c index 49a23c2a5..47df199a0 100644 --- a/ezlopi-sensors-devices/sensor-0067-UART-hilink-presence-sensor/sensor_0067_hilink_presence_sensor.c +++ b/ezlopi-sensors-devices/sensor-0067-UART-hilink-presence-sensor/sensor_0067_hilink_presence_sensor.c @@ -1,5 +1,5 @@ #include -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "ezlopi_util_trace.h" #include "ld2410.h" diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c index 20d963d39..a5e5468a2 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c @@ -9,7 +9,7 @@ #include "cjext.h" #include "lwip/ip_addr.h" #include "ezlopi_util_trace.h" -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "EZLOPI_USER_CONFIG.h" diff --git a/ezlopi-services/ezlopi-service-gpioisr/ezlopi_service_gpioisr..c b/ezlopi-services/ezlopi-service-gpioisr/ezlopi_service_gpioisr..c index 5b29b3262..f3a2be11e 100644 --- a/ezlopi-services/ezlopi-service-gpioisr/ezlopi_service_gpioisr..c +++ b/ezlopi-services/ezlopi-service-gpioisr/ezlopi_service_gpioisr..c @@ -1,6 +1,6 @@ #include -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/portmacro.h" #include "freertos/task.h" @@ -21,26 +21,26 @@ typedef struct s_event_arg TickType_t time; TickType_t debounce_ms; // s_ezlopi_device_properties_t *properties; - l_ezlopi_item_t *item; + l_ezlopi_item_t* item; f_interrupt_upcall_t __upcall; } s_event_arg_t; -static void gpio_isr_process_v3(void *pv); -static void IRAM_ATTR __gpio_isr_handler(void *arg); +static void gpio_isr_process_v3(void* pv); +static void IRAM_ATTR __gpio_isr_handler(void* arg); void gpio_isr_service_init(void) { TRACE_S("Started gpio-isr service"); - gpio_evt_queue = xQueueCreate(20, sizeof(s_event_arg_t *)); + gpio_evt_queue = xQueueCreate(20, sizeof(s_event_arg_t*)); TaskHandle_t ezlopi_service_gpio_isr_task_handle = NULL; xTaskCreate(gpio_isr_process_v3, "gpio_isr_process_v3", EZLOPI_SERVICE_GPIO_ISR_TASK_DEPTH, NULL, 3, &ezlopi_service_gpio_isr_task_handle); ezlopi_core_process_set_process_info(ENUM_EZLOPI_SERVICE_GPIO_ISR_TASK, &ezlopi_service_gpio_isr_task_handle, EZLOPI_SERVICE_GPIO_ISR_TASK_DEPTH); // xTaskCreate(gpio_isr_process, "digital-io-isr-service", EZLOPI_SERVICE_GPIO_ISR_TASK_DEPTH, NULL, 3, &ezlopi_service_gpio_isr_task_handle); } -void gpio_isr_service_register_v3(l_ezlopi_item_t *item, f_interrupt_upcall_t __upcall, TickType_t debounce_ms) +void gpio_isr_service_register_v3(l_ezlopi_item_t* item, f_interrupt_upcall_t __upcall, TickType_t debounce_ms) { - s_event_arg_t *event_arg = malloc(sizeof(s_event_arg_t)); + s_event_arg_t* event_arg = malloc(sizeof(s_event_arg_t)); if (event_arg) { @@ -51,7 +51,7 @@ void gpio_isr_service_register_v3(l_ezlopi_item_t *item, f_interrupt_upcall_t __ event_arg->debounce_ms = (0 == debounce_ms) ? default_debounce_time : debounce_ms; gpio_intr_enable(item->interface.gpio.gpio_in.gpio_num); - if (gpio_isr_handler_add(item->interface.gpio.gpio_in.gpio_num, __gpio_isr_handler, (void *)event_arg)) + if (gpio_isr_handler_add(item->interface.gpio.gpio_in.gpio_num, __gpio_isr_handler, (void*)event_arg)) { TRACE_E("Error while adding GPIO ISR handler."); gpio_reset_pin(item->interface.gpio.gpio_in.gpio_num); @@ -63,11 +63,11 @@ void gpio_isr_service_register_v3(l_ezlopi_item_t *item, f_interrupt_upcall_t __ } } -static void gpio_isr_process_v3(void *pv) +static void gpio_isr_process_v3(void* pv) { while (1) { - s_event_arg_t *event_arg = NULL; + s_event_arg_t* event_arg = NULL; xQueueReceive(gpio_evt_queue, &event_arg, portMAX_DELAY); if (NULL != event_arg) @@ -85,9 +85,9 @@ static void gpio_isr_process_v3(void *pv) } } -static void IRAM_ATTR __gpio_isr_handler(void *arg) +static void IRAM_ATTR __gpio_isr_handler(void* arg) { - void *tmp_arg = arg; + void* tmp_arg = arg; if (gpio_evt_queue) { xQueueSendFromISR(gpio_evt_queue, &tmp_arg, NULL); @@ -95,9 +95,9 @@ static void IRAM_ATTR __gpio_isr_handler(void *arg) } #if 0 -void gpio_isr_service_register(s_ezlopi_device_properties_t *properties, f_interrupt_upcall_t __upcall, TickType_t debounce_ms) +void gpio_isr_service_register(s_ezlopi_device_properties_t* properties, f_interrupt_upcall_t __upcall, TickType_t debounce_ms) { - s_event_arg_t *event_arg = malloc(sizeof(s_event_arg_t)); + s_event_arg_t* event_arg = malloc(sizeof(s_event_arg_t)); if (event_arg) { @@ -107,7 +107,7 @@ void gpio_isr_service_register(s_ezlopi_device_properties_t *properties, f_inter event_arg->debounce_ms = (0 == debounce_ms) ? default_debounce_time : debounce_ms; gpio_intr_enable(properties->interface.gpio.gpio_in.gpio_num); - if (gpio_isr_handler_add(properties->interface.gpio.gpio_in.gpio_num, __gpio_isr_handler, (void *)event_arg)) + if (gpio_isr_handler_add(properties->interface.gpio.gpio_in.gpio_num, __gpio_isr_handler, (void*)event_arg)) { TRACE_E("Error while adding GPIO ISR handler."); gpio_reset_pin(properties->interface.gpio.gpio_in.gpio_num); @@ -119,11 +119,11 @@ void gpio_isr_service_register(s_ezlopi_device_properties_t *properties, f_inter } } -static void gpio_isr_process(void *pv) +static void gpio_isr_process(void* pv) { while (1) { - s_event_arg_t *event_arg = NULL; + s_event_arg_t* event_arg = NULL; xQueueReceive(gpio_evt_queue, &event_arg, portMAX_DELAY); if (NULL != event_arg) diff --git a/ezlopi-services/ezlopi-service-led-indicator/ezlopi_service_led_indicator.c b/ezlopi-services/ezlopi-service-led-indicator/ezlopi_service_led_indicator.c index 4a79ae979..523231198 100644 --- a/ezlopi-services/ezlopi-service-led-indicator/ezlopi_service_led_indicator.c +++ b/ezlopi-services/ezlopi-service-led-indicator/ezlopi_service_led_indicator.c @@ -1,6 +1,6 @@ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #ifdef CONFIG_EZPI_ENABLE_LED_INDICATOR diff --git a/ezlopi-services/ezlopi-service-timer/ezlopi_service_timer.c b/ezlopi-services/ezlopi-service-timer/ezlopi_service_timer.c index 87d8ea1a9..1d121ae6f 100644 --- a/ezlopi-services/ezlopi-service-timer/ezlopi_service_timer.c +++ b/ezlopi-services/ezlopi-service-timer/ezlopi_service_timer.c @@ -2,7 +2,7 @@ #include #include -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/queue.h" diff --git a/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt b/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt index db91614cf..612e4a51d 100644 --- a/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt +++ b/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt @@ -1,6 +1,10 @@ file(GLOB_RECURSE provisioning_src "*.c*") +set(ESP_NATIVE_COMPONENTS + http +) + set(EZLOPI_UTIL_COMPONENTS ezlopi-util-trace ) diff --git a/ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.h b/ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.h index 9ef40fada..d62c1c4e2 100644 --- a/ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.h +++ b/ezlopi-util/ezlopi-util-trace/ezlopi_util_trace.h @@ -1,7 +1,7 @@ #ifndef _EZLOPI_UTIL_H_ #define _EZLOPI_UTIL_H_ -#include "sdkconfig.h" +#include "../../build/config/sdkconfig.h" #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "EZLOPI_USER_CONFIG.h" From f93bfd51edba46ebf19117351e72dc66730f2507 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Tue, 30 Apr 2024 19:15:41 +0545 Subject: [PATCH 25/29] code refactoring & bug fixes for latch --- .../ezlopi_core_scenes_then_methods.c | 6 +- .../ezlopi_core_scenes_when_methods.c | 1 - ...ore_scenes_when_methods_helper_functions.c | 239 ++++++++---------- .../ezlopi_service_meshbot.c | 2 + 4 files changed, 117 insertions(+), 131 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index f4e58754b..6f8cf582f 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -44,17 +44,17 @@ int ezlopi_scene_then_set_item_value(l_scenes_list_v2_t* curr_scene, void* arg) if (EZLOPI_VALUE_TYPE_INT == curr_field->value_type) { cJSON_AddNumberToObject(cj_params, ezlopi_value_str, curr_field->field_value.u_value.value_double); - TRACE_D("value: %f", curr_field->field_value.u_value.value_double); + // TRACE_D("value: %f", curr_field->field_value.u_value.value_double); } else if (EZLOPI_VALUE_TYPE_BOOL == curr_field->value_type) { cJSON_AddBoolToObject(cj_params, ezlopi_value_str, curr_field->field_value.u_value.value_bool); - TRACE_D("value: %s", curr_field->field_value.u_value.value_bool ? ezlopi_true_str : ezlopi_false_str); + // TRACE_D("value: %s", curr_field->field_value.u_value.value_bool ? ezlopi_true_str : ezlopi_false_str); } else if (EZLOPI_VALUE_TYPE_STRING == curr_field->value_type) { cJSON_AddStringToObject(cj_params, ezlopi_value_str, curr_field->field_value.u_value.value_string); - TRACE_D("value: %s", curr_field->field_value.u_value.value_string); + // TRACE_D("value: %s", curr_field->field_value.u_value.value_string); } } diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 3a8317c83..5c410b830 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -1398,6 +1398,5 @@ int ezlopi_scene_when_function(l_scenes_list_v2_t* scene_node, void* arg) } } } - return ret; } diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c index d0663fff5..6db9d3f75 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c @@ -4,6 +4,8 @@ #include "ezlopi_core_scenes_v2.h" #include "ezlopi_core_scenes_when_methods_helper_functions.h" + + //------------------------------- ezlopi_scene_when_is_date --------------------------------------------- static uint8_t isdate_check_endweek_conditon(e_isdate_modes_t mode_type, struct tm* info) @@ -965,6 +967,31 @@ int isdate_range_check_flag_result(uint8_t flag_check) return ret; } +//----------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------- +/* This function to extract the result of 'AND' when_blocks */ +static bool __and_when_block_condition(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block) +{ + bool transition_state = 1; // to make valid judgements + l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; + while (value_when_block) + { + f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); + if (scene_method) + { + transition_state &= scene_method(scene_node, (void*)value_when_block); + if (!transition_state) + { + break; + } + } + value_when_block = value_when_block->next; + } + return transition_state; +} +//----------------------------------------------------------------------------------------------------- + + //------------------------------- ezlopi_scene_when_function_method ----------------------------------- int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* when_block, cJSON* cj_func_opr) @@ -981,21 +1008,7 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe if (for_less_least) { /* first get the product of all children states*/ - bool transition_state = 1; // to make valid judgements - l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; - while (value_when_block) - { - f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); - if (scene_method) - { - transition_state &= scene_method(scene_node, (void*)value_when_block); - if (!transition_state) - { - break; - } - } - value_when_block = value_when_block->next; - } + bool transition_state = __and_when_block_condition(scene_node, when_block); /*now compare the intervals between each transtion result*/ s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; @@ -1013,7 +1026,7 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe { if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) < threshold_time) { - TRACE_W("Here-less"); + // TRACE_S("activating-less"); ret = 1; } } @@ -1021,7 +1034,7 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe { if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) >= threshold_time) { - TRACE_W("Here-alleast"); + // TRACE_S("activating-atleast"); ret = 1; } } @@ -1030,10 +1043,6 @@ int when_function_for_opr(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* whe } function_state_info->current_state = transition_state; } - else - { - ret = -1; - } } } return ret; @@ -1051,38 +1060,26 @@ int when_function_for_repeat(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* if (for_count) { /* first get the product of all children states*/ - bool transition_state = 1; // to make valid judgements - l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; - while (value_when_block) - { - f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); - if (scene_method) - { - transition_state &= scene_method(scene_node, (void*)value_when_block); - if (!transition_state) - { - break; - } - } - value_when_block = value_when_block->next; - } + bool transition_state = __and_when_block_condition(scene_node, when_block); s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; - if ((transition_state == 1) && (0 == function_state_info->current_state)) /*previous state?*/ + if ((transition_state) && (0 == function_state_info->current_state)) /*previous state?*/ { if (0 == function_state_info->transtion_instant) { /*store the first trigger time*/ + TRACE_W("here!"); function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); - TRACE_S("1st_trigger_time[%d]", function_state_info->transtion_instant); } int threshold_time = cJSON_GetNumberValue(for_interval); function_state_info->transition_count++; + TRACE_S("trigger_time[%d] count[%d]", function_state_info->transtion_instant, function_state_info->transition_count); if (function_state_info->transition_count >= for_count) { if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) <= threshold_time) { + TRACE_W("here2! dur [%d]", (((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000)); ret = 1; } function_state_info->transtion_instant = 0; @@ -1092,10 +1089,6 @@ int when_function_for_repeat(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* function_state_info->current_state = transition_state; } } - else - { - ret = -1; - } } return ret; @@ -1109,54 +1102,43 @@ int when_function_for_follow(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* if (for_delay) { s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; - if (0 == function_state_info->transtion_instant) /* trigger phase ---> started */ + if ((0 == function_state_info->transtion_instant) && (0 == function_state_info->current_state)) { /* first get the product of all children states*/ - bool transition_state = 1; // to make valid judgements - l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; - while (value_when_block) - { - f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); - if (scene_method) - { - transition_state &= scene_method(scene_node, (void*)value_when_block); - if (!transition_state) - { - break; - } - } - value_when_block = value_when_block->next; - } - - if ((transition_state == 1) && (0 == function_state_info->current_state)) /*previous state?*/ + bool transition_state = __and_when_block_condition(scene_node, when_block); + if (transition_state) /*previous state?*/ { + /* trigger phase ---> started */ function_state_info->current_state = transition_state; function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); - TRACE_S("start_follow_time[%d]", function_state_info->transtion_instant); + // TRACE_W("start_follow_time"); ret = 1; } } - else /* trigger phase ---> started */ + else { int threshold_time = cJSON_GetNumberValue(for_delay); if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) <= threshold_time) { ret = 1; + // TRACE_S(" Follow -> Active "); } else { + /* trigger phase ---> stop */ ret = 0; - TRACE_S("stop_follow_time[%d]", (uint32_t)xTaskGetTickCount()); - function_state_info->transtion_instant = 0; - function_state_info->current_state = 0; + // TRACE_W("restart the trigger..."); + + /* now refreshing then block*/ + if (false == __and_when_block_condition(scene_node, when_block)) + { + function_state_info->transtion_instant = 0; + function_state_info->current_state = 0; + } } } } } - else - { - ret = -1; - } return ret; } @@ -1168,16 +1150,12 @@ int when_function_for_pulse(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* w cJSON* for_trueperiod = cJSON_GetObjectItem(cj_func_opr, "truePeriod"); cJSON* for_falseperiod = cJSON_GetObjectItem(cj_func_opr, "falsePeriod"); cJSON* for_times = cJSON_GetObjectItem(cj_func_opr, "times"); - int true_time_dur = cJSON_GetNumberValue(for_trueperiod); - if (for_trueperiod) + if (for_trueperiod && for_times && for_falseperiod) { - int false_time_dur = 0; - int seq_count = 0; - if (for_times && for_falseperiod) - { - false_time_dur = cJSON_GetNumberValue(for_falseperiod); - seq_count = cJSON_GetNumberValue(for_times); - } + int true_time_dur = cJSON_GetNumberValue(for_trueperiod); + int false_time_dur = cJSON_GetNumberValue(for_falseperiod); + int seq_count = cJSON_GetNumberValue(for_times); + /*1. check for activation condition for 'pulse_flag' */ s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; if ((0 == function_state_info->transition_count) && @@ -1185,25 +1163,11 @@ int when_function_for_pulse(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* w (0 == function_state_info->transtion_instant) && (false == function_state_info->activate_pulse_seq)) { - bool transition_state = 1; // to make valid judgements - l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; - while (value_when_block) - { - f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); - if (scene_method) - { - transition_state &= scene_method(scene_node, (void*)value_when_block); - if (!transition_state) - { - break; - } - } - value_when_block = value_when_block->next; - } - if (transition_state == 1) + if (__and_when_block_condition(scene_node, when_block)) { + TRACE_W("starting Pulse!"); function_state_info->activate_pulse_seq = true; - function_state_info->current_state = 1; + function_state_info->current_state = 1; // state you want to start with function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); } } @@ -1214,43 +1178,80 @@ int when_function_for_pulse(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* w { function_state_info->transition_count = seq_count; /* If 'SEQ_COUNT' == 0 ; Then loop the sequence forever. */ } + else + { + seq_count = (seq_count * 2) - 1; // 6 -> [0-5] + } if (function_state_info->transition_count <= seq_count) { - if (1 == function_state_info->current_state) + uint32_t dur = (((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000); + if (true == function_state_info->current_state) { - if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) >= true_time_dur) + if (dur <= true_time_dur) + { + TRACE_S("high_pulse , true[%dsec]", dur); + } + else { - function_state_info->current_state = !function_state_info->current_state; function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); /*in sec*/ + if (function_state_info->transition_count < seq_count) + { + function_state_info->transition_count++; + } + function_state_info->current_state = 0; } } - else if (0 == function_state_info->current_state) + else if (false == function_state_info->current_state) { - if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) >= false_time_dur) + if (dur <= false_time_dur) + { + TRACE_S("low_pulse , false[%dsec]", dur); + } + else { - function_state_info->current_state = !function_state_info->current_state; function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); /*in sec*/ + if (function_state_info->transition_count < seq_count) + { + function_state_info->current_state = 1; + function_state_info->transition_count++; + } + else + { + function_state_info->current_state = 0; + } } } - - function_state_info->transition_count++; } else { - TRACE_W("Excceded pulse count "); + TRACE_E("Exceeded pulse count.............."); function_state_info->activate_pulse_seq = false; function_state_info->current_state = 0; function_state_info->transition_count = 0; - function_state_info->transtion_instant = 0; } - TRACE_S("pulse_flag=%d -> {%d}.pulse_instant[%d]", - (int)function_state_info->activate_pulse_seq, - function_state_info->transition_count, - function_state_info->transtion_instant); + } + else + { + /* trigger phase ---> stop */ + TRACE_W("restart the trigger...."); + + /* now refreshing pulse*/ + if (false == __and_when_block_condition(scene_node, when_block)) + { + function_state_info->transtion_instant = 0; + function_state_info->transition_count = 0; + } + function_state_info->current_state = 0; + } + + TRACE_W("trigger_state= %s , {seq_count: %d}.-----> return =>> [pulse_state = %s]", + (function_state_info->activate_pulse_seq) ? "true" : "false", + function_state_info->transition_count, + (function_state_info->current_state) ? "high" : "low"); ret = function_state_info->current_state; } } @@ -1269,23 +1270,7 @@ int when_function_for_latch(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* w if ((0 == function_state_info->current_state) && (cJSON_True == for_enabled->type)) /* if the trigger phase has not started */ { /* first get the product of all children states*/ - bool transition_state = 1; // to make valid judgements - l_when_block_v2_t* value_when_block = when_block->fields->field_value.u_value.when_block; - while (value_when_block) - { - f_scene_method_v2_t scene_method = ezlopi_scene_get_method_v2(value_when_block->block_options.method.type); - if (scene_method) - { - transition_state &= scene_method(scene_node, (void*)value_when_block); - if (!transition_state) - { - break; - } - } - value_when_block = value_when_block->next; - } - - if (transition_state == 1) /*if : previous state = 0*/ + if (__and_when_block_condition(scene_node, when_block)) /*if : previous state = 0*/ { function_state_info->current_state = 1; function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); @@ -1309,4 +1294,4 @@ int when_function_for_latch(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* w return ret; } -//----------------------------------------------------------------------------------------------------- \ No newline at end of file +//----------------------------------------------------------------------------------------------------- diff --git a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c index ddae2961b..ee4f93df4 100644 --- a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c +++ b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c @@ -195,6 +195,7 @@ void ezlopi_scenes_meshbot_init(void) } else { + #warning "remove these traces"; TRACE_S("scene_en ->%s , scene_node->when:%s , (scene_node->then:%s | scene_node->else:%s)", (scene_node->enabled) ? "true" : "false", (NULL == scene_node->when_block) ? "empty" : scene_node->when_block->block_options.method.name, @@ -210,6 +211,7 @@ void ezlopi_scenes_meshbot_init(void) free(str); } } + scene_node->status = EZLOPI_SCENE_STATUS_STOPPED; } TRACE_W("scenes_meshbot init process, [%d]", start_thread); From 62e39c01b4268eeab3392e18a852c54bf711362d Mon Sep 17 00:00:00 2001 From: lomasSE89 Date: Wed, 1 May 2024 01:33:06 +0545 Subject: [PATCH 26/29] initial integration done, cleaning. --- .../ezlopi-core-ble/ezlopi_core_ble_buffer.c | 2 + .../ezlopi-core-ble/ezlopi_core_ble_gap.c | 2 + .../ezlopi-core-ble/ezlopi_core_ble_gatt.c | 2 + .../ezlopi-core-ble/ezlopi_core_ble_profile.c | 2 + ezlopi-core/ezlopi-core-net/ezlopi_core_net.c | 6 +- ezlopi-core/ezlopi-core-net/ezlopi_core_net.h | 7 +- .../ezlopi-core-reset/ezlopi_core_reset.c | 2 +- ezlopi-main/CMakeLists.txt | 2 +- ezlopi-main/Kconfig.projbuild | 12 +- ezlopi-main/ezlopi_main.c | 2 - .../ezlopi-service-ble/ezlopi_service_ble.c | 4 +- .../ezlopi_service_ble_ble_auth.c | 5 +- .../ezlopi_service_ble_device_info.c | 3 + .../ezlopi_service_ble_dynamic_config.c | 2 + .../ezlopi_service_ble_provisioning.c | 3 + .../ezlopi_service_ble_security.c | 4 + .../ezlopi_service_ble_wifi.c | 3 + .../ezlopi-service-ws-server/CMakeLists.txt | 9 +- .../ezlopi_service_ws_server.c | 36 +- .../ezlopi_service_ws_server.h | 6 +- sdkconfig | 258 ++++++-- sdkconfig.esp32.4mb | 105 +++- sdkconfig.old | 589 +++++++++++------- 23 files changed, 743 insertions(+), 323 deletions(-) diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c index 0e6fb4566..68a1bd20a 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c @@ -1,4 +1,6 @@ +#include "../../build/config/sdkconfig.h" + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c index 6564d9b2d..809eca9e6 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c @@ -1,3 +1,5 @@ +#include "../../build/config/sdkconfig.h" + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c index 0f2bd7c2b..d7a04667d 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c @@ -1,3 +1,5 @@ +#include "../../build/config/sdkconfig.h" + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c index 63720fc33..4e6b81701 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c @@ -1,4 +1,6 @@ +#include "../../build/config/sdkconfig.h" + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include diff --git a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c index 93516a0c7..737cdae0b 100644 --- a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c +++ b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c @@ -1,15 +1,18 @@ #include "ezlopi_core_net.h" -#ifdef CONFIG_EZPI_CORE_ENABLE_ETH static s_ezlopi_net_status_t net_stat; +#ifdef CONFIG_EZPI_CORE_ENABLE_ETH + void ezlopi_net_init(void) { memset(&net_stat, 0, sizeof(s_ezlopi_net_status_t)); ezlopi_ethernet_init(); } +#endif // CONFIG_EZPI_CORE_ENABLE_ETH + s_ezlopi_net_status_t* ezlopi_get_net_status(void) { @@ -20,4 +23,3 @@ s_ezlopi_net_status_t* ezlopi_get_net_status(void) return &net_stat; } -#endif // CONFIG_EZPI_CORE_ENABLE_ETH \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h index cbaf8be65..91a279fff 100644 --- a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h +++ b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h @@ -1,8 +1,6 @@ #ifndef _EZLOPI_CORE_NET_H_ #define _EZLOPI_CORE_NET_H_ -#ifdef CONFIG_EZPI_CORE_ENABLE_ETH - #include #include "ezlopi_core_wifi.h" @@ -17,8 +15,11 @@ typedef struct s_ezlopi_net_status bool nma_cloud_connection_status; } s_ezlopi_net_status_t; +#ifdef CONFIG_EZPI_CORE_ENABLE_ETH +void ezlopi_net_init(void); +#endif // CONFIG_EZPI_CORE_ENABLE_ETH + s_ezlopi_net_status_t* ezlopi_get_net_status(void); -#endif // CONFIG_EZPI_CORE_ENABLE_ETH #endif // _EZLOPI_CORE_NET_H_ diff --git a/ezlopi-core/ezlopi-core-reset/ezlopi_core_reset.c b/ezlopi-core/ezlopi-core-reset/ezlopi_core_reset.c index 55dcef75b..d34d51718 100644 --- a/ezlopi-core/ezlopi-core-reset/ezlopi_core_reset.c +++ b/ezlopi-core/ezlopi-core-reset/ezlopi_core_reset.c @@ -18,7 +18,7 @@ void EZPI_CORE_reset_reboot(void) ezlopi_service_web_provisioning_deinit(); #endif // CONFIG_EZPI_WEBSOCKET_CLIENT -#if defined(CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER) +#ifdef CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER ezlopi_service_ws_server_stop(); #endif // CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER diff --git a/ezlopi-main/CMakeLists.txt b/ezlopi-main/CMakeLists.txt index edc5e50ec..5bdcf02ec 100644 --- a/ezlopi-main/CMakeLists.txt +++ b/ezlopi-main/CMakeLists.txt @@ -39,7 +39,7 @@ set(EZLOPI_SENSOR_DEVICE_COMPONENTS # Define service components set(EZLOPI_SERVICES -ezlopi-service-ble + ezlopi-service-ble ezlopi-service-ota ezlopi-service-uart ezlopi-service-modes diff --git a/ezlopi-main/Kconfig.projbuild b/ezlopi-main/Kconfig.projbuild index 73c637c06..917729f77 100644 --- a/ezlopi-main/Kconfig.projbuild +++ b/ezlopi-main/Kconfig.projbuild @@ -1,10 +1,10 @@ menu "EzloPi User Config" - choice EZLOPI_DISTRO + choice EZPI_DISTRO prompt "Select from available distros:" depends on IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32 - default EZLOPI_DISTRO_CLOUD_MESHBOT + default EZPI_DISTRO_FULL_OPTION config EZPI_DISTRO_FULL_OPTION bool "1. EZPI_DISTRO_FULL_OPTION" @@ -102,8 +102,14 @@ menu "EzloPi User Config" help Enable provisioning and monitoring via UART + # config HTTPD_WS_SUPPORT + # bool "Enable ESP HTTP Socket support" + # default n + # help + # Enable local HTTP WS Support + config EZPI_LOCAL_WEBSOCKET_SERVER - depends on (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI ) && (EZPI_DISTRO_FULL_OPTION || EZLOPI_DISTRO_LOCAL || EZLOPI_DISTRO_LOCAL_MESHBOT) + depends on (HTTPD_WS_SUPPORT && (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI ) && (EZPI_DISTRO_FULL_OPTION || EZLOPI_DISTRO_LOCAL || EZLOPI_DISTRO_LOCAL_MESHBOT)) bool "Enable local websocket server" default n help diff --git a/ezlopi-main/ezlopi_main.c b/ezlopi-main/ezlopi_main.c index c9a50e55b..db137cee1 100644 --- a/ezlopi-main/ezlopi_main.c +++ b/ezlopi-main/ezlopi_main.c @@ -59,8 +59,6 @@ void app_main(void) ezlopi_service_broadcast_init(); #endif - ezlpi_service_ws_server_dummy(); - #if defined(CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER) ezlopi_service_ws_server_start(); #endif diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c index a5e5468a2..d9ad69f86 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c @@ -1,3 +1,6 @@ + +#include "../../build/config/sdkconfig.h" + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include @@ -9,7 +12,6 @@ #include "cjext.h" #include "lwip/ip_addr.h" #include "ezlopi_util_trace.h" -#include "../../build/config/sdkconfig.h" #include "EZLOPI_USER_CONFIG.h" diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c index e9539354c..f7616ea43 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c @@ -1,5 +1,8 @@ -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZLOPI_BLE_ENABLE +// #TODO ADD guard for key enable #include #include "ezlopi_util_trace.h" diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c index 868e38b77..e841f14c5 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c @@ -1,3 +1,6 @@ + +#include "../../build/config/sdkconfig.h" + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c index cddcef720..3988052c9 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c @@ -1,3 +1,5 @@ +#include "../../build/config/sdkconfig.h" + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c index 1a795d307..46951d205 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c @@ -1,3 +1,6 @@ + +#include "../../build/config/sdkconfig.h" + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c index 69e791fc1..ca802f4bc 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c @@ -1,3 +1,7 @@ + +#include "../../build/config/sdkconfig.h" + + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c index 4291e0344..8968f3207 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c @@ -1,3 +1,6 @@ + +#include "../../build/config/sdkconfig.h" + #ifdef CONFIG_EZLOPI_BLE_ENABLE #include diff --git a/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt b/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt index 612e4a51d..e0a97bb94 100644 --- a/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt +++ b/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt @@ -1,9 +1,6 @@ -file(GLOB_RECURSE provisioning_src "*.c*") +file(GLOB_RECURSE src_files "*.c*") -set(ESP_NATIVE_COMPONENTS - http -) set(EZLOPI_UTIL_COMPONENTS ezlopi-util-trace @@ -27,10 +24,10 @@ set(EZLOPI_CLOUD_COMPONENTS -idf_component_register(SRCS "ezlopi_service_ws_server.c" "${provisioning_src}" +idf_component_register(SRCS "${src_files}" INCLUDE_DIRS "." REQUIRES ${SDK_COMPONENTS} ${EZLOPI_CORE_COMPONENTS} ${EZLOPI_UTIL_COMPONENTS} - ${EZLOPI_CLOUD_COMPONENTS} + # ${EZLOPI_CLOUD_COMPONENTS} ) diff --git a/ezlopi-services/ezlopi-service-ws-server/ezlopi_service_ws_server.c b/ezlopi-services/ezlopi-service-ws-server/ezlopi_service_ws_server.c index 176c5db2e..07466e1c3 100644 --- a/ezlopi-services/ezlopi-service-ws-server/ezlopi_service_ws_server.c +++ b/ezlopi-services/ezlopi-service-ws-server/ezlopi_service_ws_server.c @@ -7,23 +7,23 @@ CONDITIONS OF ANY KIND, either express or implied. */ -#include "cjext.h" -// #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "../../build/config/sdkconfig.h" -#include "ezlopi_util_trace.h" +#ifdef CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER +#include "esp_eth.h" +#include "esp_wifi.h" +#include "esp_event.h" +#include "sys/param.h" +#include "esp_netif.h" +#include "esp_system.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" +#include "esp_http_server.h" + +#include "cjext.h" +#include "ezlopi_util_trace.h" #include "ezlopi_cloud_constants.h" #include "ezlopi_core_api.h" @@ -37,8 +37,6 @@ #include "ezlopi_service_ws_server_clients.h" -// #if defined(CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER) - typedef struct s_async_resp_arg { int fd; @@ -469,10 +467,8 @@ static void __wifi_connection_event(esp_event_base_t event_base, int32_t event_i } } - -// #endif // CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER - void ezlpi_service_ws_server_dummy(void) { TRACE_D("I'm dummy"); -} \ No newline at end of file +} +#endif // CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ws-server/ezlopi_service_ws_server.h b/ezlopi-services/ezlopi-service-ws-server/ezlopi_service_ws_server.h index 9c5f82f16..1541e8cfc 100644 --- a/ezlopi-services/ezlopi-service-ws-server/ezlopi_service_ws_server.h +++ b/ezlopi-services/ezlopi-service-ws-server/ezlopi_service_ws_server.h @@ -5,7 +5,8 @@ #include "ezlopi_service_ws_server_clients.h" -// #if defined(CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER) +#ifdef CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER + typedef enum e_ws_status { WS_STATUS_RUNNING = 0, @@ -18,8 +19,9 @@ void ezlopi_service_ws_server_start(void); e_ws_status_t ezlopi_service_ws_server_status(void); -// #endif // CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER void ezlpi_service_ws_server_dummy(void); +#endif // CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER + #endif // __EZLOPI_SERVICE_WS_SERVER_H__ \ No newline at end of file diff --git a/sdkconfig b/sdkconfig index d01603c52..5debdd2a3 100644 --- a/sdkconfig +++ b/sdkconfig @@ -11,7 +11,7 @@ CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 # # SDK tool configuration # -CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" +CONFIG_SDK_TOOLPREFIX="xtensa-esp32s3-elf-" # CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set # end of SDK tool configuration @@ -43,13 +43,13 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set +CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y # CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set # CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 +CONFIG_BOOTLOADER_LOG_LEVEL=0 # CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set @@ -92,14 +92,14 @@ CONFIG_ESPTOOLPY_FLASHFREQ_40M=y # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set CONFIG_ESPTOOLPY_FLASHFREQ="40m" # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y -# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE="2MB" +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y CONFIG_ESPTOOLPY_BEFORE_RESET=y # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set @@ -122,12 +122,12 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # # Partition Table # -CONFIG_PARTITION_TABLE_SINGLE_APP=y +# CONFIG_PARTITION_TABLE_SINGLE_APP is not set # CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set -# CONFIG_PARTITION_TABLE_CUSTOM is not set -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="ezlopi_partitions_v3_1_4_181_4mb.csv" +CONFIG_PARTITION_TABLE_FILENAME="ezlopi_partitions_v3_1_4_181_4mb.csv" CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table @@ -144,7 +144,7 @@ CONFIG_EZPI_DISTRO_FULL_OPTION=y # CONFIG_EZLOPI_DISTRO_WIFI_HUB is not set # CONFIG_EZLOPI_DISTRO_BLE_HUB is not set # CONFIG_EZLOPI_DISTRO_MINIMAL is not set -CONFIG_EZPI_HEAP_ENABLE=y +# CONFIG_EZPI_HEAP_ENABLE is not set # CONFIG_EZPI_DEV_TYPE_TEST is not set CONFIG_EZPI_UTIL_TRACE_EN=y CONFIG_EZLOPI_BLE_ENABLE=y @@ -216,9 +216,106 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # # Bluetooth # -# CONFIG_BT_ENABLED is not set +CONFIG_BT_ENABLED=y + +# +# Bluetooth controller +# +# CONFIG_BTDM_CTRL_MODE_BLE_ONLY is not set +# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set +CONFIG_BTDM_CTRL_MODE_BTDM=y +CONFIG_BTDM_CTRL_BLE_MAX_CONN=3 +CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN=2 +CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN=0 +# CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI is not set +CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM=y +CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=1 +CONFIG_BTDM_CTRL_PCM_ROLE_EDGE_CONFIG=y +CONFIG_BTDM_CTRL_PCM_ROLE_MASTER=y +# CONFIG_BTDM_CTRL_PCM_ROLE_SLAVE is not set +CONFIG_BTDM_CTRL_PCM_POLAR_FALLING_EDGE=y +# CONFIG_BTDM_CTRL_PCM_POLAR_RISING_EDGE is not set +CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 +CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 +# CONFIG_BTDM_CTRL_AUTO_LATENCY is not set +CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT=y +CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF=y +CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3 +CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=2 +CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 +CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y +# CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set +CONFIG_BTDM_CTRL_PINNED_TO_CORE=0 +CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y +# CONFIG_BTDM_CTRL_HCI_MODE_UART_H4 is not set + +# +# MODEM SLEEP Options +# +# CONFIG_BTDM_CTRL_MODEM_SLEEP is not set +# end of MODEM SLEEP Options + +CONFIG_BTDM_BLE_DEFAULT_SCA_250PPM=y +CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1 +# CONFIG_BTDM_BLE_SCAN_DUPL is not set +CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y +CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y +CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 +CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +CONFIG_BTDM_RESERVE_DRAM=0xdb5c +CONFIG_BTDM_CTRL_HLI=y +# end of Bluetooth controller + +CONFIG_BT_BLUEDROID_ENABLED=y +# CONFIG_BT_NIMBLE_ENABLED is not set +# CONFIG_BT_CONTROLLER_ONLY is not set + +# +# Bluedroid Options +# +CONFIG_BT_BTC_TASK_STACK_SIZE=4096 +CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y +# CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1 is not set +CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0 +CONFIG_BT_BTU_TASK_STACK_SIZE=4096 +# CONFIG_BT_BLUEDROID_MEM_DEBUG is not set +# CONFIG_BT_CLASSIC_ENABLED is not set +CONFIG_BT_BLE_ENABLED=y +CONFIG_BT_GATTS_ENABLE=y +CONFIG_BT_GATTS_PPCP_CHAR_GAP=y +# CONFIG_BT_BLE_BLUFI_ENABLE is not set +CONFIG_BT_GATT_MAX_SR_PROFILES=8 +CONFIG_BT_GATT_MAX_SR_ATTRIBUTES=100 +# CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_AUTO=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 +CONFIG_BT_GATTS_ROBUST_CACHING_ENABLED=y +CONFIG_BT_GATTS_DEVICE_NAME_WRITABLE=y +CONFIG_BT_GATTS_APPEARANCE_WRITABLE=y +CONFIG_BT_GATTC_ENABLE=y +CONFIG_BT_GATTC_MAX_CACHE_CHAR=40 +# CONFIG_BT_GATTC_CACHE_NVS_FLASH is not set +CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3 +CONFIG_BT_BLE_SMP_ENABLE=y +# CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set +CONFIG_BT_STACK_NO_LOG=y +CONFIG_BT_ACL_CONNECTIONS=4 +CONFIG_BT_MULTI_CONNECTION_ENBALE=y +CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y +CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y +# CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK is not set +CONFIG_BT_SMP_ENABLE=y +# CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN is not set +CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT=30 +CONFIG_BT_MAX_DEVICE_NAME_LEN=32 +# CONFIG_BT_BLE_RPA_SUPPORTED is not set +CONFIG_BT_BLE_RPA_TIMEOUT=900 +# CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL is not set +# end of Bluedroid Options # end of Bluetooth +# CONFIG_BLE_MESH is not set + # # CoAP Configuration # @@ -268,7 +365,7 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y # # UART configuration # -# CONFIG_UART_ISR_IN_IRAM is not set +CONFIG_UART_ISR_IN_IRAM=y # end of UART configuration # @@ -310,7 +407,8 @@ CONFIG_ESP_TLS_USING_MBEDTLS=y # CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set # CONFIG_ESP_TLS_SERVER is not set # CONFIG_ESP_TLS_PSK_VERIFICATION is not set -# CONFIG_ESP_TLS_INSECURE is not set +CONFIG_ESP_TLS_INSECURE=y +# CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY is not set # end of ESP-TLS # @@ -364,7 +462,6 @@ CONFIG_ESP32_XTAL_FREQ_40=y # CONFIG_ESP32_XTAL_FREQ_AUTO is not set CONFIG_ESP32_XTAL_FREQ=40 # CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_ESP32_NO_BLOBS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set @@ -399,7 +496,7 @@ CONFIG_ETH_DMA_RX_BUFFER_NUM=10 CONFIG_ETH_DMA_TX_BUFFER_NUM=10 CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set -# CONFIG_ETH_SPI_ETHERNET_W5500 is not set +CONFIG_ETH_SPI_ETHERNET_W5500=y # CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set # CONFIG_ETH_USE_OPENETH is not set # end of Ethernet @@ -433,7 +530,7 @@ CONFIG_HTTPD_MAX_URI_LEN=512 CONFIG_HTTPD_ERR_RESP_NO_DELAY=y CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_HTTPD_LOG_PURGE_DATA is not set -# CONFIG_HTTPD_WS_SUPPORT is not set +CONFIG_HTTPD_WS_SUPPORT=y # end of HTTP Server # @@ -468,11 +565,10 @@ CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 # # Sleep Config # -# CONFIG_ESP_SLEEP_POWER_DOWN_FLASH is not set +CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y -# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set -CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y -# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set +CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y +# CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set # end of Sleep Config # @@ -551,7 +647,7 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # end of Memory protection CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y # CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set @@ -575,8 +671,7 @@ CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y # CONFIG_ESP_PANIC_HANDLER_IRAM is not set # CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5=y # end of ESP System Settings # @@ -596,12 +691,13 @@ CONFIG_ESP_TIMER_IMPL_TG0_LAC=y # Wi-Fi # CONFIG_ESP32_WIFI_ENABLED=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 # CONFIG_ESP32_WIFI_CSI_ENABLED is not set CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP32_WIFI_TX_BA_WIN=6 @@ -612,8 +708,8 @@ CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y # CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +# CONFIG_ESP32_WIFI_IRAM_OPT is not set +# CONFIG_ESP32_WIFI_RX_IRAM_OPT is not set CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set @@ -706,7 +802,7 @@ CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y CONFIG_FREERTOS_CORETIMER_0=y # CONFIG_FREERTOS_CORETIMER_1 is not set CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y -CONFIG_FREERTOS_HZ=100 +CONFIG_FREERTOS_HZ=1000 CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set @@ -727,7 +823,8 @@ CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +# CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y @@ -776,17 +873,20 @@ CONFIG_HEAP_TRACING_OFF=y # # Log output # -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set +CONFIG_LOG_DEFAULT_LEVEL_NONE=y # CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set # CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y +# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_DEFAULT_LEVEL=0 CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_ERROR is not set +# CONFIG_LOG_MAXIMUM_LEVEL_WARN is not set +# CONFIG_LOG_MAXIMUM_LEVEL_INFO is not set # CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set # CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set -CONFIG_LOG_MAXIMUM_LEVEL=3 +CONFIG_LOG_MAXIMUM_LEVEL=0 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set @@ -821,7 +921,7 @@ CONFIG_LWIP_ESP_GRATUITOUS_ARP=y CONFIG_LWIP_GARP_TMR_INTERVAL=60 CONFIG_LWIP_ESP_MLDV6_REPORT=y CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y @@ -946,33 +1046,36 @@ CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y # CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set # CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 -# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set +CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=8192 +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 +CONFIG_MBEDTLS_DYNAMIC_BUFFER=y +CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y +CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y +CONFIG_MBEDTLS_DYNAMIC_FREE_CA_CERT=y # CONFIG_MBEDTLS_DEBUG is not set # # mbedTLS v2.28.x related # # CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set +CONFIG_MBEDTLS_ECDH_LEGACY_CONTEXT=y # CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set # CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set -CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y # end of mbedTLS v2.28.x related # # Certificate Bundle # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL is not set +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE is not set # CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 # end of Certificate Bundle -# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -# CONFIG_MBEDTLS_CMAC_C is not set +CONFIG_MBEDTLS_ECP_RESTARTABLE=y +CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_HARDWARE_MPI=y CONFIG_MBEDTLS_HARDWARE_SHA=y @@ -1174,8 +1277,8 @@ CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y -# CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP is not set -# CONFIG_SPI_FLASH_SUPPORT_TH_CHIP is not set +CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y # end of Auto-detect flash chips CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y @@ -1275,7 +1378,9 @@ CONFIG_WL_SECTOR_SIZE=4096 # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 -# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set +CONFIG_WIFI_PROV_BLE_BONDING=y +CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION=y +# CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV is not set # end of Wi-Fi Provisioning Manager # @@ -1315,14 +1420,14 @@ CONFIG_LUA_ROOT="/lua" # end of Compatibility options # Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32-elf-" -# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set +CONFIG_TOOLPREFIX="xtensa-esp32s3-elf-" +CONFIG_LOG_BOOTLOADER_LEVEL_NONE=y # CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set # CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=3 +CONFIG_LOG_BOOTLOADER_LEVEL=0 # CONFIG_APP_ROLLBACK_ENABLE is not set # CONFIG_FLASH_ENCRYPTION_ENABLED is not set # CONFIG_FLASHMODE_QIO is not set @@ -1354,6 +1459,45 @@ CONFIG_STACK_CHECK_NONE=y # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y +# CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY is not set +# CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY is not set +CONFIG_BTDM_CONTROLLER_MODE_BTDM=y +CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN=2 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN=0 +CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=2 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 +CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 +CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y +# CONFIG_BTDM_CONTROLLER_HCI_MODE_UART_H4 is not set +# CONFIG_BTDM_CONTROLLER_MODEM_SLEEP is not set +# CONFIG_BLE_SCAN_DUPLICATE is not set +CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM=100 +CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +CONFIG_BLUEDROID_ENABLED=y +# CONFIG_NIMBLE_ENABLED is not set +CONFIG_BTC_TASK_STACK_SIZE=4096 +CONFIG_BLUEDROID_PINNED_TO_CORE_0=y +# CONFIG_BLUEDROID_PINNED_TO_CORE_1 is not set +CONFIG_BLUEDROID_PINNED_TO_CORE=0 +CONFIG_BTU_TASK_STACK_SIZE=4096 +# CONFIG_BLUEDROID_MEM_DEBUG is not set +# CONFIG_CLASSIC_BT_ENABLED is not set +CONFIG_GATTS_ENABLE=y +# CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set +CONFIG_GATTS_SEND_SERVICE_CHANGE_AUTO=y +CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE=0 +CONFIG_GATTC_ENABLE=y +# CONFIG_GATTC_CACHE_NVS_FLASH is not set +CONFIG_BLE_SMP_ENABLE=y +# CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set +# CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK is not set +CONFIG_SMP_ENABLE=y +# CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY is not set +CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30 CONFIG_ADC2_DISABLE_DAC=y # CONFIG_SPIRAM_SUPPORT is not set CONFIG_TRACEMEM_RESERVE_DRAM=0x0 @@ -1374,7 +1518,6 @@ CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set # CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_NO_BLOBS is not set # CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set # CONFIG_EVENT_LOOP_PROFILING is not set CONFIG_POST_EVENTS_FROM_ISR=y @@ -1382,8 +1525,8 @@ CONFIG_POST_EVENTS_FROM_IRAM_ISR=y # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 -# CONFIG_ESP_SYSTEM_PD_FLASH is not set -# CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND is not set +CONFIG_ESP_SYSTEM_PD_FLASH=y +CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND=y CONFIG_IPC_TASK_STACK_SIZE=1536 CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y # CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set @@ -1395,7 +1538,7 @@ CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y # CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set # CONFIG_ESP32S2_PANIC_GDBSTUB is not set CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=3072 CONFIG_MAIN_TASK_STACK_SIZE=3584 CONFIG_CONSOLE_UART_DEFAULT=y # CONFIG_CONSOLE_UART_CUSTOM is not set @@ -1413,6 +1556,7 @@ CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y # CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set CONFIG_TIMER_TASK_STACK_SIZE=3584 +CONFIG_SW_COEXIST_ENABLE=y # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y @@ -1437,7 +1581,7 @@ CONFIG_TIMER_QUEUE_LENGTH=10 # CONFIG_USE_ONLY_LWIP_SELECT is not set CONFIG_ESP_GRATUITOUS_ARP=y CONFIG_GARP_TMR_INTERVAL=60 -CONFIG_TCPIP_RECVMBOX_SIZE=32 +CONFIG_TCPIP_RECVMBOX_SIZE=16 CONFIG_TCP_MAXRTX=12 CONFIG_TCP_SYNMAXRTX=12 CONFIG_TCP_MSS=1440 diff --git a/sdkconfig.esp32.4mb b/sdkconfig.esp32.4mb index f8c3232fc..c9d963705 100644 --- a/sdkconfig.esp32.4mb +++ b/sdkconfig.esp32.4mb @@ -50,6 +50,14 @@ CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set CONFIG_BOOTLOADER_LOG_LEVEL=0 + +# +# Serial Flash Configurations +# +# CONFIG_BOOTLOADER_FLASH_DC_AWARE is not set +CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y +# end of Serial Flash Configurations + # CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set @@ -64,7 +72,6 @@ CONFIG_BOOTLOADER_WDT_TIME_MS=9000 # CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 # CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set -CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y # end of Bootloader config # @@ -135,13 +142,29 @@ CONFIG_PARTITION_TABLE_MD5=y # # EzloPi User Config # +CONFIG_EZPI_DISTRO_FULL_OPTION=y +# CONFIG_EZLOPI_DISTRO_LOCAL is not set +# CONFIG_EZLOPI_DISTRO_LOCAL_MESHBOT is not set +# CONFIG_EZLOPI_DISTRO_CLOUD is not set +# CONFIG_EZLOPI_DISTRO_CLOUD_MESHBOT is not set +# CONFIG_EZLOPI_DISTRO_BLE_CLOUD is not set +# CONFIG_EZLOPI_DISTRO_WIFI_HUB is not set +# CONFIG_EZLOPI_DISTRO_BLE_HUB is not set +# CONFIG_EZLOPI_DISTRO_MINIMAL is not set +# CONFIG_EZPI_HEAP_ENABLE is not set +# CONFIG_EZPI_DEV_TYPE_TEST is not set CONFIG_EZPI_UTIL_TRACE_EN=y -# CONFIG_EZPI_CORE_ETHERNET_EN is not set -CONFIG_EZPI_SERV_MESHBOT_EN=y -# CONFIG_EZLOPI_BLE_ENALBE_PASSKEY is not set -CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y -CONFIG_EZPI_SERV_MDNS_HOSTNAME="ezlopi_device" -CONFIG_EZPI_MDNS_INSTANCE_NAME="ezlopi_serial" +# CONFIG_EZLOPI_BLE_ENABLE is not set +# CONFIG_EZPI_CORE_ENABLE_ETH is not set +CONFIG_EZPI_ENABLE_WIFI=y +# CONFIG_EZPI_ENABLE_OTA is not set +# CONFIG_EZPI_ENABLE_UART_PROVISIONING is not set +CONFIG_EZPI_LOCAL_WEBSOCKET_SERVER=y +# CONFIG_EZPI_WEBSOCKET_CLIENT is not set +CONFIG_EZPI_CORE_STATIC_BUFFER_SIZE=10240 +# CONFIG_EZPI_SERV_ENABLE_MESHBOTS is not set +CONFIG_EZPI_ENABLE_LED_INDICATOR=y +# CONFIG_EZPI_ENABLE_MDNS_SERVICE is not set # end of EzloPi User Config # @@ -194,15 +217,27 @@ CONFIG_BT_ENABLED=y # # Bluetooth controller # -CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +# CONFIG_BTDM_CTRL_MODE_BLE_ONLY is not set # CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set -# CONFIG_BTDM_CTRL_MODE_BTDM is not set +CONFIG_BTDM_CTRL_MODE_BTDM=y CONFIG_BTDM_CTRL_BLE_MAX_CONN=3 -CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0 +CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN=2 +CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN=0 +# CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI is not set +CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM=y +CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=1 +CONFIG_BTDM_CTRL_PCM_ROLE_EDGE_CONFIG=y +CONFIG_BTDM_CTRL_PCM_ROLE_MASTER=y +# CONFIG_BTDM_CTRL_PCM_ROLE_SLAVE is not set +CONFIG_BTDM_CTRL_PCM_POLAR_FALLING_EDGE=y +# CONFIG_BTDM_CTRL_PCM_POLAR_RISING_EDGE is not set CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 +# CONFIG_BTDM_CTRL_AUTO_LATENCY is not set +CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT=y +CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF=y CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3 -CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0 +CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=2 CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y # CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set @@ -230,6 +265,7 @@ CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=100 CONFIG_BTDM_SCAN_DUPL_CACHE_REFRESH_PERIOD=0 # CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y +# CONFIG_BTDM_CTRL_SCAN_BACKOFF_UPPERLIMITMAX is not set CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 @@ -260,7 +296,7 @@ CONFIG_BT_GATT_MAX_SR_ATTRIBUTES=100 # CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_AUTO=y CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 -# CONFIG_BT_GATTS_ROBUST_CACHING_ENABLED is not set +CONFIG_BT_GATTS_ROBUST_CACHING_ENABLED=y # CONFIG_BT_GATTS_DEVICE_NAME_WRITABLE is not set # CONFIG_BT_GATTS_APPEARANCE_WRITABLE is not set CONFIG_BT_GATTC_ENABLE=y @@ -448,9 +484,10 @@ CONFIG_BT_LOG_BLUFI_TRACE_LEVEL=2 CONFIG_BT_ACL_CONNECTIONS=4 CONFIG_BT_MULTI_CONNECTION_ENBALE=y CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y -# CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY is not set +CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y # CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK is not set CONFIG_BT_SMP_ENABLE=y +CONFIG_BT_SMP_MAX_BONDS=15 # CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN is not set CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT=30 CONFIG_BT_MAX_DEVICE_NAME_LEN=32 @@ -458,6 +495,8 @@ CONFIG_BT_MAX_DEVICE_NAME_LEN=32 CONFIG_BT_BLE_RPA_TIMEOUT=900 # CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL is not set # end of Bluedroid Options + +# CONFIG_BT_HCI_LOG_DEBUG_EN is not set # end of Bluetooth # CONFIG_BLE_MESH is not set @@ -736,6 +775,10 @@ CONFIG_ESP_IPC_ISR_ENABLE=y # LCD and Touch Panel # +# +# LCD Touch Drivers are maintained in the IDF Component Registry +# + # # LCD Peripheral Configuration # @@ -845,6 +888,10 @@ CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +CONFIG_ESP_WIFI_STATIC_RX_MGMT_BUFFER=y +# CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER is not set +CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 +CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF=5 # CONFIG_ESP32_WIFI_CSI_ENABLED is not set CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP32_WIFI_TX_BA_WIN=6 @@ -1057,6 +1104,7 @@ CONFIG_LWIP_SO_REUSE=y CONFIG_LWIP_SO_REUSE_RXTOALL=y # CONFIG_LWIP_SO_RCVBUF is not set # CONFIG_LWIP_NETBUF_RECVINFO is not set +CONFIG_LWIP_IP_DEFAULT_TTL=64 CONFIG_LWIP_IP4_FRAG=y CONFIG_LWIP_IP6_FRAG=y # CONFIG_LWIP_IP4_REASSEMBLY is not set @@ -1109,6 +1157,8 @@ CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744 CONFIG_LWIP_TCP_WND_DEFAULT=5744 CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 CONFIG_LWIP_TCP_QUEUE_OOSEQ=y +CONFIG_LWIP_TCP_OOSEQ_TIMEOUT=6 +CONFIG_LWIP_TCP_OOSEQ_MAX_PBUFS=4 # CONFIG_LWIP_TCP_SACK_OUT is not set # CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_LWIP_TCP_OVERSIZE_MSS=y @@ -1164,6 +1214,13 @@ CONFIG_LWIP_SNTP_MAX_SERVERS=1 CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP +# +# DNS +# +CONFIG_LWIP_DNS_MAX_SERVERS=3 +# CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT is not set +# end of DNS + CONFIG_LWIP_ESP_LWIP_ASSERT=y # @@ -1397,6 +1454,20 @@ CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" # end of PThreads +# +# Main Flash configuration +# + +# +# Optional and Experimental Features (READ DOCS FIRST) +# + +# +# Features here require specific hardware (READ DOCS FIRST!) +# +# end of Optional and Experimental Features (READ DOCS FIRST) +# end of Main Flash configuration + # # SPI Flash driver # @@ -1606,12 +1677,14 @@ CONFIG_STACK_CHECK_NONE=y # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y +# CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY is not set # CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY is not set -# CONFIG_BTDM_CONTROLLER_MODE_BTDM is not set +CONFIG_BTDM_CONTROLLER_MODE_BTDM=y CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN=2 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN=0 CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3 -CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=2 CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y diff --git a/sdkconfig.old b/sdkconfig.old index d01603c52..747161d9e 100644 --- a/sdkconfig.old +++ b/sdkconfig.old @@ -11,7 +11,7 @@ CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 # # SDK tool configuration # -CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" +CONFIG_SDK_TOOLPREFIX="xtensa-esp32s3-elf-" # CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set # end of SDK tool configuration @@ -43,13 +43,21 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set +CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y # CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set # CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 +CONFIG_BOOTLOADER_LOG_LEVEL=0 + +# +# Serial Flash Configurations +# +# CONFIG_BOOTLOADER_FLASH_DC_AWARE is not set +CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y +# end of Serial Flash Configurations + # CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set @@ -64,7 +72,6 @@ CONFIG_BOOTLOADER_WDT_TIME_MS=9000 # CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 # CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set -CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y # end of Bootloader config # @@ -92,14 +99,14 @@ CONFIG_ESPTOOLPY_FLASHFREQ_40M=y # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set CONFIG_ESPTOOLPY_FLASHFREQ="40m" # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y -# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE="2MB" +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y CONFIG_ESPTOOLPY_BEFORE_RESET=y # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set @@ -122,12 +129,12 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # # Partition Table # -CONFIG_PARTITION_TABLE_SINGLE_APP=y +# CONFIG_PARTITION_TABLE_SINGLE_APP is not set # CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set -# CONFIG_PARTITION_TABLE_CUSTOM is not set -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="ezlopi_partitions_v3_1_4_181_4mb.csv" +CONFIG_PARTITION_TABLE_FILENAME="ezlopi_partitions_v3_1_4_181_4mb.csv" CONFIG_PARTITION_TABLE_OFFSET=0x8000 CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table @@ -144,7 +151,7 @@ CONFIG_EZPI_DISTRO_FULL_OPTION=y # CONFIG_EZLOPI_DISTRO_WIFI_HUB is not set # CONFIG_EZLOPI_DISTRO_BLE_HUB is not set # CONFIG_EZLOPI_DISTRO_MINIMAL is not set -CONFIG_EZPI_HEAP_ENABLE=y +# CONFIG_EZPI_HEAP_ENABLE is not set # CONFIG_EZPI_DEV_TYPE_TEST is not set CONFIG_EZPI_UTIL_TRACE_EN=y CONFIG_EZLOPI_BLE_ENABLE=y @@ -216,9 +223,292 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # # Bluetooth # -# CONFIG_BT_ENABLED is not set +CONFIG_BT_ENABLED=y + +# +# Bluetooth controller +# +# CONFIG_BTDM_CTRL_MODE_BLE_ONLY is not set +# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set +CONFIG_BTDM_CTRL_MODE_BTDM=y +CONFIG_BTDM_CTRL_BLE_MAX_CONN=3 +CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN=2 +CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN=0 +# CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_HCI is not set +CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_PCM=y +CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=1 +CONFIG_BTDM_CTRL_PCM_ROLE_EDGE_CONFIG=y +CONFIG_BTDM_CTRL_PCM_ROLE_MASTER=y +# CONFIG_BTDM_CTRL_PCM_ROLE_SLAVE is not set +CONFIG_BTDM_CTRL_PCM_POLAR_FALLING_EDGE=y +# CONFIG_BTDM_CTRL_PCM_POLAR_RISING_EDGE is not set +CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 +CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 +# CONFIG_BTDM_CTRL_AUTO_LATENCY is not set +CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT=y +CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF=y +CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3 +CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=2 +CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 +CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y +# CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set +CONFIG_BTDM_CTRL_PINNED_TO_CORE=0 +CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y +# CONFIG_BTDM_CTRL_HCI_MODE_UART_H4 is not set + +# +# MODEM SLEEP Options +# +# CONFIG_BTDM_CTRL_MODEM_SLEEP is not set +# end of MODEM SLEEP Options + +CONFIG_BTDM_BLE_DEFAULT_SCA_250PPM=y +CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1 +CONFIG_BTDM_BLE_SCAN_DUPL=y +CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE=y +# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA is not set +# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE is not set +CONFIG_BTDM_SCAN_DUPL_TYPE=0 +CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=100 +CONFIG_BTDM_SCAN_DUPL_CACHE_REFRESH_PERIOD=0 +# CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set +CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y +# CONFIG_BTDM_CTRL_SCAN_BACKOFF_UPPERLIMITMAX is not set +CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y +CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 +CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +CONFIG_BTDM_RESERVE_DRAM=0xdb5c +CONFIG_BTDM_CTRL_HLI=y +# end of Bluetooth controller + +CONFIG_BT_BLUEDROID_ENABLED=y +# CONFIG_BT_NIMBLE_ENABLED is not set +# CONFIG_BT_CONTROLLER_ONLY is not set + +# +# Bluedroid Options +# +CONFIG_BT_BTC_TASK_STACK_SIZE=4096 +CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y +# CONFIG_BT_BLUEDROID_PINNED_TO_CORE_1 is not set +CONFIG_BT_BLUEDROID_PINNED_TO_CORE=0 +CONFIG_BT_BTU_TASK_STACK_SIZE=4096 +# CONFIG_BT_BLUEDROID_MEM_DEBUG is not set +# CONFIG_BT_CLASSIC_ENABLED is not set +CONFIG_BT_BLE_ENABLED=y +CONFIG_BT_GATTS_ENABLE=y +# CONFIG_BT_GATTS_PPCP_CHAR_GAP is not set +# CONFIG_BT_BLE_BLUFI_ENABLE is not set +CONFIG_BT_GATT_MAX_SR_PROFILES=8 +CONFIG_BT_GATT_MAX_SR_ATTRIBUTES=100 +# CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL is not set +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_AUTO=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 +CONFIG_BT_GATTS_ROBUST_CACHING_ENABLED=y +# CONFIG_BT_GATTS_DEVICE_NAME_WRITABLE is not set +# CONFIG_BT_GATTS_APPEARANCE_WRITABLE is not set +CONFIG_BT_GATTC_ENABLE=y +CONFIG_BT_GATTC_MAX_CACHE_CHAR=40 +CONFIG_BT_GATTC_NOTIF_REG_MAX=5 +# CONFIG_BT_GATTC_CACHE_NVS_FLASH is not set +CONFIG_BT_GATTC_CONNECT_RETRY_COUNT=3 +CONFIG_BT_BLE_SMP_ENABLE=y +# CONFIG_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE is not set +# CONFIG_BT_STACK_NO_LOG is not set + +# +# BT DEBUG LOG LEVEL +# +# CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_HCI_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_HCI_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_HCI_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_HCI_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_HCI_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_HCI_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_HCI_TRACE_LEVEL=2 +# CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_BTM_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_BTM_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_BTM_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_BTM_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_BTM_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_BTM_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_BTM_TRACE_LEVEL=2 +# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_L2CAP_TRACE_LEVEL=2 +# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL=2 +# CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_SDP_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_SDP_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_SDP_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_SDP_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_SDP_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_SDP_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_SDP_TRACE_LEVEL=2 +# CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_GAP_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_GAP_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_GAP_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_GAP_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_GAP_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_GAP_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_GAP_TRACE_LEVEL=2 +# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_BNEP_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_BNEP_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_BNEP_TRACE_LEVEL=2 +# CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_PAN_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_PAN_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_PAN_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_PAN_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_PAN_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_PAN_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_PAN_TRACE_LEVEL=2 +# CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_A2D_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_A2D_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_A2D_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_A2D_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_A2D_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_A2D_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_A2D_TRACE_LEVEL=2 +# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_AVDT_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_AVDT_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_AVDT_TRACE_LEVEL=2 +# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_AVCT_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_AVCT_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_AVCT_TRACE_LEVEL=2 +# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_AVRC_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_AVRC_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_AVRC_TRACE_LEVEL=2 +# CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_MCA_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_MCA_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_MCA_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_MCA_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_MCA_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_MCA_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_MCA_TRACE_LEVEL=2 +# CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_HID_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_HID_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_HID_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_HID_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_HID_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_HID_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_HID_TRACE_LEVEL=2 +# CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_APPL_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_APPL_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_APPL_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_APPL_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_APPL_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_APPL_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_APPL_TRACE_LEVEL=2 +# CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_GATT_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_GATT_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_GATT_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_GATT_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_GATT_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_GATT_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_GATT_TRACE_LEVEL=2 +# CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_SMP_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_SMP_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_SMP_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_SMP_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_SMP_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_SMP_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_SMP_TRACE_LEVEL=2 +# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_BTIF_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_BTIF_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_BTIF_TRACE_LEVEL=2 +# CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_BTC_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_BTC_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_BTC_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_BTC_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_BTC_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_BTC_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_BTC_TRACE_LEVEL=2 +# CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_OSI_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_OSI_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_OSI_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_OSI_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_OSI_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_OSI_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_OSI_TRACE_LEVEL=2 +# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE is not set +# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_ERROR is not set +CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_WARNING=y +# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_API is not set +# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_EVENT is not set +# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_DEBUG is not set +# CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_VERBOSE is not set +CONFIG_BT_LOG_BLUFI_TRACE_LEVEL=2 +# end of BT DEBUG LOG LEVEL + +CONFIG_BT_ACL_CONNECTIONS=4 +CONFIG_BT_MULTI_CONNECTION_ENBALE=y +CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y +CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y +# CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK is not set +CONFIG_BT_SMP_ENABLE=y +CONFIG_BT_SMP_MAX_BONDS=15 +# CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN is not set +CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT=30 +CONFIG_BT_MAX_DEVICE_NAME_LEN=32 +# CONFIG_BT_BLE_RPA_SUPPORTED is not set +CONFIG_BT_BLE_RPA_TIMEOUT=900 +# CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL is not set +# end of Bluedroid Options + +# CONFIG_BT_HCI_LOG_DEBUG_EN is not set # end of Bluetooth +# CONFIG_BLE_MESH is not set + # # CoAP Configuration # @@ -268,7 +558,7 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y # # UART configuration # -# CONFIG_UART_ISR_IN_IRAM is not set +CONFIG_UART_ISR_IN_IRAM=y # end of UART configuration # @@ -310,7 +600,8 @@ CONFIG_ESP_TLS_USING_MBEDTLS=y # CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set # CONFIG_ESP_TLS_SERVER is not set # CONFIG_ESP_TLS_PSK_VERIFICATION is not set -# CONFIG_ESP_TLS_INSECURE is not set +CONFIG_ESP_TLS_INSECURE=y +# CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY is not set # end of ESP-TLS # @@ -364,7 +655,6 @@ CONFIG_ESP32_XTAL_FREQ_40=y # CONFIG_ESP32_XTAL_FREQ_AUTO is not set CONFIG_ESP32_XTAL_FREQ=40 # CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_ESP32_NO_BLOBS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set @@ -399,7 +689,7 @@ CONFIG_ETH_DMA_RX_BUFFER_NUM=10 CONFIG_ETH_DMA_TX_BUFFER_NUM=10 CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set -# CONFIG_ETH_SPI_ETHERNET_W5500 is not set +CONFIG_ETH_SPI_ETHERNET_W5500=y # CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set # CONFIG_ETH_USE_OPENETH is not set # end of Ethernet @@ -433,7 +723,7 @@ CONFIG_HTTPD_MAX_URI_LEN=512 CONFIG_HTTPD_ERR_RESP_NO_DELAY=y CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_HTTPD_LOG_PURGE_DATA is not set -# CONFIG_HTTPD_WS_SUPPORT is not set +CONFIG_HTTPD_WS_SUPPORT=y # end of HTTP Server # @@ -468,11 +758,11 @@ CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 # # Sleep Config # -# CONFIG_ESP_SLEEP_POWER_DOWN_FLASH is not set +CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y -# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set -CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y -# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set +CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y +# CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set +CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y # end of Sleep Config # @@ -493,6 +783,10 @@ CONFIG_ESP_IPC_ISR_ENABLE=y # LCD and Touch Panel # +# +# LCD Touch Drivers are maintained in the IDF Component Registry +# + # # LCD Peripheral Configuration # @@ -551,7 +845,7 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # end of Memory protection CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072 CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y # CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set @@ -575,8 +869,7 @@ CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y # CONFIG_ESP_PANIC_HANDLER_IRAM is not set # CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5=y # end of ESP System Settings # @@ -596,12 +889,17 @@ CONFIG_ESP_TIMER_IMPL_TG0_LAC=y # Wi-Fi # CONFIG_ESP32_WIFI_ENABLED=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +CONFIG_ESP_WIFI_STATIC_RX_MGMT_BUFFER=y +# CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER is not set +CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 +CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF=5 # CONFIG_ESP32_WIFI_CSI_ENABLED is not set CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y CONFIG_ESP32_WIFI_TX_BA_WIN=6 @@ -612,8 +910,8 @@ CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y # CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +# CONFIG_ESP32_WIFI_IRAM_OPT is not set +# CONFIG_ESP32_WIFI_RX_IRAM_OPT is not set CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set @@ -706,7 +1004,7 @@ CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y CONFIG_FREERTOS_CORETIMER_0=y # CONFIG_FREERTOS_CORETIMER_1 is not set CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y -CONFIG_FREERTOS_HZ=100 +CONFIG_FREERTOS_HZ=1000 CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set @@ -727,7 +1025,8 @@ CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +# CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y @@ -776,17 +1075,20 @@ CONFIG_HEAP_TRACING_OFF=y # # Log output # -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set +CONFIG_LOG_DEFAULT_LEVEL_NONE=y # CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set # CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y +# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_DEFAULT_LEVEL=0 CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_ERROR is not set +# CONFIG_LOG_MAXIMUM_LEVEL_WARN is not set +# CONFIG_LOG_MAXIMUM_LEVEL_INFO is not set # CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set # CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set -CONFIG_LOG_MAXIMUM_LEVEL=3 +CONFIG_LOG_MAXIMUM_LEVEL=0 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set @@ -797,6 +1099,7 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # CONFIG_LWIP_NETIF_API is not set +CONFIG_LWIP_TCPIP_TASK_PRIO=18 # CONFIG_LWIP_TCPIP_CORE_LOCKING is not set # CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y @@ -810,6 +1113,7 @@ CONFIG_LWIP_SO_REUSE=y CONFIG_LWIP_SO_REUSE_RXTOALL=y # CONFIG_LWIP_SO_RCVBUF is not set # CONFIG_LWIP_NETBUF_RECVINFO is not set +CONFIG_LWIP_IP_DEFAULT_TTL=64 CONFIG_LWIP_IP4_FRAG=y CONFIG_LWIP_IP6_FRAG=y # CONFIG_LWIP_IP4_REASSEMBLY is not set @@ -821,7 +1125,7 @@ CONFIG_LWIP_ESP_GRATUITOUS_ARP=y CONFIG_LWIP_GARP_TMR_INTERVAL=60 CONFIG_LWIP_ESP_MLDV6_REPORT=y CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y @@ -862,6 +1166,8 @@ CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744 CONFIG_LWIP_TCP_WND_DEFAULT=5744 CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 CONFIG_LWIP_TCP_QUEUE_OOSEQ=y +CONFIG_LWIP_TCP_OOSEQ_TIMEOUT=6 +CONFIG_LWIP_TCP_OOSEQ_MAX_PBUFS=4 # CONFIG_LWIP_TCP_SACK_OUT is not set # CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_LWIP_TCP_OVERSIZE_MSS=y @@ -917,6 +1223,13 @@ CONFIG_LWIP_SNTP_MAX_SERVERS=1 CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP +# +# DNS +# +CONFIG_LWIP_DNS_MAX_SERVERS=3 +# CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT is not set +# end of DNS + CONFIG_LWIP_ESP_LWIP_ASSERT=y # @@ -946,33 +1259,36 @@ CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y # CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set # CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 -# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set +CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=8192 +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 +CONFIG_MBEDTLS_DYNAMIC_BUFFER=y +CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y +CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y +CONFIG_MBEDTLS_DYNAMIC_FREE_CA_CERT=y # CONFIG_MBEDTLS_DEBUG is not set # # mbedTLS v2.28.x related # # CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set +CONFIG_MBEDTLS_ECDH_LEGACY_CONTEXT=y # CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set # CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set -CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y # end of mbedTLS v2.28.x related # # Certificate Bundle # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL is not set +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN=y # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE is not set # CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 # end of Certificate Bundle -# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -# CONFIG_MBEDTLS_CMAC_C is not set +CONFIG_MBEDTLS_ECP_RESTARTABLE=y +CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_HARDWARE_AES=y CONFIG_MBEDTLS_HARDWARE_MPI=y CONFIG_MBEDTLS_HARDWARE_SHA=y @@ -1147,6 +1463,20 @@ CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" # end of PThreads +# +# Main Flash configuration +# + +# +# Optional and Experimental Features (READ DOCS FIRST) +# + +# +# Features here require specific hardware (READ DOCS FIRST!) +# +# end of Optional and Experimental Features (READ DOCS FIRST) +# end of Main Flash configuration + # # SPI Flash driver # @@ -1174,8 +1504,8 @@ CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y -# CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP is not set -# CONFIG_SPI_FLASH_SUPPORT_TH_CHIP is not set +CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y # end of Auto-detect flash chips CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y @@ -1275,7 +1605,9 @@ CONFIG_WL_SECTOR_SIZE=4096 # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 -# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set +CONFIG_WIFI_PROV_BLE_BONDING=y +CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION=y +# CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV is not set # end of Wi-Fi Provisioning Manager # @@ -1313,162 +1645,3 @@ CONFIG_LUA_ROOT="/lua" # # CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set # end of Compatibility options - -# Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32-elf-" -# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y -# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=3 -# CONFIG_APP_ROLLBACK_ENABLE is not set -# CONFIG_FLASH_ENCRYPTION_ENABLED is not set -# CONFIG_FLASHMODE_QIO is not set -# CONFIG_FLASHMODE_QOUT is not set -CONFIG_FLASHMODE_DIO=y -# CONFIG_FLASHMODE_DOUT is not set -# CONFIG_MONITOR_BAUD_9600B is not set -# CONFIG_MONITOR_BAUD_57600B is not set -CONFIG_MONITOR_BAUD_115200B=y -# CONFIG_MONITOR_BAUD_230400B is not set -# CONFIG_MONITOR_BAUD_921600B is not set -# CONFIG_MONITOR_BAUD_2MB is not set -# CONFIG_MONITOR_BAUD_OTHER is not set -CONFIG_MONITOR_BAUD_OTHER_VAL=115200 -CONFIG_MONITOR_BAUD=115200 -CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y -# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set -CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y -# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set -CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_CXX_EXCEPTIONS is not set -CONFIG_STACK_CHECK_NONE=y -# CONFIG_STACK_CHECK_NORM is not set -# CONFIG_STACK_CHECK_STRONG is not set -# CONFIG_STACK_CHECK_ALL is not set -# CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_DISABLE_GCC8_WARNINGS is not set -# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set -CONFIG_ESP32_APPTRACE_DEST_NONE=y -CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_ADC2_DISABLE_DAC=y -# CONFIG_SPIRAM_SUPPORT is not set -CONFIG_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ULP_COPROC_ENABLED is not set -CONFIG_ULP_COPROC_RESERVE_MEM=0 -CONFIG_BROWNOUT_DET=y -CONFIG_BROWNOUT_DET_LVL_SEL_0=y -# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_BROWNOUT_DET_LVL=0 -CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y -# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set -# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set -# CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set -# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_NO_BLOBS is not set -# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -CONFIG_POST_EVENTS_FROM_IRAM_ISR=y -# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set -CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y -CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 -# CONFIG_ESP_SYSTEM_PD_FLASH is not set -# CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND is not set -CONFIG_IPC_TASK_STACK_SIZE=1536 -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -# CONFIG_ESP32_REDUCE_PHY_TX_POWER is not set -# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set -CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y -# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP32S2_PANIC_GDBSTUB is not set -CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_MAIN_TASK_STACK_SIZE=3584 -CONFIG_CONSOLE_UART_DEFAULT=y -# CONFIG_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_UART_NONE is not set -CONFIG_CONSOLE_UART=y -CONFIG_CONSOLE_UART_NUM=0 -CONFIG_CONSOLE_UART_BAUDRATE=115200 -CONFIG_INT_WDT=y -CONFIG_INT_WDT_TIMEOUT_MS=300 -CONFIG_INT_WDT_CHECK_CPU1=y -CONFIG_TASK_WDT=y -# CONFIG_TASK_WDT_PANIC is not set -CONFIG_TASK_WDT_TIMEOUT_S=5 -CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set -CONFIG_TIMER_TASK_STACK_SIZE=3584 -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_MB_QUEUE_LENGTH=20 -CONFIG_MB_SERIAL_TASK_STACK_SIZE=4096 -CONFIG_MB_SERIAL_BUF_SIZE=256 -CONFIG_MB_SERIAL_TASK_PRIO=10 -CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT=y -CONFIG_MB_CONTROLLER_SLAVE_ID=0x00112233 -CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_MB_CONTROLLER_STACK_SIZE=4096 -CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 -# CONFIG_MB_TIMER_PORT_ENABLED is not set -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set -CONFIG_TIMER_TASK_PRIORITY=1 -CONFIG_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_TIMER_QUEUE_LENGTH=10 -# CONFIG_L2_TO_L3_COPY is not set -# CONFIG_USE_ONLY_LWIP_SELECT is not set -CONFIG_ESP_GRATUITOUS_ARP=y -CONFIG_GARP_TMR_INTERVAL=60 -CONFIG_TCPIP_RECVMBOX_SIZE=32 -CONFIG_TCP_MAXRTX=12 -CONFIG_TCP_SYNMAXRTX=12 -CONFIG_TCP_MSS=1440 -CONFIG_TCP_MSL=60000 -CONFIG_TCP_SND_BUF_DEFAULT=5744 -CONFIG_TCP_WND_DEFAULT=5744 -CONFIG_TCP_RECVMBOX_SIZE=6 -CONFIG_TCP_QUEUE_OOSEQ=y -# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set -CONFIG_TCP_OVERSIZE_MSS=y -# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_TCP_OVERSIZE_DISABLE is not set -CONFIG_UDP_RECVMBOX_SIZE=6 -CONFIG_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF -# CONFIG_PPP_SUPPORT is not set -CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_ESP32_PTHREAD_STACK_MIN=768 -CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set -CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" -CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set -CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y -CONFIG_SUPPORT_TERMIOS=y -CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -# End of deprecated options From 179e0149677b841d37f51af3ad4b1976b3883c07 Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Wed, 1 May 2024 14:51:21 +0545 Subject: [PATCH 27/29] code refactoring for repeat and latch --- .../ezlopi_core_scenes_then_methods.c | 3 +- ...ore_scenes_when_methods_helper_functions.c | 61 ++++++++++--------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 6f8cf582f..1fceb4889 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -561,7 +561,6 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) if (item_id > 0) { - l_ezlopi_item_t* curr_item = ezlopi_device_get_item_by_id(item_id); if ((curr_item) && (EZLOPI_DEVICE_INTERFACE_DIGITAL_OUTPUT == curr_item->interface_type)) { @@ -609,7 +608,7 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) } else { - ret = -1; + ret = 0; TRACE_E(" 'item_id[%d]' neither 'boolean' nor 'int' ; Value-type mis-matched! ", item_id); } cJSON_Delete(cj_result_value); diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c index 6db9d3f75..94ebe938d 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c @@ -1056,38 +1056,43 @@ int when_function_for_repeat(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* cJSON* for_interval = cJSON_GetObjectItem(cj_func_opr, "seconds"); if (for_times && for_interval) { - int for_count = cJSON_GetNumberValue(for_times); /*extract the type*/ - if (for_count) + /* first get the product of all children states*/ + s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; + bool transition_state = __and_when_block_condition(scene_node, when_block); + if ((transition_state) && (0 == function_state_info->current_state)) /*previous state?*/ { - /* first get the product of all children states*/ - bool transition_state = __and_when_block_condition(scene_node, when_block); + if (0 == function_state_info->transtion_instant) + { + /*store the first trigger time*/ + TRACE_W("Start 'repeat' activation Sequence ......!"); + function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); + TRACE_W("first_trigger_time[%d] ", function_state_info->transtion_instant); + } - s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; + /*add the count*/ + function_state_info->transition_count++; + TRACE_W(" count[%d]", function_state_info->transition_count); - if ((transition_state) && (0 == function_state_info->current_state)) /*previous state?*/ + /*compare with conditon*/ + int for_count = cJSON_GetNumberValue(for_times); /*extract the type*/ + if (function_state_info->transition_count >= for_count) { - if (0 == function_state_info->transtion_instant) - { /*store the first trigger time*/ - TRACE_W("here!"); - function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); - } - + uint32_t dur = (((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000); int threshold_time = cJSON_GetNumberValue(for_interval); - function_state_info->transition_count++; - TRACE_S("trigger_time[%d] count[%d]", function_state_info->transtion_instant, function_state_info->transition_count); - if (function_state_info->transition_count >= for_count) + if (dur <= threshold_time)// from 'start' till 'now' { - if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) <= threshold_time) - { - TRACE_W("here2! dur [%d]", (((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000)); - ret = 1; - } - function_state_info->transtion_instant = 0; - function_state_info->transition_count = 0; + TRACE_W(" Successful activation sequence within [%dsec] ; threshold [%dsec]", dur, threshold_time); + ret = 1; + } + else + { + TRACE_E(" Time-Out !! consumed[%d (>%dsec)]", dur, threshold_time); } + function_state_info->transtion_instant = 0; + function_state_info->transition_count = 0; } - function_state_info->current_state = transition_state; } + function_state_info->current_state = transition_state; } } @@ -1267,7 +1272,7 @@ int when_function_for_latch(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* w if (for_enabled) { s_when_function_t* function_state_info = (s_when_function_t*)scene_node->when_block->fields->user_arg; - if ((0 == function_state_info->current_state) && (cJSON_True == for_enabled->type)) /* if the trigger phase has not started */ + if ((0 == function_state_info->current_state) && (cJSON_True == for_enabled->type) && (0 == function_state_info->transtion_instant)) /* if the trigger phase has not started */ { /* first get the product of all children states*/ if (__and_when_block_condition(scene_node, when_block)) /*if : previous state = 0*/ @@ -1277,18 +1282,14 @@ int when_function_for_latch(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* w TRACE_S("start_latched_time[%d]", (uint32_t)xTaskGetTickCount()); } } - else if ((1 == function_state_info->current_state) && (cJSON_False == for_enabled->type)) + else if (cJSON_False == for_enabled->type) { function_state_info->current_state = 0; function_state_info->transtion_instant = 0; TRACE_S("reset_latched_time[%d]", (uint32_t)xTaskGetTickCount()); } - else - { - TRACE_W("Latch state already achieved -> current_state = [%d]", function_state_info->current_state); - - } ret = function_state_info->current_state; + TRACE_W("ret-> current_state = [%d] , active_instant[%d]", function_state_info->current_state, function_state_info->transtion_instant); } } From b03e1580b2b6f06c899c275eb66aaeba6bb419ac Mon Sep 17 00:00:00 2001 From: lomasSE89 Date: Wed, 1 May 2024 15:25:11 +0545 Subject: [PATCH 28/29] cleaned. --- .../ezlopi-core-ble/ezlopi_core_ble_buffer.c | 4 +- .../ezlopi-core-ble/ezlopi_core_ble_buffer.h | 4 +- .../ezlopi-core-ble/ezlopi_core_ble_config.h | 4 +- .../ezlopi-core-ble/ezlopi_core_ble_gap.c | 8 +-- .../ezlopi-core-ble/ezlopi_core_ble_gap.h | 4 +- .../ezlopi-core-ble/ezlopi_core_ble_gatt.c | 6 +-- .../ezlopi-core-ble/ezlopi_core_ble_gatt.h | 4 +- .../ezlopi-core-ble/ezlopi_core_ble_profile.c | 4 +- .../ezlopi-core-ble/ezlopi_core_ble_profile.h | 4 +- .../ezlopi_core_processes.c | 4 +- ezlopi-main/Kconfig.projbuild | 50 +++++++++---------- ezlopi-main/ezlopi_main.c | 2 +- .../ezlopi-service-ble/CMakeLists.txt | 2 +- .../ezlopi-service-ble/ezlopi_service_ble.c | 12 ++--- .../ezlopi-service-ble/ezlopi_service_ble.h | 4 +- .../ezlopi_service_ble_ble_auth.c | 4 +- .../ezlopi_service_ble_ble_auth.h | 4 +- .../ezlopi_service_ble_device_info.c | 4 +- .../ezlopi_service_ble_dynamic_config.c | 4 +- .../ezlopi_service_ble_provisioning.c | 4 +- .../ezlopi_service_ble_security.c | 4 +- .../ezlopi_service_ble_wifi.c | 4 +- ezlopi-user-config/EZLOPI_USER_CONFIG.h | 14 +++--- sdkconfig | 20 ++++---- sdkconfig.esp32.4mb | 16 +++--- sdkconfig.esp32s3.8mb | 2 +- 26 files changed, 97 insertions(+), 99 deletions(-) diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c index 68a1bd20a..0933ceeb9 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c @@ -1,7 +1,7 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include @@ -101,4 +101,4 @@ void ezlopi_ble_buffer_accumulate_to_start(s_linked_buffer_t* l_buffer) l_buffer->next = NULL; } } -#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file +#endif // CONFIG_EZPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.h index 3bad3253a..fe57e4fc2 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.h @@ -1,7 +1,7 @@ #ifndef _EZLOPI_CORE_BLE_BUFFER_H_ #define _EZLOPI_CORE_BLE_BUFFER_H_ -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include "esp_gatts_api.h" @@ -17,6 +17,6 @@ void ezlopi_ble_buffer_add_to_buffer(s_linked_buffer_t* buffer, esp_ble_gatts_cb void ezlopi_ble_buffer_free_buffer(s_linked_buffer_t* l_buffer); void ezlopi_ble_buffer_accumulate_to_start(s_linked_buffer_t* l_buffer); -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE #endif // _EZLOPI_CORE_BLE_BUFFER_H_ \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_config.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_config.h index 3c557a71f..4771d85d6 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_config.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_config.h @@ -1,7 +1,7 @@ #ifndef _EZLOPI_CORE_BLE_CONFIG_H_ #define _EZLOPI_CORE_BLE_CONFIG_H_ -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include "esp_gatts_api.h" @@ -58,6 +58,6 @@ typedef struct s_gatt_service struct s_gatt_service* next; } s_gatt_service_t; -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE #endif // _EZLOPI_CORE_BLE_CONFIG_H_ \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c index 809eca9e6..f6939449a 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c @@ -1,6 +1,6 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include @@ -224,7 +224,7 @@ void ezlopi_ble_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_p break; } -#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZPI_BLE_ENALBE_PAIRING) case ESP_GAP_BLE_PASSKEY_REQ_EVT: // 12 { break; @@ -312,7 +312,7 @@ void ezlopi_ble_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_p ezlopi_ble_setup_adv_config(); break; } -#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZPI_BLE_ENALBE_PAIRING) case ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT: // 22 { ezlopi_ble_setup_adv_config(); @@ -852,4 +852,4 @@ static void ezlopi_ble_setup_service_uuid(void) // dump("complete-uuid", (all_service_uuid ? (void *)all_service_uuid : (void *)ezlopi__str), 0, all_service_uuid_len); } -#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file +#endif // CONFIG_EZPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.h index 6c796d070..0b2c0d957 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.h @@ -1,7 +1,7 @@ #ifndef _EZLOPI_CORE_BLE_GAP_H_ #define _EZLOPI_CORE_BLE_GAP_H_ -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include "esp_gap_ble_api.h" #include "ezlopi_core_ble_config.h" @@ -14,6 +14,6 @@ void ezlopi_ble_gap_config_scan_rsp_data(void); void ezlopi_ble_gap_start_advertising(void); void ezlopi_ble_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* param); -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE #endif // _EZLOPI_CORE_BLE_GAP_H_ \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c index d7a04667d..d9ba1e516 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c @@ -1,6 +1,6 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include @@ -191,7 +191,7 @@ void ezlopi_ble_gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t ga ezlopi_ble_gatt_call_write_exec_by_handle(gatts_if, param); break; } -#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZPI_BLE_ENALBE_PAIRING) case ESP_GATTS_CONNECT_EVT: { TRACE_S("ESP_GATTS_CONNECT_EVT"); @@ -504,6 +504,6 @@ static char* ezlopi_ble_gatt_event_to_string(esp_gatts_cb_event_t event) return ret; } -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE #endif // 1 == ENABLE_TRACE \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.h index 304e3c5b0..d9abda2f8 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.h @@ -1,7 +1,7 @@ #ifndef _EZLOPI_CORE_BLE_GATT_H_ #define _EZLOPI_CORE_BLE_GATT_H_ -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include "ezlopi_core_ble_config.h" @@ -9,6 +9,6 @@ uint16_t ezlopi_ble_gatt_get_max_data_size(void); void ezlopi_ble_gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t* param); void ezlopi_ble_gatts_characteristic_notify(s_gatt_service_t* service, s_gatt_char_t* characteristics, esp_gatt_value_t* value); -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE #endif // _EZLOPI_CORE_BLE_GATT_H_ diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c index 4e6b81701..d24a2dadb 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.c @@ -1,7 +1,7 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include @@ -442,4 +442,4 @@ void ezlopi_ble_gatt_print_uuid(esp_bt_uuid_t* uuid, char* msg) #endif } -#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file +#endif // CONFIG_EZPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.h b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.h index 34cc58298..1436b78b0 100644 --- a/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.h +++ b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_profile.h @@ -1,7 +1,7 @@ #ifndef _EZLOPI_CORE_BLE_PROFILE_H_ #define _EZLOPI_CORE_BLE_PROFILE_H_ -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE s_gatt_service_t* ezlopi_ble_profile_get_by_app_id(uint16_t app_id); s_gatt_service_t* ezlopi_ble_profile_get_service_by_gatts_if(uint16_t gatts_if); @@ -29,6 +29,6 @@ void ezlopi_ble_gatt_print_service(s_gatt_service_t* service); void ezlopi_ble_gatt_print_uuid(esp_bt_uuid_t* uuid, char* msg); void ezlopi_ble_profile_print(void); -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE #endif // _EZLOPI_CORE_BLE_PROFILE_H_ \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c b/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c index e806f59ff..8a49e4e9f 100755 --- a/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c +++ b/ezlopi-core/ezlopi-core-processes/ezlopi_core_processes.c @@ -42,7 +42,7 @@ static size_t set_default_task_memory_usage(const char* default_task_name) { stack_size = CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH; } -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE else if (0 == strncmp("BTU_TASK", default_task_name, 9)) { // stack_size = CONFIG_BTU_TASK_STACK_SIZE; @@ -53,7 +53,7 @@ static size_t set_default_task_memory_usage(const char* default_task_name) // stack_size = CONFIG_BT_BTC_TASK_STACK_SIZE; stack_size = 4096; } -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE else if (0 == strncmp("sys_evt", default_task_name, 8)) { stack_size = CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE; diff --git a/ezlopi-main/Kconfig.projbuild b/ezlopi-main/Kconfig.projbuild index 917729f77..504261b5c 100644 --- a/ezlopi-main/Kconfig.projbuild +++ b/ezlopi-main/Kconfig.projbuild @@ -9,29 +9,29 @@ menu "EzloPi User Config" config EZPI_DISTRO_FULL_OPTION bool "1. EZPI_DISTRO_FULL_OPTION" - config EZLOPI_DISTRO_LOCAL - bool "2. EZLOPI_DISTRO_LOCAL" + config EZPI_DISTRO_LOCAL + bool "2. EZPI_DISTRO_LOCAL" - config EZLOPI_DISTRO_LOCAL_MESHBOT - bool "3. EZLOPI_DISTRO_LOCAL_MESHBOT" + config EZPI_DISTRO_LOCAL_MESHBOT + bool "3. EZPI_DISTRO_LOCAL_MESHBOT" - config EZLOPI_DISTRO_CLOUD - bool "4. EZLOPI_DISTRO_CLOUD" + config EZPI_DISTRO_CLOUD + bool "4. EZPI_DISTRO_CLOUD" - config EZLOPI_DISTRO_CLOUD_MESHBOT - bool "5. EZLOPI_DISTRO_CLOUD_MESHBOT" + config EZPI_DISTRO_CLOUD_MESHBOT + bool "5. EZPI_DISTRO_CLOUD_MESHBOT" - config EZLOPI_DISTRO_BLE_CLOUD - bool "6. EZLOPI_DISTRO_BLE_CLOUD" + config EZPI_DISTRO_BLE_CLOUD + bool "6. EZPI_DISTRO_BLE_CLOUD" - config EZLOPI_DISTRO_WIFI_HUB - bool "7. EZLOPI_DISTRO_WIFI_HUB" + config EZPI_DISTRO_WIFI_HUB + bool "7. EZPI_DISTRO_WIFI_HUB" - config EZLOPI_DISTRO_BLE_HUB - bool "8. EZLOPI_DISTRO_BLE_HUB" + config EZPI_DISTRO_BLE_HUB + bool "8. EZPI_DISTRO_BLE_HUB" - config EZLOPI_DISTRO_MINIMAL - bool "9. EZLOPI_DISTRO_MINIMAL" + config EZPI_DISTRO_MINIMAL + bool "9. EZPI_DISTRO_MINIMAL" endchoice @@ -53,16 +53,16 @@ menu "EzloPi User Config" help ezlopi-util-trace component is enabled to log the outputs to the serial monitor - config EZLOPI_BLE_ENABLE - depends on EZPI_DISTRO_FULL_OPTION || EZLOPI_DISTRO_LOCAL || EZLOPI_DISTRO_LOCAL_MESHBOT || EZLOPI_DISTRO_BLE_CLOUD || EZLOPI_DISTRO_BLE_HUB || EZLOPI_DISTRO_MINIMAL + config EZPI_BLE_ENABLE + depends on EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_LOCAL || EZPI_DISTRO_LOCAL_MESHBOT || EZPI_DISTRO_BLE_CLOUD || EZPI_DISTRO_BLE_HUB || EZPI_DISTRO_MINIMAL bool "Enable BLE" default n help Enable BLE - config EZLOPI_BLE_ENALBE_PAIRING + config EZPI_BLE_ENALBE_PAIRING bool "Enable BLE pairing" - depends on EZLOPI_BLE_ENABLE + depends on EZPI_BLE_ENABLE default y help Enable BLE pairing @@ -70,7 +70,7 @@ menu "EzloPi User Config" config EZLOPI_BLE_ENALBE_PASSKEY bool "Enable BLE pass key" default n - depends on EZLOPI_BLE_ENALBE_PAIRING + depends on EZPI_BLE_ENALBE_PAIRING help Enable BLE pass key @@ -109,14 +109,14 @@ menu "EzloPi User Config" # Enable local HTTP WS Support config EZPI_LOCAL_WEBSOCKET_SERVER - depends on (HTTPD_WS_SUPPORT && (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI ) && (EZPI_DISTRO_FULL_OPTION || EZLOPI_DISTRO_LOCAL || EZLOPI_DISTRO_LOCAL_MESHBOT)) + depends on (HTTPD_WS_SUPPORT && (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI ) && (EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_LOCAL || EZPI_DISTRO_LOCAL_MESHBOT)) bool "Enable local websocket server" default n help Enable local websocket server config EZPI_WEBSOCKET_CLIENT - depends on (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI ) && (EZPI_DISTRO_FULL_OPTION || EZLOPI_DISTRO_CLOUD || EZLOPI_DISTRO_CLOUD_MESHBOT || EZLOPI_DISTRO_BLE_CLOUD || EZLOPI_DISTRO_WIFI_HUB || EZLOPI_DISTRO_BLE_HUB) + depends on (EZPI_CORE_ENABLE_ETH || EZPI_ENABLE_WIFI ) && (EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_CLOUD || EZPI_DISTRO_CLOUD_MESHBOT || EZPI_DISTRO_BLE_CLOUD || EZPI_DISTRO_WIFI_HUB || EZPI_DISTRO_BLE_HUB) bool "Enable Web-Socket client" default n help @@ -130,7 +130,7 @@ menu "EzloPi User Config" Static buffer is used to broadcast data. Data is broadcasted by local-websocket-server and websocket-client. Default value is 10KB" config EZPI_SERV_ENABLE_MESHBOTS - depends on (EZPI_WEBSOCKET_CLIENT || EZPI_LOCAL_WEBSOCKET_SERVER) && (EZPI_DISTRO_FULL_OPTION || EZLOPI_DISTRO_LOCAL_MESHBOT || EZLOPI_DISTRO_CLOUD_MESHBOT ) + depends on (EZPI_WEBSOCKET_CLIENT || EZPI_LOCAL_WEBSOCKET_SERVER) && (EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_LOCAL_MESHBOT || EZPI_DISTRO_CLOUD_MESHBOT ) bool "Enable meshbot service" default n help @@ -150,7 +150,7 @@ menu "EzloPi User Config" Enable indicator LED available in the device config EZPI_ENABLE_MDNS_SERVICE - depends on EZPI_DISTRO_FULL_OPTION || EZLOPI_DISTRO_LOCAL || EZLOPI_DISTRO_LOCAL_MESHBOT + depends on EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_LOCAL || EZPI_DISTRO_LOCAL_MESHBOT bool "Enable mDNS service" default n help diff --git a/ezlopi-main/ezlopi_main.c b/ezlopi-main/ezlopi_main.c index db137cee1..3d19b9cbc 100644 --- a/ezlopi-main/ezlopi_main.c +++ b/ezlopi-main/ezlopi_main.c @@ -51,7 +51,7 @@ void app_main(void) timer_service_init(); -#if defined(CONFIG_EZLOPI_BLE_ENABLE) +#if defined(CONFIG_EZPI_BLE_ENABLE) ezlopi_ble_service_init(); #endif diff --git a/ezlopi-services/ezlopi-service-ble/CMakeLists.txt b/ezlopi-services/ezlopi-service-ble/CMakeLists.txt index d5861f074..9d306e02d 100644 --- a/ezlopi-services/ezlopi-service-ble/CMakeLists.txt +++ b/ezlopi-services/ezlopi-service-ble/CMakeLists.txt @@ -12,7 +12,7 @@ set(EZLOPI_CORE_COMPONENTS ) -idf_component_register(SRCS "ezlopi_service_ble_security.c" "ezlopi_service_ble_device_info.c" "ezlopi_service_ble_provisioning.c" "ezlopi_service_ble.c" "ezlopi_service_ble_dynamic_config.c" "ezlopi_service_ble_wifi.c" "${src_files}" +idf_component_register(SRCS "ezlopi_service_ble_ble_auth.c" "ezlopi_service_ble_security.c" "ezlopi_service_ble_device_info.c" "ezlopi_service_ble_provisioning.c" "ezlopi_service_ble.c" "ezlopi_service_ble_dynamic_config.c" "ezlopi_service_ble_wifi.c" "${src_files}" INCLUDE_DIRS "." REQUIRES ${EZLOPI_CORE_COMPONENTS} ) diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c index d9ad69f86..e82317a4c 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c @@ -1,7 +1,7 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include #include @@ -44,7 +44,7 @@ static void ezlopi_ble_basic_init(void); static void ezlopi_ble_start_secure_gatt_server(void); #endif -#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZPI_BLE_ENALBE_PAIRING) static void ezlopi_ble_start_secure_gatt_server_open_pairing(void); #endif @@ -68,17 +68,17 @@ void ezlopi_ble_service_init(void) CHECK_PRINT_ERROR(esp_ble_gatt_set_local_mtu(517), "set local MTU failed"); -#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZPI_BLE_ENALBE_PAIRING) #if (1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY) ezlopi_ble_start_secure_gatt_server(); #else ezlopi_ble_start_secure_gatt_server_open_pairing(); #endif // 1 == CONFIG_EZLOPI_BLE_ENALBE_PASSKEY -#endif // 1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING +#endif // 1 == CONFIG_EZPI_BLE_ENALBE_PAIRING } -#if (1 == CONFIG_EZLOPI_BLE_ENALBE_PAIRING) +#if (1 == CONFIG_EZPI_BLE_ENALBE_PAIRING) static void ezlopi_ble_start_secure_gatt_server_open_pairing(void) { const esp_ble_auth_req_t auth_req = ESP_LE_AUTH_REQ_SC_MITM_BOND; @@ -179,4 +179,4 @@ int ezlopi_ble_service_get_ble_mac(uint8_t mac[6]) } return ret; } -#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file +#endif // CONFIG_EZPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.h b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.h index 32d3e2335..22efddfc9 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.h +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.h @@ -2,7 +2,7 @@ #ifndef _EZLOPI_SERVICE_BLE_H_ #define _EZLOPI_SERVICE_BLE_H_ -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #define CHECK_PRINT_ERROR(x, msg) \ { \ @@ -52,6 +52,6 @@ void ezlopi_ble_service_init(void); int ezlopi_ble_service_get_ble_mac(uint8_t mac[6]); -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE #endif // _EZLOPI_SERVICE_BLE_H_ diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c index f7616ea43..45f2c2116 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.c @@ -1,7 +1,7 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE // #TODO ADD guard for key enable #include @@ -111,4 +111,4 @@ char* ezlopi_ble_auth_status_to_string(e_auth_status_t status) return ret; } -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.h b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.h index 36d70ac38..4121a30c6 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.h +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_ble_auth.h @@ -1,7 +1,7 @@ #ifndef _EZLOPI_SERVICE_BLE_BLE_AUT_H_ #define _EZLOPI_SERVICE_BLE_BLE_AUT_H_ -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE typedef enum e_auth_status { BLE_AUTH_SUCCESS = 1, @@ -17,6 +17,6 @@ e_auth_status_t ezlopi_ble_auth_store_user_id(char* user_id); e_auth_status_t ezlopi_ble_auth_check_user_id(char* user_id); char* ezlopi_ble_auth_status_to_string(e_auth_status_t status); -#endif //CONFIG_EZLOPI_BLE_ENABLE +#endif //CONFIG_EZPI_BLE_ENABLE #endif // _EZLOPI_SERVICE_BLE_BLE_AUT_H_ diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c index e841f14c5..317b2cc64 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_device_info.c @@ -1,7 +1,7 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include #include @@ -750,4 +750,4 @@ void __add_factory_info_to_root(cJSON* root, char* key, char* value) } } -#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file +#endif // CONFIG_EZPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c index 3988052c9..64c03c663 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_dynamic_config.c @@ -1,6 +1,6 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include #include @@ -347,4 +347,4 @@ static char* __dynamic_config_base64(void) return base64_data; } -#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file +#endif // CONFIG_EZPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c index 46951d205..b022ecbad 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_provisioning.c @@ -1,7 +1,7 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include #include @@ -563,6 +563,6 @@ static char* __provisioning_info_base64(void) return base64_data; } -#endif // CONFIG_EZLOPI_BLE_ENABLE +#endif // CONFIG_EZPI_BLE_ENABLE #endif // EZPI_SERV_BLE_ENABLE_READ_PROV \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c index ca802f4bc..d7dcd187a 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_security.c @@ -2,7 +2,7 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include @@ -227,4 +227,4 @@ static void __process_auth_command(cJSON* root) } #endif } -#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file +#endif // CONFIG_EZPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c index 8968f3207..213e76559 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble_wifi.c @@ -1,7 +1,7 @@ #include "../../build/config/sdkconfig.h" -#ifdef CONFIG_EZLOPI_BLE_ENABLE +#ifdef CONFIG_EZPI_BLE_ENABLE #include @@ -124,4 +124,4 @@ static void wifi_creds_parse_and_connect(uint8_t* value, uint32_t len) } } } -#endif // CONFIG_EZLOPI_BLE_ENABLE \ No newline at end of file +#endif // CONFIG_EZPI_BLE_ENABLE \ No newline at end of file diff --git a/ezlopi-user-config/EZLOPI_USER_CONFIG.h b/ezlopi-user-config/EZLOPI_USER_CONFIG.h index ee0428f5e..5f617653d 100644 --- a/ezlopi-user-config/EZLOPI_USER_CONFIG.h +++ b/ezlopi-user-config/EZLOPI_USER_CONFIG.h @@ -6,21 +6,21 @@ #if defined(CONFIG_EZPI_DISTRO_FULL_OPTION) #define CONFIG_EZPI_DISTRO_NAME "EZPI_DISTRO_FULL_OPTION" -#elif defined(CONFIG_EZLOPI_DISTRO_LOCAL) +#elif defined(CONFIG_EZPI_DISTRO_LOCAL) #define CONFIG_EZPI_DISTRO_NAME "EZLOPI_DISTRO_LOCAL" -#elif defined(CONFIG_EZLOPI_DISTRO_LOCAL_MESHBOT) +#elif defined(CONFIG_EZPI_DISTRO_LOCAL_MESHBOT) #define CONFIG_EZPI_DISTRO_NAME "EZLOPI_DISTRO_LOCAL_MESHBOT" #elif defined(CONFIG_EZLOPI_DISTRO_CLOUD) #define CONFIG_EZPI_DISTRO_NAME "EZLOPI_DISTRO_CLOUD" -#elif defined(CONFIG_EZLOPI_DISTRO_CLOUD_MESHBOT) +#elif defined(CONFIG_EZPI_DISTRO_CLOUD_MESHBOT) #define CONFIG_EZPI_DISTRO_NAME "EZLOPI_DISTRO_CLOUD_MESHBOT" -#elif defined(CONFIG_EZLOPI_DISTRO_BLE_CLOUD) +#elif defined(CONFIG_EZPI_DISTRO_BLE_CLOUD) #define CONFIG_EZPI_DISTRO_NAME "EZLOPI_DISTRO_BLE_CLOUD" -#elif defined(CONFIG_EZLOPI_DISTRO_WIFI_HUB) +#elif defined(CONFIG_EZPI_DISTRO_WIFI_HUB) #define CONFIG_EZPI_DISTRO_NAME "EZLOPI_DISTRO_WIFI_HUB" -#elif defined(CONFIG_EZLOPI_DISTRO_BLE_HUB) +#elif defined(CONFIG_EZPI_DISTRO_BLE_HUB) #define CONFIG_EZPI_DISTRO_NAME "EZLOPI_DISTRO_BLE_HUB" -#elif defined(CONFIG_EZLOPI_DISTRO_MINIMAL) +#elif defined(CONFIG_EZPI_DISTRO_MINIMAL) #define CONFIG_EZPI_DISTRO_NAME "EZLOPI_DISTRO_MINIMAL" #else #define CONFIG_EZPI_DISTRO_NAME "EZLOPI_DISTRO_CUSTOM" diff --git a/sdkconfig b/sdkconfig index 5debdd2a3..b19efc772 100644 --- a/sdkconfig +++ b/sdkconfig @@ -136,20 +136,18 @@ CONFIG_PARTITION_TABLE_MD5=y # EzloPi User Config # CONFIG_EZPI_DISTRO_FULL_OPTION=y -# CONFIG_EZLOPI_DISTRO_LOCAL is not set -# CONFIG_EZLOPI_DISTRO_LOCAL_MESHBOT is not set -# CONFIG_EZLOPI_DISTRO_CLOUD is not set -# CONFIG_EZLOPI_DISTRO_CLOUD_MESHBOT is not set -# CONFIG_EZLOPI_DISTRO_BLE_CLOUD is not set -# CONFIG_EZLOPI_DISTRO_WIFI_HUB is not set -# CONFIG_EZLOPI_DISTRO_BLE_HUB is not set -# CONFIG_EZLOPI_DISTRO_MINIMAL is not set +# CONFIG_EZPI_DISTRO_LOCAL is not set +# CONFIG_EZPI_DISTRO_LOCAL_MESHBOT is not set +# CONFIG_EZPI_DISTRO_CLOUD is not set +# CONFIG_EZPI_DISTRO_CLOUD_MESHBOT is not set +# CONFIG_EZPI_DISTRO_BLE_CLOUD is not set +# CONFIG_EZPI_DISTRO_WIFI_HUB is not set +# CONFIG_EZPI_DISTRO_BLE_HUB is not set +# CONFIG_EZPI_DISTRO_MINIMAL is not set # CONFIG_EZPI_HEAP_ENABLE is not set # CONFIG_EZPI_DEV_TYPE_TEST is not set CONFIG_EZPI_UTIL_TRACE_EN=y -CONFIG_EZLOPI_BLE_ENABLE=y -CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y -# CONFIG_EZLOPI_BLE_ENALBE_PASSKEY is not set +# CONFIG_EZPI_BLE_ENABLE is not set # CONFIG_EZPI_CORE_ENABLE_ETH is not set CONFIG_EZPI_ENABLE_WIFI=y CONFIG_EZPI_ENABLE_OTA=y diff --git a/sdkconfig.esp32.4mb b/sdkconfig.esp32.4mb index c9d963705..16d1561a4 100644 --- a/sdkconfig.esp32.4mb +++ b/sdkconfig.esp32.4mb @@ -143,18 +143,18 @@ CONFIG_PARTITION_TABLE_MD5=y # EzloPi User Config # CONFIG_EZPI_DISTRO_FULL_OPTION=y -# CONFIG_EZLOPI_DISTRO_LOCAL is not set -# CONFIG_EZLOPI_DISTRO_LOCAL_MESHBOT is not set +# CONFIG_EZPI_DISTRO_LOCAL is not set +# CONFIG_EZPI_DISTRO_LOCAL_MESHBOT is not set # CONFIG_EZLOPI_DISTRO_CLOUD is not set -# CONFIG_EZLOPI_DISTRO_CLOUD_MESHBOT is not set -# CONFIG_EZLOPI_DISTRO_BLE_CLOUD is not set -# CONFIG_EZLOPI_DISTRO_WIFI_HUB is not set -# CONFIG_EZLOPI_DISTRO_BLE_HUB is not set -# CONFIG_EZLOPI_DISTRO_MINIMAL is not set +# CONFIG_EZPI_DISTRO_CLOUD_MESHBOT is not set +# CONFIG_EZPI_DISTRO_BLE_CLOUD is not set +# CONFIG_EZPI_DISTRO_WIFI_HUB is not set +# CONFIG_EZPI_DISTRO_BLE_HUB is not set +# CONFIG_EZPI_DISTRO_MINIMAL is not set # CONFIG_EZPI_HEAP_ENABLE is not set # CONFIG_EZPI_DEV_TYPE_TEST is not set CONFIG_EZPI_UTIL_TRACE_EN=y -# CONFIG_EZLOPI_BLE_ENABLE is not set +# CONFIG_EZPI_BLE_ENABLE is not set # CONFIG_EZPI_CORE_ENABLE_ETH is not set CONFIG_EZPI_ENABLE_WIFI=y # CONFIG_EZPI_ENABLE_OTA is not set diff --git a/sdkconfig.esp32s3.8mb b/sdkconfig.esp32s3.8mb index 4306d1abb..4985378f3 100644 --- a/sdkconfig.esp32s3.8mb +++ b/sdkconfig.esp32s3.8mb @@ -151,7 +151,7 @@ CONFIG_PARTITION_TABLE_MD5=y # CONFIG_EZPI_CORE_ETHERNET_EN is not set CONFIG_EZPI_SERV_MESHBOT_EN=y # CONFIG_EZLOPI_BLE_ENALBE_PASSKEY is not set -CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y +CONFIG_EZPI_BLE_ENALBE_PAIRING=y # # EzloPi mDNS config From 1bf866f98110e957e7030b8664d0f6fd81a839fd Mon Sep 17 00:00:00 2001 From: ezlo-rikenm Date: Wed, 1 May 2024 17:16:54 +0545 Subject: [PATCH 29/29] function feature ready for merge --- .../ezlopi_core_scenes_then_methods.c | 36 ++++++++++++++----- .../ezlopi_core_scenes_when_methods.c | 9 +++-- ...ore_scenes_when_methods_helper_functions.c | 6 ++-- .../ezlopi_service_meshbot.c | 2 +- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index 1fceb4889..6926cf735 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c @@ -526,10 +526,10 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) { TRACE_W(" toggle_value "); int ret = 0; - +#if 0 if (curr_scene) { - int item_id = 0; /* item */ + uint32_t item_id = 0; /* item */ const char* __id_string = NULL; char* expression_name = NULL; /* expression */ @@ -544,8 +544,8 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) if (EZLOPI_VALUE_TYPE_ITEM == curr_field->value_type) { item_id = strtoul(curr_field->field_value.u_value.value_string, NULL, 16); - __id_string = curr_field->field_value.u_value.value_string; - TRACE_W("item_id: %s", __id_string); + TRACE_W("item_id: %s", curr_field->field_value.u_value.value_string); + TRACE_W("item_id: %d", item_id); } } else if (0 == strncmp(curr_field->name, "expression", 11)) /*need to add in str*/ @@ -561,23 +561,32 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) if (item_id > 0) { + TRACE_W("item_id: %u", item_id); l_ezlopi_item_t* curr_item = ezlopi_device_get_item_by_id(item_id); if ((curr_item) && (EZLOPI_DEVICE_INTERFACE_DIGITAL_OUTPUT == curr_item->interface_type)) { cJSON* cj_tmp_value = cJSON_CreateObject(); if (cj_tmp_value) { - curr_item->func(EZLOPI_ACTION_HUB_GET_ITEM, curr_item, (void*)cj_tmp_value, NULL); + if (curr_item->func(EZLOPI_ACTION_GET_EZLOPI_VALUE, curr_item, (void*)cj_tmp_value, NULL)) + { + CJSON_TRACE("value", cj_tmp_value)/*value formatted & value only*/ + } + else + { + TRACE_E("here"); + } + cJSON* cj_val = cJSON_GetObjectItem(cj_tmp_value, ezlopi_value_str); cJSON* cj_valuetype = cJSON_GetObjectItem(cj_tmp_value, ezlopi_valueType_str); if (cj_val && cj_valuetype) { + TRACE_W("here"); cJSON* cj_result_value = cJSON_CreateObject(); if (cj_result_value) { - ret = 1; - cJSON_AddStringToObject(cj_result_value, ezlopi__id_str, __id_string); + cJSON_AddStringToObject(cj_result_value, ezlopi__id_str, __id_string); if (0 == strncmp(cj_valuetype->valuestring, value_type_bool, 6)) { TRACE_S("1. getting 'item_id[%d]' ; bool_value = %s ", item_id, cj_val->valuestring); // "false" or "true" @@ -589,7 +598,8 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) { cJSON_AddBoolToObject(cj_result_value, ezlopi_value_str, false); } - + TRACE_W("here"); + ret = 1; curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_result_value, curr_item->user_arg); } else if (0 == strncmp(cj_valuetype->valuestring, value_type_int, 6)) @@ -604,6 +614,8 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) cJSON_AddNumberToObject(cj_result_value, ezlopi_value_str, 0); } + TRACE_W("here"); + ret = 1; curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_result_value, curr_item->user_arg); } else @@ -617,6 +629,10 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) } cJSON_Delete(cj_tmp_value); } + else + { + TRACE_E("wrong item_ID"); + } } else if (NULL != expression_name) { @@ -625,10 +641,12 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) { if (EXPRESSION_VALUE_TYPE_NUMBER == curr_exp->exp_value.type) { + ret = 1; curr_exp->exp_value.u_value.number_value = (0 == curr_exp->exp_value.u_value.number_value) ? 1 : 0; } else if (EXPRESSION_VALUE_TYPE_BOOL) { + ret = 1; curr_exp->exp_value.u_value.boolean_value = (false == curr_exp->exp_value.u_value.boolean_value) ? true : false; } } @@ -636,6 +654,6 @@ int ezlopi_scene_then_toggle_value(l_scenes_list_v2_t* curr_scene, void* arg) } } } - +#endif return ret; } \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c index 5c410b830..4d49338b3 100755 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.c @@ -425,6 +425,7 @@ int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, { TRACE_W(" isHouse_mode_changed_from"); int ret = 0; +#if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block) @@ -465,7 +466,7 @@ int ezlopi_scene_when_is_house_mode_changed_from(l_scenes_list_v2_t* scene_node, } } } - +#endif return ret; } @@ -473,6 +474,7 @@ int ezlopi_scene_when_is_House_Mode_Alarm_Phase_Range(l_scenes_list_v2_t* scene_ { TRACE_W(" is_House_Mode_Alarm_Phase_Range "); int ret = 0; +#if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block) @@ -500,7 +502,7 @@ int ezlopi_scene_when_is_House_Mode_Alarm_Phase_Range(l_scenes_list_v2_t* scene_ curr_field = curr_field->next; } } - +#endif return ret; } @@ -508,6 +510,7 @@ int ezlopi_scene_when_is_House_Mode_Switch_to_Range(l_scenes_list_v2_t* scene_no { TRACE_W(" is_House_Mode_Switch_to_Range "); int ret = 0; +#if 0 l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (when_block && scene_node) @@ -523,7 +526,7 @@ int ezlopi_scene_when_is_House_Mode_Switch_to_Range(l_scenes_list_v2_t* scene_no TRACE_E(" Current HouseMode_phase does not have duration "); } } - +#endif return ret; } diff --git a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c index 94ebe938d..ab3ba343c 100644 --- a/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c +++ b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods_helper_functions.c @@ -1064,14 +1064,14 @@ int when_function_for_repeat(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* if (0 == function_state_info->transtion_instant) { /*store the first trigger time*/ - TRACE_W("Start 'repeat' activation Sequence ......!"); + // TRACE_W("Start 'repeat' activation Sequence ......!"); function_state_info->transtion_instant = (uint32_t)xTaskGetTickCount(); TRACE_W("first_trigger_time[%d] ", function_state_info->transtion_instant); } /*add the count*/ function_state_info->transition_count++; - TRACE_W(" count[%d]", function_state_info->transition_count); + // TRACE_W(" count[%d]", function_state_info->transition_count); /*compare with conditon*/ int for_count = cJSON_GetNumberValue(for_times); /*extract the type*/ @@ -1132,7 +1132,7 @@ int when_function_for_follow(l_scenes_list_v2_t* scene_node, l_when_block_v2_t* { /* trigger phase ---> stop */ ret = 0; - // TRACE_W("restart the trigger..."); + TRACE_W("restart the trigger..."); /* now refreshing then block*/ if (false == __and_when_block_condition(scene_node, when_block)) diff --git a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c index ee4f93df4..05aae7779 100644 --- a/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c +++ b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c @@ -272,7 +272,7 @@ PT_THREAD(__scene_proto_thread(l_scenes_list_v2_t* scene_node, uint32_t routine_ ctx->delay_ms = delay_ms; ctx->action_node = then_block_node; - ctx->curr_ticks = xTaskGetTickCount(); + ctx->curr_ticks = xTaskGetTickCount(); TRACE_D("entering delay: %d", ctx->curr_ticks); PT_WAIT_UNTIL(&ctx->pt, (xTaskGetTickCount() - ctx->curr_ticks) > ctx->delay_ms); TRACE_D("exiting delay: %d", xTaskGetTickCount());