Skip to content

Commit

Permalink
Merge pull request #95 from ezloteam/fake_login_EZPI-341
Browse files Browse the repository at this point in the history
  • Loading branch information
lomasSE89 authored Mar 28, 2024
2 parents 58e2a00 + 0a3edf3 commit 07495ca
Show file tree
Hide file tree
Showing 15 changed files with 272 additions and 224 deletions.
6 changes: 6 additions & 0 deletions ezlopi-cloud/ezlopi-cloud-offline-login/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file(GLOB_RECURSE src_files "*.c*")
idf_component_register(SRCS "ezlopi_cloud_offline_login.c" "${src_files}"
INCLUDE_DIRS "."
REQUIRES ezlopi-cloud-data
ezlopi-util-trace
json )
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#include "ezlopi_core_devices_list.h"
#include "ezlopi_cloud_constants.h"


void EZPI_CLOUD_offline_login(cJSON* cj_request, cJSON* cj_response)
{
cJSON_AddItemReferenceToObject(cj_response, ezlopi_id_str, cJSON_GetObjectItem(cj_request, ezlopi_id_str));
// cJSON_AddItemReferenceToObject(cj_response, ezlopi_method_str, cJSON_GetObjectItem(cj_request, ezlopi_method_str));
cJSON_AddObjectToObject(cj_response, ezlopi_result_str);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef EZLOPI_CLOUD_OFFLINE_LOGIN_H_
#define EZLOPI_CLOUD_OFFLINE_LOGIN_H_

#include "cJSON.h"

void EZPI_CLOUD_offline_login(cJSON* cj_request, cJSON* cj_response);

#endif // EZLOPI_CLOUD_OFFLINE_LOGIN_H_
2 changes: 0 additions & 2 deletions ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ void ezlopi_ble_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_p
}
}

#if 0
static char* ezlopi_ble_gap_event_to_str(esp_gap_ble_cb_event_t event)
{
char* ret = "BLE GAP Event Not defined!";
Expand Down Expand Up @@ -817,7 +816,6 @@ static void show_bonded_devices(void)
free(dev_list);
}
}
#endif

static void ezlopi_ble_setup_service_uuid(void)
{
Expand Down
2 changes: 0 additions & 2 deletions ezlopi-core/ezlopi-core-ble/ezlopi_core_ble_gatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ static void ezlopi_ble_gatt_call_read_by_handle(esp_gatt_if_t gatts_if, esp_ble_
}
}

#if 0
static char* ezlopi_ble_gatt_event_to_string(esp_gatts_cb_event_t event)
{
char* ret = "GATT event not defined!";
Expand Down Expand Up @@ -499,4 +498,3 @@ static char* ezlopi_ble_gatt_event_to_string(esp_gatts_cb_event_t event)
}
return ret;
}
#endif
3 changes: 2 additions & 1 deletion ezlopi-core/ezlopi-core-ezlopi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ set(EZLOPI_CLOUD_COMPONENTS
ezlopi-cloud-ota
ezlopi-cloud-location
ezlopi-cloud-coordinates
ezlopi-cloud-offline-login
)

idf_component_register(SRCS "ezlopi_core_ezlopi.c" "${config_src}"
idf_component_register(SRCS "ezlopi_core_ezlopi_methods.c" "ezlopi_core_ezlopi.c" "${config_src}"
INCLUDE_DIRS "."
REQUIRES ${EZLOPI_CORE_COMPONENTS}
${EZLOPI_CLOUD_COMPONENTS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ CLOUD_METHOD("registered", registered, NULL)

CLOUD_METHOD("hub.coordinates.set", hub_coordinates_set, NULL)
CLOUD_METHOD("hub.coordinates.get", hub_coordinates_get, NULL)
CLOUD_METHOD("hub.offline.login.ui", EZPI_CLOUD_offline_login, NULL)
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "ezlopi_cloud_modes_updaters.h"
#include "ezlopi_cloud_scenes_scripts.h"
#include "ezlopi_cloud_scenes_expressions.h"
#include "ezlopi_cloud_offline_login.h"

#include "ezlopi_core_reset.h"
#include "ezlopi_core_ezlopi_methods.h"
Expand Down
2 changes: 1 addition & 1 deletion ezlopi-core/ezlopi-core-mdns/ezlopi_core_mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static void __mdns_init(void* pv)
{
TRACE_I("\t%s\t%s", mdns_context[i].key, mdns_context[i].value);
}
mdns_service_add(ezlopi_mdns_instance_name, "_ezlopi", "_tcp", 8073, mdns_context, service_size);
mdns_service_add(ezlopi_mdns_instance_name, "_ezlopi", "_tcp", 17001, mdns_context, service_size);
break;
}
else
Expand Down
2 changes: 1 addition & 1 deletion ezlopi-core/ezlopi-core-scenes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

file(GLOB_RECURSE config_src "*.c")

idf_component_register(SRCS "ezlopi_core_scenes_when_methods.c" "ezlopi_core_scenes_scripts.c" "${config_src}"
idf_component_register(SRCS "ezlopi_core_scenes_print.c" "ezlopi_core_scenes_when_methods.c" "ezlopi_core_scenes_scripts.c" "${config_src}"
INCLUDE_DIRS "."
REQUIRES core
)
1 change: 1 addition & 0 deletions ezlopi-core/ezlopi-core-scenes/ezlopi_core_scenes_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "ezlopi_cloud_constants.h"

static void ezlopi_print_when_blocks(l_when_block_v2_t* when_blocks);

void ezlopi_print_block_options(s_block_options_v2_t* block_options, l_fields_v2_t* fields)
{
Expand Down
2 changes: 1 addition & 1 deletion ezlopi-hal/ezlopi-hal-adc/ezlopi_hal_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int ezlopi_adc_init(uint8_t gpio_num, uint8_t width)
{
ezlopi_analog_object_handle->adc_channel = channel;
ezlopi_analog_object_handle->unit = ADC_UNIT_1;
ezlopi_analog_object_handle->attenuation = ADC_ATTEN_DB_12;
ezlopi_analog_object_handle->attenuation = ADC_ATTEN_11db;
#if CONFIG_IDF_TARGET_ESP32
ezlopi_analog_object_handle->width = width;
#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ int ezlopi_service_ws_server_broadcast(char* data)
void ezlopi_service_ws_server_start(void)
{
ezlopi_wifi_event_add(__wifi_connection_event, NULL);
if (ezlopi_wifi_got_ip())
{
if (WS_STATUS_STOPPED == gs_ws_status)
{
__start_server();
}
}
}

void ezlopi_service_ws_server_stop(void)
Expand All @@ -130,7 +137,10 @@ static void __wifi_connection_event(esp_event_base_t event_base, int32_t event_i
{
if (IP_EVENT_STA_GOT_IP == event_id)
{
__start_server();
if (WS_STATUS_STOPPED == gs_ws_status)
{
__start_server();
}
}
else
{
Expand Down Expand Up @@ -354,14 +364,7 @@ static void __start_server(void)

httpd_config_t config = HTTPD_DEFAULT_CONFIG();

// uint64_t id_val = ezlopi_factory_info_v3_get_id();
// if (id_val)
// {
// uint32_t serial_last4 = id_val % 10000;
// config.server_port = serial_last4;
// }

config.server_port = 8073;
config.server_port = 17001;

config.task_priority = 8;
config.stack_size = 1024 * 4;
Expand Down
9 changes: 4 additions & 5 deletions sdkconfig
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ CONFIG_PARTITION_TABLE_MD5=y
# EzloPi User Config
#
# CONFIG_EZPI_DEV_TYPE_TEST is not set
# CONFIG_EZPI_UTIL_ENABLE_TRACE is not set
CONFIG_EZPI_UTIL_ENABLE_TRACE=y
# CONFIG_EZPI_CORE_ENABLE_ETH is not set
CONFIG_EZPI_SERV_ENABLE_MESHBOTS=y
# CONFIG_EZLOPI_BLE_ENABLE is not set
CONFIG_EZLOPI_BLE_ENABLE=y
# CONFIG_EZLOPI_BLE_ENALBE_PASSKEY is not set
CONFIG_EZLOPI_BLE_ENALBE_PAIRING=y

#
# EzloPi mDNS config
Expand Down Expand Up @@ -316,7 +318,6 @@ 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
Expand Down Expand Up @@ -751,7 +752,6 @@ 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

#
Expand Down Expand Up @@ -1090,7 +1090,6 @@ 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
Expand Down
Loading

0 comments on commit 07495ca

Please sign in to comment.