How to hide BLE in ESP32?

SombraRPK
Posts: 18
Joined: Wed Jul 04, 2018 2:37 am

How to hide BLE in ESP32?

Postby SombraRPK » Wed Jul 04, 2018 1:56 pm

Hi! I’m currently working on a project in which I don’t want my BLE device to be found by any other device. I’ve tried initializing the Bluetooth with no name but it’s still being found. I just want to establish the Bluetooth connection via MAC address.

Any idea is welcomed.

Thanks in advance, guys.

bobolink
Posts: 98
Joined: Mon Feb 26, 2018 4:17 pm

Re: How to hide BLE in ESP32?

Postby bobolink » Thu Jul 05, 2018 12:42 pm

iOS has BLE services that are sort of hidden (like time and battery services). They don’t want to waste battery advertising them if you don’t need them.
You find them by knowing a long UUID a priori. The process is called service “solicitation” in the BLE specification. If that is any help.

SombraRPK
Posts: 18
Joined: Wed Jul 04, 2018 2:37 am

Re: How to hide BLE in ESP32?

Postby SombraRPK » Wed Aug 01, 2018 8:47 pm

Thanks @bobolink. I'll check the BLE specification, but just to be sure, what you're saying is that if service solicitation is like "enabled" then the ESP32 can be found, otherwise it remains hidden?

bobolink
Posts: 98
Joined: Mon Feb 26, 2018 4:17 pm

Re: How to hide BLE in ESP32?

Postby bobolink » Thu Aug 02, 2018 12:02 pm

I think it has to be supported in the BLE implementation on the ESP32. It’s optional.
The ESP32 isn’t “found” because it isn’t advertising (transmitting) its services all the time. Its receiver is listening for a certain transmission, if heard then it starts advertising as a normal peripheral.
It’s complicated because the ESP32 performs two roles. As Central and as Peripheral.
I don’t know if that is what you had in mind or you wanted to control the radio directly with some kind of low probability of intercept waveform. Which is way beyond me.

Here is a video I did on soliciting services on the iPhone. It’s embarrassing to watch since I was just leaning YouTube and the narrator sounds like an idiot :D
https://youtu.be/d0woZaZjkAs

bobolink
Posts: 98
Joined: Mon Feb 26, 2018 4:17 pm

Re: How to hide BLE in ESP32?

Postby bobolink » Thu Aug 02, 2018 12:57 pm

Again, not sure if solicitation is the kind of hiding you want but ANCS is an iPhone BLE service which must be solicited. Here is someone talking ANCS implementation on the ESP32 with Mr. Kolban
https://github.com/nkolban/esp32-snippets/issues/430

mike_acosta_v
Posts: 2
Joined: Wed Aug 15, 2018 1:34 am

Re: How to hide BLE in ESP32?

Postby mike_acosta_v » Wed Aug 15, 2018 1:40 am

Hi, you can prob this:

BLEServer *server = NULL;
server = BLEDevice::createServer();
servidor->getAdvertising()->c(1,0);


This is the function:
/*
void BLEAdvertising::setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly) {
ESP_LOGD(LOG_TAG, ">> setScanFilter: scanRequestWhitelistOnly: %d, connectWhitelistOnly: %d", scanRequestWhitelistOnly, connectWhitelistOnly);
if (!scanRequestWhitelistOnly && !connectWhitelistOnly) {
m_advParams.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY;
ESP_LOGD(LOG_TAG, "<< setScanFilter");
return;
}
if (scanRequestWhitelistOnly && !connectWhitelistOnly) {
m_advParams.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_WLST_CON_ANY;
ESP_LOGD(LOG_TAG, "<< setScanFilter");
return;
}
if (!scanRequestWhitelistOnly && connectWhitelistOnly) {
m_advParams.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_WLST;
ESP_LOGD(LOG_TAG, "<< setScanFilter");
return;
}
if (scanRequestWhitelistOnly && connectWhitelistOnly) {
m_advParams.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_WLST_CON_WLST;
ESP_LOGD(LOG_TAG, "<< setScanFilter");
return;
}
} // setScanFilter
*/
This code is for Arduino.

mike_acosta_v
Posts: 2
Joined: Wed Aug 15, 2018 1:34 am

Re: How to hide BLE in ESP32?

Postby mike_acosta_v » Thu Aug 16, 2018 4:07 pm

I'm sorry.
This is the correct:

BLEServer *server = NULL;
server = BLEDevice::createServer();
server->getAdvertising()->setScanFilter(1,0);

necati
Posts: 5
Joined: Wed Aug 29, 2018 1:27 am

Re: How to hide BLE in ESP32?

Postby necati » Wed Aug 29, 2018 3:23 pm

bobolink wrote:I think it has to be supported in the BLE implementation on the ESP32. It’s optional.
The ESP32 isn’t “found” because it isn’t advertising (transmitting) its services all the time. Its receiver is listening for a certain transmission, if heard then it starts advertising as a normal peripheral.
It’s complicated because the ESP32 performs two roles. As Central and as Peripheral.
I don’t know if that is what you had in mind or you wanted to control the radio directly with some kind of low probability of intercept waveform. Which is way beyond me.

Here is a video I did on soliciting services on the iPhone. It’s embarrassing to watch since I was just leaning YouTube and the narrator sounds like an idiot :D
https://youtu.be/d0woZaZjkAs
I'm new to BLE technology. I do research for ESP32.

You know the communication between the Macbook and the magic mouse. Mouse broadcasts. The Macbook will receive this broadcast.
Here the MacBook does not appear with other device scans. But bluetooth is on. Can we configure the same for esp32?

I am working on an android project. You can also think about IOS. I want to make a ble communication with Esp32. I only have one wish. Esp32 does not appear when scanning other bluetooth devices.

ESP32 does not appear in the scan of andorid and iOS devices. Just like the MacBook.

How does good communication take place? Android phone has esp32's Service_UUID or Characteristic_UUID. Is it possible to connect to ESP32 even though it does not appear in any browsing?

zeitounian
Posts: 5
Joined: Mon Sep 17, 2018 12:16 am

Re: How to hide BLE in ESP32?

Postby zeitounian » Mon Sep 17, 2018 12:21 am

Good night, your work was very good, I need help to connect the Iphone to the ESP32, I do not succeed in my attempts, how do I run the devices, how do I pair with Android.

SombraRPK
Posts: 18
Joined: Wed Jul 04, 2018 2:37 am

Re: How to hide BLE in ESP32?

Postby SombraRPK » Tue Oct 09, 2018 11:37 pm

Great! Thank you all, guys! Tried the mike_acosta's code and now it is working wonderfully!

Who is online

Users browsing this forum: No registered users and 62 guests