more merge error fixes

This commit is contained in:
Jason2866
2025-07-23 18:02:58 +02:00
parent c95f289c2d
commit 8e3cdf0ee7
30 changed files with 10 additions and 748 deletions
+1 -5
View File
@@ -1,5 +1 @@
# NimBLE_extended_client example using h2zero Arduino NimBLE stack
BLE 5 client example, using the great [h2zero NimBLE](https://github.com/h2zero/NimBLE-Arduino) implementation.
Thx @h2zero for the great BLE library.
# NimBLE Sample Scan example
@@ -12,15 +12,6 @@
platform = espressif32
framework = arduino
monitor_speed = 115200
build_flags =
'-DCONFIG_BT_NIMBLE_EXT_ADV=1'
lib_deps =
https://github.com/h2zero/NimBLE-Arduino
lib_ignore =
BLE
BluetoothSerial
SimpleBLE
WiFiProv
custom_component_remove =
espressif/esp_hosted
espressif/esp_wifi_remote
@@ -40,8 +31,8 @@ custom_component_remove =
[env:esp32s3]
board = esp32-s3-devkitc-1
[env:esp32c2]
board = esp32-c2-devkitm-1
;[env:esp32c2]
;board = esp32-c2-devkitm-1
[env:esp32c3]
board = esp32-c3-devkitm-1
@@ -1,150 +0,0 @@
/** NimBLE Extended Client Demo:
*
* Demonstrates the Bluetooth 5.x client capabilities.
*
* Created: on April 2 2022
* Author: H2zero
*
*/
#include <Arduino.h>
#include <NimBLEDevice.h>
#if !CONFIG_BT_NIMBLE_EXT_ADV
# error Must enable extended advertising, see nimconfig.h file.
#endif
#define SERVICE_UUID "ABCD"
#define CHARACTERISTIC_UUID "1234"
static const NimBLEAdvertisedDevice* advDevice;
static bool doConnect = false;
static uint32_t scanTime = 10 * 1000; // In milliseconds, 0 = scan forever
/** Define the PHY's to use when connecting to peer devices, can be 1, 2, or all 3 (default).*/
static uint8_t connectPhys = BLE_GAP_LE_PHY_CODED_MASK | BLE_GAP_LE_PHY_1M_MASK /*| BLE_GAP_LE_PHY_2M_MASK */;
/** Define a class to handle the callbacks for client connection events */
class ClientCallbacks : public NimBLEClientCallbacks {
void onConnect(NimBLEClient* pClient) override { Serial.printf("Connected\n"); };
void onDisconnect(NimBLEClient* pClient, int reason) override {
Serial.printf("%s Disconnected, reason = %d - Starting scan\n", pClient->getPeerAddress().toString().c_str(), reason);
NimBLEDevice::getScan()->start(scanTime);
}
} clientCallbacks;
/** Define a class to handle the callbacks when advertisements are received */
class scanCallbacks : public NimBLEScanCallbacks {
void onResult(const NimBLEAdvertisedDevice* advertisedDevice) override {
Serial.printf("Advertised Device found: %s\n", advertisedDevice->toString().c_str());
if (advertisedDevice->isAdvertisingService(NimBLEUUID("ABCD"))) {
Serial.printf("Found Our Service\n");
doConnect = true;
/** Save the device reference in a global for the client to use*/
advDevice = advertisedDevice;
/** stop scan before connecting */
NimBLEDevice::getScan()->stop();
}
}
/** Callback to process the results of the completed scan or restart it */
void onScanEnd(const NimBLEScanResults& results, int rc) override { Serial.printf("Scan Ended\n"); }
} scanCallbacks;
/** Handles the provisioning of clients and connects / interfaces with the server */
bool connectToServer() {
NimBLEClient* pClient = nullptr;
pClient = NimBLEDevice::createClient();
pClient->setClientCallbacks(&clientCallbacks, false);
/**
* Set the PHY's to use for this connection. This is a bitmask that represents the PHY's:
* * 0x01 BLE_GAP_LE_PHY_1M_MASK
* * 0x02 BLE_GAP_LE_PHY_2M_MASK
* * 0x04 BLE_GAP_LE_PHY_CODED_MASK
* Combine these with OR ("|"), eg BLE_GAP_LE_PHY_1M_MASK | BLE_GAP_LE_PHY_2M_MASK | BLE_GAP_LE_PHY_CODED_MASK;
*/
pClient->setConnectPhy(connectPhys);
/** Set how long we are willing to wait for the connection to complete (milliseconds), default is 30000. */
pClient->setConnectTimeout(10 * 1000);
if (!pClient->connect(advDevice)) {
/** Created a client but failed to connect, don't need to keep it as it has no data */
NimBLEDevice::deleteClient(pClient);
Serial.printf("Failed to connect, deleted client\n");
return false;
}
Serial.printf("Connected to: %s RSSI: %d\n", pClient->getPeerAddress().toString().c_str(), pClient->getRssi());
/** Now we can read/write/subscribe the characteristics of the services we are interested in */
NimBLERemoteService* pSvc = nullptr;
NimBLERemoteCharacteristic* pChr = nullptr;
pSvc = pClient->getService(SERVICE_UUID);
if (pSvc) {
pChr = pSvc->getCharacteristic(CHARACTERISTIC_UUID);
if (pChr) {
if (pChr->canRead()) {
std::string value = pChr->readValue();
Serial.printf("Characteristic value: %s\n", value.c_str());
}
}
} else {
Serial.printf("ABCD service not found.\n");
}
NimBLEDevice::deleteClient(pClient);
Serial.printf("Done with this device!\n");
return true;
}
void setup() {
Serial.begin(115200);
Serial.printf("Starting NimBLE Client\n");
/** Initialize NimBLE and set the device name */
NimBLEDevice::init("NimBLE Extended Client");
/** Create aNimBLE Scan instance and set the callbacks for scan events */
NimBLEScan* pScan = NimBLEDevice::getScan();
pScan->setScanCallbacks(&scanCallbacks);
/** Set scan interval (how often) and window (how long) in milliseconds */
pScan->setInterval(97);
pScan->setWindow(67);
/**
* Active scan will gather scan response data from advertisers
* but will use more energy from both devices
*/
pScan->setActiveScan(true);
/**
* Start scanning for advertisers for the scan time specified (in milliseconds) 0 = forever
* Optional callback for when scanning stops.
*/
pScan->start(scanTime);
Serial.printf("Scanning for peripherals\n");
}
void loop() {
/** Loop here until we find a device we want to connect to */
if (doConnect) {
if (connectToServer()) {
Serial.printf("Success!, scanning for more!\n");
} else {
Serial.printf("Failed to connect, starting scan\n");
}
doConnect = false;
NimBLEDevice::getScan()->start(scanTime);
}
delay(10);
}
-1
View File
@@ -1 +0,0 @@
.pio
@@ -1,5 +0,0 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
@@ -28,6 +28,13 @@ lib_ignore = wifi
build_flags = -DBUILTIN_RGBLED_PIN=8
-DNR_OF_LEDS=1
[env:esp32-c5]
platform = espressif32
framework = arduino
board = esp32-c5-devkitc-1
build_flags = -DBUILTIN_RGBLED_PIN=27
-DNR_OF_LEDS=1
[env:esp32-c6]
platform = espressif32
framework = arduino
-1
View File
@@ -1 +0,0 @@
.pio
-1
View File
@@ -1 +0,0 @@
.pio
@@ -1,5 +0,0 @@
.pio
.vscode
.dependencies.lock
sdkconfig.esp32c6
managed_components
-1
View File
@@ -1 +0,0 @@
.pio
@@ -1,2 +0,0 @@
.pio
.vscode
@@ -1 +0,0 @@
.pio
-1
View File
@@ -1 +0,0 @@
.pio
-1
View File
@@ -1 +0,0 @@
.pio
@@ -1,112 +0,0 @@
---
name: Bug report
about: libcoap crashes, produces incorrect output, or has incorrect behavior
title: ''
labels: ''
assignees: ''
---
----------------------------- Delete Below -----------------------------
INSTRUCTIONS
============
Before submitting a new issue, please follow the checklist and try to find the
answer.
- [ ] I have read the documentation [libcoap Modules Documentation](https://libcoap.net/doc/reference/develop/modules.html)
and the issue is not addressed there.
- [ ] I have read the documentation [libcoap Manual Pages](https://libcoap.net/doc/reference/develop/manpage.html)
and the issue is not addressed there.
- [ ] I have updated my libcoap branch (develop) to the latest version and
checked that the issue is present there.
- [ ] I have searched the [Issue Tracker](https://github.com/obgm/libcoap/issues)
(both open and closed - overwrite `is:issue is:open`) for a similar issue and
not found a similar issue.
- [ ] I have checked the [Wiki](https://github.com/obgm/libcoap/wiki) to see if
the issue is reported there.
- [ ] I have read the HOWTOs provided with the source.
- [ ] I have read the [BUILDING](https://raw.githubusercontent.com/obgm/libcoap/develop/BUILDING)
on how to build from source.
If the issue cannot be solved after checking through the steps above, please
follow these instructions so we can get the needed information to help you in a
quick and effective fashion.
1. Fill in all the fields under **Environment** marked with [ ] by picking the
correct option for you in each case and deleting the others.
2. Describe your problem.
3. Include any debug logs (running the application with verbose logging).
4. Providing as much information as possible under **Other items if possible**
will help us locate and fix the problem.
5. Use [Markdown](https://guides.github.com/features/mastering-markdown/) (see
formatting buttons above) and the Preview tab to check what the issue will look
like.
6. Delete these instructions from the `Delete Below` to the `Delete Above`
marker lines before submitting this issue.
**IMPORTANT: If you do not follow these instructions and provide the necessary
details, it may not be possible to resolve your issue.**
----------------------------- Delete Above -----------------------------
## Environment
- libcoap version (run ``git describe --tags`` to find it):
// v4.3.0-rc3-41-g25fe796
- Build System: [Make|CMake]
- Operating System: [Windows|Linux|macOS|FreeBSD|Cygwin|Solaris|RIOT|Other (which?)]
- Operating System Version: [ ]
- Hosted Environment: [None|Contiki|LwIP|ESP-IDF|Other (which?)]
## Problem Description
// Detailed problem description goes here.
### Expected Behavior
// Describe what you are expecting.
### Actual Behavior
// Describe what you are seeing.
### Steps to reproduce
1. step1
2. ...
### Code to reproduce this issue
```cpp
// the code should be wrapped in the ```cpp tag so that it will be displayed
better.
#include "coap3/coap.h"
void main()
{
}
```
// If your code is longer than 30 lines, upload it as an attachment. Do not
include code that is proprietary or sensitive for your project. Try to reduce
your code as much as possible so that it only demonstrates the issue.
## Debug Logs
```
Debug verbose logs go here.
Please copy the plain text here for us to search the error log. Or attach the
complete logs but leave the main part here if the log is *too* long.
```
## Other items if possible
- [ ] Does what you are trying to do work under any configuration. Detail what
works.
- [ ] Network configuration that is not straightforward. Detail any networking
that may have NAT or firewalls that might affect what is going on.
@@ -1,14 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: General libcoap Information
url: https://libcoap.net/
about: General information about libcoap
- name: General libcoap Documentation
url: https://libcoap.net/documentation.html
about: Documentation information for libcoap
- name: Latest libcoap API Documentation
url: https://libcoap.net/doc/reference/develop/modules.html
about: Latest API information for libcoap
- name: Latest libcoap Manual Pages
url: https://libcoap.net/doc/reference/develop/manpage.html
about: Latest Manual Pages and Examples for libcoap
@@ -1,26 +0,0 @@
---
name: Feature request
about: Suggest an idea for libcoap
title: ''
labels: 'Type: Feature Request'
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. E.g. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
Please give as many details as you can. Include suggestions for useful APIs or interfaces if relevant.
**Additional context**
Add any other context or screenshots about the feature request here.
@@ -1,196 +0,0 @@
name: Build Tests
on:
push:
branches:
- main
- develop
- release-*
- gh-workflows
pull_request:
branches:
- main
- develop
env:
PLATFORM: posix
TESTS: yes
OPENSSL_INSTALL_PATH: C:\Program Files\OpenSSL-Win64\
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
CC: ["gcc", "clang"]
TLS: ["no", "openssl", "gnutls", "mbedtls"]
steps:
- uses: actions/checkout@v2
- name: setup
run: |
sudo apt-get update && sudo apt-get install -y libcunit1-dev libmbedtls-dev libgnutls28-dev libtool libtool-bin exuberant-ctags valgrind
./autogen.sh
- name: configure no-TLS
if: matrix.TLS == 'no'
run: |
mkdir build-${{matrix.TLS}}-${{matrix.CC}}
cd build-${{matrix.TLS}}-${{matrix.CC}}
$GITHUB_WORKSPACE/configure --disable-silent-rules --disable-documentation --enable-examples --enable-tests --disable-dtls CC=${{matrix.CC}}
- name: configure TLS
if: matrix.TLS != 'no'
run: |
mkdir build-${{matrix.TLS}}-${{matrix.CC}}
cd build-${{matrix.TLS}}-${{matrix.CC}}
"$GITHUB_WORKSPACE/configure" --disable-silent-rules --disable-documentation --enable-examples --enable-tests --with-${{matrix.TLS}} CC=${{matrix.CC}}
- name: compile
run: |
cd build-${{matrix.TLS}}-${{matrix.CC}}
make EXTRA_CFLAGS=-Werror && make check EXTRA_CFLAGS=-Werror
- name: test
run: |
cd build-${{matrix.TLS}}-${{matrix.CC}}
libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression tests/testdriver
tinydtls-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: setup
run: |
sudo apt-get update && sudo apt-get install -y libcunit1-dev libtool libtool-bin exuberant-ctags valgrind
./autogen.sh
- name: configure
run: |
$GITHUB_WORKSPACE/configure --disable-silent-rules --disable-documentation --enable-examples --enable-tests --with-tinydtls
- name: compile
run: |
make EXTRA_CFLAGS=-Werror && make check EXTRA_CFLAGS=-Werror
- name: test
run: |
LD_LIBRARY_PATH=ext/tinydtls libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=$GITHUB_WORKSPACE/tests/valgrind_suppression tests/testdriver
cmake-build:
runs-on: ubuntu-latest
strategy:
matrix:
TLS: ["no", "openssl", "gnutls", "mbedtls", "tinydtls"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: setup
run: |
sudo apt-get update && sudo apt-get install -y libcunit1-dev libmbedtls-dev libgnutls28-dev
cmake -E make_directory $GITHUB_WORKSPACE}/build-${{matrix.TLS}}-cmake
- name: configure no-TLS
if: matrix.TLS == 'no'
run: |
cd $GITHUB_WORKSPACE}/build-${{matrix.TLS}}-cmake
cmake $GITHUB_WORKSPACE -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON -DENABLE_DTLS=OFF -DENABLE_DOCS=OFF
- name: configure TLS
if: matrix.TLS != 'no'
run: |
cd $GITHUB_WORKSPACE}/build-${{matrix.TLS}}-cmake
cmake $GITHUB_WORKSPACE -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON -DENABLE_DTLS=ON -DENABLE_DOCS=OFF -DDTLS_BACKEND=${{matrix.TLS}}
- name: build
run: |
cd $GITHUB_WORKSPACE}/build-${{matrix.TLS}}-cmake
cmake --build .
other-build:
runs-on: ubuntu-latest
strategy:
matrix:
OS: ["contiki", "lwip"]
steps:
- uses: actions/checkout@v2
- name: setup
run: |
./autogen.sh
- name: configure
run: |
$GITHUB_WORKSPACE/configure --disable-documentation --disable-examples --disable-tests --disable-dtls
- name: compile
run: |
make -C examples/${{matrix.OS}}
ms-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Install OpenSSL on Windows (choco)
run: |
choco install openssl
shell: cmd
- name: Build sln
shell: cmd
run: call .\scripts\msbuild.sln.cmd
additional-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: setup
run: |
sudo apt-get update && sudo apt-get install -y libgnutls28-dev libtool libtool-bin exuberant-ctags
./autogen.sh
- name: configure
run: ./configure --disable-tests --disable-documentation
- name: build
run: |
make
make -C tests/oss-fuzz -f Makefile.ci check clean
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: setup
run: |
sudo apt-get update && sudo apt-get install -y libtool libtool-bin exuberant-ctags graphviz doxygen libxml2-utils xsltproc docbook-xml docbook-xsl asciidoc
./autogen.sh
- name: configure
run: ./configure --disable-tests --enable-documentation --prefix $GITHUB_WORKSPACE/test-install
- name: manuals check
run: |
make -C man
- name: manual page examples check
run: |
man/examples-code-check man
- name: doxygen check
run: |
make -C doc
- name: installation check
run: |
make install && ls -lR $GITHUB_WORKSPACE/test-install
distribution:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: setup
run: |
sudo apt-get update && sudo apt-get install -y libcunit1-dev libtool libtool-bin exuberant-ctags graphviz doxygen libxml2-utils xsltproc docbook-xml docbook-xsl asciidoc
./autogen.sh
- name: configure
run: |
mkdir build-dist
cd build-dist
$GITHUB_WORKSPACE/configure --enable-silent-rules --enable-documentation --enable-examples --disable-dtls
- name: build distribution
run: |
cd build-dist
make dist
- name: check distribution build
run: |
cd build-dist
$GITHUB_WORKSPACE/scripts/github_dist.sh
shell: bash
@@ -1,116 +0,0 @@
# .gitignore for libcoap
# autosave files
*~
\#*#
# ignoring autogenerated files and directories by autoreconf
INSTALL
Makefile
Makefile.in
aclocal.m4
ar-lib
autom4te.cache/
coap_config.h
coap_config.h.in
compile
config.*
!config.yml
configure
debian/
depcomp
install-sh
libcoap-*.tar.bz2
libtool
ltmain.sh
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
stamp-h1
# ignoring more files generated by the configure script or the make actions
.libs/
libcoap*.la
libcoap*.pc
src/**/.deps/
src/**/.dirstamp
src/**/.libs/
src/**/*.o
src/**/*.lo
src/*.lo
src/*.o
src/.deps/
src/.dirstamp
src/.libs/
build/
# the doc/ folder
doc/Doxyfile
doc/Makefile.in
doc/docbook-xsl.css
doc/doxyfile.stamp
doc/doxygen_sqlite3.db
doc/DoxygenLayout.xml
doc/upgrade_*.html
doc/html/
doc/man_html/
doc/man_tmp/
# the man/ folder
man/docbook-xsl.css
man/examples-code-check
man/examples-code-check.exe
man/examples-code-check.o
man/Makefile
man/Makefile.in
man/tmp
man/.deps/
man/*.html
man/*.txt
man/*.xml
man/*.3
man/*.5
man/*.7
# the examples/ folder
examples/.deps/
examples/*.o
examples/coap-client
examples/coap-client-*
examples/coap-etsi_iot_01
examples/coap-rd
examples/coap-rd-*
examples/coap-server
examples/coap-server-*
examples/coap-tiny
examples/*.exe
# the include/ folder
include/coap3/coap.h
# the tests/ folder
tests/.deps
tests/oss-fuzz/Makefile.ci
tests/testdriver
tests/*.o
tests/test_common.h
# ctags - Sublime plugin
tags
.tags*
TAGS
# ignore gcov-generated files
**/*.gcda
**/*.gcno
**/*.gcov
# IDE files
CMakeLists.txt.user
/.vs/
/out/
/.vscode/
/_build/
@@ -1,4 +0,0 @@
[submodule "ext/tinydtls"]
path = ext/tinydtls
url = https://github.com/eclipse/tinydtls.git
ignore = dirty
@@ -1,70 +0,0 @@
os:
- linux
language: c
compiler:
- gcc
- clang
services:
- docker
env:
- PLATFORM=posix TESTS=yes TLS=no
- PLATFORM=posix TESTS=yes TLS=gnutls SMALL_STACK=yes
- PLATFORM=posix TESTS=yes TLS=gnutls SMALL_STACK=no
- PLATFORM=posix TESTS=yes TLS=gnutls SMALL_STACK=yes EPOLL=no
- PLATFORM=posix TESTS=yes TLS=gnutls SMALL_STACK=no EPOLL=no
- PLATFORM=posix TESTS=yes TLS=openssl
- PLATFORM=posix TESTS=yes TLS=tinydtls
- PLATFORM=posix TESTS=yes TLS=mbedtls
before_install:
- docker build -t obgm/libcoap:travis-env .
branches:
only:
- main
- develop
- /^release-.*$/
- travis-test
stages:
- test
- other platforms
- dist
jobs:
include:
- stage: other platforms
env: PLATFORM=contiki TLS=no
before_script:
script:
- docker run --privileged -e CC -e PLATFORM -e TLS obgm/libcoap:travis-env /bin/sh -c "scripts/build.sh"
- stage: other platforms
env: PLATFORM=lwip TLS=no
before_script:
script:
- docker run --privileged -e CC -e PLATFORM -e TLS obgm/libcoap:travis-env /bin/sh -c "scripts/build.sh"
- stage: dist
env: PLATFORM=posix TESTS=yes TLS=no DOCS=yes
before_script:
script:
- docker run --privileged -e CC -e PLATFORM -e TESTS -e DOCS -e TLS obgm/libcoap:travis-env /bin/sh -c "scripts/dist.sh"
# Docker disables IPv6 in containers by default, so re-enable it.
before_script:
# `daemon.json` is normally missing, but let's log it in case that changes.
- sudo touch /etc/docker/daemon.json
- sudo cat /etc/docker/daemon.json
- sudo service docker stop
# This needs YAML quoting because of the curly braces.
- 'echo ''{"ipv6": true, "fixed-cidr-v6": "2001:db8:1::/64"}'' | sudo tee /etc/docker/daemon.json'
- sudo service docker start
# Fail early if docker failed on start -- add `- sudo dockerd` to debug.
- sudo docker info
# Paranoia log: what if our config got overwritten?
- sudo cat /etc/docker/daemon.json
script:
- docker run --privileged -e CC -e PLATFORM -e TESTS -e DOCS -e TLS -e EPOLL -e SMALL_STACK obgm/libcoap:travis-env /bin/sh -c "scripts/build.sh"
@@ -1,5 +0,0 @@
imagename
build.sh
*~
.*.swp
\#*#
@@ -1,7 +0,0 @@
contiki-minimal-net.a
contiki-minimal-net.map
contiki/
obj_minimal-net/
server.minimal-net
symbols.c
symbols.h
@@ -1,7 +0,0 @@
# not going for submodules here to keep things easy
lwip
lwip-contrib
# never objects, and not the resulting binary
*.o
server
-1
View File
@@ -1 +0,0 @@
.pio
-1
View File
@@ -1 +0,0 @@
.pio
-1
View File
@@ -1 +0,0 @@
.pio
@@ -1 +0,0 @@
.pio
@@ -1 +0,0 @@
.pio
@@ -1 +0,0 @@
.pio