Skip to content

Commit

Permalink
Merge pull request #128 from ezloteam/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
krishna-ezlo authored May 10, 2024
2 parents 97fb1de + 9bf696d commit 647ce35
Show file tree
Hide file tree
Showing 215 changed files with 4,881 additions and 8,317 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ cpp_space_after_semicolon=false
cpp_space_remove_around_unary_operator=true
cpp_space_around_binary_operator=insert
cpp_space_around_assignment_operator=insert
cpp_space_pointer_reference_alignment=left
cpp_space_pointer_reference_alignment=ignore
cpp_space_around_ternary_operator=insert
cpp_wrap_preserve_blocks=one_liners
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ _deps
# Local History for Visual Studio Code
**/.history/


dependencies.lock
sdkconfig.old
sdkconfig
36 changes: 23 additions & 13 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,28 @@

## New:
1. Implementation of 6-function-APIs (for less, for at-least, repeat, follow, pulse, latch): [EZPI-351](https://jira.mios.com/browse/EZPI-351)
2. Implementation of heap-memory guard when 'scene_create' triggered: [EZPI-358](https://jira.mios.com/browse/EZPI-358)
3. Implementation of 'toggle-value' method; [testing remained] [EZPI-349](https://jira.mios.com/browse/EZPI-349)
4. Implementation fake Token based security on local API [EZPI-341](https://jira.mios.com/browse/EZPI-341)
5. Implementation of WiFi Change API [EZPI-302](https://jira.mios.com/browse/EZPI-302)
6. Implementation of Battery status on Firmware Core [EZPI-332](https://jira.mios.com/browse/EZPI-332)
7. Implementation of Status indicator based on LED and BLE for EzloPi [EZPI-344](https://jira.mios.com/browse/EZPI-344)
8. Implementation of UART (serial) configuration from serial and BLE [EZPI-347](https://jira.mios.com/browse/EZPI-347)
2. Implement EzloPi Device Statuses API [EZPI-254](https://jira.mios.com/browse/EZPI-254)
3. Change Serial Config, Update NVS and Reboot EzloPi Device if only new config [EZPI-365](https://jira.mios.com/browse/EZPI-365)
4. Implement hub.device.armed.set API [EZPI-379](https://jira.mios.com/browse/EZPI-379)
5. EzloPi Distro Design and implementation [EZPI-385](https://jira.mios.com/browse/EZPI-385)
6. EzloPi - Framework for house-modes [EZPI-280](https://jira.mios.com/browse/EZPI-280)
7. 'hub.modes.current.get' api integration [EZPI-292](https://jira.mios.com/browse/EZPI-292)
8. Implementation of then-method 'toggle-value' [EZPI-349](https://jira.mios.com/browse/EZPI-349)
9. Implementation of isHouseMode_changed_from_method [EZPI-366](https://jira.mios.com/browse/EZPI-366)
10. Implementation of switchHouseMode_then_method [EZPI-366](https://jira.mios.com/browse/EZPI-366)
11. Implementation of isHouseModeAlarmPhaseRange [EZPI-367](https://jira.mios.com/browse/EZPI-367)
12. Implementation of isHouseModeSwitchToRange [EZPI-373](https://jira.mios.com/browse/EZPI-373)
13. Implementation of Log Control from Serial [EZPI-388](https://jira.mios.com/browse/EZPI-388)
14. Add chip compatibility for config [EZPI-389](https://jira.mios.com/browse/EZPI-389)

## Fixes:
1. Fix device tree free-issue when initialization: [EZPI-333](https://jira.mios.com/browse/EZPI-333)
2. Fix 'NOT' scene method parsing failure: [EZPI-363](https://jira.mios.com/browse/EZPI-363)
3. Fix 'Scene_State' enable/disable not update in NVS: [EZPI-364](https://jira.mios.com/browse/EZPI-364)
4. mDNS Service type modification: [EZPI-356](https://jira.mios.com/browse/EZPI-356)
5. Replacenemt of dynamic buffer to static buffer for minimizing heap fragmentation [EZPI-352](https://jira.mios.com/browse/EZPI-352)
6. WiFi SSID and PSW to be matched len with factory info [EZPI-316](https://jira.mios.com/browse/EZPI-316)
1. Memory leak fixing causing device to go offline [EZPI-369](https://jira.mios.com/browse/EZPI-369)
2. Add Filter on serial info such that if not provisioned send data 0 [EZPI-353](https://jira.mios.com/browse/EZPI-353)
3. Implement cloud API controlled logs for cloud and serial on EzloPi [EZPI-370](https://jira.mios.com/browse/EZPI-370)
4. Cleanup distro merge [EZPI-378](https://jira.mios.com/browse/EZPI-378)
5. Fix Flash overflow with converting LOG macros into a function based implementaion [EZPI-384](https://jira.mios.com/browse/EZPI-384)
6. Connect to SNTP if only WiFi connected and reduce delay time [EZPI-386](https://jira.mios.com/browse/EZPI-386)
7. Meshbots Branch "review" refactoring [EZPI-261](https://jira.mios.com/browse/EZPI-261)
8. Test and fixing on 'house-modes' [EZPI-301](https://jira.mios.com/browse/EZPI-301)
9. When several scenes (more than 6) are created, the next created scenes stop coming from the controller [EZPI-250](https://jira.mios.com/browse/EZPI-250)
10. Fix invalid '_item_ID' in toggle_value method [EZPI-390](https://jira.mios.com/browse/EZPI-390)
5 changes: 5 additions & 0 deletions ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#define __EZLOPI_CLOUD_KEYWORDS_H__

#include "stdio.h"
const char* ezlopi_ESP32_str = "ESP32";
const char* ezlopi_ESP32S3_str = "ESP32S3";
const char* ezlopi_ESP32C3_str = "ESP32C3";
const char* ezlopi_ezlopi_str = "ezlopi";
const char* ezlopi__str = "";
const char* ezlopi_id_str = "id";
Expand Down Expand Up @@ -321,5 +324,7 @@ const char* ezlopi_start_bits_str = "start_bits";
const char* ezlopi_stop_bits_str = "stop_bits";
const char* ezlopi_frame_size_str = "frame_size";
const char* ezlopi_flow_control_str = "flow_control";
const char *ezlopi_chipset_str = "chipset";
const char *ezlopi_internet_str = "internet";

#endif // __EZLOPI_CLOUD_KEYWORDS_H__
16 changes: 11 additions & 5 deletions ezlopi-cloud/ezlopi-cloud-constants/ezlopi_cloud_keywords.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include "stdio.h"

extern const char* ezlopi_ESP32_str;
extern const char* ezlopi_ESP32S3_str;
extern const char* ezlopi_ESP32C3_str;
extern const char* ezlopi_ezlopi_str;
extern const char* ezlopi__str;
extern const char* ezlopi_id_str;
Expand Down Expand Up @@ -319,10 +322,13 @@ extern const char* ezlopi_longitude_str;

extern const char* ezlopi_urls_str;

const char* ezlopi_parity_str;
const char* ezlopi_start_bits_str;
const char* ezlopi_stop_bits_str;
const char* ezlopi_frame_size_str;
const char* ezlopi_flow_control_str;
extern const char* ezlopi_parity_str;
extern const char* ezlopi_start_bits_str;
extern const char* ezlopi_stop_bits_str;
extern const char* ezlopi_frame_size_str;
extern const char* ezlopi_flow_control_str;

extern const char *ezlopi_chipset_str;
extern const char *ezlopi_internet_str;

#endif // __EZLOPI_CLOUD_KEYWORDS_H__
10 changes: 5 additions & 5 deletions ezlopi-cloud/ezlopi-cloud-coordinates/ezlopi_cloud_coordinates.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ static double sg_longitude;

void hub_coordinates_set(cJSON* cj_request, cJSON* cj_response)
{
cJSON_AddObjectToObject(cj_response, ezlopi_result_str);
cJSON_AddObjectToObject(__FUNCTION__, cj_response, ezlopi_result_str);
if (cj_request)
{
cJSON* cj_params = cJSON_GetObjectItem(cj_request, ezlopi_params_str);
cJSON* cj_params = cJSON_GetObjectItem(__FUNCTION__, cj_request, ezlopi_params_str);
if (cj_params)
{
CJSON_GET_VALUE_DOUBLE(cj_params, ezlopi_latitude_str, sg_latitude);
CJSON_GET_VALUE_DOUBLE(cj_params, ezlopi_longitude_str, sg_longitude);

char lat_long_str[256];
if (cJSON_PrintPreallocated(cj_params, lat_long_str, sizeof(lat_long_str), false))
if (cJSON_PrintPreallocated(__FUNCTION__, cj_params, lat_long_str, sizeof(lat_long_str), false))
{
ezlopi_nvs_write_latitude_longitude(lat_long_str);
}
Expand All @@ -37,8 +37,8 @@ void hub_coordinates_get(cJSON* cj_request, cJSON* cj_response)
char* lat_long_vals = ezlopi_nvs_read_latidtude_longitude();
if (lat_long_vals)
{
cJSON_AddRawToObject(cj_response, ezlopi_result_str, lat_long_vals);
free(lat_long_vals);
cJSON_AddRawToObject(__FUNCTION__, cj_response, ezlopi_result_str, lat_long_vals);
ezlopi_free(__FUNCTION__, lat_long_vals);
}
}

Expand Down
52 changes: 26 additions & 26 deletions ezlopi-cloud/ezlopi-cloud-data/ezlopi_cloud_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@

void data_list(cJSON* cj_request, cJSON* cj_response)
{
cJSON* cjson_result = cJSON_AddObjectToObject(cj_response, ezlopi_result_str);
cJSON* cjson_result = cJSON_AddObjectToObject(__FUNCTION__, cj_response, ezlopi_result_str);
if (cjson_result)
{
cJSON* cj_settings = cJSON_AddObjectToObject(cjson_result, ezlopi_settings_str);
cJSON* cj_settings = cJSON_AddObjectToObject(__FUNCTION__, cjson_result, ezlopi_settings_str);
if (cj_settings)
{
cJSON* cj_first_start = cJSON_AddObjectToObject(cj_settings, ezlopi_first_start_str);
cJSON* cj_first_start = cJSON_AddObjectToObject(__FUNCTION__, cj_settings, ezlopi_first_start_str);
if (cj_first_start)
{
cJSON_AddNumberToObject(cj_first_start, ezlopi_value_str, 0);
cJSON_AddNumberToObject(__FUNCTION__, cj_first_start, ezlopi_value_str, 0);
}

#warning "WARNING: work required here!"
Expand All @@ -44,23 +44,23 @@ void data_list(cJSON* cj_request, cJSON* cj_response)
#if 0
static cJSON* ezlopi_cloud_data_create_device_list(void)
{
cJSON* cjson_device_list = cJSON_CreateObject();
cJSON* cjson_device_list = cJSON_CreateObject(__FUNCTION__);

if (cjson_device_list)
{
cJSON_AddNumberToObject(cjson_device_list, "ids", 1234);
cJSON_AddNumberToObject(__FUNCTION__, cjson_device_list, "ids", 1234);
}

return cjson_device_list;
}

static cJSON* ezlopi_cloud_data_create_settings_list(void)
{
cJSON* cjson_device_list = cJSON_CreateObject();
cJSON* cjson_device_list = cJSON_CreateObject(__FUNCTION__);

if (cjson_device_list)
{
cJSON_AddNumberToObject(cjson_device_list, "ids", 1234);
cJSON_AddNumberToObject(__FUNCTION__, cjson_device_list, "ids", 1234);
}

return cjson_device_list;
Expand All @@ -71,29 +71,29 @@ static cJSON* ezlopi_cloud_data_list_settings(l_ezlopi_configured_devices_t* ezl
cJSON* cjson_settings = NULL;
if (ezlopi_device)
{
cjson_settings = cJSON_CreateObject();
cjson_settings = cJSON_CreateObject(__FUNCTION__);
if (cjson_settings)
{
char tmp_string[64];
snprintf(tmp_string, sizeof(tmp_string), "%08x", ezlopi_device->properties->ezlopi_cloud.device_id);
cJSON_AddStringToObject(cjson_settings, ezlopi__id_str, tmp_string);
cJSON_AddStringToObject(cjson_settings, ezlopi_deviceTypeId_str, ezlopi_ezlopi_str);
cJSON_AddStringToObject(cjson_settings, ezlopi_parentDeviceId_str, ezlopi__str);
cJSON_AddStringToObject(cjson_settings, ezlopi_category_str, ezlopi_device->properties->ezlopi_cloud.category);
cJSON_AddStringToObject(cjson_settings, ezlopi_subcategory_str, ezlopi_device->properties->ezlopi_cloud.subcategory);
cJSON_AddBoolToObject(cjson_settings, ezlopi_batteryPowered_str, ezlopi_device->properties->ezlopi_cloud.battery_powered);
cJSON_AddStringToObject(cjson_settings, "name", ezlopi_device->properties->ezlopi_cloud.device_name);
cJSON_AddStringToObject(cjson_settings, ezlopi_type_str, ezlopi_device->properties->ezlopi_cloud.device_type);
cJSON_AddBoolToObject(cjson_settings, ezlopi_reachable_str, ezlopi_device->properties->ezlopi_cloud.reachable);
cJSON_AddBoolToObject(cjson_settings, ezlopi_persistent_str, true);
cJSON_AddBoolToObject(cjson_settings, ezlopi_serviceNotification_str, false);
cJSON_AddBoolToObject(cjson_settings, "armed", false);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi__id_str, tmp_string);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi_deviceTypeId_str, ezlopi_ezlopi_str);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi_parentDeviceId_str, ezlopi__str);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi_category_str, ezlopi_device->properties->ezlopi_cloud.category);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi_subcategory_str, ezlopi_device->properties->ezlopi_cloud.subcategory);
cJSON_AddBoolToObject(__FUNCTION__, cjson_settings, ezlopi_batteryPowered_str, ezlopi_device->properties->ezlopi_cloud.battery_powered);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, "name", ezlopi_device->properties->ezlopi_cloud.device_name);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi_type_str, ezlopi_device->properties->ezlopi_cloud.device_type);
cJSON_AddBoolToObject(__FUNCTION__, cjson_settings, ezlopi_reachable_str, ezlopi_device->properties->ezlopi_cloud.reachable);
cJSON_AddBoolToObject(__FUNCTION__, cjson_settings, ezlopi_persistent_str, true);
cJSON_AddBoolToObject(__FUNCTION__, cjson_settings, ezlopi_serviceNotification_str, false);
cJSON_AddBoolToObject(__FUNCTION__, cjson_settings, "armed", false);
snprintf(tmp_string, sizeof(tmp_string), "%08x", ezlopi_device->properties->ezlopi_cloud.room_id);
cJSON_AddStringToObject(cjson_settings, ezlopi_roomId_str, tmp_string);
cJSON_AddStringToObject(cjson_settings, ezlopi_security_str, ezlopi__str);
cJSON_AddBoolToObject(cjson_settings, ezlopi_ready_str, true);
cJSON_AddStringToObject(cjson_settings, ezlopi_status_str, ezlopi_synced_str);
cJSON_AddStringToObject(cjson_settings, ezlopi_info_str, "{}");
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi_roomId_str, tmp_string);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi_security_str, ezlopi__str);
cJSON_AddBoolToObject(__FUNCTION__, cjson_settings, ezlopi_ready_str, true);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi_status_str, ezlopi_synced_str);
cJSON_AddStringToObject(__FUNCTION__, cjson_settings, ezlopi_info_str, "{}");
}
}

Expand Down
34 changes: 17 additions & 17 deletions ezlopi-cloud/ezlopi-cloud-devices/ezlopi_cloud_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

void devices_list_v3(cJSON* cj_request, cJSON* cj_response)
{
cJSON* cjson_result = cJSON_AddObjectToObject(cj_response, ezlopi_result_str);
cJSON* cjson_result = cJSON_AddObjectToObject(__FUNCTION__, cj_response, ezlopi_result_str);
if (cjson_result)
{
cJSON* cjson_devices_array = cJSON_AddArrayToObject(cjson_result, "devices");
cJSON* cjson_devices_array = cJSON_AddArrayToObject(__FUNCTION__, cjson_result, "devices");
if (cjson_devices_array)
{
l_ezlopi_device_t* curr_device = ezlopi_device_get_head();
Expand All @@ -27,7 +27,7 @@ void devices_list_v3(cJSON* cj_request, cJSON* cj_response)
{
if (!cJSON_AddItemToArray(cjson_devices_array, cj_properties))
{
cJSON_Delete(cj_properties);
cJSON_Delete(__FUNCTION__, cj_properties);
}
}
curr_device = curr_device->next;
Expand All @@ -51,19 +51,19 @@ void devices_list_v3(cJSON* cj_request, cJSON* cj_response)

void device_name_set(cJSON* cj_request, cJSON* cj_response)
{
cJSON* cj_result = cJSON_AddObjectToObject(cj_response, ezlopi_result_str);
cJSON* cj_result = cJSON_AddObjectToObject(__FUNCTION__, cj_response, ezlopi_result_str);
if (cj_result)
{
cJSON* cj_params = cJSON_GetObjectItem(cj_request, ezlopi_params_str);
cJSON* cj_params = cJSON_GetObjectItem(__FUNCTION__, cj_request, ezlopi_params_str);
if (cj_params)
{
cJSON* cj_device_id = cJSON_GetObjectItem(cj_params, ezlopi__id_str);
cJSON* cj_device_id = cJSON_GetObjectItem(__FUNCTION__, cj_params, ezlopi__id_str);
if (cj_device_id)
{
uint32_t device_id = strtoul(cj_device_id->valuestring, NULL, 16);
if (device_id)
{
ezlopi_device_name_set_by_device_id(device_id, cJSON_GetObjectItem(cj_params, ezlopi_name_str));
ezlopi_device_name_set_by_device_id(device_id, cJSON_GetObjectItem(__FUNCTION__, cj_params, ezlopi_name_str));
}
}
}
Expand All @@ -74,16 +74,16 @@ void device_updated(cJSON* cj_request, cJSON* cj_response)
{
if (cj_request)
{
cJSON_AddStringToObject(cj_response, ezlopi_id_str, ezlopi_ui_broadcast_str);
cJSON_AddStringToObject(cj_response, ezlopi_msg_subclass_str, "hub.device.updated");
cJSON_AddStringToObject(__FUNCTION__, cj_response, ezlopi_id_str, ezlopi_ui_broadcast_str);
cJSON_AddStringToObject(__FUNCTION__, cj_response, ezlopi_msg_subclass_str, "hub.device.updated");

cJSON* cj_result = cJSON_AddObjectToObject(cj_response, ezlopi_result_str);
cJSON* cj_result = cJSON_AddObjectToObject(__FUNCTION__, cj_response, ezlopi_result_str);
if (cj_result)
{
cJSON* cj_params = cJSON_GetObjectItem(cj_request, ezlopi_params_str);
cJSON* cj_params = cJSON_GetObjectItem(__FUNCTION__, cj_request, ezlopi_params_str);
if (cj_params)
{
cJSON* cj_device_id = cJSON_GetObjectItem(cj_params, ezlopi__id_str);
cJSON* cj_device_id = cJSON_GetObjectItem(__FUNCTION__, cj_params, ezlopi__id_str);
if (cj_device_id && cj_device_id->valuestring)
{
uint32_t device_id = strtoul(cj_device_id->valuestring, NULL, 16);
Expand All @@ -95,16 +95,16 @@ void device_updated(cJSON* cj_request, cJSON* cj_response)
{
char tmp_str[32];
snprintf(tmp_str, sizeof(tmp_str), "%08x", device_id);
cJSON_AddStringToObject(cj_result, ezlopi__id_str, tmp_str);
cJSON_AddStringToObject(cj_result, ezlopi_name_str, device_node->cloud_properties.device_name);
cJSON_AddTrueToObject(cj_result, ezlopi_syncNotification_str);
cJSON_AddStringToObject(__FUNCTION__, cj_result, ezlopi__id_str, tmp_str);
cJSON_AddStringToObject(__FUNCTION__, cj_result, ezlopi_name_str, device_node->cloud_properties.device_name);
cJSON_AddTrueToObject(__FUNCTION__, cj_result, ezlopi_syncNotification_str);

s_ezlopi_cloud_controller_t* controller_info = ezlopi_device_get_controller_information();

if (controller_info)
{
cJSON_AddBoolToObject(cj_result, ezlopi_armed_str, controller_info->armed ? cJSON_True : cJSON_False);
cJSON_AddBoolToObject(cj_result, ezlopi_serviceNotification_str, controller_info->service_notification ? cJSON_True : cJSON_False);
cJSON_AddBoolToObject(__FUNCTION__, cj_result, ezlopi_armed_str, controller_info->armed ? cJSON_True : cJSON_False);
cJSON_AddBoolToObject(__FUNCTION__, cj_result, ezlopi_serviceNotification_str, controller_info->service_notification ? cJSON_True : cJSON_False);
}

break;
Expand Down
Loading

0 comments on commit 647ce35

Please sign in to comment.