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

GattCharacteristic size can be optimized by removing read and write authorization callback #115

Open
pan- opened this issue Nov 25, 2015 · 3 comments

Comments

@pan-
Copy link
Member

pan- commented Nov 25, 2015

Each GattCharacteristic store two FunctionPointersWithContext, one for the readAuthorization callback and one for the writeAuthorization callback. This waste some space given that:

  • In practice these authorizations are not always used (especially the readAuthorization)
  • The implementation of GattServer has to keep track of all GattCharacteristics registered

One way to get rid of these callbacks in Characteristic is to move these callbacks to the GattServer exactly like its already done for onDataRead, onDataWritten or onDataSent.

With this change, only the callbacks requiring authorization are stored in memory and the developer can optimize the amount of authorization callbacks use by grouping some authorization together instead of instantiating one callback by characteristic (for instance, it can be done service wide).

@rgrover
Copy link
Contributor

rgrover commented Nov 25, 2015

thanks for raising this.

@ciarmcom
Copy link
Member

ARM Internal Ref: IOTSFW-1331

@marcuschangarm
Copy link
Contributor

I'm not particular fond of the current onDataRead, onDataWritten and onDataSent callbacks because all subscribers get notified whether or not the event is relevant for them.

For example, if I have multiple services running at the same time I'm only interested in the data read/write callback for that particular characteristic.

On the watch, I only use readAuthorization and writeAuthorization instead of onDataRead and onDataWritten.

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

No branches or pull requests

4 participants