Skip to content

Commit

Permalink
feat(ESPAT-2194): Added a fatfs_to_http_server example
Browse files Browse the repository at this point in the history
  • Loading branch information
ustccw committed Jan 7, 2025
1 parent a107039 commit 23c61ea
Show file tree
Hide file tree
Showing 4 changed files with 416 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/at_fatfs_to_http_server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

file(GLOB_RECURSE srcs *.c)

set(includes "include")

# Add more required components you need here, separated by spaces
set(require_components at freertos esp_http_client)

idf_component_register(
SRCS ${srcs}
INCLUDE_DIRS ${includes}
REQUIRES ${require_components})

idf_component_set_property(${COMPONENT_NAME} WHOLE_ARCHIVE TRUE)
34 changes: 34 additions & 0 deletions examples/at_fatfs_to_http_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
### Usage
1. Add this `at_fatfs_to_http_server` component into the build system of esp-at project.

- Linux or macOS
```
export AT_CUSTOM_COMPONENTS=(path_of_at_custom_cmd)
```

- Windows
```
set AT_CUSTOM_COMPONENTS=(path_of_at_custom_cmd)
```

Notes:
- You need to replace (path_of_at_custom_cmd) with your real absolute path of your `at_custom_cmd` directory.
- You can specify multiple components. For example: `export AT_CUSTOM_COMPONENTS="~/prefix/my_path1 ~/prefix/my_path2"`.

2. Compile your firmware according to the [Compile ESP-AT Project](https://docs.espressif.com/projects/esp-at/en/latest/esp32/Compile_and_Develop/How_to_clone_project_and_compile_it.html#compile-esp-at-project-locally) guide.

3. Send a new AT command based on your situation.

The new command format is:
```
AT+FS_TO_HTTP_SERVER=<"dst_path">,<url_len>
```
where:
- <"dst_path">: Specify the destination path where the file will be posted from the filesystem after the HTTP POST request is successfully executed.
- <url_len>: URL length. Maximum: 8192 bytes.

For example: url is "http://httpbin.org/post", and you want to post file `foo.bin`.
```
AT+FS_TO_HTTP_SERVER="foo.bin",23
// then input http://httpbin.org/post
```
Loading

0 comments on commit 23c61ea

Please sign in to comment.