jjoe64 / esp32_ble_light Goto Github PK
View Code? Open in Web Editor NEWStripped version of the ESP32 BLE library, to only support server logic and reduce size
Stripped version of the ESP32 BLE library, to only support server logic and reduce size
I want rssi distance to measure the distance between Estimote beacon to ESP33.
below code will send beacon data to cloud. I want to get distance also.
please suggest.
#include <BLEDevice.h>
#include <BLEAdvertisedDevice.h>
#include <WiFi.h>
#include <PubSubClient.h>
int scanTime = 10; //In seconds
BLEScan* pBLEScan = BLEDevice::getScan();
WiFiClient espClient;
PubSubClient client(espClient);
class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
void onResult(BLEAdvertisedDevice advertisedDevice) {
client.publish("esp32", advertisedDevice.getAddress().toString().c_str());
}
};
void setup() {
Serial.begin(115200);
WiFi.begin("hello", "hello@123");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
client.setServer("192.168.4.116", 1883);
while (!client.connected()) {
if (client.connect("ESP32Client", "admin", "admin123" )) {
}
}
BLEDevice::init("");
}
void loop() {
// put your main code here, to run repeatedly:
if(WiFi.status() == WL_CONNECTED)
{
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster
BLEScanResults foundDevices = pBLEScan->start(scanTime);
}
delay(2000);
}
Hello, I try your lib but i have this issue
can you check? thanks
Stefano
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp: In static member function 'static void BLEDevice::gapEventHandler(esp_gap_ble_cb_event_t, esp_ble_gap_cb_param_t*)':
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:123:7: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
if(BLEDevice::m_securityCallbacks!=nullptr){
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:124:66: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
esp_ble_confirm_reply(param->ble_security.ble_req.bd_addr, BLEDevice::m_securityCallbacks->onConfirmPIN(param->ble_security.key_notif.passkey));
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:132:7: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
if(BLEDevice::m_securityCallbacks!=nullptr){
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:133:70: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
esp_ble_passkey_reply(param->ble_security.ble_req.bd_addr, true, BLEDevice::m_securityCallbacks->onPassKeyRequest());
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:145:7: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
if(BLEDevice::m_securityCallbacks!=nullptr){
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:146:67: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
esp_ble_gap_security_rsp(param->ble_security.ble_req.bd_addr, BLEDevice::m_securityCallbacks->onSecurityRequest());
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:160:7: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
if(BLEDevice::m_securityCallbacks!=nullptr){
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:162:5: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
BLEDevice::m_securityCallbacks->onPassKeyNotify(param->ble_security.key_notif.passkey);
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:176:8: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
if(BLEDevice::m_securityCallbacks!=nullptr){
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:177:6: error: 'm_securityCallbacks' is not a member of 'BLEDevice'
BLEDevice::m_securityCallbacks->onAuthenticationComplete(param->ble_security.auth_cmpl);
^
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp: In static member function 'static void BLEDevice::init(std::__cxx11::string)':
C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light\src\BLEDevice.cpp:255:43: error: 'gattClientEventHandler' is not a member of 'BLEDevice'
errRc = esp_ble_gattc_register_callback(BLEDevice::gattClientEventHandler);
^
Più di una libreria trovata per "BLEDevice.h"
Usata: C:\Users\StefanoskyW\Documents\Arduino\libraries\esp32_ble_light
Non usata: C:\Users\StefanoskyW\Documents\Arduino\hardware\espressif\esp32\libraries\BLE
Non usata: C:\Users\StefanoskyW\Documents\Arduino\hardware\espressif\esp32\libraries\BLE
Non usata: C:\Users\StefanoskyW\Documents\Arduino\hardware\espressif\esp32\libraries\BLE
Non usata: C:\Users\StefanoskyW\Documents\Arduino\hardware\espressif\esp32\libraries\BLE
exit status 1
Errore durante la compilazione per la scheda SparkFun ESP32 Thing.
I am trying to use this awesome light BLE library, but need use the notify. I see it in the example, but when I compile, I get an error that there is no
error: 'class BLECharacteristic' has no member named 'notify'
error: 'class BLECharacteristic' has no member named 'notify'
pTxCharacteristic->notify();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.