-
Notifications
You must be signed in to change notification settings - Fork 715
BLE RSSI of connected device #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Sigmaaaa i should state i have never actually had to deal with this issue, but perhaps are you looking at this backwards? You state that you want your server to determine if a client is getting out of range, but I believe this is a responsibility of a client. The client adjusted its scan settings to find and made the decision to connected to the server, is it not the clients responsibility to determine range for themselves. Also, how does the server know what is 'out of range' is for a particular client, perhaps that client's radio is very sensitive and works fine at -90db but another seems spotty at -60. Besides not having the info, it seems improper to give the server the responsibility to monitor each and every client that is connected when a client can do this better for themselves. The more I conciser it the more i believe it is up to the client not server. |
Here is function for BLEClient: |
@chegewara OP stated he wanted rssi of clients connected to esp32 server, not the rssi of an esp32 client. |
Like i said, this is GAP function which means can be used by server of client: |
@chegewara do you have an example of how this might look like for Arduino IDE? |
As the above comments, I'm not using BLEClient.cpp; ony BLEServer and BLEUtils. I'm gonna have to dig deeper, thanks :D |
Thats not a problem. This idf function is gap function and can be used in server or client, you just have to copy it: |
@chegewara I noticed someting in here: Should I try these out? |
You can use this code as is (copy/paste) and add to custom gap event handler:
|
Thank you @chegewara , it works great. static void my_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* param) {
} |
That's good, @Consistometru, but you need to check the event type. The RSSI info you are printing is only valid when the event type is ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT. That's what @chegewara's "case" statement was all about. Since you don't care about other event types, you can just surround your code with if (event == ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT) {...} |
Could you share the full version of your program ? I try to put your function in to BLEServer Example but it's still not worked |
Same Here |
Hello,
I'm trying to display the RSSI of any client connected to the ESP32 BLE Server in the Serial Monitor using your BLE_Server Example. This is easily possible while scanning for devices but I can't seem to figure out a way to obtain RSSI after a device is connected, is this possible?
Note: I know this might seem like irrelevant data to want after a device is connected, but I'm trying to use the RSSI to notify the user if they are going out of range of the device, and yes, I do realize finding distance using BLE is very inaccurate but I just want to use it as a measure of being close or far.
Thanks
The text was updated successfully, but these errors were encountered: