Skip to content

Conversation

@yinzara
Copy link
Contributor

@yinzara yinzara commented Dec 19, 2025

No description provided.

@yinzara
Copy link
Contributor Author

yinzara commented Dec 19, 2025

@emontnemery Would love your opinion on this as well.

src/ble.md Outdated
Comment on lines 225 to 227
to set hostname first then device name. It should generally accept any UTF-8 encoded string however some device
manufacturers may choose not to support characters outside the ASCII range. Getting this property should
(unless it contains non-ASCII characters) return the same value as the Device Info's "Device Name" (4th) property.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting this property should (unless it contains non-ASCII characters) return the same value as the Device Info's "Device Name" (4th) property.

Why does the character set matter to the response of this command vs that of device info? The character encoding of the device info is not specified, should we do that?
Maybe specify strings sent from the device are either 7-bit ascii or UTF-8 (UTF-8 is backwards compatible with 7-bit ascii).
If the device does not accept UTF-8 in strings sent to the device, I think we need a flag for that.

My preference would be to simply specify all strings are UTF-8 (with restrictions for codes where applicable, such as for the hostname).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just saying all strings for the entire protocol are encoded as 7 bit ASCII or UTF-8 if supported across the entire protocol and get rid of all the call out about special handling between Get Device Info and Set Device Name makes the most sense to me as well

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does that statement mean though? If all strings can be encoded as 7-bit ASCII or UTF-8 without any exceptions, we might as well just say UTF-8 because 7-bit ASCII is a subset of UTF-8?

Copy link
Contributor Author

@yinzara yinzara Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we say manufacturers must support 7-bit ASCII and may choose to support the full UTF-8 character set? Or just say all strings are UTF-8 encoded and the full UTF character set must be supported for device name?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the device manufacturer need to care? Isn't the device name just a NUL-terminated string for the device itself? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's true. So I'l just change it to say all strings are assumed to be UTF-8 encoded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emontnemery Are you good with the current version to be merged? I have PRs prepped for other libraries related to these changes. :-)

Example without OS Name: `ESPHome`, `2021.11.0`, `esp32-s3-devkitc-1/esp32-s3`, `Temperature Monitor`.

Example: `ESPHome`, `2021.11.0`, `ESP32-C3`, `Temperature Monitor`.
Example with OS Name: `Bluetooth Proxy`, `v1.0.0`, `denky_d4/esp32`, `My Bluetooth Proxy`, `ESPHome`, `2025.12.2`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes discussed with @balloob to device info specification that are non-breaking.

src/ble.md Outdated
Comment on lines 230 to 231
manufacturer. It may alter the default "hostname" or not. If setting both this property and hostname, it is recommended
to set hostname first then device name. Getting this property should return the same value as the Device Info's

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it recommended to first set hostname and then device name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because some manufacturers may choose to default the hostname to something based on the device name and if you set host name second you can be sure it isn’t modified by the device when the device name is set

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, so it would seem it's better to first set the device name and then the hostname.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol i feel dumb now youre absolutely right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants