summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkolban <kolban1@kolban.com>2017-10-15 12:56:03 -0500
committerkolban <kolban1@kolban.com>2017-10-15 12:56:03 -0500
commitcb1ab4ea76af17d347cdadcc003d1fe53af12aa7 (patch)
treefbedba11d1b6957cf263f207f2ecdeba7c5dd213
parentChanged pointer to ESP32 issues. (diff)
downloadthermostat-cb1ab4ea76af17d347cdadcc003d1fe53af12aa7.tar.gz
thermostat-cb1ab4ea76af17d347cdadcc003d1fe53af12aa7.tar.bz2
thermostat-cb1ab4ea76af17d347cdadcc003d1fe53af12aa7.zip
Fixes for #121
-rw-r--r--library.properties2
-rw-r--r--src/BLEAddress.cpp3
-rw-r--r--src/BLEAdvertisedDevice.cpp3
-rw-r--r--src/BLEAdvertising.cpp3
-rw-r--r--src/BLECharacteristic.cpp3
-rw-r--r--src/BLECharacteristicCallbacks.cpp3
-rw-r--r--src/BLECharacteristicMap.cpp3
-rw-r--r--src/BLEClient.cpp3
-rw-r--r--src/BLEDescriptor.cpp3
-rw-r--r--src/BLEDescriptorMap.cpp3
-rw-r--r--src/BLEDevice.cpp3
-rw-r--r--src/BLERemoteCharacteristic.cpp3
-rw-r--r--src/BLERemoteDescriptor.cpp3
-rw-r--r--src/BLERemoteService.cpp3
-rw-r--r--src/BLEScan.cpp3
-rw-r--r--src/BLEServer.cpp4
-rw-r--r--src/BLEService.cpp7
-rw-r--r--src/BLEService.h6
-rw-r--r--src/BLEValue.cpp3
-rw-r--r--src/FreeRTOS.cpp8
-rw-r--r--src/FreeRTOS.h12
21 files changed, 71 insertions, 13 deletions
diff --git a/library.properties b/library.properties
index 779706d..f473071 100644
--- a/library.properties
+++ b/library.properties
@@ -1,5 +1,5 @@
name=ESP32 BLE Arduino
-version=0.4.5
+version=0.4.6
author=Neil Kolban <kolban1@kolban.com>
maintainer=Neil Kolban <kolban1@kolban.com>
sentence=BLE functions for ESP32
diff --git a/src/BLEAddress.cpp b/src/BLEAddress.cpp
index d2f7f8b..895feda 100644
--- a/src/BLEAddress.cpp
+++ b/src/BLEAddress.cpp
@@ -13,6 +13,9 @@
#include <iomanip>
#include <string.h>
#include <stdio.h>
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
/**
diff --git a/src/BLEAdvertisedDevice.cpp b/src/BLEAdvertisedDevice.cpp
index 5074b81..83869cf 100644
--- a/src/BLEAdvertisedDevice.cpp
+++ b/src/BLEAdvertisedDevice.cpp
@@ -17,6 +17,9 @@
#include <sstream>
#include "BLEAdvertisedDevice.h"
#include "BLEUtils.h"
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG="BLEAdvertisedDevice";
BLEAdvertisedDevice::BLEAdvertisedDevice() {
diff --git a/src/BLEAdvertising.cpp b/src/BLEAdvertising.cpp
index 2647966..e5179a4 100644
--- a/src/BLEAdvertising.cpp
+++ b/src/BLEAdvertising.cpp
@@ -12,6 +12,9 @@
#include <esp_err.h>
#include "BLEUtils.h"
#include "GeneralUtils.h"
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLEAdvertising";
diff --git a/src/BLECharacteristic.cpp b/src/BLECharacteristic.cpp
index 284032e..18ba65d 100644
--- a/src/BLECharacteristic.cpp
+++ b/src/BLECharacteristic.cpp
@@ -18,6 +18,9 @@
#include "BLEUtils.h"
#include "BLE2902.h"
#include "GeneralUtils.h"
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLECharacteristic";
diff --git a/src/BLECharacteristicCallbacks.cpp b/src/BLECharacteristicCallbacks.cpp
index b733865..46905b5 100644
--- a/src/BLECharacteristicCallbacks.cpp
+++ b/src/BLECharacteristicCallbacks.cpp
@@ -8,6 +8,9 @@
#if defined(CONFIG_BT_ENABLED)
#include "BLECharacteristic.h"
#include <esp_log.h>
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLECharacteristicCallbacks";
diff --git a/src/BLECharacteristicMap.cpp b/src/BLECharacteristicMap.cpp
index 6ded0a6..bcf4a75 100644
--- a/src/BLECharacteristicMap.cpp
+++ b/src/BLECharacteristicMap.cpp
@@ -9,6 +9,9 @@
#include <sstream>
#include <iomanip>
#include "BLEService.h"
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
/**
diff --git a/src/BLEClient.cpp b/src/BLEClient.cpp
index 645c4ae..93f703a 100644
--- a/src/BLEClient.cpp
+++ b/src/BLEClient.cpp
@@ -18,6 +18,9 @@
#include <string>
#include <sstream>
#include <unordered_set>
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
/*
* Design
diff --git a/src/BLEDescriptor.cpp b/src/BLEDescriptor.cpp
index 4a7fda6..8362af0 100644
--- a/src/BLEDescriptor.cpp
+++ b/src/BLEDescriptor.cpp
@@ -16,6 +16,9 @@
#include "BLEService.h"
#include "BLEDescriptor.h"
#include "GeneralUtils.h"
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLEDescriptor";
diff --git a/src/BLEDescriptorMap.cpp b/src/BLEDescriptorMap.cpp
index b211652..4e372e1 100644
--- a/src/BLEDescriptorMap.cpp
+++ b/src/BLEDescriptorMap.cpp
@@ -11,6 +11,9 @@
#include "BLECharacteristic.h"
#include "BLEDescriptor.h"
#include <esp_gatts_api.h> // ESP32 BLE
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
/**
* @brief Return the descriptor by UUID.
diff --git a/src/BLEDevice.cpp b/src/BLEDevice.cpp
index b2777e5..97d02b1 100644
--- a/src/BLEDevice.cpp
+++ b/src/BLEDevice.cpp
@@ -26,6 +26,9 @@
#include "BLEClient.h"
#include "BLEUtils.h"
#include "GeneralUtils.h"
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLEDevice";
diff --git a/src/BLERemoteCharacteristic.cpp b/src/BLERemoteCharacteristic.cpp
index 2e0fbb0..ba781d2 100644
--- a/src/BLERemoteCharacteristic.cpp
+++ b/src/BLERemoteCharacteristic.cpp
@@ -18,6 +18,9 @@
#include "BLEUtils.h"
#include "GeneralUtils.h"
#include "BLERemoteDescriptor.h"
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLERemoteCharacteristic"; // The logging tag for this class.
diff --git a/src/BLERemoteDescriptor.cpp b/src/BLERemoteDescriptor.cpp
index a606929..7a509f8 100644
--- a/src/BLERemoteDescriptor.cpp
+++ b/src/BLERemoteDescriptor.cpp
@@ -10,6 +10,9 @@
#include "BLERemoteDescriptor.h"
#include "GeneralUtils.h"
#include <esp_log.h>
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLERemoteDescriptor";
diff --git a/src/BLERemoteService.cpp b/src/BLERemoteService.cpp
index c312e94..c0df06c 100644
--- a/src/BLERemoteService.cpp
+++ b/src/BLERemoteService.cpp
@@ -13,6 +13,9 @@
#include "GeneralUtils.h"
#include <esp_log.h>
#include <esp_err.h>
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLERemoteService";
diff --git a/src/BLEScan.cpp b/src/BLEScan.cpp
index 925c09d..d3157b7 100644
--- a/src/BLEScan.cpp
+++ b/src/BLEScan.cpp
@@ -17,6 +17,9 @@
#include "BLEScan.h"
#include "BLEUtils.h"
#include "GeneralUtils.h"
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLEScan";
diff --git a/src/BLEServer.cpp b/src/BLEServer.cpp
index 4a8dfd5..0e66ec0 100644
--- a/src/BLEServer.cpp
+++ b/src/BLEServer.cpp
@@ -20,6 +20,9 @@
#include <string>
#include <gatt_api.h>
#include <unordered_set>
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG = "BLEServer";
@@ -198,7 +201,6 @@ void BLEServer::handleGATTServerEvent(
// - uint16_t app_id
case ESP_GATTS_REG_EVT: {
m_gatts_if = gatts_if;
-
m_semaphoreRegisterAppEvt.give(); // Unlock the mutex waiting for the registration of the app.
break;
} // ESP_GATTS_REG_EVT
diff --git a/src/BLEService.cpp b/src/BLEService.cpp
index 9e7fa28..669ed26 100644
--- a/src/BLEService.cpp
+++ b/src/BLEService.cpp
@@ -56,9 +56,14 @@ BLEService::BLEService(BLEUUID uuid, uint32_t numHandles) {
* @param [in] gatts_if The handle of the GATT server interface.
* @return N/A.
*/
+
void BLEService::executeCreate(BLEServer *pServer) {
//ESP_LOGD(LOG_TAG, ">> executeCreate() - Creating service (esp_ble_gatts_create_service) service uuid: %s", getUUID().toString().c_str());
- getUUID(); // Needed for a weird bug fix
+ //getUUID(); // Needed for a weird bug fix
+ //char x[1000];
+ //memcpy(x, &m_uuid, sizeof(m_uuid));
+ //char x[10];
+ //memcpy(x, &deleteMe, 10);
m_pServer = pServer;
m_semaphoreCreateEvt.take("executeCreate"); // Take the mutex and release at event ESP_GATTS_CREATE_EVT
diff --git a/src/BLEService.h b/src/BLEService.h
index 9a93aff..19b472e 100644
--- a/src/BLEService.h
+++ b/src/BLEService.h
@@ -78,10 +78,12 @@ private:
uint16_t m_handle;
BLECharacteristic* m_lastCreatedCharacteristic;
BLEServer* m_pServer;
+ BLEUUID m_uuid;
+ char deleteMe[10];
//FreeRTOS::Semaphore m_serializeMutex;
FreeRTOS::Semaphore m_semaphoreCreateEvt = FreeRTOS::Semaphore("CreateEvt");
- FreeRTOS::Semaphore m_semaphoreStartEvt = FreeRTOS::Semaphore("StartEvt");
- BLEUUID m_uuid;
+ FreeRTOS::Semaphore m_semaphoreStartEvt = FreeRTOS::Semaphore("StartEvt");
+
uint32_t m_numHandles;
uint16_t getHandle();
diff --git a/src/BLEValue.cpp b/src/BLEValue.cpp
index d36d207..49818e2 100644
--- a/src/BLEValue.cpp
+++ b/src/BLEValue.cpp
@@ -10,6 +10,9 @@
#include <esp_log.h>
#include "BLEValue.h"
+#ifdef ARDUINO_ARCH_ESP32
+#include "esp32-hal-log.h"
+#endif
static const char* LOG_TAG="BLEValue";
diff --git a/src/FreeRTOS.cpp b/src/FreeRTOS.cpp
index dea73bf..3cabd91 100644
--- a/src/FreeRTOS.cpp
+++ b/src/FreeRTOS.cpp
@@ -4,8 +4,9 @@
* Created on: Feb 24, 2017
* Author: kolban
*/
-#include <freertos/FreeRTOS.h>
-#include <freertos/task.h>
+#include <freertos/FreeRTOS.h> // Include the base FreeRTOS definitions
+#include <freertos/task.h> // Include the task definitions
+#include <freertos/semphr.h> // Include the semaphore definitions
#include <string>
#include <sstream>
#include <iomanip>
@@ -102,6 +103,9 @@ FreeRTOS::Semaphore::~Semaphore() {
*/
void FreeRTOS::Semaphore::give() {
xSemaphoreGive(m_semaphore);
+#ifdef ARDUINO_ARCH_ESP32
+ FreeRTOS::sleep(10);
+#endif
ESP_LOGV(LOG_TAG, "Semaphore giving: %s", toString().c_str());
m_owner = "<N/A>";
} // Semaphore::give
diff --git a/src/FreeRTOS.h b/src/FreeRTOS.h
index 320f4cc..edaa9df 100644
--- a/src/FreeRTOS.h
+++ b/src/FreeRTOS.h
@@ -10,9 +10,9 @@
#include <stdint.h>
#include <string>
-#include <freertos/FreeRTOS.h>
-#include <freertos/task.h>
-#include <freertos/semphr.h>
+#include <freertos/FreeRTOS.h> // Include the base FreeRTOS definitions
+#include <freertos/task.h> // Include the task definitions
+#include <freertos/semphr.h> // Include the semaphore definitions
/**
@@ -40,9 +40,9 @@ public:
std::string toString();
private:
SemaphoreHandle_t m_semaphore;
- std::string m_name;
- std::string m_owner;
- uint32_t m_value;
+ std::string m_name;
+ std::string m_owner;
+ uint32_t m_value;
};
};