Open facundoo opened 5 years ago
Haven't figured out what's wrong with their code, but the generic BLE stuff work. I installed the "ESP32 BLE Arduino" library by Neil Kolban and then got a quick example working with:
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEScan.h>
#include <BLEAdvertisedDevice.h>
int scanTime = 5; //In seconds
BLEScan* pBLEScan;
class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
void onResult(BLEAdvertisedDevice advertisedDevice) {
Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str());
}
};
void setup()
{
Serial.begin(115200);
delay(10);
BLEDevice::init("");
pBLEScan = BLEDevice::getScan(); //create new scan
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster
pBLEScan->setInterval(100);
pBLEScan->setWindow(99); // less or equal setInterval value
delay(500);
}
void loop()
{
BLEScanResults foundDevices = pBLEScan->start(scanTime, false);
Serial.print("Devices found: ");
Serial.println(foundDevices.getCount());
Serial.println("Scan done!");
pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
delay(2000);
}
Unfortunately, adding in the WiFi.h makes it 110% the size of the storage of my Beetle. :/
@Chocho2017 Please fix it. One of the top reason I baught a FireBeetle is that DFRobot ESP32 claims to be able to handle BT and WiFi concurrently, but now I see the BT library is broken. It would have the same value to me as the no brand ESP32 board with 1/3 of its price without this feature.
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp: In function 'void send_ble_data(uint8_t*, uint16_t, uint16_t)':
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:167:25: error: invalid conversion from 'esp_gatt_srvc_id_t*' to 'uint16_t {aka short unsigned int}' [-fpermissive]
ESP_GATT_AUTH_REQ_NONE);
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:167:25: error: invalid conversion from 'esp_gatt_id_t*' to 'uint16_t {aka short unsigned int}' [-fpermissive]
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:167:25: error: invalid conversion from 'uint16_t {aka short unsigned int}' to 'uint8_t {aka unsigned char}' [-fpermissive]
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:167:25: error: cannot convert 'uint8_t {aka unsigned char}' to 'esp_gatt_write_type_t' for argument '6' to 'esp_err_t esp_ble_gattc_write_char(esp_gatt_if_t, uint16_t, uint16_t, uint16_t, uint8_t*, esp_gatt_write_type_t, esp_gatt_auth_req_t)'
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp: In function 'void gattc_profile_a_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)':
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:242:59: error: cannot convert 'esp_gatt_id_t' to 'esp_gatt_srvc_id_t' in initialization
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:261:84: error: 'esp_ble_gattc_get_characteristic' was not declared in this scope
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:263:10: error: 'ESP_GATTC_GET_CHAR_EVT' was not declared in this scope
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:264:21: error: 'union esp_ble_gattc_cb_param_t' has no member named 'get_char'
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:267:21: error: 'union esp_ble_gattc_cb_param_t' has no member named 'get_char'
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:268:130: error: 'union esp_ble_gattc_cb_param_t' has no member named 'get_char'
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:270:89: error: 'union esp_ble_gattc_cb_param_t' has no member named 'get_char'
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:279:41: error: 'struct esp_ble_gattc_cb_param_t::gattc_reg_for_notify_evt_param' has no member named 'char_id'
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp: In member function 'bool DFRobot_ESP32_BLE::connected(const char*)':
C:\Users\ortizfa\Documents\Arduino\libraries\DFRobot_ESP32_WiFiBLE\DFRobot_ESP32_BLE.cpp:638:74: error: cannot convert 'bool' to 'esp_ble_addr_type_t' for argument '3' to 'esp_err_t esp_ble_gattc_open(esp_gatt_if_t, uint8_t*, esp_ble_addr_type_t, bool)'
esp_ble_gattc_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, mac, true);
exit status 1 Error compiling for board FireBeetle-ESP32.