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-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-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-cloud/ezlopi-cloud-scenes/CMakeLists.txt b/ezlopi-cloud/ezlopi-cloud-scenes/CMakeLists.txt index 55a8e5adc..5395117bf 100644 --- a/ezlopi-cloud/ezlopi-cloud-scenes/CMakeLists.txt +++ b/ezlopi-cloud/ezlopi-cloud-scenes/CMakeLists.txt @@ -20,7 +20,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.c b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c index 834b7dc54..6dbca7c5b 100755 --- a/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c +++ b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes.c @@ -13,6 +13,7 @@ #include "ezlopi_cloud_constants.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) { @@ -344,7 +345,40 @@ void scenes_notification_remove(cJSON* cj_request, cJSON* cj_response) } } -/////////// updater for scene +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 698ae8c07..b12b6260f 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-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes_block_list.c b/ezlopi-cloud/ezlopi-cloud-scenes/ezlopi_cloud_scenes_block_list.c index 050792d21..86710add3 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-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-api/ezlopi_core_api_macros.h b/ezlopi-core/ezlopi-core-api/ezlopi_core_api_macros.h index 120217a0b..b5d6c400c 100644 --- a/ezlopi-core/ezlopi-core-api/ezlopi_core_api_macros.h +++ b/ezlopi-core/ezlopi-core-api/ezlopi_core_api_macros.h @@ -69,6 +69,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-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-ble/ezlopi_core_ble_buffer.c b/ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_buffer.c index a9ab5c140..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,10 +1,15 @@ + +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_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 +37,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 +47,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 +62,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 +100,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_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 d008f520f..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,18 +1,22 @@ #ifndef _EZLOPI_CORE_BLE_BUFFER_H_ #define _EZLOPI_CORE_BLE_BUFFER_H_ +#ifdef CONFIG_EZPI_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_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 e12a8e40b..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,6 +1,8 @@ #ifndef _EZLOPI_CORE_BLE_CONFIG_H_ #define _EZLOPI_CORE_BLE_CONFIG_H_ +#ifdef CONFIG_EZPI_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_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 b7494de99..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,3 +1,7 @@ +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_BLE_ENABLE + #include #include "ezlopi_util_trace.h" @@ -220,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; @@ -308,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(); @@ -848,3 +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_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 5ac77a927..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,6 +1,8 @@ #ifndef _EZLOPI_CORE_BLE_GAP_H_ #define _EZLOPI_CORE_BLE_GAP_H_ +#ifdef CONFIG_EZPI_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_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 b35f3bd61..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,3 +1,7 @@ +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_BLE_ENABLE + #include #include "esp_gatt_common_api.h" @@ -187,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"); @@ -499,4 +503,7 @@ static char* ezlopi_ble_gatt_event_to_string(esp_gatts_cb_event_t event) } return ret; } + +#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 96227fdd6..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,10 +1,14 @@ #ifndef _EZLOPI_CORE_BLE_GATT_H_ #define _EZLOPI_CORE_BLE_GATT_H_ +#ifdef CONFIG_EZPI_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_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 34797950d..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,3 +1,8 @@ + +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_BLE_ENABLE + #include #include "ezlopi_util_trace.h" @@ -436,3 +441,5 @@ void ezlopi_ble_gatt_print_uuid(esp_bt_uuid_t* uuid, char* msg) } #endif } + +#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 64f1f9e6b..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,31 +1,34 @@ #ifndef _EZLOPI_CORE_BLE_PROFILE_H_ #define _EZLOPI_CORE_BLE_PROFILE_H_ +#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); +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_EZPI_BLE_ENABLE + #endif // _EZLOPI_CORE_BLE_PROFILE_H_ \ No newline at end of file diff --git a/ezlopi-core/ezlopi-core-devices/CMakeLists.txt b/ezlopi-core/ezlopi-core-devices/CMakeLists.txt index 510e31c00..8f3e68962 100644 --- a/ezlopi-core/ezlopi-core-devices/CMakeLists.txt +++ b/ezlopi-core/ezlopi-core-devices/CMakeLists.txt @@ -89,7 +89,7 @@ set(EZLOPI_SENSOR_DEVICE_COMPONENTS ) -idf_component_register(SRCS "ezlopi_core_device_value_updated.c" "${config_src}" +idf_component_register(SRCS "ezlopi_core_devices.c" "ezlopi_core_device_value_updated.c" "${config_src}" INCLUDE_DIRS "." REQUIRES ${EZLOPI_CORE_COMPONENTS} ${EZLOPI_HAL_COMPONENTS} 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-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-factory-info/ezlopi_core_factory_info.h b/ezlopi-core/ezlopi-core-factory-info/ezlopi_core_factory_info.h index 5fc2cbecf..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 @@ -164,9 +164,9 @@ extern "C" [\ {\ \"dev_type\": 1,\ - \"dev_name\": \"LED\",\ + \"dev_name\": \"switch_temp\",\ \"id_room\": \"\",\ - \"id_item\": 1,\ + \"id_item\": 2,\ \"gpio_in\": 0,\ \"gpio_out\": 5,\ \"pullup_ip\": false,\ @@ -176,9 +176,31 @@ extern "C" \"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_total\": 5}"; + \"dev_total\": 2}"; #endif 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..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); @@ -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..737cdae0b 100644 --- a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c +++ b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.c @@ -1,14 +1,19 @@ #include "ezlopi_core_net.h" + 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(); } -s_ezlopi_net_status_t *ezlopi_get_net_status(void) +#endif // CONFIG_EZPI_CORE_ENABLE_ETH + +s_ezlopi_net_status_t* ezlopi_get_net_status(void) { net_stat.wifi_status = ezlopi_wifi_status(); @@ -16,4 +21,5 @@ 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 +} + diff --git a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h index b5de2d5b7..91a279fff 100644 --- a/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h +++ b/ezlopi-core/ezlopi-core-net/ezlopi_core_net.h @@ -10,10 +10,16 @@ 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); +#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 // _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..8a49e4e9f 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 "../../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" @@ -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_EZPI_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_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-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-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..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 @@ -6,6 +6,7 @@ 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(ANY_OF, "any_of", "any of", "numbersArray") 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/__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..7de4bdab3 --- /dev/null +++ b/ezlopi-core/ezlopi-core-scenes/__operators_macros/__string_op_comparision_operators_macros.h @@ -0,0 +1,12 @@ +SCENES_STROPS_COMP_OPERATORES(NONE, NULL, NULL, NULL) +////////////////////////////////////////////////////////////////////////////// +SCENES_STROPS_COMP_OPERATORES(BEGINS_WITH, "begin", "begins with", "stringOperation") +SCENES_STROPS_COMP_OPERATORES(ENDS_WITH, "end", "ends with", "stringOperation") +SCENES_STROPS_COMP_OPERATORES(CONTAINS, "contain", "contains", "stringOperation") +SCENES_STROPS_COMP_OPERATORES(LENGTH, "length", "length equal to", "stringOperation") +SCENES_STROPS_COMP_OPERATORES(NOT_BEGIN, "not_begin", "doesn't begin with", "stringOperation") +SCENES_STROPS_COMP_OPERATORES(NOT_END, "not_end", "doesn't end with", "stringOperation") +SCENES_STROPS_COMP_OPERATORES(NOT_CONTAIN, "not_contain", "doesn't contain", "stringOperation") +SCENES_STROPS_COMP_OPERATORES(NOT_LENGTH, "not_length", "length not equal to", "stringOperation") +////////////////////////////////////////////////////////////////////////////// +SCENES_STROPS_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_delete.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_delete.c index b05d0384d..6d3af71c1 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); @@ -38,6 +41,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 +56,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; @@ -66,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); @@ -80,56 +92,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_expressions.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_expressions.c index 5b78500c7..373d7d009 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; 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_method_types.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_method_types.h index d1ad21b1d..13209f737 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 @@ -13,6 +13,8 @@ EZLOPI_SCENE(WHEN_METHOD_IS_USER_LOCK_OPERATION, "isUserLockOperation", ezlopi_s #if defined(CONFIG_EZLPI_SERV_ENABLE_MODES) 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_HOUSE_MODE_SWTICH_TO_RANGE, "isHouseModeSwitchtoRange", ezlopi_scene_when_is_House_Mode_Switch_to_Range) #endif // CONFIG_EZLPI_SERV_ENABLE_MODES EZLOPI_SCENE(WHEN_METHOD_IS_DEVICE_STATE, "isDeviceState", ezlopi_scene_when_is_device_state) 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 e2a4503fc..4f21d09ed 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" @@ -129,71 +130,99 @@ 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: + 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; + 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_GREATER_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_EQUAL: + //---------------------- RHS ------------------------- + if (EZLOPI_VALUE_TYPE_EXPRESSION == value_field->value_type) { - ret = (item_value == value_field->field_value.u_value.value_double); - 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_EQUAL: + else { - ret = (item_value != value_field->field_value.u_value.value_double); - break; + value_to_compare_with = value_field->field_value.u_value.value_double; } - case SCENES_NUM_COMP_OPERATORS_BETWEEN: + //---------------------------------------------------- + if (item_exp_value && value_to_compare_with) { - TRACE_W("'SCENES_OPERATORS_BETWEEN' not implemented!"); - break; - } - case SCENES_NUM_COMP_OPERATORS_NOT_BETWEEN: - { - TRACE_W("'SCENES_OPERATORS_NOT_BETWEEN' not implemented!"); - break; - } + switch (ezlopi_scenes_numeric_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string)) + { + case SCENES_NUM_COMP_OPERATORS_LESS: + { + ret = (item_exp_value < value_to_compare_with); + break; + } + case SCENES_NUM_COMP_OPERATORS_LESS_EQUAL: + { + ret = (item_exp_value <= value_to_compare_with); + break; + } + case SCENES_NUM_COMP_OPERATORS_GREATER: + { + ret = (item_exp_value > value_to_compare_with); + break; + } + case SCENES_NUM_COMP_OPERATORS_GREATER_EQUAL: + { + ret = (item_exp_value >= value_to_compare_with); + break; + } + case SCENES_NUM_COMP_OPERATORS_EQUAL: + { + ret = (item_exp_value == value_to_compare_with); + break; + } + case SCENES_NUM_COMP_OPERATORS_NOT_EQUAL: + { + ret = (item_exp_value != value_to_compare_with); + 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; - } + 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; + } + 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; - } + default: + { + break; + } + } } } @@ -268,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: @@ -427,131 +407,212 @@ 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_STROPS_COMP_OPERATORES(OPERATOR, op, name, method) op, +#include "__operators_macros/__string_op_comparision_operators_macros.h" +#undef SCENES_STROPS_COMP_OPERATORES +}; + +static const char* const ezlopi_scenes_strops_cmp_operators_name[] = { +#define SCENES_STROPS_COMP_OPERATORES(OPERATOR, op, name, method) name, +#include "__operators_macros/__string_op_comparision_operators_macros.h" +#undef SCENES_STROPS_COMP_OPERATORES +}; + +static const char* const ezlopi_scenes_strops_cmp_operators_method[] = { +#define SCENES_STROPS_COMP_OPERATORES(OPERATOR, op, name, method) method, +#include "__operators_macros/__string_op_comparision_operators_macros.h" +#undef SCENES_STROPS_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_STROPS_COMP_OPERATORES_NONE + 1; + if (operator_str) + { + while ((ret <= SCENES_STROPS_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_STROPS_COMP_OPERATORES_NONE) && (operator SCENES_STROPS_COMP_OPERATORES_NONE) && (operatorfield_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' ? + ret = ezlopi_scenes_strops_cmp_operators_name[operator]; + } + return ret; +} - // 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; - } +const char* ezlopi_scenes_strops_comparator_operators_get_method(e_scene_strops_cmp_operators_t operator) +{ + const char* ret = NULL; + if ((operator> SCENES_STROPS_COMP_OPERATORES_NONE) && (operatorfield_value.u_value.value_string); + //---------------------- 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 ------------------------- - switch (string_operator) - { - case SCENES_STRINGS_OPERATORS_LESS: - { - ret = (STR_OP_COMP(expression_name, < , expression_field->val); - break; - } - case SCENES_STRINGS_OPERATORS_GREATER: - { - ret = (STR_OP_COMP(expression_name, > , expression_field->val); - break; - } - case SCENES_STRINGS_OPERATORS_LESS_EQUAL: - { - ret = (STR_OP_COMP(expression_name, <= , expression_field->val); - break; - } - case SCENES_STRINGS_OPERATORS_GREATER_EQUAL: - { - ret = (STR_OP_COMP(expression_name, >= , expression_field->val); - break; - } - case SCENES_STRINGS_OPERATORS_EQUAL: - { - ret = (STR_OP_COMP(expression_name, == , expression_field->val); - break; - } - case SCENES_STRINGS_OPERATORS_NOT_EQUAL: + 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_strops_cmp_operators_t strops_operator = ezlopi_scenes_strops_comparator_operators_get_enum(comparator_field->field_value.u_value.value_string); + switch (strops_operator) { - ret = (STR_OP_COMP(expression_name, != , expression_field->val); - break; - } - case SCENES_STRINGS_OPERATORS_BEGINS_WITH: + + case SCENES_STROPS_COMP_OPERATORES_BEGINS_WITH: { - TRACE_W("'SCENES_STRINGS_OPERATORS_BEGINS_WITH' not implemented!"); + 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 - item_exp_value_str); + ret = (0 == diff) ? 1 : 0; + } break; } - case SCENES_STRINGS_OPERATORS_ENDS_WITH: + case SCENES_STROPS_COMP_OPERATORES_NOT_BEGIN: { - TRACE_W("'SCENES_STRINGS_OPERATORS_ENDS_WITH' not implemented!"); + 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 - item_exp_value_str); + ret = (0 < diff) ? 1 : 0; + } break; } - case SCENES_STRINGS_OPERATORS_CONTAINS: + case SCENES_STROPS_COMP_OPERATORES_CONTAINS: { - TRACE_W("'SCENES_STRINGS_OPERATORS_CONTAINS' not implemented!"); + 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 - item_exp_value_str); + ret = (diff <= 0) ? 1 : 0; + } break; } - case SCENES_STRINGS_OPERATORS_NOT_BEGIN: + case SCENES_STROPS_COMP_OPERATORES_NOT_CONTAIN: { - TRACE_W("'SCENES_STRINGS_OPERATORS_NOT_BEGIN' not implemented!"); + 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_NOT_END: + case SCENES_STROPS_COMP_OPERATORES_ENDS_WITH: { - TRACE_W("'SCENES_STRINGS_OPERATORS_NOT_END' not implemented!"); + 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(value_to_compare_with) == strlen(last)) ? 1 : 0; + } break; } - case SCENES_STRINGS_OPERATORS_NOT_CONTAIN: + case SCENES_STROPS_COMP_OPERATORES_NOT_END: { - TRACE_W("'SCENES_STRINGS_OPERATORS_NOT_CONTAIN' not implemented!"); + 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(value_to_compare_with) != strlen(last)) ? 1 : 0; + } break; } - case SCENES_STRINGS_OPERATORS_LENGTH: + case SCENES_STROPS_COMP_OPERATORES_LENGTH: { - TRACE_W("'SCENES_STRINGS_OPERATORS_LENGTH' not implemented!"); // int comparision + ret = (value_to_compare_with_num == strlen(item_exp_value_str)); // int value comparision break; } - case SCENES_STRINGS_OPERATORS_NOT_LENGTH: + case SCENES_STROPS_COMP_OPERATORES_NOT_LENGTH: { - TRACE_W("'SCENES_STRINGS_OPERATORS_NOT_LENGTH' not implemented!"); // int 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_STROPS_COMP_OPERATORES_* [%d]' out of range!", strops_operator); break; } } } + + } return ret; } -#endif + /************* Values in_array ************/ static const char* const ezlopi_scenes_inarr_cmp_operators_op[] = { @@ -619,48 +680,31 @@ 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; - e_scene_str_cmp_operators_t string_operator = ezlopi_scenes_inarr_comparator_operators_get_enum(op_str); - switch (string_operator) + e_scene_inarr_cmp_operators_t inarr_operator = ezlopi_scenes_inarr_comparator_operators_get_enum(op_str); + switch (inarr_operator) { case SCENES_IN_ARRAY_OPERATORS_IN: { @@ -671,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; @@ -691,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; @@ -708,74 +752,16 @@ int ezlopi_scenes_operators_value_inarr_operations(uint32_t item_id, l_fields_v2 default: { - TRACE_E("'SCENES_IN_ARRAY_OPERATORS_* [%d]' out of range!", string_operator); + TRACE_E("'SCENES_IN_ARRAY_OPERATORS_* [%d]' out of range!", inarr_operator); break; } } } - 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 ************/ @@ -852,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) { @@ -861,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); @@ -870,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; @@ -920,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; @@ -1004,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) { @@ -1013,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); @@ -1022,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; } @@ -1054,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; @@ -1072,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) { @@ -1083,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 @@ -1138,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; @@ -1193,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) { @@ -1204,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) { @@ -1216,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) { @@ -1228,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) { @@ -1241,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) { @@ -1256,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) { @@ -1276,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; @@ -1292,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) { @@ -1301,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); @@ -1315,12 +1325,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) @@ -1335,6 +1345,7 @@ int ezlopi_scenes_operators_value_number_range_operations(uint32_t item_id, l_fi } } } + cJSON_Delete(cj_item_value); } break; } @@ -1401,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; @@ -1417,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) { @@ -1426,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); @@ -1450,8 +1458,8 @@ int ezlopi_scenes_operators_has_atleastone_dictionary_value_operations(uint32_t } } } + cJSON_Delete(cj_item_value); } - break; } item = item->next; @@ -1471,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; @@ -1487,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) @@ -1497,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); @@ -1513,6 +1518,7 @@ int ezlopi_scenes_operators_is_dictionary_changed_operations(l_scenes_list_v2_t* } } } + cJSON_Delete(cj_item_value); } break; @@ -1559,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_operators.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_operators.h index 2c222c89c..237dc331a 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_STROPS_COMP_OPERATORES(OPERATOR, op, name, method) SCENES_STROPS_COMP_OPERATORES_##OPERATOR, +#include "__operators_macros/__string_op_comparision_operators_macros.h" +#undef SCENES_STROPS_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, @@ -41,6 +49,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); @@ -48,25 +63,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_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); @@ -74,7 +102,7 @@ const char* ezlopi_scenes_value_with_less_comparator_operators_get_op(e_scene_va const char* ezlopi_scenes_value_with_less_comparator_operators_get_name(e_scene_value_with_less_cmp_operators_t operator); const char* ezlopi_scenes_value_with_less_comparator_operators_get_method(e_scene_value_with_less_cmp_operators_t operator); -int ezlopi_scenes_operators_value_with_less_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); +// int ezlopi_scenes_operators_value_with_less_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); // Value without less Operators e_scene_value_without_less_cmp_operators_t ezlopi_scenes_value_without_less_comparator_operators_get_enum(char* operator_str); @@ -82,11 +110,11 @@ const char* ezlopi_scenes_value_without_less_comparator_operators_get_op(e_scene const char* ezlopi_scenes_value_without_less_comparator_operators_get_name(e_scene_value_without_less_cmp_operators_t operator); const char* ezlopi_scenes_value_without_less_comparator_operators_get_method(e_scene_value_without_less_cmp_operators_t operator); -int ezlopi_scenes_operators_value_without_less_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); +// int ezlopi_scenes_operators_value_without_less_operations(uint32_t item_id, l_fields_v2_t* value_field, l_fields_v2_t* comparator_field); // 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); 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_then_methods.c b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_then_methods.c index a83aee51f..bbdcc8a76 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,18 +2,21 @@ #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" #include "ezlopi_core_event_group.h" #include "ezlopi_core_factory_info.h" #include "ezlopi_core_scenes_scripts.h" +#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) { @@ -35,67 +38,47 @@ 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)) { 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); } } 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); + ret = 1; } - - curr_device = curr_device->next; } } - 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) { - TRACE_W("Warning: then-method not implemented!"); + // TRACE_W("Warning: then-method not implemented!"); int ret = 0; if (curr_scene) { @@ -123,20 +106,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; } } } @@ -152,8 +130,58 @@ 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) + { + 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 defined(CONFIG_EZLPI_SERV_ENABLE_MODES) + if (house_mode_id > 0) + { + // 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); + 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)) + { + ezlopi_core_modes_api_switch_mode(req_mode); + ret = 1; + } + } +#endif //CONFIG_EZLPI_SERV_ENABLE_MODES + } + + } + + return ret; } int ezlopi_scene_then_send_http_request(l_scenes_list_v2_t* curr_scene, void* arg) { @@ -349,15 +377,74 @@ 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, 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_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) { @@ -437,6 +524,136 @@ 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 0 + if (curr_scene) + { + uint32_t item_id = 0; /* item */ + const char* __id_string = NULL; + char* expression_name = NULL; /* expression */ + + 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); + 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*/ + { + 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; + TRACE_W("expn_name : '%s'", expression_name); + } + } + curr_field = curr_field->next; + } + + 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) + { + 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) + { + + 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); + } + 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)) + { + 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); + } + + TRACE_W("here"); + ret = 1; + curr_item->func(EZLOPI_ACTION_SET_VALUE, curr_item, cj_result_value, curr_item->user_arg); + } + else + { + ret = 0; + TRACE_E(" 'item_id[%d]' neither 'boolean' nor 'int' ; Value-type mis-matched! ", item_id); + } + cJSON_Delete(cj_result_value); + } + } + } + cJSON_Delete(cj_tmp_value); + } + else + { + TRACE_E("wrong item_ID"); + } + } + else if (NULL != expression_name) + { + s_ezlopi_expressions_t* curr_exp = ezlopi_scenes_get_expression_node_by_name(expression_name); + if (curr_exp) + { + 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; + } + } + + } + } + } +#endif + return ret; } \ 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_v2.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_v2.h index 7aaa3003f..93a3e31bd 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 ff37c7e45..38492be66 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" @@ -17,16 +18,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)) @@ -42,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; } } } @@ -116,7 +105,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 +163,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 +173,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 +208,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 +217,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 +245,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 +253,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 +263,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 +290,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 +298,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 +308,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. @@ -397,7 +375,7 @@ int ezlopi_scene_when_is_user_lock_operation(l_scenes_list_v2_t* scene_node, voi #if defined(CONFIG_EZLPI_SERV_ENABLE_MODES) 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_modechanged_to"); int ret = 0; l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; @@ -410,7 +388,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; @@ -419,15 +400,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); } @@ -440,8 +424,111 @@ 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_changed_from"); + int ret = 0; +#if 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); + } + } + } + } +#endif + return ret; +} + +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; +#if 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; + } + } +#endif + return ret; +} + +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; +#if 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 "); + } + } +#endif + return ret; } #endif // CONFIG_EZLPI_SERV_ENABLE_MODES @@ -486,21 +573,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"; @@ -603,7 +686,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) @@ -627,7 +710,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 { @@ -659,31 +742,48 @@ 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; + 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* 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); + 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, 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))) + { + item_or_expression_field = curr_field; // 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)) + { + 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); + ret = ezlopi_scenes_operators_value_number_operations(item_or_expression_field, value_field, comparator_field); } } @@ -692,46 +792,95 @@ 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; 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; /* 0->'between' | 1->'not_between'*/ 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; + } + } } } @@ -741,28 +890,34 @@ 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("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; - // 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; 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 + item_exp_field = curr_field; } } - 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))) + { + item_exp_field = curr_field; + } + } + 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))) { @@ -771,53 +926,54 @@ 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)) + { + value_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_exp_field && 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); + ret = ezlopi_scenes_operators_value_strings_operations(item_exp_field, 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); - // } } - // #endif + return ret; } 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("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)) @@ -841,16 +997,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; } @@ -859,23 +1010,29 @@ 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)) @@ -895,33 +1052,27 @@ 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; } 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("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) @@ -930,10 +1081,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))) @@ -941,42 +1099,40 @@ 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; } 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) { @@ -986,7 +1142,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))) { @@ -1009,16 +1165,15 @@ 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 +#if defined(CONFIG_EZPI_ENABLE_OTA) l_when_block_v2_t* when_block = (l_when_block_v2_t*)arg; if (scene_node && when_block) { @@ -1055,16 +1210,15 @@ int ezlopi_scene_when_is_firmware_update_state(l_scenes_list_v2_t* scene_node, v } } } -#endif +#endif// CONFIG_EZPI_ENABLE_OTA 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) { @@ -1075,7 +1229,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))) { @@ -1104,7 +1258,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; } @@ -1120,6 +1273,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) { @@ -1136,7 +1290,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; } @@ -1146,21 +1300,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; } @@ -1187,7 +1338,6 @@ int ezlopi_scene_when_or(l_scenes_list_v2_t* scene_node, void* arg) } } - TRACE_I("or => %d", ret); return ret; } @@ -1212,12 +1362,48 @@ 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 + 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))) + { + TRACE_S("when_func_here->[%d]", i); + 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.h b/ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_when_methods.h index 54e0fe0b3..40c13b09c 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,10 @@ 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_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); @@ -37,3 +39,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 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..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 @@ -1,10 +1,11 @@ #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 --------------------------------------------- static uint8_t isdate_check_endweek_conditon(e_isdate_modes_t mode_type, struct tm* info) @@ -117,7 +118,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 +492,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 +595,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 +620,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 +636,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 +966,333 @@ int isdate_range_check_flag_result(uint8_t flag_check) } return ret; } -//------------------------------------------------------------------------------------------------------------------- \ No newline at end of file + +//----------------------------------------------------------------------------------------------------- +//----------------------------------------------------------------------------------------------------- +/* 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) +{ + // TRACE_W("for_least"); + 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 = __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; + + 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) + { + // TRACE_S("activating-less"); + ret = 1; + } + } + else if (0 == strncmp(for_less_least, "least", 6)) + { + if ((((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000) >= threshold_time) + { + // TRACE_S("activating-atleast"); + 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); + } + } + function_state_info->current_state = transition_state; + } + } + } + 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) + { + /* 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?*/ + { + 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); + } + + /*add the count*/ + 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*/ + if (function_state_info->transition_count >= for_count) + { + uint32_t dur = (((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000); + int threshold_time = cJSON_GetNumberValue(for_interval); + if (dur <= threshold_time)// from 'start' till 'now' + { + 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; + } + } + + 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) && (0 == function_state_info->current_state)) + { + /* first get the product of all children states*/ + 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_W("start_follow_time"); + ret = 1; + } + } + 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_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; + } + } + } + } + } + + 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"); + if (for_trueperiod && for_times && for_falseperiod) + { + 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) && + (0 == function_state_info->current_state) && + (0 == function_state_info->transtion_instant) && + (false == function_state_info->activate_pulse_seq)) + { + 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; // state you want to start with + 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. */ + } + else + { + seq_count = (seq_count * 2) - 1; // 6 -> [0-5] + } + + if (function_state_info->transition_count <= seq_count) + { + uint32_t dur = (((uint32_t)xTaskGetTickCount() - function_state_info->transtion_instant) / 1000); + if (true == function_state_info->current_state) + { + if (dur <= true_time_dur) + { + TRACE_S("high_pulse , true[%dsec]", dur); + } + else + { + 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 (false == function_state_info->current_state) + { + if (dur <= false_time_dur) + { + TRACE_S("low_pulse , false[%dsec]", dur); + } + else + { + 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; + } + } + } + } + else + { + TRACE_E("Exceeded pulse count.............."); + function_state_info->activate_pulse_seq = false; + function_state_info->current_state = 0; + function_state_info->transition_count = 0; + } + + + + } + 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; + } + } + + 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) && (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*/ + { + 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 (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()); + } + 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); + } + } + + return ret; +} +//----------------------------------------------------------------------------------------------------- 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 433c22b9c..e254c986a 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-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-main/CMakeLists.txt b/ezlopi-main/CMakeLists.txt index dde3b6f7e..5bdcf02ec 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 @@ -38,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 1b353b4e6..504261b5c 100644 --- a/ezlopi-main/Kconfig.projbuild +++ b/ezlopi-main/Kconfig.projbuild @@ -1,40 +1,46 @@ 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" - 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 + 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 @@ -47,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 @@ -64,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 @@ -96,15 +102,21 @@ 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 || 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 @@ -118,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 @@ -130,10 +142,15 @@ 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 + depends on EZPI_DISTRO_FULL_OPTION || EZPI_DISTRO_LOCAL || EZPI_DISTRO_LOCAL_MESHBOT bool "Enable mDNS service" default n help @@ -188,15 +205,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..3d19b9cbc 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,12 +46,12 @@ 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(); -#if defined(CONFIG_EZLOPI_BLE_ENABLE) +#if defined(CONFIG_EZPI_BLE_ENABLE) ezlopi_ble_service_init(); #endif @@ -58,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 @@ -93,30 +92,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]; + 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); + 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); - uxTaskGetSystemState(task_array, total_task_numbers, NULL); +#ifdef CONFIG_EZPI_HEAP_ENABLE + ezlopi_util_heap_trace(); - for (int i = 0; i < total_task_numbers; i++) { + 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 + +#if 0 + + uxTaskGetSystemState(task_array, total_task_numbers, NULL); + + 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-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..70c42b9be 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" @@ -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_broadcast(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_broadcast(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 bd588aa2c..7fb6e4458 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" @@ -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_broadcast(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_broadcast(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 b90338948..f0f2b8e48 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" @@ -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_broadcast(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_broadcast(curr_item); + ret = 1; } curr_item = curr_item->next; } 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..5e9b8a733 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" @@ -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_broadcast(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_broadcast(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_broadcast(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 db72772a9..b97c58a42 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_broadcast(dimmable_bulb_arg->item_dimmer); ezlopi_device_value_updated_from_device_broadcast(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_broadcast(dimmable_bulb_arg->item_dimmer); ezlopi_device_value_updated_from_device_broadcast(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 7e9507133..4bca9b05f 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 67de59db0..9a41c0ce7 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_broadcast(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_broadcast(rgb_args->RGB_LED_onoff_switch_item); + ret = 1; } } } 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-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 482279d99..92a975d5e 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; 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 a24753ea5..e82317a4c 100644 --- a/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c +++ b/ezlopi-services/ezlopi-service-ble/ezlopi_service_ble.c @@ -1,3 +1,8 @@ + +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_BLE_ENABLE + #include #include #include @@ -7,7 +12,6 @@ #include "cjext.h" #include "lwip/ip_addr.h" #include "ezlopi_util_trace.h" -#include "sdkconfig.h" #include "EZLOPI_USER_CONFIG.h" @@ -40,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 @@ -64,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; @@ -175,3 +179,4 @@ int ezlopi_ble_service_get_ble_mac(uint8_t mac[6]) } return ret; } +#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 23f2af10f..22efddfc9 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_EZPI_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_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 5036de56b..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,3 +1,8 @@ + +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_BLE_ENABLE +// #TODO ADD guard for key enable #include #include "ezlopi_util_trace.h" @@ -13,7 +18,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 +38,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 +70,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 +111,4 @@ char *ezlopi_ble_auth_status_to_string(e_auth_status_t status) return ret; } -// int ezlopi_ble_auth_ +#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 ccac2312e..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,6 +1,7 @@ #ifndef _EZLOPI_SERVICE_BLE_BLE_AUT_H_ #define _EZLOPI_SERVICE_BLE_BLE_AUT_H_ +#ifdef CONFIG_EZPI_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_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 a36632a2f..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,3 +1,8 @@ + +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_BLE_ENABLE + #include #include @@ -744,3 +749,5 @@ void __add_factory_info_to_root(cJSON* root, char* key, char* value) free(value); } } + +#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 86b87bafd..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,3 +1,7 @@ +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_BLE_ENABLE + #include #include @@ -342,3 +346,5 @@ static char* __dynamic_config_base64(void) return base64_data; } + +#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 0f321d433..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,3 +1,8 @@ + +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_BLE_ENABLE + #include #include @@ -557,4 +562,7 @@ static char* __provisioning_info_base64(void) return base64_data; } + +#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 86ae0b75d..d7dcd187a 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,9 @@ + +#include "../../build/config/sdkconfig.h" + + +#ifdef CONFIG_EZPI_BLE_ENABLE + #include #include "lwip/ip_addr.h" @@ -136,7 +142,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 +180,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); } } } @@ -220,4 +226,5 @@ static void __process_auth_command(cJSON* root) TRACE_W("Not authenticated!"); } #endif -} \ 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 265125bcd..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,3 +1,8 @@ + +#include "../../build/config/sdkconfig.h" + +#ifdef CONFIG_EZPI_BLE_ENABLE + #include #include "cjext.h" @@ -119,3 +124,4 @@ static void wifi_creds_parse_and_connect(uint8_t* value, uint32_t len) } } } +#endif // CONFIG_EZPI_BLE_ENABLE \ No newline at end of file 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-meshbot/ezlopi_service_meshbot.c b/ezlopi-services/ezlopi-service-meshbot/ezlopi_service_meshbot.c index c051a9259..05aae7779 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; @@ -195,8 +195,26 @@ 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, + (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.cj_function) + { + char* str = cJSON_Print(scene_node->when_block->block_options.cj_function); + if (str) + { + TRACE_D("function_cjson : %s", str); + free(str); + } + } + scene_node->status = EZLOPI_SCENE_STATUS_STOPPED; } + TRACE_W("scenes_meshbot init process, [%d]", start_thread); scene_node = scene_node->next; } @@ -234,6 +252,7 @@ PT_THREAD(__scene_proto_thread(l_scenes_list_v2_t* scene_node, uint32_t routine_ 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; @@ -253,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()); 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-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 ab884b8b5..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" @@ -41,9 +42,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 +75,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 +83,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 +201,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 +210,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); @@ -382,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); @@ -412,8 +410,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 +551,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 +643,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 +712,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 +727,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-services/ezlopi-service-ws-server/CMakeLists.txt b/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt index db91614cf..e0a97bb94 100644 --- a/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt +++ b/ezlopi-services/ezlopi-service-ws-server/CMakeLists.txt @@ -1,5 +1,6 @@ -file(GLOB_RECURSE provisioning_src "*.c*") +file(GLOB_RECURSE src_files "*.c*") + set(EZLOPI_UTIL_COMPONENTS ezlopi-util-trace @@ -23,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/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..5f617653d 100644 --- a/ezlopi-user-config/EZLOPI_USER_CONFIG.h +++ b/ezlopi-user-config/EZLOPI_USER_CONFIG.h @@ -1,33 +1,55 @@ #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" -#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" #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/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" diff --git a/sdkconfig b/sdkconfig index 9efed4f52..d95331ed4 100644 --- a/sdkconfig +++ b/sdkconfig @@ -4,9 +4,9 @@ # CONFIG_IDF_CMAKE=y CONFIG_IDF_TARGET_ARCH_XTENSA=y -CONFIG_IDF_TARGET="esp32" -CONFIG_IDF_TARGET_ESP32=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 +CONFIG_IDF_TARGET="esp32s3" +CONFIG_IDF_TARGET_ESP32S3=y +CONFIG_IDF_FIRMWARE_CHIP_ID=0x0009 # # SDK tool configuration @@ -38,7 +38,7 @@ CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 # # Bootloader config # -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000 +CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x0 CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set @@ -70,25 +70,37 @@ CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y # # Security features # +CONFIG_SECURE_BOOT_SUPPORTS_RSA=y +CONFIG_SECURE_TARGET_HAS_SECURE_ROM_DL_MODE=y # CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set # CONFIG_SECURE_BOOT is not set # CONFIG_SECURE_FLASH_ENC_ENABLED is not set # end of Security features +# +# Boot ROM Behavior +# +CONFIG_BOOT_ROM_LOG_ALWAYS_ON=y +# CONFIG_BOOT_ROM_LOG_ALWAYS_OFF is not set +# CONFIG_BOOT_ROM_LOG_ON_GPIO_HIGH is not set +# CONFIG_BOOT_ROM_LOG_ON_GPIO_LOW is not set +# end of Boot ROM Behavior + # # Serial flasher config # CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 # CONFIG_ESPTOOLPY_NO_STUB is not set +# CONFIG_ESPTOOLPY_OCT_FLASH is not set # CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set CONFIG_ESPTOOLPY_FLASHMODE_DIO=y # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y CONFIG_ESPTOOLPY_FLASHMODE="dio" +# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set CONFIG_ESPTOOLPY_FLASHFREQ_40M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set CONFIG_ESPTOOLPY_FLASHFREQ="40m" # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set @@ -136,28 +148,26 @@ 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_DEV_TYPE_TEST=y -CONFIG_EZPI_UTIL_TRACE_EN=y -# CONFIG_EZLOPI_BLE_ENABLE 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 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 # CONFIG_EZPI_ENABLE_UART_PROVISIONING is not set # 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_WEBSOCKET_CLIENT is not set +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 # @@ -206,51 +216,81 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # Bluetooth # CONFIG_BT_ENABLED=y +CONFIG_BT_SOC_SUPPORT_5_0=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 +CONFIG_BT_CTRL_MODE_EFF=1 +CONFIG_BT_CTRL_BLE_MAX_ACT=10 +CONFIG_BT_CTRL_BLE_MAX_ACT_EFF=10 +CONFIG_BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB=0 +CONFIG_BT_CTRL_PINNED_TO_CORE_0=y +# CONFIG_BT_CTRL_PINNED_TO_CORE_1 is not set +CONFIG_BT_CTRL_PINNED_TO_CORE=0 +CONFIG_BT_CTRL_HCI_MODE_VHCI=y +# CONFIG_BT_CTRL_HCI_MODE_UART_H4 is not set +CONFIG_BT_CTRL_HCI_TL=1 +CONFIG_BT_CTRL_ADV_DUP_FILT_MAX=30 +CONFIG_BT_BLE_CCA_MODE_NONE=y +# CONFIG_BT_BLE_CCA_MODE_HW is not set +# CONFIG_BT_BLE_CCA_MODE_SW is not set +CONFIG_BT_BLE_CCA_MODE=0 +CONFIG_BT_CTRL_HW_CCA_VAL=20 +CONFIG_BT_CTRL_HW_CCA_EFF=0 +CONFIG_BT_CTRL_CE_LENGTH_TYPE_ORIG=y +# CONFIG_BT_CTRL_CE_LENGTH_TYPE_CE is not set +# CONFIG_BT_CTRL_CE_LENGTH_TYPE_SD is not set +CONFIG_BT_CTRL_CE_LENGTH_TYPE_EFF=0 +CONFIG_BT_CTRL_TX_ANTENNA_INDEX_0=y +# CONFIG_BT_CTRL_TX_ANTENNA_INDEX_1 is not set +CONFIG_BT_CTRL_TX_ANTENNA_INDEX_EFF=0 +CONFIG_BT_CTRL_RX_ANTENNA_INDEX_0=y +# CONFIG_BT_CTRL_RX_ANTENNA_INDEX_1 is not set +CONFIG_BT_CTRL_RX_ANTENNA_INDEX_EFF=0 +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N24 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N21 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N18 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N15 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N12 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N9 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N6 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N3 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N0 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P3 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P6 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P9 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P12 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P15 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P18 is not set +CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P21=y +CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_EFF=15 +CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y +CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 +CONFIG_BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +CONFIG_BT_CTRL_BLE_SCAN_DUPL=y +CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DEVICE=y +# CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA is not set +# CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE is not set +CONFIG_BT_CTRL_SCAN_DUPL_TYPE=0 +CONFIG_BT_CTRL_SCAN_DUPL_CACHE_SIZE=100 +CONFIG_BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD=0 +# CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN is not set +# CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EN is not set +CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_DIS=y +CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF=0 # # 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 +# CONFIG_BT_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_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 +CONFIG_BT_CTRL_SLEEP_MODE_EFF=0 +CONFIG_BT_CTRL_SLEEP_CLOCK_EFF=0 +CONFIG_BT_CTRL_HCI_TL_EFF=1 +# CONFIG_BT_CTRL_AGC_RECORRECT_EN is not set +# CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX is not set # end of Bluetooth controller CONFIG_BT_BLUEDROID_ENABLED=y @@ -266,7 +306,6 @@ CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y 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 @@ -281,6 +320,7 @@ CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 # 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 @@ -469,8 +509,9 @@ 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_50_FEATURES_SUPPORTED is not set +CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y # CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL is not set # end of Bluedroid Options # end of Bluetooth @@ -495,6 +536,7 @@ CONFIG_COAP_LOG_DEFAULT_LEVEL=0 # # CONFIG_ADC_FORCE_XPD_FSM is not set CONFIG_ADC_DISABLE_DAC=y +# CONFIG_ADC_CONTINUOUS_FORCE_USE_ADC2_ON_C3_S3 is not set # end of ADC configuration # @@ -516,10 +558,6 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y # TWAI configuration # # CONFIG_TWAI_ISR_IN_IRAM is not set -# CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC is not set -# CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST is not set -# CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID is not set -# CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set # CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM is not set # end of TWAI configuration @@ -529,18 +567,6 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y CONFIG_UART_ISR_IN_IRAM=y # end of UART configuration -# -# RTCIO configuration -# -# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set -# end of RTCIO configuration - -# -# GPIO Configuration -# -# CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set -# end of GPIO Configuration - # # GDMA Configuration # @@ -554,17 +580,14 @@ CONFIG_UART_ISR_IN_IRAM=y # # CONFIG_EFUSE_CUSTOM_TABLE is not set # CONFIG_EFUSE_VIRTUAL is not set -# CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE is not set -CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y -# CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT is not set -CONFIG_EFUSE_MAX_BLK_LEN=192 +CONFIG_EFUSE_MAX_BLK_LEN=256 # end of eFuse Bit Manager # # ESP-TLS # CONFIG_ESP_TLS_USING_MBEDTLS=y -# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +CONFIG_ESP_TLS_USE_DS_PERIPHERAL=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 @@ -572,68 +595,80 @@ CONFIG_ESP_TLS_USING_MBEDTLS=y # end of ESP-TLS # -# ESP32-specific +# ESP32S3-Specific # -CONFIG_ESP32_REV_MIN_0=y -# CONFIG_ESP32_REV_MIN_1 is not set -# CONFIG_ESP32_REV_MIN_1_1 is not set -# CONFIG_ESP32_REV_MIN_2 is not set -# CONFIG_ESP32_REV_MIN_3 is not set -# CONFIG_ESP32_REV_MIN_3_1 is not set -CONFIG_ESP32_REV_MIN=0 -CONFIG_ESP32_REV_MIN_FULL=0 +CONFIG_ESP32S3_REV_MIN_0=y +# CONFIG_ESP32S3_REV_MIN_1 is not set +# CONFIG_ESP32S3_REV_MIN_2 is not set +CONFIG_ESP32S3_REV_MIN_FULL=0 CONFIG_ESP_REV_MIN_FULL=0 -CONFIG_ESP32_REV_MAX_FULL_STR_OPT=y -CONFIG_ESP32_REV_MAX_FULL=399 -CONFIG_ESP_REV_MAX_FULL=399 -CONFIG_ESP32_DPORT_WORKAROUND=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=160 -# CONFIG_ESP32_SPIRAM_SUPPORT is not set -# CONFIG_ESP32_TRAX is not set -CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_ULP_COPROC_ENABLED is not set -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 -CONFIG_ESP32_DEBUG_OCDAWARE=y -CONFIG_ESP32_BROWNOUT_DET=y -CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL=0 -CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y -# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 -CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 -CONFIG_ESP32_XTAL_FREQ_40=y -# CONFIG_ESP32_XTAL_FREQ_26 is not set -# CONFIG_ESP32_XTAL_FREQ_AUTO is not set -CONFIG_ESP32_XTAL_FREQ=40 -# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE 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 -CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 -# end of ESP32-specific +CONFIG_ESP32S3_REV_MAX_FULL_STR_OPT=y +CONFIG_ESP32S3_REV_MAX_FULL=99 +CONFIG_ESP_REV_MAX_FULL=99 +# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80 is not set +# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set +CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240 + +# +# Cache config +# +CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB=y +# CONFIG_ESP32S3_INSTRUCTION_CACHE_32KB is not set +CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE=0x4000 +# CONFIG_ESP32S3_INSTRUCTION_CACHE_4WAYS is not set +CONFIG_ESP32S3_INSTRUCTION_CACHE_8WAYS=y +CONFIG_ESP32S3_ICACHE_ASSOCIATED_WAYS=8 +# CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_16B is not set +CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_32B=y +CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_SIZE=32 +# CONFIG_ESP32S3_INSTRUCTION_CACHE_WRAP is not set +# CONFIG_ESP32S3_DATA_CACHE_16KB is not set +CONFIG_ESP32S3_DATA_CACHE_32KB=y +# CONFIG_ESP32S3_DATA_CACHE_64KB is not set +CONFIG_ESP32S3_DATA_CACHE_SIZE=0x8000 +# CONFIG_ESP32S3_DATA_CACHE_4WAYS is not set +CONFIG_ESP32S3_DATA_CACHE_8WAYS=y +CONFIG_ESP32S3_DCACHE_ASSOCIATED_WAYS=8 +# CONFIG_ESP32S3_DATA_CACHE_LINE_16B is not set +CONFIG_ESP32S3_DATA_CACHE_LINE_32B=y +# CONFIG_ESP32S3_DATA_CACHE_LINE_64B is not set +CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE=32 +# CONFIG_ESP32S3_DATA_CACHE_WRAP is not set +# end of Cache config + +# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set +# CONFIG_ESP32S3_TRAX is not set +CONFIG_ESP32S3_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32S3_ULP_COPROC_ENABLED is not set +CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM=0 +CONFIG_ESP32S3_DEBUG_OCDAWARE=y +CONFIG_ESP32S3_BROWNOUT_DET=y +CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_7=y +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_1 is not set +CONFIG_ESP32S3_BROWNOUT_DET_LVL=7 +CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32S3_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32S3_TIME_SYSCALL_USE_NONE is not set +CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC=y +# CONFIG_ESP32S3_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_ESP32S3_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_ESP32S3_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=1024 +CONFIG_ESP32S3_DEEP_SLEEP_WAKEUP_DELAY=2000 +# CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM is not set +# CONFIG_ESP32S3_USE_FIXED_STATIC_RAM_SIZE is not set +# end of ESP32S3-Specific # # ADC-Calibration # -CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y -CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y -CONFIG_ADC_CAL_LUT_ENABLE=y # end of ADC-Calibration # @@ -646,14 +681,6 @@ CONFIG_ESP_ERR_TO_NAME_LOOKUP=y # Ethernet # CONFIG_ETH_ENABLED=y -CONFIG_ETH_USE_ESP32_EMAC=y -CONFIG_ETH_PHY_INTERFACE_RMII=y -CONFIG_ETH_RMII_CLK_INPUT=y -# CONFIG_ETH_RMII_CLK_OUTPUT is not set -CONFIG_ETH_RMII_CLK_IN_GPIO=0 -CONFIG_ETH_DMA_BUFFER_SIZE=512 -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 @@ -716,10 +743,9 @@ CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y -# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR is not set +# CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES=4 # end of MAC Config # @@ -729,11 +755,13 @@ CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y 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_ENABLE_INTERNAL_RESISTORS=y # end of Sleep Config # # RTC Clock Config # +CONFIG_RTC_CLOCK_BBPLL_POWER_ON_WITH_USB=y # end of RTC Clock Config # end of Hardware Settings @@ -753,6 +781,7 @@ CONFIG_ESP_IPC_ISR_ENABLE=y # LCD Peripheral Configuration # CONFIG_LCD_PANEL_IO_FORMAT_BUF_SIZE=32 +# CONFIG_LCD_RGB_ISR_IRAM_SAFE is not set # end of LCD Peripheral Configuration # end of LCD and Touch Panel @@ -773,6 +802,7 @@ CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 CONFIG_ESP_PHY_MAX_TX_POWER=20 # CONFIG_ESP_PHY_REDUCE_TX_POWER is not set +CONFIG_ESP_PHY_ENABLE_USB=y CONFIG_ESP_PHY_RF_CAL_PARTIAL=y # CONFIG_ESP_PHY_RF_CAL_NONE is not set # CONFIG_ESP_PHY_RF_CAL_FULL is not set @@ -783,6 +813,8 @@ CONFIG_ESP_PHY_CALIBRATION_MODE=0 # Power Management # # CONFIG_PM_ENABLE is not set +CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y +CONFIG_PM_POWER_DOWN_TAGMEM_IN_LIGHT_SLEEP=y # end of Power Management # @@ -800,6 +832,8 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set # CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set # CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set +CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y +CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y # # Memory protection @@ -815,8 +849,12 @@ CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 CONFIG_ESP_CONSOLE_UART_DEFAULT=y +# CONFIG_ESP_CONSOLE_USB_CDC is not set +# CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG is not set # CONFIG_ESP_CONSOLE_UART_CUSTOM is not set # CONFIG_ESP_CONSOLE_NONE is not set +# CONFIG_ESP_CONSOLE_SECONDARY_NONE is not set +CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG=y CONFIG_ESP_CONSOLE_UART=y CONFIG_ESP_CONSOLE_MULTIPLE_UART=y CONFIG_ESP_CONSOLE_UART_NUM=0 @@ -831,7 +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=y +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y # end of ESP System Settings # @@ -843,8 +881,7 @@ CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 # CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set -# CONFIG_ESP_TIMER_IMPL_FRC2 is not set -CONFIG_ESP_TIMER_IMPL_TG0_LAC=y +CONFIG_ESP_TIMER_IMPL_SYSTIMER=y # end of High resolution timer (esp_timer) # @@ -872,7 +909,9 @@ CONFIG_ESP32_WIFI_IRAM_OPT=y CONFIG_ESP32_WIFI_RX_IRAM_OPT=y CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set +# CONFIG_ESP_WIFI_FTM_ENABLE is not set # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set +# CONFIG_ESP_WIFI_GCMP_SUPPORT is not set # CONFIG_ESP_WIFI_GMAC_SUPPORT is not set CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y # CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set @@ -958,10 +997,10 @@ CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20 # # CONFIG_FREERTOS_UNICORE is not set CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -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_TICK_SUPPORT_SYSTIMER=y +CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL1=y +# CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL3 is not set +CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER=y CONFIG_FREERTOS_HZ=1000 CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set @@ -983,15 +1022,13 @@ 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 # CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set # CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set CONFIG_FREERTOS_DEBUG_OCDAWARE=y -# CONFIG_FREERTOS_FPU_IN_ISR is not set CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y # CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set # end of FreeRTOS @@ -1057,6 +1094,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 @@ -1237,6 +1275,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 CONFIG_MBEDTLS_ECP_RESTARTABLE=y CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_HARDWARE_AES=y +CONFIG_MBEDTLS_AES_USE_INTERRUPT=y CONFIG_MBEDTLS_HARDWARE_MPI=y CONFIG_MBEDTLS_HARDWARE_SHA=y CONFIG_MBEDTLS_ROM_MD5=y @@ -1416,6 +1455,7 @@ CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" # CONFIG_SPI_FLASH_VERIFY_WRITE is not set # CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y +# CONFIG_SPI_FLASH_ROM_IMPL is not set CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y # CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set # CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set @@ -1439,6 +1479,7 @@ 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_MXIC_OPI_CHIP=y # end of Auto-detect flash chips CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y @@ -1492,6 +1533,12 @@ CONFIG_WS_BUFFER_SIZE=1024 # end of Websocket # end of TCP Transport +# +# TinyUSB Stack +# +# CONFIG_TINYUSB is not set +# end of TinyUSB Stack + # # Unity unit testing library # @@ -1504,10 +1551,24 @@ CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y # CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set # end of Unity unit testing library +# +# USB-OTG +# +CONFIG_USB_OTG_SUPPORTED=y +CONFIG_USB_HOST_CONTROL_TRANSFER_MAX_SIZE=256 +CONFIG_USB_HOST_HW_BUFFER_BIAS_BALANCED=y +# CONFIG_USB_HOST_HW_BUFFER_BIAS_IN is not set +# CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT is not set + # # Root Hub configuration # +CONFIG_USB_HOST_DEBOUNCE_DELAY_MS=250 +CONFIG_USB_HOST_RESET_HOLD_MS=30 +CONFIG_USB_HOST_RESET_RECOVERY_MS=30 +CONFIG_USB_HOST_SET_ADDR_RECOVERY_MS=10 # end of Root Hub configuration +# end of USB-OTG # # Virtual file system @@ -1619,28 +1680,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 @@ -1649,7 +1688,6 @@ CONFIG_BLUEDROID_PINNED_TO_CORE_0=y 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 @@ -1824,32 +1862,9 @@ 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 -# 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_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=y CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND=y CONFIG_IPC_TASK_STACK_SIZE=1536 @@ -1858,10 +1873,12 @@ CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y 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_ESP_SYSTEM_PM_POWER_DOWN_CPU=y # 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_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=3072 CONFIG_MAIN_TASK_STACK_SIZE=3584 @@ -1937,6 +1954,7 @@ 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_USB_ENABLED is not set CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y CONFIG_SUPPORT_TERMIOS=y CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 diff --git a/sdkconfig.esp32.4mb b/sdkconfig.esp32.4mb index f8c3232fc..16d1561a4 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_EZPI_DISTRO_LOCAL is not set +# CONFIG_EZPI_DISTRO_LOCAL_MESHBOT is not set +# CONFIG_EZLOPI_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_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_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 +# 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.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 diff --git a/sdkconfig.old b/sdkconfig.old index 999fc68ba..b80d75093 100644 --- a/sdkconfig.old +++ b/sdkconfig.old @@ -4,9 +4,9 @@ # CONFIG_IDF_CMAKE=y CONFIG_IDF_TARGET_ARCH_XTENSA=y -CONFIG_IDF_TARGET="esp32" -CONFIG_IDF_TARGET_ESP32=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 +CONFIG_IDF_TARGET="esp32s3" +CONFIG_IDF_TARGET_ESP32S3=y +CONFIG_IDF_FIRMWARE_CHIP_ID=0x0009 # # SDK tool configuration @@ -38,7 +38,7 @@ CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 # # Bootloader config # -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000 +CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x0 CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set @@ -70,25 +70,37 @@ CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y # # Security features # +CONFIG_SECURE_BOOT_SUPPORTS_RSA=y +CONFIG_SECURE_TARGET_HAS_SECURE_ROM_DL_MODE=y # CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set # CONFIG_SECURE_BOOT is not set # CONFIG_SECURE_FLASH_ENC_ENABLED is not set # end of Security features +# +# Boot ROM Behavior +# +CONFIG_BOOT_ROM_LOG_ALWAYS_ON=y +# CONFIG_BOOT_ROM_LOG_ALWAYS_OFF is not set +# CONFIG_BOOT_ROM_LOG_ON_GPIO_HIGH is not set +# CONFIG_BOOT_ROM_LOG_ON_GPIO_LOW is not set +# end of Boot ROM Behavior + # # Serial flasher config # CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 # CONFIG_ESPTOOLPY_NO_STUB is not set +# CONFIG_ESPTOOLPY_OCT_FLASH is not set # CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set CONFIG_ESPTOOLPY_FLASHMODE_DIO=y # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y CONFIG_ESPTOOLPY_FLASHMODE="dio" +# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set CONFIG_ESPTOOLPY_FLASHFREQ_40M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set CONFIG_ESPTOOLPY_FLASHFREQ="40m" # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set @@ -136,28 +148,26 @@ 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_DEV_TYPE_TEST=y -CONFIG_EZPI_UTIL_TRACE_EN=y -# CONFIG_EZLOPI_BLE_ENABLE 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 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 # CONFIG_EZPI_ENABLE_UART_PROVISIONING is not set # 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_WEBSOCKET_CLIENT is not set CONFIG_EZPI_ENABLE_LED_INDICATOR=y +# CONFIG_EZPI_ENABLE_MDNS_SERVICE is not set # end of EzloPi User Config # @@ -206,51 +216,81 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # Bluetooth # CONFIG_BT_ENABLED=y +CONFIG_BT_SOC_SUPPORT_5_0=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 +CONFIG_BT_CTRL_MODE_EFF=1 +CONFIG_BT_CTRL_BLE_MAX_ACT=10 +CONFIG_BT_CTRL_BLE_MAX_ACT_EFF=10 +CONFIG_BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB=0 +CONFIG_BT_CTRL_PINNED_TO_CORE_0=y +# CONFIG_BT_CTRL_PINNED_TO_CORE_1 is not set +CONFIG_BT_CTRL_PINNED_TO_CORE=0 +CONFIG_BT_CTRL_HCI_MODE_VHCI=y +# CONFIG_BT_CTRL_HCI_MODE_UART_H4 is not set +CONFIG_BT_CTRL_HCI_TL=1 +CONFIG_BT_CTRL_ADV_DUP_FILT_MAX=30 +CONFIG_BT_BLE_CCA_MODE_NONE=y +# CONFIG_BT_BLE_CCA_MODE_HW is not set +# CONFIG_BT_BLE_CCA_MODE_SW is not set +CONFIG_BT_BLE_CCA_MODE=0 +CONFIG_BT_CTRL_HW_CCA_VAL=20 +CONFIG_BT_CTRL_HW_CCA_EFF=0 +CONFIG_BT_CTRL_CE_LENGTH_TYPE_ORIG=y +# CONFIG_BT_CTRL_CE_LENGTH_TYPE_CE is not set +# CONFIG_BT_CTRL_CE_LENGTH_TYPE_SD is not set +CONFIG_BT_CTRL_CE_LENGTH_TYPE_EFF=0 +CONFIG_BT_CTRL_TX_ANTENNA_INDEX_0=y +# CONFIG_BT_CTRL_TX_ANTENNA_INDEX_1 is not set +CONFIG_BT_CTRL_TX_ANTENNA_INDEX_EFF=0 +CONFIG_BT_CTRL_RX_ANTENNA_INDEX_0=y +# CONFIG_BT_CTRL_RX_ANTENNA_INDEX_1 is not set +CONFIG_BT_CTRL_RX_ANTENNA_INDEX_EFF=0 +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N24 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N21 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N18 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N15 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N12 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N9 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N6 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N3 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N0 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P3 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P6 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P9 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P12 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P15 is not set +# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P18 is not set +CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P21=y +CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_EFF=15 +CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y +CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 +CONFIG_BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +CONFIG_BT_CTRL_BLE_SCAN_DUPL=y +CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DEVICE=y +# CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA is not set +# CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE is not set +CONFIG_BT_CTRL_SCAN_DUPL_TYPE=0 +CONFIG_BT_CTRL_SCAN_DUPL_CACHE_SIZE=100 +CONFIG_BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD=0 +# CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN is not set +# CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EN is not set +CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_DIS=y +CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF=0 # # 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 +# CONFIG_BT_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_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 +CONFIG_BT_CTRL_SLEEP_MODE_EFF=0 +CONFIG_BT_CTRL_SLEEP_CLOCK_EFF=0 +CONFIG_BT_CTRL_HCI_TL_EFF=1 +# CONFIG_BT_CTRL_AGC_RECORRECT_EN is not set +# CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX is not set # end of Bluetooth controller CONFIG_BT_BLUEDROID_ENABLED=y @@ -266,7 +306,6 @@ CONFIG_BT_BLUEDROID_PINNED_TO_CORE_0=y 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 @@ -281,6 +320,7 @@ CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MODE=0 # 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 @@ -469,8 +509,9 @@ 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_50_FEATURES_SUPPORTED is not set +CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y # CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL is not set # end of Bluedroid Options # end of Bluetooth @@ -495,6 +536,7 @@ CONFIG_COAP_LOG_DEFAULT_LEVEL=0 # # CONFIG_ADC_FORCE_XPD_FSM is not set CONFIG_ADC_DISABLE_DAC=y +# CONFIG_ADC_CONTINUOUS_FORCE_USE_ADC2_ON_C3_S3 is not set # end of ADC configuration # @@ -516,10 +558,6 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y # TWAI configuration # # CONFIG_TWAI_ISR_IN_IRAM is not set -# CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC is not set -# CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST is not set -# CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID is not set -# CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set # CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM is not set # end of TWAI configuration @@ -529,18 +567,6 @@ CONFIG_SPI_SLAVE_ISR_IN_IRAM=y CONFIG_UART_ISR_IN_IRAM=y # end of UART configuration -# -# RTCIO configuration -# -# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set -# end of RTCIO configuration - -# -# GPIO Configuration -# -# CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set -# end of GPIO Configuration - # # GDMA Configuration # @@ -554,17 +580,14 @@ CONFIG_UART_ISR_IN_IRAM=y # # CONFIG_EFUSE_CUSTOM_TABLE is not set # CONFIG_EFUSE_VIRTUAL is not set -# CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE is not set -CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y -# CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT is not set -CONFIG_EFUSE_MAX_BLK_LEN=192 +CONFIG_EFUSE_MAX_BLK_LEN=256 # end of eFuse Bit Manager # # ESP-TLS # CONFIG_ESP_TLS_USING_MBEDTLS=y -# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +CONFIG_ESP_TLS_USE_DS_PERIPHERAL=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 @@ -572,68 +595,80 @@ CONFIG_ESP_TLS_USING_MBEDTLS=y # end of ESP-TLS # -# ESP32-specific +# ESP32S3-Specific # -CONFIG_ESP32_REV_MIN_0=y -# CONFIG_ESP32_REV_MIN_1 is not set -# CONFIG_ESP32_REV_MIN_1_1 is not set -# CONFIG_ESP32_REV_MIN_2 is not set -# CONFIG_ESP32_REV_MIN_3 is not set -# CONFIG_ESP32_REV_MIN_3_1 is not set -CONFIG_ESP32_REV_MIN=0 -CONFIG_ESP32_REV_MIN_FULL=0 +CONFIG_ESP32S3_REV_MIN_0=y +# CONFIG_ESP32S3_REV_MIN_1 is not set +# CONFIG_ESP32S3_REV_MIN_2 is not set +CONFIG_ESP32S3_REV_MIN_FULL=0 CONFIG_ESP_REV_MIN_FULL=0 -CONFIG_ESP32_REV_MAX_FULL_STR_OPT=y -CONFIG_ESP32_REV_MAX_FULL=399 -CONFIG_ESP_REV_MAX_FULL=399 -CONFIG_ESP32_DPORT_WORKAROUND=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=160 -# CONFIG_ESP32_SPIRAM_SUPPORT is not set -# CONFIG_ESP32_TRAX is not set -CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_ULP_COPROC_ENABLED is not set -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 -CONFIG_ESP32_DEBUG_OCDAWARE=y -CONFIG_ESP32_BROWNOUT_DET=y -CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL=0 -CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y -# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 -CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 -CONFIG_ESP32_XTAL_FREQ_40=y -# CONFIG_ESP32_XTAL_FREQ_26 is not set -# CONFIG_ESP32_XTAL_FREQ_AUTO is not set -CONFIG_ESP32_XTAL_FREQ=40 -# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE 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 -CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 -# end of ESP32-specific +CONFIG_ESP32S3_REV_MAX_FULL_STR_OPT=y +CONFIG_ESP32S3_REV_MAX_FULL=99 +CONFIG_ESP_REV_MAX_FULL=99 +# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80 is not set +# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set +CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240 + +# +# Cache config +# +CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB=y +# CONFIG_ESP32S3_INSTRUCTION_CACHE_32KB is not set +CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE=0x4000 +# CONFIG_ESP32S3_INSTRUCTION_CACHE_4WAYS is not set +CONFIG_ESP32S3_INSTRUCTION_CACHE_8WAYS=y +CONFIG_ESP32S3_ICACHE_ASSOCIATED_WAYS=8 +# CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_16B is not set +CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_32B=y +CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_SIZE=32 +# CONFIG_ESP32S3_INSTRUCTION_CACHE_WRAP is not set +# CONFIG_ESP32S3_DATA_CACHE_16KB is not set +CONFIG_ESP32S3_DATA_CACHE_32KB=y +# CONFIG_ESP32S3_DATA_CACHE_64KB is not set +CONFIG_ESP32S3_DATA_CACHE_SIZE=0x8000 +# CONFIG_ESP32S3_DATA_CACHE_4WAYS is not set +CONFIG_ESP32S3_DATA_CACHE_8WAYS=y +CONFIG_ESP32S3_DCACHE_ASSOCIATED_WAYS=8 +# CONFIG_ESP32S3_DATA_CACHE_LINE_16B is not set +CONFIG_ESP32S3_DATA_CACHE_LINE_32B=y +# CONFIG_ESP32S3_DATA_CACHE_LINE_64B is not set +CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE=32 +# CONFIG_ESP32S3_DATA_CACHE_WRAP is not set +# end of Cache config + +# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set +# CONFIG_ESP32S3_TRAX is not set +CONFIG_ESP32S3_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32S3_ULP_COPROC_ENABLED is not set +CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM=0 +CONFIG_ESP32S3_DEBUG_OCDAWARE=y +CONFIG_ESP32S3_BROWNOUT_DET=y +CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_7=y +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_1 is not set +CONFIG_ESP32S3_BROWNOUT_DET_LVL=7 +CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32S3_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32S3_TIME_SYSCALL_USE_NONE is not set +CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC=y +# CONFIG_ESP32S3_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_ESP32S3_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_ESP32S3_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=1024 +CONFIG_ESP32S3_DEEP_SLEEP_WAKEUP_DELAY=2000 +# CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM is not set +# CONFIG_ESP32S3_USE_FIXED_STATIC_RAM_SIZE is not set +# end of ESP32S3-Specific # # ADC-Calibration # -CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y -CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y -CONFIG_ADC_CAL_LUT_ENABLE=y # end of ADC-Calibration # @@ -646,14 +681,6 @@ CONFIG_ESP_ERR_TO_NAME_LOOKUP=y # Ethernet # CONFIG_ETH_ENABLED=y -CONFIG_ETH_USE_ESP32_EMAC=y -CONFIG_ETH_PHY_INTERFACE_RMII=y -CONFIG_ETH_RMII_CLK_INPUT=y -# CONFIG_ETH_RMII_CLK_OUTPUT is not set -CONFIG_ETH_RMII_CLK_IN_GPIO=0 -CONFIG_ETH_DMA_BUFFER_SIZE=512 -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 @@ -716,10 +743,9 @@ CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y -# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR is not set +# CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES=4 # end of MAC Config # @@ -729,11 +755,13 @@ CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y 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_ENABLE_INTERNAL_RESISTORS=y # end of Sleep Config # # RTC Clock Config # +CONFIG_RTC_CLOCK_BBPLL_POWER_ON_WITH_USB=y # end of RTC Clock Config # end of Hardware Settings @@ -753,6 +781,7 @@ CONFIG_ESP_IPC_ISR_ENABLE=y # LCD Peripheral Configuration # CONFIG_LCD_PANEL_IO_FORMAT_BUF_SIZE=32 +# CONFIG_LCD_RGB_ISR_IRAM_SAFE is not set # end of LCD Peripheral Configuration # end of LCD and Touch Panel @@ -773,6 +802,7 @@ CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 CONFIG_ESP_PHY_MAX_TX_POWER=20 # CONFIG_ESP_PHY_REDUCE_TX_POWER is not set +CONFIG_ESP_PHY_ENABLE_USB=y CONFIG_ESP_PHY_RF_CAL_PARTIAL=y # CONFIG_ESP_PHY_RF_CAL_NONE is not set # CONFIG_ESP_PHY_RF_CAL_FULL is not set @@ -783,6 +813,8 @@ CONFIG_ESP_PHY_CALIBRATION_MODE=0 # Power Management # # CONFIG_PM_ENABLE is not set +CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y +CONFIG_PM_POWER_DOWN_TAGMEM_IN_LIGHT_SLEEP=y # end of Power Management # @@ -800,6 +832,8 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set # CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set # CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set +CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y +CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y # # Memory protection @@ -815,8 +849,12 @@ CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 CONFIG_ESP_CONSOLE_UART_DEFAULT=y +# CONFIG_ESP_CONSOLE_USB_CDC is not set +# CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG is not set # CONFIG_ESP_CONSOLE_UART_CUSTOM is not set # CONFIG_ESP_CONSOLE_NONE is not set +# CONFIG_ESP_CONSOLE_SECONDARY_NONE is not set +CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG=y CONFIG_ESP_CONSOLE_UART=y CONFIG_ESP_CONSOLE_MULTIPLE_UART=y CONFIG_ESP_CONSOLE_UART_NUM=0 @@ -831,7 +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=y +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y # end of ESP System Settings # @@ -843,8 +881,7 @@ CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 # CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set -# CONFIG_ESP_TIMER_IMPL_FRC2 is not set -CONFIG_ESP_TIMER_IMPL_TG0_LAC=y +CONFIG_ESP_TIMER_IMPL_SYSTIMER=y # end of High resolution timer (esp_timer) # @@ -872,7 +909,9 @@ CONFIG_ESP32_WIFI_IRAM_OPT=y CONFIG_ESP32_WIFI_RX_IRAM_OPT=y CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set +# CONFIG_ESP_WIFI_FTM_ENABLE is not set # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set +# CONFIG_ESP_WIFI_GCMP_SUPPORT is not set # CONFIG_ESP_WIFI_GMAC_SUPPORT is not set CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y # CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set @@ -958,10 +997,10 @@ CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20 # # CONFIG_FREERTOS_UNICORE is not set CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -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_TICK_SUPPORT_SYSTIMER=y +CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL1=y +# CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL3 is not set +CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER=y CONFIG_FREERTOS_HZ=1000 CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set @@ -983,15 +1022,13 @@ 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 # CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set # CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set CONFIG_FREERTOS_DEBUG_OCDAWARE=y -# CONFIG_FREERTOS_FPU_IN_ISR is not set CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y # CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set # end of FreeRTOS @@ -1057,6 +1094,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 @@ -1237,6 +1275,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 CONFIG_MBEDTLS_ECP_RESTARTABLE=y CONFIG_MBEDTLS_CMAC_C=y CONFIG_MBEDTLS_HARDWARE_AES=y +CONFIG_MBEDTLS_AES_USE_INTERRUPT=y CONFIG_MBEDTLS_HARDWARE_MPI=y CONFIG_MBEDTLS_HARDWARE_SHA=y CONFIG_MBEDTLS_ROM_MD5=y @@ -1416,6 +1455,7 @@ CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" # CONFIG_SPI_FLASH_VERIFY_WRITE is not set # CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y +# CONFIG_SPI_FLASH_ROM_IMPL is not set CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y # CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set # CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set @@ -1439,6 +1479,7 @@ 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_MXIC_OPI_CHIP=y # end of Auto-detect flash chips CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y @@ -1492,6 +1533,12 @@ CONFIG_WS_BUFFER_SIZE=1024 # end of Websocket # end of TCP Transport +# +# TinyUSB Stack +# +# CONFIG_TINYUSB is not set +# end of TinyUSB Stack + # # Unity unit testing library # @@ -1504,10 +1551,24 @@ CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y # CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set # end of Unity unit testing library +# +# USB-OTG +# +CONFIG_USB_OTG_SUPPORTED=y +CONFIG_USB_HOST_CONTROL_TRANSFER_MAX_SIZE=256 +CONFIG_USB_HOST_HW_BUFFER_BIAS_BALANCED=y +# CONFIG_USB_HOST_HW_BUFFER_BIAS_IN is not set +# CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT is not set + # # Root Hub configuration # +CONFIG_USB_HOST_DEBOUNCE_DELAY_MS=250 +CONFIG_USB_HOST_RESET_HOLD_MS=30 +CONFIG_USB_HOST_RESET_RECOVERY_MS=30 +CONFIG_USB_HOST_SET_ADDR_RECOVERY_MS=10 # end of Root Hub configuration +# end of USB-OTG # # Virtual file system @@ -1578,366 +1639,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-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 is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -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 -# 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_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 -# 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_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=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 -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=3072 -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_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 -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=16 -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