Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lomassubedi committed Mar 26, 2024
1 parent a66216e commit 0a3edf3
Show file tree
Hide file tree
Showing 15 changed files with 273 additions and 274 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
60 changes: 5 additions & 55 deletions sdkconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ 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
Expand All @@ -72,6 +64,7 @@ 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

#
Expand Down Expand Up @@ -105,7 +98,6 @@ 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_S3_STR=y
# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
Expand Down Expand Up @@ -156,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 @@ -295,7 +289,6 @@ 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
# CONFIG_BT_BLE_ADV_DATA_LENGTH_ZERO_AUX is not set
# end of Bluetooth controller

CONFIG_BT_BLUEDROID_ENABLED=y
Expand Down Expand Up @@ -325,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 @@ -511,7 +503,6 @@ CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y
# CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY is not set
# CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK is not set
CONFIG_BT_SMP_ENABLE=y
CONFIG_BT_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
Expand Down Expand Up @@ -761,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 All @@ -783,10 +773,6 @@ CONFIG_ESP_IPC_ISR_ENABLE=y
# LCD and Touch Panel
#

#
# LCD Touch Drivers are maintained in the IDF Component Registry
#

#
# LCD Peripheral Configuration
#
Expand Down Expand Up @@ -880,7 +866,6 @@ 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_4=y
CONFIG_ESP_SYSTEM_BBPLL_RECALIB=y
# end of ESP System Settings

#
Expand All @@ -906,10 +891,6 @@ 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
Expand Down Expand Up @@ -1109,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 All @@ -1123,7 +1103,6 @@ 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
Expand Down Expand Up @@ -1176,8 +1155,6 @@ 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
Expand Down Expand Up @@ -1233,13 +1210,6 @@ 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

#
Expand Down Expand Up @@ -1474,26 +1444,6 @@ 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!)
#
# CONFIG_SPI_FLASH_HPM_ENA is not set
CONFIG_SPI_FLASH_HPM_AUTO=y
# CONFIG_SPI_FLASH_HPM_DIS is not set
CONFIG_SPI_FLASH_HPM_ON=y
CONFIG_SPI_FLASH_HPM_DC_AUTO=y
# CONFIG_SPI_FLASH_HPM_DC_DISABLE is not set
# end of Optional and Experimental Features (READ DOCS FIRST)
# end of Main Flash configuration

#
# SPI Flash driver
#
Expand Down
Loading

0 comments on commit 0a3edf3

Please sign in to comment.