mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-03 21:56:40 +02:00
Compare commits
34 Commits
console_si
...
mdns-v1.2.
Author | SHA1 | Date | |
---|---|---|---|
7c5a832821 | |||
0bb72f29be | |||
ebdac9cc01 | |||
df04b14e2b | |||
b6a4d94ab0 | |||
418791cf79 | |||
ce9337d332 | |||
0b783c01dd | |||
425931a808 | |||
1b94554f1f | |||
924f28e9c4 | |||
6a74971d4b | |||
11e58dc484 | |||
f795d2fd15 | |||
2e6732882d | |||
d7d249013f | |||
1f6e7f22ce | |||
edeb936a5d | |||
ac8f1de187 | |||
62e3756904 | |||
1f2ceedec5 | |||
a7d981863f | |||
96b0898f28 | |||
5134eedc45 | |||
269622170e | |||
1db1e1508d | |||
3e8de3af3a | |||
39e972544f | |||
9e3c53c27a | |||
f591b7f4c1 | |||
b6e2ac2a70 | |||
e834d47577 | |||
2aada0f308 | |||
1a5ba98964 |
8
.github/workflows/modem__target-test.yml
vendored
8
.github/workflows/modem__target-test.yml
vendored
@ -16,6 +16,10 @@ jobs:
|
||||
idf_ver: ["latest"]
|
||||
idf_target: ["esp32c3"]
|
||||
test: [ { app: pppd, path: test/target }, { app: sim800_c3, path: examples/pppos_client }, { app: sim800_cmux, path: examples/simple_cmux_client } ]
|
||||
include:
|
||||
- idf_ver: "latest"
|
||||
idf_target: "esp32s2"
|
||||
test: { app: usb_a7670_s2, path: examples/pppos_client }
|
||||
runs-on: ubuntu-20.04
|
||||
container: espressif/idf:${{ matrix.idf_ver }}
|
||||
env:
|
||||
@ -55,6 +59,10 @@ jobs:
|
||||
idf_ver: ["latest"]
|
||||
idf_target: ["esp32c3"]
|
||||
test: [ { app: pppd, path: test/target }, { app: sim800_c3, path: examples/pppos_client }, { app: sim800_cmux, path: examples/simple_cmux_client } ]
|
||||
include:
|
||||
- idf_ver: "latest"
|
||||
idf_target: "esp32s2"
|
||||
test: { app: usb_a7670_s2, path: examples/pppos_client }
|
||||
needs: build_esp_modem_tests
|
||||
runs-on:
|
||||
- self-hosted
|
||||
|
8
.github/workflows/publish-docs-component.yml
vendored
8
.github/workflows/publish-docs-component.yml
vendored
@ -50,7 +50,7 @@ jobs:
|
||||
sudo apt-get -y install doxygen clang python3-pip
|
||||
python -m pip install breathe recommonmark esp-docs==1.4.1
|
||||
for comp in `ls components`; do
|
||||
if [ -d $GITHUB_WORKSPACE/docs/${comp} ]; then
|
||||
if [[ -d $GITHUB_WORKSPACE/docs/${comp} ]]; then
|
||||
cd $GITHUB_WORKSPACE/docs/${comp}
|
||||
if [[ "${{ env.BUMP_COMPONENT }}" == "${comp}" ]]; then
|
||||
echo "Building specific version of ${comp} (${{ env.BUMP_VERSION }})"
|
||||
@ -69,7 +69,7 @@ jobs:
|
||||
export GIT_VER=$(git describe --always)
|
||||
export GITHUB_REF_NAME=latest
|
||||
for comp in `ls components`; do
|
||||
if [ -d $GITHUB_WORKSPACE/docs/${comp} ]; then
|
||||
if [[ -d $GITHUB_WORKSPACE/docs/${comp} ]]; then
|
||||
echo "Deploying latest of ${comp}"
|
||||
export DOCS_BUILD_DIR=$GITHUB_WORKSPACE/docs/${comp}
|
||||
export DOCS_DEPLOY_PATH=$DOCS_DEPLOY_PATH_ORIG/${comp}
|
||||
@ -78,8 +78,8 @@ jobs:
|
||||
fi
|
||||
done;
|
||||
# Deploy docs with version path
|
||||
if [[ "${{ env.BUMP_VERSION }}" != "" ]] && [[ -d $GITHUB_WORKSPACE/docs/${comp} ]]; then
|
||||
echo "Deploying specific version of ${comp} (${{ env.BUMP_VERSION }})"
|
||||
if [[ "${{ env.BUMP_VERSION }}" != "" ]] && [[ -d $GITHUB_WORKSPACE/docs/${{ env.BUMP_COMPONENT }} ]]; then
|
||||
echo "Deploying specific version of ${{ env.BUMP_COMPONENT }} (${{ env.BUMP_VERSION }})"
|
||||
cd $GITHUB_WORKSPACE/docs/${{ env.BUMP_COMPONENT }}
|
||||
export GITHUB_REF_NAME=${{ env.BUMP_VERSION }}
|
||||
deploy-docs
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
Contributions in the form of pull requests, issue reports, and feature requests are welcome!
|
||||
|
||||
## Common Terminology:
|
||||
* [Type]: Examples include feat (for new features), fix (for bug fixes), ci (for continuous integration), bump (for version updates), etc. You can find a comprehensive list of types in .pre-commit-config.yaml on line 65.
|
||||
* [Scope]: Refers to specific sections or areas within the project, such as mdns, modem, common, console, etc. You can discover additional scopes in .pre-commit-config.yaml on line 65.
|
||||
* [Component]: This is the name of the component, and it should match the directory name where the component code is located.
|
||||
|
||||
## Submitting a PR
|
||||
|
||||
- [ ] Fork the [esp-protocols repository on GitHub](https://github.com/espressif/esp-protocols) to start making your changes.
|
||||
@ -14,6 +19,37 @@ For quick merging, the contribution should be short, and concentrated on a singl
|
||||
|
||||
Please follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) rule when writing commit messages.
|
||||
|
||||
A typical commit message title template:
|
||||
|
||||
Template:
|
||||
`[type]([scope]): Message`
|
||||
|
||||
e.g.
|
||||
`feat(console): Added fully operational ifconfig command`
|
||||
|
||||
|
||||
## Creating a new component
|
||||
|
||||
Steps:
|
||||
1. Add a file named .cz.yaml to the root of the component.
|
||||
|
||||
The template for .cz.yaml should look like this:
|
||||
```
|
||||
---
|
||||
commitizen:
|
||||
bump_message: 'bump([scope]): $current_version -> $new_version'
|
||||
pre_bump_hooks: python ../../ci/changelog.py [component]
|
||||
tag_format: [component]-v$version
|
||||
version: 0.0.0
|
||||
version_files:
|
||||
- idf_component.yml
|
||||
```
|
||||
2. Run the following command to bump the version of the component:
|
||||
|
||||
`ci/bump [component] [version] --bump-message "bump([scope]): First version [version]"`
|
||||
|
||||
Replace [component], [version] and [scope] with the specific component name, version and scope you are working with. This command will help you bump the version of the component with the provided details.
|
||||
|
||||
## Release process
|
||||
|
||||
When releasing a new component version we have to:
|
||||
|
@ -33,3 +33,7 @@ Please refer to instructions in [ESP-IDF](https://github.com/espressif/esp-idf)
|
||||
|
||||
* Brief introduction [README](components/esp_mqtt_cxx/README.md)
|
||||
* Full html [documentation](https://docs.espressif.com/projects/esp-protocols/esp_mqtt_cxx/docs/latest/index.html)
|
||||
|
||||
### console_simple_init
|
||||
|
||||
* Brief introduction [README](components/console_simple_init/README.md)
|
||||
|
2
ci/bump
2
ci/bump
@ -14,7 +14,7 @@ if ! cz bump --dry-run; then
|
||||
fi
|
||||
|
||||
cz_bump_out=`cz bump --files-only "$@"`
|
||||
commit_title=`echo "${cz_bump_out}" | head -1`
|
||||
commit_title=`echo "${cz_bump_out}" | grep "bump(" | head -1`
|
||||
commit_body=`cat ../../release_notes.txt`
|
||||
|
||||
git add -u .
|
||||
|
@ -31,6 +31,11 @@ def main():
|
||||
'breaking': 'Breaking changes',
|
||||
'major': 'Major changes'
|
||||
}
|
||||
|
||||
res = git('show-ref', '--tags', _tty_out=False)
|
||||
if old_ref not in res:
|
||||
old_ref = git('rev-list', '--max-parents=0', 'HEAD', _tty_out=False).strip()
|
||||
|
||||
brief_log = git.log('--oneline', '{}..HEAD'.format(old_ref), '--', 'components/' + component, _tty_out=False)
|
||||
for oneline in brief_log.splitlines():
|
||||
[commit, brief_msg] = oneline.split(' ', 1)
|
||||
@ -80,6 +85,11 @@ def main():
|
||||
changelog += '- {}\n'.format(it)
|
||||
changelog += '\n'
|
||||
filename = os.path.join(root_path, 'components', component, 'CHANGELOG.md')
|
||||
# Check if the changelog file exists.
|
||||
if not os.path.exists(filename):
|
||||
# File does not exist, create it
|
||||
with open(filename, 'w') as file:
|
||||
file.write('# Changelog\n\n')
|
||||
# insert the actual changelog to the beginning of the file, just after the title (2nd line)
|
||||
with open(filename, 'r') as orig_changelog:
|
||||
changelog_title = orig_changelog.readline(
|
||||
|
@ -12,6 +12,7 @@ if git log -1 -m --name-only --pretty="" | grep -q components/${comp}/idf_compon
|
||||
echo "${comp}: Component version file has changed"
|
||||
version=`grep version: components/${comp}/.cz.yaml`
|
||||
version=${version#*version: }
|
||||
version="${version//\~/_}"
|
||||
|
||||
tag_format=`grep tag_format: components/${comp}/.cz.yaml`
|
||||
tag_format=${tag_format#*tag_format: }
|
||||
|
7
components/asio/.cz.yaml
Normal file
7
components/asio/.cz.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
commitizen:
|
||||
bump_message: 'bump(asio): $current_version -> $new_version'
|
||||
pre_bump_hooks: python ../../ci/changelog.py asio
|
||||
tag_format: asio-v$version
|
||||
version: 1.28.0~0
|
||||
version_files:
|
||||
- idf_component.yml
|
@ -1,5 +1,29 @@
|
||||
# Changelog
|
||||
|
||||
## [1.28.0~0](https://github.com/espressif/esp-protocols/commits/asio-1.28.0~0)
|
||||
|
||||
### Features
|
||||
|
||||
- Updates asio to 1.28 ([b310abe](https://github.com/espressif/esp-protocols/commit/b310abe))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Makes the examples to override path ([842b2b2](https://github.com/espressif/esp-protocols/commit/842b2b2))
|
||||
- Removes esp_exception and make all examples to use exceptions ([c1c9350](https://github.com/espressif/esp-protocols/commit/c1c9350))
|
||||
- removed Wno-format flag and fixed formatting warnings ([c48e442](https://github.com/espressif/esp-protocols/commit/c48e442))
|
||||
- added idf_component.yml for examples ([d273e10](https://github.com/espressif/esp-protocols/commit/d273e10))
|
||||
- Reintroduce missing CHANGELOGs ([200cbb3](https://github.com/espressif/esp-protocols/commit/200cbb3), [#235](https://github.com/espressif/esp-protocols/issues/235))
|
||||
|
||||
### Updated
|
||||
|
||||
- docs(common): updated component and example links ([f48d9b2](https://github.com/espressif/esp-protocols/commit/f48d9b2))
|
||||
- docs(common): improving documentation ([ca3fce0](https://github.com/espressif/esp-protocols/commit/ca3fce0))
|
||||
- Add homepage URL and License to all components ([ef3f0ee](https://github.com/espressif/esp-protocols/commit/ef3f0ee))
|
||||
- Added badges with version of components to the respective README files ([e4c8a59](https://github.com/espressif/esp-protocols/commit/e4c8a59))
|
||||
- CI: Fix ASIO example test ([6e2bb51](https://github.com/espressif/esp-protocols/commit/6e2bb51))
|
||||
- Examples: using pytest.ini from top level directory ([aee016d](https://github.com/espressif/esp-protocols/commit/aee016d))
|
||||
- CI: fixing the files to be complient with pre-commit hooks ([945bd17](https://github.com/espressif/esp-protocols/commit/945bd17))
|
||||
|
||||
## [1.14.1~3](https://github.com/espressif/esp-protocols/commits/f148c98)
|
||||
|
||||
### Updated
|
||||
|
@ -25,6 +25,7 @@ The control of lifetime of the class, done by `std::shared_ptr` usage, guarantee
|
||||
async operations until it's not needed any more. This makes necessary that all of the async operation class must start
|
||||
its lifetime as a `std::shared_ptr` due to the usage of `std::enable_shared_from_this`.
|
||||
|
||||
```
|
||||
|
||||
User creates a shared_ptr──┐
|
||||
of AddressResolution and │
|
||||
@ -47,6 +48,7 @@ its lifetime as a `std::shared_ptr` due to the usage of `std::enable_shared_from
|
||||
is called. │
|
||||
└────►Completion Handler()
|
||||
|
||||
```
|
||||
|
||||
The previous diagram shows the process and the life span of each of the tasks in this examples. At each stage the
|
||||
object responsible for the last action inject itself to the completion handler of the next stage for reuse.
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: "1.14.1~3"
|
||||
version: "1.28.0~0"
|
||||
description: ASIO
|
||||
url: https://github.com/espressif/esp-protocols/tree/master/components/asio
|
||||
dependencies:
|
||||
|
@ -3,6 +3,6 @@ commitizen:
|
||||
bump_message: 'bump(console): $current_version -> $new_version'
|
||||
pre_bump_hooks: python ../../ci/changelog.py console_simple_init
|
||||
tag_format: console_simple_init-v$version
|
||||
version: 1.0.1
|
||||
version: 1.0.2
|
||||
version_files:
|
||||
- idf_component.yml
|
||||
|
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## [1.0.2](https://github.com/espressif/esp-protocols/commits/console_simple_init-v1.0.2)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fixed bump version check in publish-docs yml ([e834d47](https://github.com/espressif/esp-protocols/commit/e834d47))
|
||||
|
||||
## [1.0.1](https://github.com/espressif/esp-protocols/commits/console_simple_init-v1.0.1)
|
||||
|
||||
### Bug Fixes
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
int do_user_cmd(int argc, char **argv)
|
||||
{
|
||||
printf("Hello from user command\n");
|
||||
printf("Hello from user command.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: 1.0.1
|
||||
version: 1.0.2
|
||||
description: The component provides helper functions for easy initialization and start of esp console.
|
||||
url: https://github.com/espressif/esp-protocols/tree/master/components/console_simple_init
|
||||
dependencies:
|
||||
|
@ -3,6 +3,6 @@ commitizen:
|
||||
bump_message: 'bump(modem): $current_version -> $new_version'
|
||||
pre_bump_hooks: python ../../ci/changelog.py esp_modem
|
||||
tag_format: modem-v$version
|
||||
version: 1.0.3
|
||||
version: 1.0.4
|
||||
version_files:
|
||||
- idf_component.yml
|
||||
|
@ -1,5 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
## [1.0.4](https://github.com/espressif/esp-protocols/commits/modem-v1.0.4)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Added USB runner with ESP32S2 with A7670 ([edeb936](https://github.com/espressif/esp-protocols/commit/edeb936))
|
||||
- Extend docs on AT client example ([1f2ceed](https://github.com/espressif/esp-protocols/commit/1f2ceed))
|
||||
- Fix pytest exclusion, gitignore, and changelog checks ([2696221](https://github.com/espressif/esp-protocols/commit/2696221))
|
||||
- Fix DTE to post fragments to parsers for USB term ([1db1e15](https://github.com/espressif/esp-protocols/commit/1db1e15))
|
||||
- Fix DUAL_MODE regression from cb6e03ac ([2aada0f](https://github.com/espressif/esp-protocols/commit/2aada0f))
|
||||
- Fix AT client example to use custom AT processing ([1a5ba98](https://github.com/espressif/esp-protocols/commit/1a5ba98), [#352](https://github.com/espressif/esp-protocols/issues/352))
|
||||
|
||||
## [1.0.3](https://github.com/espressif/esp-protocols/commits/modem-v1.0.3)
|
||||
|
||||
### Bug Fixes
|
||||
|
@ -9,6 +9,20 @@ This example could be used in two different configurations:
|
||||
1) Custom TCP transport: Implements a TCP transport in form of AT commands and uses it as custom transport for mqtt client.
|
||||
2) Localhost listener: Uses standard transports to connect and forwards socket layer data from the client to the modem using AT commands.
|
||||
|
||||
### Custom TCP transport
|
||||
|
||||
This configuration expects that the network library, that is used to communicate with the endpoint uses `tcp_transport` component. In this example, we use `esp-mqtt` which supports custom transports so that we can implement a transport layer that communicate on TCP layer using AT commands. If we want to use TLS, we could add an SSL layer on top of this TCP layer.
|
||||
|
||||
To enable this mode, please set `EXAMPLE_CUSTOM_TCP_TRANSPORT=y`
|
||||
|
||||

|
||||
|
||||
### Localhost listener
|
||||
|
||||
This configuration could be used with any network library, which is connecting to a localhost endpoint instead of remote one. This example creates a localhost listener which basically mimics the remote endpoint by forwarding the traffic between the library and the TCP/socket layer of the modem (which is already secure if the TLS is used in the network library)
|
||||
|
||||

|
||||
|
||||
### Supported IDF versions
|
||||
|
||||
This example is supported from IDF `v5.0`.
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 137 KiB |
Binary file not shown.
After Width: | Height: | Size: 123 KiB |
@ -0,0 +1,14 @@
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
# Override some defaults to enable PPP
|
||||
CONFIG_LWIP_PPP_SUPPORT=y
|
||||
CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y
|
||||
CONFIG_LWIP_PPP_PAP_SUPPORT=y
|
||||
CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=4096
|
||||
CONFIG_LWIP_PPP_ENABLE_IPV6=n
|
||||
CONFIG_EXAMPLE_SERIAL_CONFIG_USB=y
|
||||
CONFIG_EXAMPLE_MODEM_DEVICE_A7670=y
|
||||
CONFIG_EXAMPLE_MODEM_PPP_APN="lpwa.vodafone.com"
|
||||
CONFIG_EXAMPLE_MODEM_PPP_AUTH_NONE=y
|
||||
CONFIG_EXAMPLE_MQTT_TEST_TOPIC="/ci/esp-modem/pppos-client"
|
||||
CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y
|
||||
CONFIG_ESP32_PANIC_PRINT_HALT=y
|
@ -1,4 +1,4 @@
|
||||
version: "1.0.3"
|
||||
version: "1.0.4"
|
||||
description: esp modem
|
||||
url: https://github.com/espressif/esp-protocols/tree/master/components/esp_modem
|
||||
dependencies:
|
||||
|
@ -33,7 +33,7 @@ DTE::DTE(std::unique_ptr<Terminal> terminal):
|
||||
DTE::DTE(const esp_modem_dte_config *config, std::unique_ptr<Terminal> t, std::unique_ptr<Terminal> s):
|
||||
buffer(config->dte_buffer_size),
|
||||
cmux_term(nullptr), primary_term(std::move(t)), secondary_term(std::move(s)),
|
||||
mode(modem_mode::UNDEF)
|
||||
mode(modem_mode::DUAL_MODE)
|
||||
{
|
||||
set_command_callbacks();
|
||||
}
|
||||
@ -41,7 +41,7 @@ DTE::DTE(const esp_modem_dte_config *config, std::unique_ptr<Terminal> t, std::u
|
||||
DTE::DTE(std::unique_ptr<Terminal> t, std::unique_ptr<Terminal> s):
|
||||
buffer(dte_default_buffer_size),
|
||||
cmux_term(nullptr), primary_term(std::move(t)), secondary_term(std::move(s)),
|
||||
mode(modem_mode::UNDEF)
|
||||
mode(modem_mode::DUAL_MODE)
|
||||
{
|
||||
set_command_callbacks();
|
||||
}
|
||||
@ -78,9 +78,9 @@ void DTE::set_command_callbacks()
|
||||
if (command_cb.process_line(data, 0, len)) {
|
||||
return true;
|
||||
}
|
||||
// cannot inflate and the processing hasn't finishes in the first iteration -> report a failure
|
||||
command_cb.give_up();
|
||||
return true;
|
||||
// cannot inflate and the processing hasn't finishes in the first iteration, but continue
|
||||
// (will post next fragments to the parser, since we might be just missing a last token or OK
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
// data == nullptr: Terminals which request users to read current data
|
||||
@ -313,6 +313,7 @@ void DTE::on_read(got_line_cb on_read_cb)
|
||||
if (on_read_cb == nullptr) {
|
||||
primary_term->set_read_cb(nullptr);
|
||||
internal_lock.unlock();
|
||||
set_command_callbacks();
|
||||
return;
|
||||
}
|
||||
internal_lock.lock();
|
||||
|
8
components/esp_mqtt_cxx/.cz.yaml
Normal file
8
components/esp_mqtt_cxx/.cz.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
commitizen:
|
||||
bump_message: 'bump(mqtt_cxx): $current_version -> $new_version'
|
||||
pre_bump_hooks: python ../../ci/changelog.py esp_mqtt_cxx
|
||||
tag_format: mqtt_cxx-v$version
|
||||
version: 0.2.0
|
||||
version_files:
|
||||
- idf_component.yml
|
@ -1,5 +1,26 @@
|
||||
# Changelog
|
||||
|
||||
## [0.2.0](https://github.com/espressif/esp-protocols/commits/mqtt_cxx-v0.2.0)
|
||||
|
||||
### Features
|
||||
|
||||
- configure client authentication via certificate/key or secure element ([ee09ff4](https://github.com/espressif/esp-protocols/commit/ee09ff4))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- removed Wno-format flag and fixed formatting warnings ([c48e442](https://github.com/espressif/esp-protocols/commit/c48e442))
|
||||
- Removes meaningless printf on subscribed handler (#358) ([bac742d](https://github.com/espressif/esp-protocols/commit/bac742d), [#356](https://github.com/espressif/esp-protocols/issues/356))
|
||||
- Removes unused type for configuration ([839c79d](https://github.com/espressif/esp-protocols/commit/839c79d))
|
||||
- added idf_component.yml for examples ([d273e10](https://github.com/espressif/esp-protocols/commit/d273e10))
|
||||
- Reintroduce missing CHANGELOGs ([200cbb3](https://github.com/espressif/esp-protocols/commit/200cbb3), [#235](https://github.com/espressif/esp-protocols/issues/235))
|
||||
|
||||
### Updated
|
||||
|
||||
- docs(common): updated component and example links ([f48d9b2](https://github.com/espressif/esp-protocols/commit/f48d9b2))
|
||||
- docs(esp_mqtt_cxx): updated documentation and deployment file ([a547ec8](https://github.com/espressif/esp-protocols/commit/a547ec8))
|
||||
- docs(common): improving documentation ([ca3fce0](https://github.com/espressif/esp-protocols/commit/ca3fce0))
|
||||
- Add homepage URL and License to all components ([ef3f0ee](https://github.com/espressif/esp-protocols/commit/ef3f0ee))
|
||||
|
||||
## [0.1.0](https://github.com/espressif/esp-protocols/commits/1407dfc)
|
||||
|
||||
### Updated
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: "0.1.0"
|
||||
version: "0.2.0"
|
||||
description: esp mqtt cxx
|
||||
url: https://github.com/espressif/esp-protocols/tree/master/components/esp_mqtt_cxx
|
||||
dependencies:
|
||||
|
93
components/esp_websocket_client/.gitignore
vendored
93
components/esp_websocket_client/.gitignore
vendored
@ -1,93 +0,0 @@
|
||||
.config
|
||||
*.o
|
||||
*.pyc
|
||||
|
||||
# gtags
|
||||
GTAGS
|
||||
GRTAGS
|
||||
GPATH
|
||||
|
||||
# emacs
|
||||
.dir-locals.el
|
||||
|
||||
# emacs temp file suffixes
|
||||
*~
|
||||
.#*
|
||||
\#*#
|
||||
|
||||
# eclipse setting
|
||||
.settings
|
||||
|
||||
# MacOS directory files
|
||||
.DS_Store
|
||||
|
||||
# Components Unit Test Apps files
|
||||
components/**/build
|
||||
components/**/sdkconfig
|
||||
components/**/sdkconfig.old
|
||||
|
||||
# Example project files
|
||||
examples/**/sdkconfig
|
||||
examples/**/sdkconfig.old
|
||||
examples/**/build
|
||||
|
||||
# Doc build artifacts
|
||||
docs/_build/
|
||||
docs/doxygen_sqlite3.db
|
||||
|
||||
# Downloaded font files
|
||||
docs/_static/DejaVuSans.ttf
|
||||
docs/_static/NotoSansSC-Regular.otf
|
||||
|
||||
# Unit test app files
|
||||
tools/unit-test-app/sdkconfig
|
||||
tools/unit-test-app/sdkconfig.old
|
||||
tools/unit-test-app/build
|
||||
tools/unit-test-app/builds
|
||||
tools/unit-test-app/output
|
||||
tools/unit-test-app/test_configs
|
||||
|
||||
# Unit Test CMake compile log folder
|
||||
log_ut_cmake
|
||||
|
||||
# test application build files
|
||||
test/**/build
|
||||
test/**/sdkconfig
|
||||
test/**/sdkconfig.old
|
||||
|
||||
# IDF monitor test
|
||||
tools/test_idf_monitor/outputs
|
||||
|
||||
TEST_LOGS
|
||||
|
||||
# gcov coverage reports
|
||||
*.gcda
|
||||
*.gcno
|
||||
coverage.info
|
||||
coverage_report/
|
||||
|
||||
test_multi_heap_host
|
||||
|
||||
# VS Code Settings
|
||||
.vscode/
|
||||
|
||||
# VIM files
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Clion IDE CMake build & config
|
||||
.idea/
|
||||
cmake-build-*/
|
||||
|
||||
# Results for the checking of the Python coding style and static analysis
|
||||
.mypy_cache
|
||||
flake8_output.txt
|
||||
|
||||
# ESP-IDF default build directory name
|
||||
build
|
||||
|
||||
# lock files for examples and components
|
||||
dependencies.lock
|
||||
|
||||
# ignore generated docs
|
||||
docs/html
|
@ -792,6 +792,51 @@ esp_err_t esp_websocket_client_set_headers(esp_websocket_client_handle_t client,
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t esp_websocket_client_append_header(esp_websocket_client_handle_t client, const char *key, const char *value)
|
||||
{
|
||||
// Validate the input parameters
|
||||
if (client == NULL || key == NULL || value == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
websocket_config_storage_t *cfg = client->config;
|
||||
|
||||
// Calculate the length for "key: value\r\n"
|
||||
size_t len = strlen(key) + strlen(value) + 5; // 5 accounts for ": \r\n" and null-terminator
|
||||
|
||||
// If no previous headers exist
|
||||
if (cfg->headers == NULL) {
|
||||
cfg->headers = (char *)malloc(len);
|
||||
if (cfg->headers == NULL) {
|
||||
ESP_LOGE(TAG, "Failed to allocate...");
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
snprintf(cfg->headers, len, "%s: %s\r\n", key, value);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
// Extend the current headers to accommodate the new key-value pair
|
||||
size_t current_len = strlen(cfg->headers);
|
||||
size_t new_len = current_len + len;
|
||||
|
||||
// Allocate memory for new headers
|
||||
char *new_headers = (char *)malloc(new_len);
|
||||
if (new_headers == NULL) {
|
||||
ESP_LOGE(TAG, "Failed to allocate...");
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
// Copy old headers and append the new header
|
||||
strcpy(new_headers, cfg->headers);
|
||||
snprintf(new_headers + current_len, len, "%s: %s\r\n", key, value);
|
||||
|
||||
// Free old headers and assign the new header pointer to cfg->headers
|
||||
free(cfg->headers);
|
||||
cfg->headers = new_headers;
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t esp_websocket_client_recv(esp_websocket_client_handle_t client)
|
||||
{
|
||||
int rlen;
|
||||
@ -1155,6 +1200,7 @@ int esp_websocket_client_send_fin(esp_websocket_client_handle_t client, TickType
|
||||
|
||||
int esp_websocket_client_send_with_opcode(esp_websocket_client_handle_t client, ws_transport_opcodes_t opcode, const uint8_t *data, int len, TickType_t timeout)
|
||||
{
|
||||
int ret = ESP_OK;
|
||||
if (client == NULL || len < 0 || (data == NULL && len > 0)) {
|
||||
ESP_LOGE(TAG, "Invalid arguments");
|
||||
return ESP_FAIL;
|
||||
@ -1167,24 +1213,28 @@ int esp_websocket_client_send_with_opcode(esp_websocket_client_handle_t client,
|
||||
|
||||
if (!esp_websocket_client_is_connected(client)) {
|
||||
ESP_LOGE(TAG, "Websocket client is not connected");
|
||||
ret = ESP_FAIL;
|
||||
goto unlock_and_return;
|
||||
}
|
||||
|
||||
if (client->transport == NULL) {
|
||||
ESP_LOGE(TAG, "Invalid transport");
|
||||
ret = ESP_FAIL;
|
||||
goto unlock_and_return;
|
||||
}
|
||||
if (esp_websocket_new_buf(client, true) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to setup tx buffer");
|
||||
ret = ESP_FAIL;
|
||||
goto unlock_and_return;
|
||||
}
|
||||
if (esp_websocket_client_send_with_exact_opcode(client, opcode | WS_TRANSPORT_OPCODES_FIN, data, len, timeout) != true) {
|
||||
ESP_LOGE(TAG, "Failed to send the buffer");
|
||||
ret = ESP_FAIL;
|
||||
goto unlock_and_return;
|
||||
}
|
||||
unlock_and_return:
|
||||
xSemaphoreGiveRecursive(client->lock);
|
||||
return ESP_FAIL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool esp_websocket_client_is_connected(esp_websocket_client_handle_t client)
|
||||
|
@ -79,6 +79,9 @@ static void websocket_app_start(void)
|
||||
ESP_LOGI(TAG, "Connecting to %s...", websocket_cfg.uri);
|
||||
|
||||
esp_websocket_client_handle_t client = esp_websocket_client_init(&websocket_cfg);
|
||||
// This call demonstrates adding another header; it's called to increase code coverage
|
||||
esp_websocket_client_append_header(client, "HeaderNewKey", "value");
|
||||
|
||||
esp_websocket_register_events(client, WEBSOCKET_EVENT_ANY, websocket_event_handler, (void *)client);
|
||||
|
||||
esp_websocket_client_start(client);
|
||||
@ -93,6 +96,14 @@ static void websocket_app_start(void)
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Sending fragmented message");
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
memset(data, 'a', sizeof(data));
|
||||
esp_websocket_client_send_text_partial(client, data, sizeof(data), portMAX_DELAY);
|
||||
memset(data, 'b', sizeof(data));
|
||||
esp_websocket_client_send_cont_msg(client, data, sizeof(data), portMAX_DELAY);
|
||||
esp_websocket_client_send_fin(client, portMAX_DELAY);
|
||||
|
||||
esp_websocket_client_destroy(client);
|
||||
}
|
||||
|
||||
|
@ -158,13 +158,31 @@ esp_err_t esp_websocket_client_set_uri(esp_websocket_client_handle_t client, con
|
||||
* @brief Set additional websocket headers for the client, when performing this behavior, the headers will replace the old ones
|
||||
* @pre Must stop the WebSocket client before set headers if the client has been connected
|
||||
*
|
||||
* @param[in] client The client
|
||||
* @param headers additional header strings each terminated with \r\n
|
||||
* - This API should be used after the WebSocket client connection has succeeded (i.e., once the transport layer is initialized).
|
||||
* - If you wish to set or append headers before the WebSocket client connection is established(before handshake), consider the following options:
|
||||
* 1. Input headers directly into the config options, terminating each item with [CR][LF]. This approach will replace any previous headers.
|
||||
* Example: websocket_cfg.headers = "Sec-WebSocket-Key: my_key\r\nPassword: my_pass\r\n";
|
||||
* 2. Use the `esp_websocket_client_append_header` API to append a single header to the current set.
|
||||
*
|
||||
* @param[in] client The WebSocket client handle
|
||||
* @param[in] headers Additional header strings each terminated with [CR][LF]
|
||||
*
|
||||
* @return esp_err_t
|
||||
*/
|
||||
esp_err_t esp_websocket_client_set_headers(esp_websocket_client_handle_t client, const char *headers);
|
||||
|
||||
/**
|
||||
* @brief Appends a new key-value pair to the headers of a WebSocket client.
|
||||
* @pre Ensure that this function is called before starting the WebSocket client.
|
||||
*
|
||||
* @param[in] client The WebSocket client handle
|
||||
* @param[in] key The header key to append
|
||||
* @param[in] value The associated value for the given key
|
||||
*
|
||||
* @return esp_err_t
|
||||
*/
|
||||
esp_err_t esp_websocket_client_append_header(esp_websocket_client_handle_t client, const char *key, const char *value);
|
||||
|
||||
/**
|
||||
* @brief Open the WebSocket connection
|
||||
*
|
||||
|
@ -3,6 +3,6 @@ commitizen:
|
||||
bump_message: 'bump(mdns): $current_version -> $new_version'
|
||||
pre_bump_hooks: python ../../ci/changelog.py mdns
|
||||
tag_format: mdns-v$version
|
||||
version: 1.2.1
|
||||
version: 1.2.2
|
||||
version_files:
|
||||
- idf_component.yml
|
||||
|
@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
## [1.2.2](https://github.com/espressif/esp-protocols/commits/mdns-v1.2.2)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- add terminator for the getting host name ([b6a4d94](https://github.com/espressif/esp-protocols/commit/b6a4d94))
|
||||
- Enable ESP_WIFI_CONFIG when ESP-IDF <= 5.1 ([0b783c0](https://github.com/espressif/esp-protocols/commit/0b783c0))
|
||||
- set host list NULL on destroy ([ea54eef](https://github.com/espressif/esp-protocols/commit/ea54eef))
|
||||
- removed Wno-format flag and fixed formatting warnings ([c48e442](https://github.com/espressif/esp-protocols/commit/c48e442))
|
||||
- remove the the range of MDNS_MAX_SERVICES and fix issues of string functions ([3dadce2](https://github.com/espressif/esp-protocols/commit/3dadce2))
|
||||
|
||||
## [1.2.1](https://github.com/espressif/esp-protocols/commits/mdns-v1.2.1)
|
||||
|
||||
### Features
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: "1.2.1"
|
||||
version: "1.2.2"
|
||||
description: mDNS
|
||||
url: https://github.com/espressif/esp-protocols/tree/master/components/mdns
|
||||
dependencies:
|
||||
|
@ -25,6 +25,12 @@
|
||||
#include "esp_wifi.h"
|
||||
#endif
|
||||
|
||||
#if ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(5, 1, 0)
|
||||
// IDF <= v5.1 does not support enabling/disabling esp-wifi
|
||||
#define MDNS_ESP_WIFI_ENABLED 1
|
||||
#else
|
||||
#define MDNS_ESP_WIFI_ENABLED CONFIG_ESP_WIFI_ENABLED
|
||||
#endif
|
||||
|
||||
#ifdef MDNS_ENABLE_DEBUG
|
||||
void mdns_debug_packet(const uint8_t *data, size_t len);
|
||||
@ -4158,7 +4164,7 @@ void mdns_preset_if_handle_system_event(void *arg, esp_event_base_t event_base,
|
||||
}
|
||||
|
||||
esp_netif_dhcp_status_t dcst;
|
||||
#if CONFIG_ESP_WIFI_ENABLED
|
||||
#if MDNS_ESP_WIFI_ENABLED
|
||||
if (event_base == WIFI_EVENT) {
|
||||
switch (event_id) {
|
||||
case WIFI_EVENT_STA_CONNECTED:
|
||||
@ -5360,7 +5366,7 @@ static inline void set_default_duplicated_interfaces(void)
|
||||
|
||||
static inline void unregister_predefined_handlers(void)
|
||||
{
|
||||
#if defined(CONFIG_ESP_WIFI_ENABLED) && (CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP)
|
||||
#if defined(MDNS_ESP_WIFI_ENABLED) && (CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP)
|
||||
esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, mdns_preset_if_handle_system_event);
|
||||
#endif
|
||||
#if CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP || CONFIG_MDNS_PREDEF_NETIF_ETH
|
||||
@ -5457,7 +5463,7 @@ esp_err_t mdns_init(void)
|
||||
goto free_queue;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ESP_WIFI_ENABLED) && (CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP)
|
||||
#if defined(MDNS_ESP_WIFI_ENABLED) && (CONFIG_MDNS_PREDEF_NETIF_STA || CONFIG_MDNS_PREDEF_NETIF_AP)
|
||||
if ((err = esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, mdns_preset_if_handle_system_event, NULL)) != ESP_OK) {
|
||||
goto free_event_handlers;
|
||||
}
|
||||
@ -5607,7 +5613,9 @@ esp_err_t mdns_hostname_get(char *hostname)
|
||||
}
|
||||
|
||||
MDNS_SERVICE_LOCK();
|
||||
strncpy(hostname, _mdns_server->hostname, strnlen(_mdns_server->hostname, MDNS_NAME_BUF_LEN));
|
||||
size_t len = strnlen(_mdns_server->hostname, MDNS_NAME_BUF_LEN - 1);
|
||||
strncpy(hostname, _mdns_server->hostname, len);
|
||||
hostname[len] = 0;
|
||||
MDNS_SERVICE_UNLOCK();
|
||||
return ESP_OK;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ ESP platform port currently supports only network asynchronous socket operations
|
||||
SSL/TLS support is disabled by default and could be enabled in component configuration menu by choosing TLS library from
|
||||
|
||||
- mbedTLS with OpenSSL translation layer (default option)
|
||||
- wolfSSL
|
||||
|
||||
SSL support is very basic at this stage and it does include following features:
|
||||
|
||||
@ -32,11 +31,13 @@ Internal asio settings for ESP include
|
||||
|
||||
Application Example
|
||||
-------------------
|
||||
ESP examples are based on standard asio :example:`examples <../examples>`:
|
||||
ESP examples are based on standard asio :example:`examples <../../../components/asio/examples>`:
|
||||
|
||||
- :example:`udp_echo_server <../examples/udp_echo_server>`
|
||||
- :example:`tcp_echo_server <../examples/tcp_echo_server>`
|
||||
- :example:`asio_chat <../examples/asio_chat>`
|
||||
- :example:`ssl_client_server <../examples/ssl_client_server>`
|
||||
- :example:`asio_chat <../../../components/asio/examples/asio_chat>`
|
||||
- :example:`async_request <../../../components/asio/examples/async_request>`
|
||||
- :example:`socks4 <../../../components/asio/examples/socks4>`
|
||||
- :example:`ssl_client_server <../../../components/asio/examples/ssl_client_server>`
|
||||
- :example:`tcp_echo_server <../../../components/asio/examples/tcp_echo_server>`
|
||||
- :example:`udp_echo_server <../../../components/asio/examples/udp_echo_server>`
|
||||
|
||||
Please refer to the specific example README.md for details
|
||||
|
@ -23,3 +23,6 @@ log_file = test.log
|
||||
log_file_level = INFO
|
||||
log_file_format = %(asctime)s %(levelname)s %(message)s
|
||||
log_file_date_format = %Y-%m-%d %H:%M:%S
|
||||
|
||||
# Directory patterns to avoid for recursion
|
||||
norecursedirs = "managed_components"
|
||||
|
Reference in New Issue
Block a user