Replies: 6 comments 1 reply
-
There are three places the device name is commonly provided in BLE. One is in the advertisement data, which is what is available before connecting to the device. Another is in the Generic Access service (0x1801), Device Name (0x2a00). I believe you aren't allowed to read that attribute on iOS or MacOS. And finally there is Device Information service (0x180a), which has Model Number (0x2a24). Not exactly device name, but close. Try using nRF Connect or Lightblue on Android to inspect the device. Or BlueZ on Linux. Maybe you will be allowed to find the attribute that is set to "ESP32" and then at least you know where the value is coming from. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the direction on this. I found where the device name is being set. It is set at compile time in the build folder sdkconfig file. There are two places that it is set - one is CONFIG_NIMBLE_SVC_GAP_DEVICE_NAME="MPY ESP32" and the other is CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="MPY ESP32". There is also a line in the sdkconfig.ble file in the esp32/boards directory - CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="MPY ESP32". When I change the CONFIG statements in the sdkconfig file in the build folder and recompile, the device name changes to what I set it to. It does not seem to matter what the CONFIG statement in the skdconfig.ble file is set to. My question - is there a way for this to be over ridden in micropython so that I can change a device name without having to recompile micropython? Thank you. |
Beta Was this translation helpful? Give feedback.
-
From the name of that config, it seems that would be the Device Name as part of the Generic Access service. Take a look at the micropython docs for BLE:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the direction. I've tried this before - changing it using BLE.confg works when scanning for the device on a Windows machine. However, a MAC will only list the device in the Web Bluetooth navigator with the name set at compile time. I'm hoping to learn why this is? |
Beta Was this translation helpful? Give feedback.
-
Here' some test code - I'm using an ESP32_S3. import ubluetooth |
Beta Was this translation helpful? Give feedback.
-
Doesn't look like you set gap_name with BLE.config. Try that. import bluetooth
ble = bluetooth.BLE()
from ble_advertising import advertising_payload as adpl
pl = adpl(name='myDevice')
ble.active(True)
ble.config(gap_name="myGapName")
ble.gap_advertise(30000, adv_data=pl) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello - I've developed an ESP32-S3 based web bluetooth application. The web app uses the web bluetooth API for connecting to hardware. The issue I'm having is when I re-name the device. If I assign a name to the device in the micropython ble_uart_repl.py file, the new name always appears correct in the web bluetooth chooser window within my app on a Windows PC. However, on a MAC PC, the new name will only appear 'intially' when the device is not yet paired. Once it is paired, the device name will revert to 'ESP32' in the web bluetooth chooser from then on. I believe this has something to do with how MAC handles ble devices in the system OS. Does anyone listening have any experience or knowledge of this issue? If so, is there a way that it can be handled so that the ble device name being assigned in micropython is used as the device name on a MAC OS -- ?
Beta Was this translation helpful? Give feedback.
All reactions