BLE: Use unique name
This commit is contained in:
parent
e3434708cb
commit
296b1fd0ec
2 changed files with 13 additions and 5 deletions
|
|
@ -167,6 +167,7 @@ pub async fn run(
|
|||
esp_radio::ble::controller::BleConnector<'static>,
|
||||
CONTROLLER_SLOTS,
|
||||
>,
|
||||
name: alloc::string::String,
|
||||
) {
|
||||
let mut resources: HostResources<DefaultPacketPool, CONNECTIONS_MAX, L2CAP_CHANNELS_MAX> =
|
||||
HostResources::new();
|
||||
|
|
@ -192,10 +193,10 @@ pub async fn run(
|
|||
"Starting advertising and GATT service for {}",
|
||||
features.join(",")
|
||||
);
|
||||
let server = Server::new_with_config(GapConfig::Peripheral(PeripheralConfig {
|
||||
name: "ESP32 C-ITS",
|
||||
appearance: &appearance::UNKNOWN,
|
||||
}))
|
||||
let server = Server::new_with_config(PeripheralConfig {
|
||||
name: &name,
|
||||
appearance: &appearance::UNKNOWN, // maybe appearance::outdoor_sports_activity::LOCATION_AND_NAVIGATION_DISPLAY ?
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
let _ = embassy_futures::join::join(ble_task(runner), async {
|
||||
|
|
|
|||
|
|
@ -219,7 +219,14 @@ async fn main(spawner: Spawner) -> ! {
|
|||
#[cfg(feature = "ble")]
|
||||
{
|
||||
let controller = ble::make_controller(peripherals.BT);
|
||||
spawner.spawn(ble::run(controller).expect("Failed to spawn BLE task"));
|
||||
let serial = &mac.as_bytes()[4..7];
|
||||
let name = alloc::format!(
|
||||
"ESP32 C-ITS {:02x}{:02x}{:02x}",
|
||||
serial[0],
|
||||
serial[1],
|
||||
serial[2]
|
||||
);
|
||||
spawner.spawn(ble::run(controller, name).expect("Failed to spawn BLE task"));
|
||||
}
|
||||
|
||||
// Setup GNSS:
|
||||
|
|
|
|||
Loading…
Reference in a new issue