Skip to content

Commit

Permalink
Merge pull request #26 from hedrosistemas/develop
Browse files Browse the repository at this point in the history
Merge from hedrosistemas
  • Loading branch information
wjsan authored Oct 22, 2024
2 parents 17f4218 + 703e8ed commit 8ae9d37
Show file tree
Hide file tree
Showing 122 changed files with 11,235 additions and 741 deletions.
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"env": {
"IDF_COMPILER": "C:\\Users\\intec\\.espressif\\tools\\xtensa-esp-elf\\esp-13.2.0_20230928\\xtensa-esp-elf\\bin\\xtensa-esp32-elf-gcc.exe"
"IDF_COMPILER": "C:\\Users\\BINAR\\.espressif\\tools\\xtensa-esp-elf\\esp-13.2.0_20240530\\xtensa-esp-elf\\bin\\xtensa-esp32-elf-gcc.exe"
},
"configurations": [
{
Expand Down
54 changes: 27 additions & 27 deletions ciot_ext.tag
Original file line number Diff line number Diff line change
Expand Up @@ -8593,7 +8593,7 @@
</member>
<member kind="variable">
<type>const ProtobufCEnumDescriptor</type>
<name>ciot__ciot_err__descriptor</name>
<name>ciot__ciot__err__descriptor</name>
<anchorfile>errors_8pb-c_8c.html</anchorfile>
<anchor>abfa771d06cfc5550e0683759baec4d94</anchor>
<arglist></arglist>
Expand All @@ -8618,158 +8618,158 @@
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_OK</name>
<name>CIOT__CIOT__ERR__CIOT_OK</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea7294c3a453eac537a9ff371894537b64</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_NULL_ARG</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_NULL_ARG</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deaa9b0cc3fe841fa6dcbae5ce94d8e5da2</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_INVALID_ID</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_INVALID_ID</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea8a8e57afe3f9a5dce3b93d29d10fa202</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_INVALID_TYPE</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_INVALID_TYPE</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deafbdfdfd8b2f5ab61c54fbe1370013c0c</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_OVERFLOW</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_OVERFLOW</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deaedb6fc1b6d985accf9cc42edd6463410</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_NOT_IMPLEMENTED</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_NOT_IMPLEMENTED</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deaec7398a368e2293053c98bca4356c0e6</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_NOT_SUPPORTED</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_NOT_SUPPORTED</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea6a4165ef2682069543616351ffce0a9b</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_BUSY</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_BUSY</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea2a4579447082d796a436c2c78b776252</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_INVALID_STATE</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_INVALID_STATE</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deaa4b52322af2548f57a264e332efe8d03</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_SERIALIZATION</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_SERIALIZATION</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea4802783865a263f80f5c489e27912f70</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_DESERIALIZATION</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_DESERIALIZATION</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deacf22ef4d12595d78bea7eb714f1f4649</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_SEND_DATA</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_SEND_DATA</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea857ea48cafe0270a008b3451516db7b6</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_RECV_DATA</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_RECV_DATA</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deabc5eb6ae3edd4b27be0f0d74802a61aa</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_INVALID_SIZE</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_INVALID_SIZE</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deaeba2719688998ddf2876c145dcaedd31</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_CLOSED</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_CLOSED</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deaca2d4a4a40eaaf1738d93a94b75926a2</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_NOT_FOUND</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_NOT_FOUND</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea82cc6d4f90cf3af0761080ce27fa5e03</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_VALIDATION_FAILED</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_VALIDATION_FAILED</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea05cdc8fb5aebd0d9e6b46bd569e0fa58</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_CONNECTION</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_CONNECTION</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea537f8f5b9337a62e725d2bb5db4ab9d6</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_DISCONNECTION</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_DISCONNECTION</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea282dd6c1d32ccaa5413a312b9ab8d0ef</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_EXCEPTION</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_EXCEPTION</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deaf9d0cb8c8c0df17d8e549f2b85a43ac4</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_TERMINATOR_MISSING</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_TERMINATOR_MISSING</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea5d77a625d646b85d0bb853eb2b0e6965</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_INVALID_ARG</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_INVALID_ARG</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7deaa843ed8fe22087d8713e2ac76b22e8f9</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_NO_MEMORY</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_NO_MEMORY</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea552542b71379e9f4872c979506e84ae5</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_ERR_TIMEOUT</name>
<name>CIOT__CIOT__ERR__CIOT_ERR_TIMEOUT</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea56d156577c434fdc956311dc244e54bc</anchor>
<arglist></arglist>
</member>
<member kind="enumvalue">
<name>CIOT__CIOT_ERR__CIOT_FAIL</name>
<name>CIOT__CIOT__ERR__CIOT_FAIL</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>a9ed00d4c46bfaed408ceb78e9f6ac7dea1d6b6afa2c2854a9903371653b4b9dfe</anchor>
<arglist></arglist>
</member>
<member kind="variable">
<type>const ProtobufCEnumDescriptor</type>
<name>ciot__ciot_err__descriptor</name>
<name>ciot__ciot__err__descriptor</name>
<anchorfile>errors_8pb-c_8h.html</anchorfile>
<anchor>abfa771d06cfc5550e0683759baec4d94</anchor>
<arglist></arglist>
Expand Down
5 changes: 5 additions & 0 deletions common/Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ set(CIOT_PB_INCLUDE_DIRS
${CIOT_DIR}/src/proto/
)

set(CIOT_MBED_INCLUDE_DIRS
${CIOT_DIR}/libs/crypt
)

FILE(GLOB_RECURSE CIOT_COMMON_SRCS ${CIOT_DIR}/src/common/*.c)
FILE(GLOB_RECURSE CIOT_CORE_SRCS ${CIOT_DIR}/src/core/*.c)
FILE(GLOB_RECURSE CIOT_PB_C_SRCS ${CIOT_DIR}/src/proto/protobuf-c/protobuf-c/*.c)
FILE(GLOB_RECURSE CIOT_PB_V1_SRCS ${CIOT_DIR}/src/proto/ciot/proto/v1/*.c)
FILE(GLOB_RECURSE CIOT_MBED_SRCS ${CIOT_DIR}/libs/crypt/*.c)

list(APPEND CIOT_SRCS ${CIOT_COMMON_SRCS})
list(APPEND CIOT_SRCS ${CIOT_CORE_SRCS})
Expand Down
5 changes: 2 additions & 3 deletions examples/cli/ciot_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ static const char *TAG = "ciot_cli";

static const char *default_argv[] = {
"ciot_cli",
"save",
"5",
"9"
"set-dfu",
"1",
};
static bool run_cmd = false;

Expand Down
8 changes: 5 additions & 3 deletions examples/cli/ciot_cli_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ciot_err_t ciot_cli_conn_start()
if (type == CIOT__IFACE_TYPE__IFACE_TYPE_UNKNOWN || conn_data == NULL)
{
printf("ERROR: connection not configured.\n");
exit(CIOT_ERR__CONNECTION);
exit(CIOT__ERR__CONNECTION);
}

if (type == CIOT__IFACE_TYPE__IFACE_TYPE_UART && conn_data && conn_data->uart)
Expand All @@ -75,7 +75,7 @@ ciot_err_t ciot_cli_conn_start()
if (conn == NULL)
{
printf("selected connection (%s) is not configured\n", ciot__iface_type__descriptor.values[type].name);
exit(CIOT_ERR__CONNECTION);
exit(CIOT__ERR__CONNECTION);
}

cfgs[1] = conn_data;
Expand Down Expand Up @@ -110,12 +110,14 @@ int ciot_cli_conn(int argc, char const *argv[])

ciot_err_t ciot_cli_conn_send_msg(ciot_msg_t *msg)
{
ciot_msg_print(&msg->base);
return ciot_iface_send_req(conn, msg);
}

ciot_err_t ciot_cli_conn_send_req(ciot_msg_t *msg, ciot_iface_event_handler_fn *req_handler_fn)
{
req_handler = req_handler_fn;
ciot_msg_print(&msg->base);
return ciot_iface_send_req(conn, msg);
}

Expand Down Expand Up @@ -331,5 +333,5 @@ static ciot_err_t ciot_cli_event_handler(ciot_iface_t *sender, ciot_iface_event_
CIOT_LOGI(TAG, "Other event type: %d", event->type);
break;
}
return CIOT_ERR__OK;
return CIOT__ERR__OK;
}
2 changes: 1 addition & 1 deletion examples/cli/ciot_cli_ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,5 @@ static ciot_err_t ciot_cli_ota_event_handler(ciot_iface_t *iface, ciot_iface_eve

CIOT_LOGI(TAG, "event received: %d", event->type);

return CIOT_ERR__OK;
return CIOT__ERR__OK;
}
2 changes: 1 addition & 1 deletion examples/http_server/ciot_custom_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef __CIOT_CUSTOM_CONFIG__H__
#define __CIOT_CUSTOM_CONFIG__H__

#define CIOT_CONFIG_LOG_LEVEL CIOT_LOG_LEVEL_INFO
#define CIOT_CONFIG_LOG_LEVEL CIOT__LOG_LEVEL__LOG_LEVEL_INFO
#define CIOT_CONFIG_APP_VER 0, 1, 0
#define CIOT_CONFIG_HARDWARE_NAME "CIoT HTTP Server"

Expand Down
2 changes: 1 addition & 1 deletion examples/mqtt_client/ciot_custom_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef __CIOT_CUSTOM_CONFIG__H__
#define __CIOT_CUSTOM_CONFIG__H__

#define CIOT_CONFIG_LOG_LEVEL CIOT_LOG_LEVEL_INFO
#define CIOT_CONFIG_LOG_LEVEL CIOT__LOG_LEVEL__LOG_LEVEL_INFO
#define CIOT_CONFIG_APP_VER 0, 1, 0
#define CIOT_CONFIG_HARDWARE_NAME "CIoT HTTP Server"

Expand Down
2 changes: 1 addition & 1 deletion examples/nrf_ble_module/ciot_custom_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "ciot_log.h"

#define CIOT_CONFIG_LOG_LEVEL CIOT_LOG_LEVEL_NONE
#define CIOT_CONFIG_LOG_LEVEL CIOT__LOG_LEVEL__LOG_LEVEL_INFO
#define CIOT_CONFIG_HARDWARE_NAME "CIoT NRF Ble Module"
#define CIOT_CONFIG_APP_VER 0, 1, 0

Expand Down
2 changes: 1 addition & 1 deletion examples/nrf_dfu_master/ciot_custom_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef __CIOT_CUSTOM_CONFIG__H__
#define __CIOT_CUSTOM_CONFIG__H__

#define CIOT_CONFIG_LOG_LEVEL CIOT_LOG_LEVEL_INFO
#define CIOT_CONFIG_LOG_LEVEL CIOT__LOG_LEVEL__LOG_LEVEL_INFO
#define CIOT_CONFIG_APP_VER 0, 1, 0
#define CIOT_CONFIG_HARDWARE_NAME "CIoT HTTP Server"

Expand Down
2 changes: 1 addition & 1 deletion examples/tcp_client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ static ciot_err_t app_event_handler(ciot_iface_t *sender, ciot_iface_event_t *ev
CIOT_LOGI(TAG, "Firwmare Version: %d.%d.%d", info->app_ver.data[0], info->app_ver.data[1], info->app_ver.data[2]);
}

return CIOT_ERR__OK;
return CIOT__ERR__OK;
}
2 changes: 1 addition & 1 deletion examples/uart/ciot_custom_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef __CIOT_CUSTOM_CONFIG__H__
#define __CIOT_CUSTOM_CONFIG__H__

#define CIOT_CONFIG_LOG_LEVEL CIOT_LOG_LEVEL_INFO
#define CIOT_CONFIG_LOG_LEVEL CIOT__LOG_LEVEL__LOG_LEVEL_INFO
#define CIOT_CONFIG_APP_VER 0, 1, 0
#define CIOT_CONFIG_HARDWARE_NAME "CIoT HTTP Server"

Expand Down
1 change: 1 addition & 0 deletions include/ciot_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
#define CIOT_CONFIG_FEATURE_MQTT_CLIENT 0
#define CIOT_CONFIG_FEATURE_TIMER 0
#define CIOT_CONFIG_FEATURE_SERIALIZER 0
#define CIOT_CONFIG_FEATURE_CRYPT 0

#endif
32 changes: 32 additions & 0 deletions include/ciot_crypt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @file ciot_crypt.h
* @author your name ([email protected])
* @brief
* @version 0.1
* @date 2024-10-04
*
* @copyright Copyright (c) 2024
*
*/

#ifndef __CIOT_CRYPT__H__
#define __CIOT_CRYPT__H__

#include <inttypes.h>
#include "ciot_err.h"

typedef struct ciot_crypt_key
{
const uint8_t *data;
int size;
} ciot_crypt_key_t;

typedef struct ciot_crypt
{
ciot_crypt_key_t key;
} ciot_crypt_t;

ciot_err_t ciot_crypt_enc(ciot_crypt_t *crypt, char *data, char *out, int size);
ciot_err_t ciot_crypt_dec(ciot_crypt_t *crypt, char *data, char *out, int size);

#endif //!__CIOT_CRYPT__H__
Loading

0 comments on commit 8ae9d37

Please sign in to comment.