Compare commits

..

6 Commits

24 changed files with 53 additions and 39 deletions

View File

@ -14,11 +14,12 @@ elseif("nimble" IN_LIST BUILD_COMPONENTS OR "__nimble" IN_LIST __hack_component_
)
endif()
if("arduino" IN_LIST BUILD_COMPONENTS OR __hack_component_targets MATCHES "__idf_arduino")
list(APPEND ESP_NIMBLE_PRIV_REQUIRES
arduino
)
endif()
# Dont use arduino bullshit
#if("arduino" IN_LIST BUILD_COMPONENTS OR __hack_component_targets MATCHES "__idf_arduino")
# list(APPEND ESP_NIMBLE_PRIV_REQUIRES
# arduino
# )
#endif()
idf_component_register(
REQUIRED_IDF_TARGETS
@ -53,7 +54,12 @@ idf_component_register(
REQUIRES
bt
nvs_flash
esp_ringbuf
PRIV_REQUIRES
${ESP_NIMBLE_PRIV_REQUIRES}
)
target_compile_options(${COMPONENT_TARGET}
PUBLIC
-DDONT_USE_ARDUINO_BULLSHIT
)

View File

@ -155,7 +155,7 @@ void FreeRTOS::Semaphore::give() {
} else {
xSemaphoreGive(m_semaphore);
}
// #ifdef ARDUINO_ARCH_ESP32
// #if defined(ARDUINO_ARCH_ESP32) && !defined(DONT_USE_ARDUINO_BULLSHIT)
// FreeRTOS::sleep(10);
// #endif
@ -243,7 +243,7 @@ bool FreeRTOS::Semaphore::take(uint32_t timeoutMs, std::string owner) {
std::string FreeRTOS::Semaphore::toString() {
char hex[9];
std::string res = "name: " + m_name + " (0x";
snprintf(hex, sizeof(hex), "%08x", (uint32_t)m_semaphore);
snprintf(hex, sizeof(hex), "%08lx", (uint32_t)m_semaphore);
res += hex;
res += "), owner: " + m_owner;
return res;

View File

@ -45,7 +45,7 @@
/* of data as per HID Class standard */
/* Main items */
#ifdef ARDUINO_ARCH_ESP32
#if defined(ARDUINO_ARCH_ESP32) && !defined(DONT_USE_ARDUINO_BULLSHIT)
#define HIDINPUT(size) (0x80 | size)
#define HIDOUTPUT(size) (0x90 | size)
#else

View File

@ -12,7 +12,7 @@
* Author: kolban
*/
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include <algorithm>

View File

@ -15,7 +15,7 @@
#ifndef COMPONENTS_NIMBLEADDRESS_H_
#define COMPONENTS_NIMBLEADDRESS_H_
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "nimble/ble.h"
/**** FIX COMPILATION ****/

View File

@ -12,7 +12,7 @@
* Author: kolban
*/
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include <string.h>
#include <algorithm>

View File

@ -15,6 +15,7 @@
#ifndef MAIN_NIMBLEBEACON_H_
#define MAIN_NIMBLEBEACON_H_
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "NimBLEUUID.h"
/**
* @brief Representation of a beacon.
@ -48,4 +49,5 @@ public:
void setSignalPower(int8_t signalPower);
}; // NimBLEBeacon
#endif
#endif /* MAIN_NIMBLEBEACON_H_ */

View File

@ -473,7 +473,7 @@ NimBLECharacteristicCallbacks* NimBLECharacteristic::getCallbacks() {
* @param [in] length The length of the data in bytes.
*/
void NimBLECharacteristic::setValue(const uint8_t* data, size_t length) {
#if CONFIG_LOG_DEFAULT_LEVEL > 3 || (ARDUINO_ARCH_ESP32 && CORE_DEBUG_LEVEL >= 4)
#if CONFIG_LOG_DEFAULT_LEVEL > 3 || (ARDUINO_ARCH_ESP32 && !defined(DONT_USE_ARDUINO_BULLSHIT) && CORE_DEBUG_LEVEL >= 4)
char* pHex = NimBLEUtils::buildHexData(nullptr, data, length);
NIMBLE_LOGD(LOG_TAG, ">> setValue: length=%d, data=%s, characteristic UUID=%s", length, pHex, getUUID().toString().c_str());
free(pHex);

View File

@ -1034,7 +1034,7 @@ uint16_t NimBLEClient::getMTU() {
NIMBLE_LOGD(LOG_TAG, "ble_sm_inject_io result: %d", rc);
} else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) {
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %d", event->passkey.params.numcmp);
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %lu", event->passkey.params.numcmp);
pkey.action = event->passkey.params.action;
// Compatibility only - Do not use, should be removed the in future
if(NimBLEDevice::m_securityCallbacks != nullptr) {

View File

@ -12,7 +12,7 @@
* Author: kolban
*/
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "nimconfig.h"
#include "NimBLEDevice.h"
@ -30,7 +30,7 @@
#include "services/gap/ble_svc_gap.h"
#include "services/gatt/ble_svc_gatt.h"
#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
#if defined(CONFIG_ENABLE_ARDUINO_DEPENDS) && !defined(DONT_USE_ARDUINO_BULLSHIT)
#include "esp32-hal-bt.h"
#endif
@ -740,7 +740,7 @@ NimBLEAddress NimBLEDevice::getWhiteListAddress(size_t index) {
int rc=0;
esp_err_t errRc = ESP_OK;
#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
#if defined(CONFIG_ENABLE_ARDUINO_DEPENDS) && !defined(DONT_USE_ARDUINO_BULLSHIT)
// make sure the linker includes esp32-hal-bt.c so ardruino init doesn't release BLE memory.
btStarted();
#endif
@ -783,6 +783,8 @@ NimBLEAddress NimBLEDevice::getWhiteListAddress(size_t index) {
// Set the device name.
rc = ble_svc_gap_device_name_set(deviceName.c_str());
if (rc != 0)
NIMBLE_LOGE(LOG_TAG, "ble_svc_gap_device_name_set() failed %i name_size=%zd", rc, deviceName.size());
assert(rc == 0);
ble_store_config_init();
@ -808,10 +810,12 @@ NimBLEAddress NimBLEDevice::getWhiteListAddress(size_t index) {
if (ret == 0) {
nimble_port_deinit();
#if 0
ret = esp_nimble_hci_and_controller_deinit();
if (ret != ESP_OK) {
NIMBLE_LOGE(LOG_TAG, "esp_nimble_hci_and_controller_deinit() failed with error: %d", ret);
}
#endif
initialized = false;
m_synced = false;

View File

@ -15,7 +15,7 @@
#ifndef MAIN_NIMBLEDEVICE_H_
#define MAIN_NIMBLEDEVICE_H_
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "nimconfig.h"

View File

@ -12,7 +12,7 @@
* Author: pcbreflux
*/
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "NimBLEEddystoneTLM.h"
#include "NimBLELog.h"
@ -124,30 +124,30 @@ std::string NimBLEEddystoneTLM::toString() {
out += " C\n";
out += "Adv. Count ";
snprintf(val, sizeof(val), "%d", ENDIAN_CHANGE_U32(m_eddystoneData.advCount));
snprintf(val, sizeof(val), "%lu", ENDIAN_CHANGE_U32(m_eddystoneData.advCount));
out += val;
out += "\n";
out += "Time in seconds ";
snprintf(val, sizeof(val), "%d", rawsec/10);
snprintf(val, sizeof(val), "%lu", rawsec/10);
out += val;
out += "\n";
out += "Time ";
snprintf(val, sizeof(val), "%04d", rawsec / 864000);
snprintf(val, sizeof(val), "%04lu", rawsec / 864000);
out += val;
out += ".";
snprintf(val, sizeof(val), "%02d", (rawsec / 36000) % 24);
snprintf(val, sizeof(val), "%02lu", (rawsec / 36000) % 24);
out += val;
out += ":";
snprintf(val, sizeof(val), "%02d", (rawsec / 600) % 60);
snprintf(val, sizeof(val), "%02lu", (rawsec / 600) % 60);
out += val;
out += ":";
snprintf(val, sizeof(val), "%02d", (rawsec / 10) % 60);
snprintf(val, sizeof(val), "%02lu", (rawsec / 10) % 60);
out += val;
out += "\n";

View File

@ -14,6 +14,8 @@
#ifndef _NimBLEEddystoneTLM_H_
#define _NimBLEEddystoneTLM_H_
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "NimBLEUUID.h"
#include <string>
@ -57,4 +59,5 @@ private:
}; // NimBLEEddystoneTLM
#endif
#endif /* _NimBLEEddystoneTLM_H_ */

View File

@ -12,7 +12,7 @@
* Author: pcbreflux
*/
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "NimBLEEddystoneURL.h"
#include "NimBLELog.h"

View File

@ -14,6 +14,7 @@
#ifndef _NIMBLEEddystoneURL_H_
#define _NIMBLEEddystoneURL_H_
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "NimBLEUUID.h"
#include <string>
@ -49,4 +50,5 @@ private:
}; // NIMBLEEddystoneURL
#endif
#endif /* _NIMBLEEddystoneURL_H_ */

View File

@ -10,9 +10,7 @@
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#ifdef ARDUINO_ARCH_ESP32
#if defined(ARDUINO_ARCH_ESP32) && !defined(DONT_USE_ARDUINO_BULLSHIT)
#include "syscfg/syscfg.h"
#include "modlog/modlog.h"
@ -62,5 +60,4 @@
#endif /*ARDUINO_ARCH_ESP32*/
#endif /*CONFIG_BT_ENABLED*/
#endif /*MAIN_NIMBLELOG_H_*/
#endif /*MAIN_NIMBLELOG_H_*/

View File

@ -284,7 +284,7 @@ bool NimBLEScan::isScanning() {
* @return True if scan started or false if there was an error.
*/
bool NimBLEScan::start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResults), bool is_continue) {
NIMBLE_LOGD(LOG_TAG, ">> start(duration=%d)", duration);
NIMBLE_LOGD(LOG_TAG, ">> start(duration=%lu)", duration);
// Save the callback to be invoked when the scan completes.
m_scanCompleteCB = scanCompleteCB;

View File

@ -13,7 +13,7 @@
*/
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "NimBLESecurity.h"
#include "NimBLEDevice.h"

View File

@ -15,7 +15,7 @@
#ifndef COMPONENTS_NIMBLESECURITY_H_
#define COMPONENTS_NIMBLESECURITY_H_
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "host/ble_gap.h"
/**** FIX COMPILATION ****/

View File

@ -174,7 +174,7 @@ void NimBLEServer::start() {
abort();
}
#if CONFIG_LOG_DEFAULT_LEVEL > 3 || (ARDUINO_ARCH_ESP32 && CORE_DEBUG_LEVEL >= 4)
#if CONFIG_LOG_DEFAULT_LEVEL > 3 || (ARDUINO_ARCH_ESP32 && !defined(DONT_USE_ARDUINO_BULLSHIT) && CORE_DEBUG_LEVEL >= 4)
ble_gatts_show_local();
#endif
/*** Future use ***
@ -524,7 +524,7 @@ NimBLEConnInfo NimBLEServer::getPeerIDInfo(uint16_t id) {
NIMBLE_LOGD(LOG_TAG, "BLE_SM_IOACT_DISP; ble_sm_inject_io result: %d", rc);
} else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) {
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %d", event->passkey.params.numcmp);
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %lu", event->passkey.params.numcmp);
pkey.action = event->passkey.params.action;
// Compatibility only - Do not use, should be removed the in future
if(NimBLEDevice::m_securityCallbacks != nullptr) {

View File

@ -12,7 +12,7 @@
* Author: kolban
*/
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "NimBLEUtils.h"
#include "NimBLEUUID.h"

View File

@ -15,7 +15,7 @@
#ifndef COMPONENTS_NIMBLEUUID_H_
#define COMPONENTS_NIMBLEUUID_H_
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "host/ble_uuid.h"
/**** FIX COMPILATION ****/

View File

@ -7,7 +7,7 @@
*/
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "NimBLEUtils.h"
#include "NimBLELog.h"

View File

@ -9,7 +9,7 @@
#ifndef COMPONENTS_NIMBLEUTILS_H_
#define COMPONENTS_NIMBLEUTILS_H_
#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_NIMBLE_ENABLED)
#include "host/ble_gap.h"