Skip to content

Commit e4a847b

Browse files
committed
Restructure app_webrtc.c to move out signaling to separate file
1 parent a5c28ec commit e4a847b

File tree

28 files changed

+3555
-1670
lines changed

28 files changed

+3555
-1670
lines changed

esp_port/components/esp_webrtc_utils/src/flash_wrapper.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ typedef struct {
5353
size_t size;
5454
size_t offset;
5555
size_t* size_result; // Pointer to store size result for GET_SIZE operation
56+
bool* exists_result; // Pointer to store exists result for EXISTS operation
5657
struct stat stat_info;
5758
} file;
5859
struct {
@@ -353,8 +354,14 @@ static esp_err_t do_file_op(flash_op_t *op)
353354
if (f) {
354355
fclose(f);
355356
op->result = ESP_OK;
357+
if (op->op.file.exists_result != NULL) {
358+
*op->op.file.exists_result = true;
359+
}
356360
} else {
357361
op->result = ESP_ERR_NOT_FOUND;
362+
if (op->op.file.exists_result != NULL) {
363+
*op->op.file.exists_result = false;
364+
}
358365
}
359366
break;
360367

@@ -527,12 +534,11 @@ esp_err_t flash_wrapper_write(const char* path, const void* buf, size_t size)
527534
esp_err_t flash_wrapper_exists(const char* path, bool* exists)
528535
{
529536
flash_op_t op = {
530-
.op_type = FLASH_OP_EXISTS
537+
.op_type = FLASH_OP_EXISTS,
538+
.op.file.exists_result = exists
531539
};
532540
strncpy(op.op.file.path, path, sizeof(op.op.file.path) - 1);
533-
esp_err_t ret = submit_flash_op(&op);
534-
*exists = (ret == ESP_OK);
535-
return ESP_OK;
541+
return submit_flash_op(&op);
536542
}
537543

538544
esp_err_t flash_wrapper_stat(const char* path, struct stat* st)

esp_port/components/kvs_utils/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ idf_component_register(
4545
INCLUDE_DIRS
4646
"./include"
4747
"./src"
48-
REQUIRES esp_system heap pthread esp_webrtc_utils
48+
REQUIRES esp_system heap pthread
4949
)

esp_port/components/kvs_webrtc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ idf_component_register(
8686
SRCS "${kvs_webrtc_srcs}"
8787
"${CMAKE_CURRENT_SOURCE_DIR}/src/WebRtcLogging.c"
8888
"${CMAKE_CURRENT_SOURCE_DIR}/src/app_webrtc.c"
89+
"${CMAKE_CURRENT_SOURCE_DIR}/src/kvs_signaling.c"
8990

9091
INCLUDE_DIRS "${kvs_webrtc_include_dirs}"
9192
"${CMAKE_CURRENT_SOURCE_DIR}/include"

esp_port/components/kvs_webrtc/idf_component.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,10 @@ dependencies:
3939
version: "*"
4040
public: true
4141

42+
webrtc_bridge:
43+
path: ../webrtc_bridge
44+
version: "*"
45+
public: true
46+
4247
espressif/esp_websocket_client:
4348
version: "*"

0 commit comments

Comments
 (0)