Skip to content
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

Ability to write Descriptors in advertizement #118

Open
vikramdattu opened this issue Dec 4, 2023 · 5 comments
Open

Ability to write Descriptors in advertizement #118

vikramdattu opened this issue Dec 4, 2023 · 5 comments

Comments

@vikramdattu
Copy link

Describe the solution you'd like
BlueZ already does have this support, and Bleak supports read descriptors property

Additional context
Many of the applications, use characteristics descriptors. Having the method for this exposed will help a ton.

@mklemarczyk
Copy link

@vikramdattu still interested? I was thinking on the improvements to bless. If @kevincar you agree, I will take the subject ;)

@kevincar
Copy link
Owner

@mklemarczyk Absolutely!

@mklemarczyk
Copy link

@kevincar I have some prototype, I plan to share a PR soon so others can check it for different platforms.
I primary work on linux.

@mklemarczyk
Copy link

mklemarczyk commented Jun 23, 2024

I send you first proposal in PR #134
Who wish to help testing on other platforms ? I will need some data to complete implementation.

@mklemarczyk
Copy link

mklemarczyk commented Sep 9, 2024

@vikramdattu @kevincar Simple example with descriptor for service. You can define descriptors for different characteristics and services. As many you like. I use them mostly for static data to notify about unit or refresh rate. Those should not be updated too often.

You can use predefined guid from Bluetooth standard, or define your guid for custom descriptors.

    # Simple advertisement service with descriptor.
    gatt: Dict = {
        weather_service_id: {
            temperature_characteristic_id: {
                'Properties': (
                    GATTCharacteristicProperties.read
                    | GATTCharacteristicProperties.write
                ),
                'Permissions': (
                    GATTAttributePermissions.readable
                    | GATTAttributePermissions.writeable
                ),
                'Value': None,
                'Descriptors': {
                    '2901': { # Bluetooth descriptor guid, or your custom 128bit guid
                        'Properties': (
                            GATTDescriptorProperties.read
                            | GATTDescriptorProperties.write
                        ),
                        'Permissions': (
                            GATTAttributePermissions.readable
                            | GATTAttributePermissions.writeable
                        ),
                        'Value': b'millis', # Static value for descriptor.
                    }
                }
            }
        }
    }

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

No branches or pull requests

3 participants