Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
narangmayank committed Jan 17, 2024
2 parents a0a1243 + 63d4dd0 commit 1c19ef5
Show file tree
Hide file tree
Showing 91 changed files with 1,203 additions and 554 deletions.
17 changes: 0 additions & 17 deletions AUTHORS.md

This file was deleted.

4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
idf_component_register(
INCLUDE_DIRS
"include/mcu_hal"
"include/core_sdk"
"include/core_sdk"
SRCS
"src/mcu_hal/bytebeam_esp_hal.c"
"src/core_sdk/bytebeam_client.c"
"src/core_sdk/bytebeam_action.c"
"src/core_sdk/bytebeam_stream.c"
"src/core_sdk/bytebeam_ota.c"
"src/core_sdk/bytebeam_log.c"
"src/core_sdk/bytebeam_log.c"
PRIV_REQUIRES
"json"
"mqtt"
Expand Down
156 changes: 137 additions & 19 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -1,30 +1,148 @@
menu "Bytebeam"
menu "Device Shadow"
config DEVICE_SHADOW_STATUS
string "Status"
default "Device is Online"
help
Provide the status

config DEVICE_SHADOW_SOFTWARE_TYPE
string "Software Type"
default "bytebeam-app"
help
Provide the software type

choice BYTEBEAM_PROVISIONING_FILESYSTEM
prompt "Provisioning file system"
default BYTEBEAM_PROVISION_DEVICE_FROM_SPIFFS
help
Select the file system for the device provisioning
config DEVICE_SHADOW_SOFTWARE_VERSION
string "Software Version"
default "v0.1.0"
help
Provide the software version

config DEVICE_SHADOW_HARDWARE_TYPE
string "Hardware Type"
default "Bytebeam ESP32"
help
Provide the hardware type

config DEVICE_SHADOW_HARDWARE_VERSION
string "Hardware Version"
default "rev1"
help
Provide the hardware version

config DEVICE_SHADOW_CUSTOM_JSON_STR_LEN
int "Custom json string len (In Bytes)"
default 512
help
Provide the length of custom device shadow json str

config DEVICE_SHADOW_PUSH_INTERVAL
int "Push Interval (In Seconds)"
default 40
help
Provide the heartbeat push interval
endmenu

menu "Device Provisioning"
choice DEVICE_PROVISIONING_FILESYSTEM
prompt "Provisioning file system"
default DEVICE_PROVISIONING_FILESYSTEM_IS_SPIFFS
help
Select the file system for the device provisioning

config DEVICE_PROVISIONING_FILESYSTEM_IS_SPIFFS
bool "SPIFFS"
help
Use spiffs file system for device provisioning

config DEVICE_PROVISIONING_FILESYSTEM_IS_FATFS
bool "FATFS"
help
Use fatfs file system for device provisioning

config BYTEBEAM_PROVISION_DEVICE_FROM_SPIFFS
bool "SPIFFS"
config DEVICE_PROVISIONING_FILESYSTEM_IS_LITTLEFS
bool "LITTLEFS"
help
Use littlefs file system for device provisioning
endchoice

config DEVICE_PROVISIONING_FILENAME
string "Provisioning file name"
default "device_config.json"
help
Use spiffs file system for device provisioning
Provide the file name for the device provisioning
endmenu

config BYTEBEAM_PROVISION_DEVICE_FROM_LITTLEFS
bool "LITTLEFS"
menu "Bytebeam Logging"
config BYTEBEAM_CLOUD_LOGGING_IS_ENABLED
bool "Enable cloud logging"
help
Use littlefs file system for device provisioning
Enable cloud logging

config BYTEBEAM_CLOUD_LOGGING_STREAM
string "Cloud logging log stream"
depends on BYTEBEAM_CLOUD_LOGGING_IS_ENABLED
default "logs"
help
Provide the cloud logging stream name

config BYTEBEAM_PROVISION_DEVICE_FROM_FATFS
bool "FATFS"
choice BYTEBEAM_LOGGING_LEVEL
prompt "Logging level"
default BYTEBEAM_LOGGING_LEVEL_IS_INFO
help
Use fatfs file system for device provisioning
endchoice
Select the bytebeam logging level

config BYTEBEAM_LOGGING_LEVEL_IS_NONE
bool "No Output"
help
None log level

config BYTEBEAM_LOGGING_LEVEL_IS_ERROR
bool "Error"
help
Error log level

config BYTEBEAM_LOGGING_LEVEL_IS_WARN
bool "Warning"
help
Warning log level

config BYTEBEAM_LOGGING_LEVEL_IS_INFO
bool "Info"
help
Info log level

config BYTEBEAM_LOGGING_LEVEL_IS_DEBUG
bool "Debug"
help
Debug log level

config BYTEBEAM_LOGGING_LEVEL_IS_VERBOSE
bool "Verbose"
help
Verbose log level
endchoice

config BYTEBEAM_LOGGING_LEVEL
int
default 0 if BYTEBEAM_LOGGING_LEVEL_IS_NONE
default 1 if BYTEBEAM_LOGGING_LEVEL_IS_ERROR
default 2 if BYTEBEAM_LOGGING_LEVEL_IS_WARN
default 3 if BYTEBEAM_LOGGING_LEVEL_IS_INFO
default 4 if BYTEBEAM_LOGGING_LEVEL_IS_DEBUG
default 5 if BYTEBEAM_LOGGING_LEVEL_IS_VERBOSE
endmenu

config BYTEBEAM_PROVISIONING_FILENAME
string "Provisioning file name"
default "device_config.json"
config NUM_MESSAGES_IN_MQTT_BATCH
int "MQTT batch element numbers"
default 125
help
Provide the file name for the device provisioning
Provide the number of elements in mqtt batch

config MQTT_BATCH_ELEMENT_SIZE
int "MQTT batch element size (In Bytes)"
default 250
help
Provide the length of element in mqtt batch

endmenu
18 changes: 11 additions & 7 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# Bytebeam ESP-IDF SDK Examples

This section includes some basic example app's to get you started with **bytebeam-esp-idf-sdk**
This section includes the example apps to easily get you started with **bytebeam-esp-idf-sdk**

- setup_client
- actions_handling
- toggle_led
- receive_data
- actions_handling
- toggle_led
- update_config
- push_data
- esp_touch
- temp_humid
- update_config
- esp_touch
- temp_humid
- custom_device_shaodw
- batch_mqtt_data
- cloud_logging
- basic_ota
- basic_ota_rollback
- hello_wokwi
- hello_wokwi
- hello_cmake
7 changes: 0 additions & 7 deletions examples/basic_ota/main/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,6 @@ void app_main(void)
// sync time from the ntp
sync_time_from_ntp();

// setting up the device info i.e to be seen in the device shadow
bytebeam_client.device_info.status = "Device is Up!";
bytebeam_client.device_info.software_type = "basic-ota-app";
bytebeam_client.device_info.software_version = "1.0.0";
bytebeam_client.device_info.hardware_type = "ESP32 DevKit V1";
bytebeam_client.device_info.hardware_version = "rev1";

// initialize the bytebeam client
bytebeam_init(&bytebeam_client);

Expand Down
1 change: 1 addition & 0 deletions examples/basic_ota/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_example.csv"
CONFIG_EXAMPLE_WIFI_SSID="Bytebeam"
CONFIG_EXAMPLE_WIFI_PASSWORD="IoTYahinBanega"
CONFIG_DEVICE_SHADOW_SOFTWARE_TYPE="basic-ota-app"
8 changes: 0 additions & 8 deletions examples/basic_ota_rollback/main/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "freertos/task.h"

#include "esp_ota_ops.h"

#include "bytebeam_sdk.h"

// this macro is used to specify the delay for 10 sec.
Expand Down Expand Up @@ -140,13 +139,6 @@ void app_main(void)
// sync time from the ntp
sync_time_from_ntp();

// setting up the device info i.e to be seen in the device shadow
bytebeam_client.device_info.status = "Device is Up!";
bytebeam_client.device_info.software_type = "basic-ota-rollback-app";
bytebeam_client.device_info.software_version = fw_version;
bytebeam_client.device_info.hardware_type = "ESP32 DevKit V1";
bytebeam_client.device_info.hardware_version = "rev1";

// initialize the bytebeam client
bytebeam_init(&bytebeam_client);

Expand Down
1 change: 1 addition & 0 deletions examples/basic_ota_rollback/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_example.csv"
CONFIG_EXAMPLE_WIFI_SSID="Bytebeam"
CONFIG_EXAMPLE_WIFI_PASSWORD="IoTYahinBanega"
CONFIG_DEVICE_SHADOW_SOFTWARE_TYPE="basic-ota-rollback-app"
57 changes: 7 additions & 50 deletions examples/cloud_logging/main/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,18 @@ static bytebeam_client_t bytebeam_client;

static const char *TAG = "BYTEBEAM_CLOUD_LOGGING_EXAMPLE";

static void bytebeam_cloud_logging_test(void)
static void bytebeam_cloud_logging_test()
{
/* default bytebeam log level is BYTEBEAM_LOG_LEVEL_INFO, so logs beyond info level will not work :)
* You can always change the log setting at the compile time or run time
*/
BYTEBEAM_LOGE(TAG, "I am %s Log", "Error");
BYTEBEAM_LOGW(TAG, "I am %s Log", "Warn");
BYTEBEAM_LOGI(TAG, "I am %s Log", "Info");
BYTEBEAM_LOGD(TAG, "I am %s Log", "Debug"); // debug Log will not appear to cloud
BYTEBEAM_LOGV(TAG, "I am %s Log", "Verbose"); // verbose Log will not appear to cloud

// changing log level to Verbose for showing use case
// setting log level to Verbose
esp_log_level_set(TAG, ESP_LOG_VERBOSE);
bytebeam_log_level_set(BYTEBEAM_LOG_LEVEL_VERBOSE);

/* now bytebeam log level is BYTEBEAM_LOG_LEVEL_VERBOSE, so every logs should work now :)
* make sure your esp log level supports Verbose to see the log in the terminal
*/
// sending logs to bytebeam
BYTEBEAM_LOGE(TAG, "This is %s Log", "Error");
BYTEBEAM_LOGW(TAG, "This is %s Log", "Warn");
BYTEBEAM_LOGI(TAG, "This is %s Log", "Info");
BYTEBEAM_LOGD(TAG, "This is %s Log", "Debug"); // debug Log should appear to cloud
BYTEBEAM_LOGV(TAG, "This is %s Log", "Verbose"); // verbose Log should appear to cloud

// changing log level back to Info for meeting initial conditions
esp_log_level_set(TAG, ESP_LOG_INFO);
bytebeam_log_level_set(BYTEBEAM_LOG_LEVEL_INFO);
BYTEBEAM_LOGD(TAG, "This is %s Log", "Debug");
BYTEBEAM_LOGV(TAG, "This is %s Log", "Verbose");

ESP_LOGI(TAG, "Bytebeam Log Test Executed Successfully !\n");
}
Expand All @@ -77,7 +62,6 @@ static void app_start(bytebeam_client_t *bytebeam_client)

if(bytebeam_client->connection_status == 1)
{
// this is how you can do cloud logging, try other log levels for better understanding
BYTEBEAM_LOGI(TAG, "Status : Connected");
BYTEBEAM_LOGI(TAG, "Project Id : %s, Device Id : %s", bytebeam_client->device_cfg.project_id, bytebeam_client->device_cfg.device_id);
}
Expand Down Expand Up @@ -151,13 +135,6 @@ void app_main(void)
// sync time from the ntp
sync_time_from_ntp();

// setting up the device info i.e to be seen in the device shadow
bytebeam_client.device_info.status = "Device is Up!";
bytebeam_client.device_info.software_type = "cloud-logging-app";
bytebeam_client.device_info.software_version = "1.0.0";
bytebeam_client.device_info.hardware_type = "ESP32 DevKit V1";
bytebeam_client.device_info.hardware_version = "rev1";

// initialize the bytebeam client
bytebeam_init(&bytebeam_client);

Expand All @@ -173,28 +150,8 @@ void app_main(void)
ESP_LOGI(TAG, "Cloud Logging is Disabled.");
}

// enable cloud logging for your device (default)
// bytebeam_enable_cloud_logging();

// disable cloud logging for your device
// bytebeam_disable_cloud_logging();

// get the log stream name
// char* log_stream_name = bytebeam_log_stream_get();

// configure the log stream if needed, defaults to "logs"
// bytebeam_log_stream_set("device_logs");

// get the bytebeam log level
// int current_log_level = bytebeam_log_level_get();

// set the bytebeam log level
// bytebeam_log_level_set(log_level_to_set);

/* bytebeam logs can be tested once bytebeam client is started successfully, Use bytebeam_cloud_logging_test to test
* the bytebeam log feature i.e this functions is not included in the sdk
*/
// bytebeam_cloud_logging_test();
// bytebeam logs can be tested once bytebeam client is started successfully
bytebeam_cloud_logging_test();

//
// start the main application
Expand Down
2 changes: 2 additions & 0 deletions examples/cloud_logging/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_example.csv"
CONFIG_EXAMPLE_WIFI_SSID="Bytebeam"
CONFIG_EXAMPLE_WIFI_PASSWORD="IoTYahinBanega"
CONFIG_DEVICE_SHADOW_SOFTWARE_TYPE="cloud-logging-app"
CONFIG_BYTEBEAM_CLOUD_LOGGING_IS_ENABLED=y
1 change: 0 additions & 1 deletion examples/hello_cmake/components/README.md

This file was deleted.

Loading

0 comments on commit 1c19ef5

Please sign in to comment.