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

Expand get and set methods to allow getting and setting all attributes #155

Open
petekubiak opened this issue Nov 4, 2024 · 4 comments
Open

Comments

@petekubiak
Copy link
Collaborator

This issue stems from this comment in #151.
Currently the get and set methods on the gatt_server macro-generated type assume that they would only be called on characteristics and not other types of attribute. This is because they are based on the methods of the same names on the AttributeTable. In order to allow getting and setting of other types of attribute types, these methods need to be changed to accept some sort of AttributeHandle type.

Here is a suggestion of what this might look like.

@lulf
Copy link
Member

lulf commented Nov 5, 2024

I've got nothing against the ability to read/write to handles that are not characteristics, but out of curiosity: what is the use case for using get and set on non-characteristic handles? (I wasn't aware that you could even have attribute handles that were not a characteristic)

@petekubiak
Copy link
Collaborator Author

To be honest I wasn't aware of this either, but in the linked comment @alexmoon said "you also need to be able to get and set descriptor values and the like"

@alexmoon
Copy link

alexmoon commented Nov 5, 2024

Attributes include:

  • Primary Service Declaration
  • Secondary Service Declaration
  • Included Service Declaration
  • Characteristic Declaration
  • Characteristic Extended Properties
  • Characteristic Value
  • Descriptor Value

I believe from the client's perspective all of those are read-only except for Characteristic Value and Descriptor Value. Descriptor Value includes things like the Client Characteristic Configuration Descriptor (for enabling notifications/indications) but can also include arbitrary additional descriptors depending on the service (for example HID defines several descriptor values). So at the very least, the attribute table needs to include support for Descriptor Values.

The other GATT attributes may need to be changed at runtime by the server in certain circumstances. For example, a device may need to enable or disable a service depending on some configuration. And applications need to be able to send Service Changed indications to clients to indicate that things have changed. We probably don't need to go as far as putting everything in the attribute table, but we should keep in mind that the data is not necessarily static.

@lulf
Copy link
Member

lulf commented Nov 5, 2024

Ok, so out of those, I think only the service attributes are the ones not modifiable right now, so I agree it's good to fix this generically.

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