Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/tests/server-build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build*/
sdkconfig
sdkconfig.old
managed_components/
dependencies.lock
6 changes: 6 additions & 0 deletions .github/tests/server-build/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.16)
get_filename_component(NIMBLE_CPP_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
set(EXTRA_COMPONENT_DIRS "${NIMBLE_CPP_ROOT}")
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(nimble_server_build)
1 change: 1 addition & 0 deletions .github/tests/server-build/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
idf_component_register(SRCS "main.cpp" REQUIRES esp-nimble-cpp)
9 changes: 9 additions & 0 deletions .github/tests/server-build/main/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "NimBLEDevice.h"

// Compile/link probe: exercise the server even when advertising is disabled.
extern "C" void app_main() {
NimBLEDevice::init("server-build-probe");
auto* server = NimBLEDevice::createServer();
server->advertiseOnDisconnect(false);
server->createService("180f");
}
7 changes: 7 additions & 0 deletions .github/tests/server-build/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_ROLE_CENTRAL=n
CONFIG_BT_NIMBLE_ROLE_OBSERVER=n
CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y
CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y
CONFIG_COMPILER_OPTIMIZATION_PERF=y
1 change: 1 addition & 0 deletions .github/tests/server-build/sdkconfig.no-broadcaster
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_BT_NIMBLE_ROLE_BROADCASTER=n
43 changes: 43 additions & 0 deletions .github/workflows/s31-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: S31 and server role builds

on:
workflow_dispatch:
pull_request:
push:
branches: [master]

permissions:
contents: read

jobs:
server-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [esp32s3, esp32s31]
broadcaster: [enabled, disabled]
# ESP-IDF v6.1; S31 still requires --preview. Stable 5.x jobs stay unchanged.
container: espressif/idf@sha256:81893c71bb5e570088901f21def8684c25cd2a9020281bd01b843a7655edb18c
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
path: esp-nimble-cpp
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- name: Build server role probe
env:
IDF_TARGET: ${{ matrix.target }}
BROADCASTER: ${{ matrix.broadcaster }}
shell: bash
run: |
. "${IDF_PATH}/export.sh"
cd esp-nimble-cpp/.github/tests/server-build
defaults="sdkconfig.defaults"
if [ "$BROADCASTER" = disabled ]; then defaults="$defaults;sdkconfig.no-broadcaster"; fi
idf.py --preview -D "SDKCONFIG_DEFAULTS=$defaults" build
python - "$BROADCASTER" <<'PYTHON'
import sys
from pathlib import Path
enabled = "CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y" in Path("sdkconfig").read_text().splitlines()
assert enabled == (sys.argv[1] == "enabled"), "role override was not applied"
PYTHON
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ idf_component_register(
REQUIRED_IDF_TARGETS
"esp32"
"esp32s3"
"esp32s31"
"esp32c2"
"esp32c3"
"esp32c5"
Expand Down
6 changes: 5 additions & 1 deletion src/NimBLEServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ NimBLEServer::NimBLEServer()
m_svcChanged{false},
m_deleteCallbacks{false},
m_registerAppServicesFirst{false},
# if !MYNEWT_VAL(BLE_EXT_ADV)
# if !MYNEWT_VAL(BLE_EXT_ADV) && MYNEWT_VAL(BLE_ROLE_BROADCASTER)
m_advertiseOnDisconnect{false},
# endif
m_pServerCallbacks{&defaultCallbacks},
Expand Down Expand Up @@ -363,7 +363,11 @@ bool NimBLEServer::disconnect(const NimBLEConnInfo& connInfo, uint8_t reason) co
* @param [in] enable true == advertise, false == don't advertise.
*/
void NimBLEServer::advertiseOnDisconnect(bool enable) {
# if MYNEWT_VAL(BLE_ROLE_BROADCASTER)
m_advertiseOnDisconnect = enable;
# else
(void)enable;
# endif
} // advertiseOnDisconnect
# endif

Expand Down
Loading