spacecheese / bluez_peripheral

A library for building BLE peripherals using GATT and bluez
MIT License
42 stars 8 forks source link

Advertisement Release method not called #18

Closed Martwall closed 1 year ago

Martwall commented 1 year ago

I wanted to do some clean up actions after the LE advertisement was unregistered (as specified in the advertising-api) but the Release method was never called. Removing the unexport of the advertisement in the register function resolved the issue. Is there a specific reason why the advertisement is unexported from the bus or could this be removed to allow execution of the Release method? https://github.com/spacecheese/bluez_peripheral/blob/4df66c4c4bcfc363e1f904748d3ed72992261272/bluez_peripheral/advert.py#L121

spacecheese commented 1 year ago

Possibly a register/ unregister method would make sense here. The reason for the unexport was to prevent adverts colliding on the bus which is a problem if you don't change the default path and then try registering multiple adverts but I hadn't seen this particular use case. I think probably the best compromise would be to make the path selection process a bit more clever and call unexport when Release gets called whilst also providing a Release callback. I might get chance to look at this in more depth next week.

Martwall commented 1 year ago

Alright I understand makes sense. It is probably not a very common use case but could be used when wanting to keep advertising when there are connected devices or for clearing listeners.

Yes something like you sugested sounds good. I'll take some time to think about it after the christmas break if you need som input and can help out with implementation if needed.


Från: Space Cheese @.> Skickat: torsdag 22 december 2022 15:38 Till: spacecheese/bluez_peripheral @.> Kopia: Martwall @.>; Author @.> Ämne: Re: [spacecheese/bluez_peripheral] Advertisement Release method not called (Issue #18)

Possibly a register/ unregister method would make sense here. The reason for the unexport was to prevent adverts colliding on the bus which is a problem if you don't change the default path and then try registering multiple adverts but I hadn't seen this particular use case. I think probably the best compromise would be to make the path selection process a bit more clever and call unexport when Release gets called whilst also providing a Release callback.

— Reply to this email directly, view it on GitHubhttps://github.com/spacecheese/bluez_peripheral/issues/18#issuecomment-1362914899, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIBOXZ6RVHJY7FM4BPTN6KLWORRWBANCNFSM6AAAAAATGVKV7U. You are receiving this because you authored the thread.Message ID: @.***>