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

Testing a proof-of-concept fix for the duplicate GATT service issue. #36

Open
wants to merge 1 commit into
base: herald
Choose a base branch
from

Conversation

alwentiu
Copy link

This is related to Issue #33 (duplicate GATT service registered). I think there are two separate issues:

  • bluetoothGattServer in AdvertLoopTask is not closed properly when bluetooth adapter is powered off. It seems that in some phone models, the GATT server is not automatically closed when bluetooth is powered off. This was consistently observed in Samsung phones.
  • multiple SensorArray objects are created, in BluetoothMonitoringService, when bluetooth is powered off and on. This leads to a new instance of ConcreteBLETransmitter being created each time bluetooth is powered off/on.

The modifications I did:

  • In ConcreteBLETransmitter.kt, make sure services are cleard and GATT server closed (if it exists)
  • In BluetoothMonitoringService.kt, make sure no duplicate SensorArray objects are created.

DISCLAIMER: This modification is meant to demonstrate a diagnosis of the root cause of the issue; it is not meant as a definitive fix. Further tests will be required.

- In ConcreteBLETransmitter.kt, make sure services are cleard and GATT server closed (if it exists)
- In BluetoothMonitoringService.kt, make sure no duplicate SensorArray objects are created.

DISCLAIMER: This modification is meant to demonstrate a diagnosis of the root cause of the issue; it is not meant as a definitive fix.
@jimmo
Copy link

jimmo commented Dec 18, 2020

This fix looks good, but I think there might still be one extra step required to solve the duplicate RPAs.
Please see this comment -- theheraldproject/herald-for-android#107 (comment)

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

Successfully merging this pull request may close these issues.

2 participants