The FitbitGatt API is designed to provide a strong state machine around all Android gatt operations with the aim of making Android BLE development across Android vendors as straightforward and side-effect free as possible.
Mozilla Public License 2.0
57
stars
17
forks
source link
Remove enum ambiguity from TransactionResult.responseStatus() #36
TransactionResult.responseStatus was used to hold ordinals from both GattStatus and GattDisconnectReason enums, which created ambiguity about its meaning. Also, sometimes the "code" was passed in instead of the ordinal, creating an incorrect mapping.
Furthermore, there are 2 GattDisconnectReason enums, one of which appears to be a superset of the other.
changes
Changed the type of responseStatus to GattStatus to enforce type safety
Added a disconnectReason field to TransactionResult to carry this information as well
Marked the less complete GattDisconnectReason as @Deprecated
Tried to use the correct enum that corresponds to the namespace of the status argument in each callback. Definitely could have made a mistake here as it's not always easy to tell.
how tested
No changes to bluetooth behavior, so I didn't test it.
Fixes
description
TransactionResult.responseStatus was used to hold ordinals from both GattStatus and GattDisconnectReason enums, which created ambiguity about its meaning. Also, sometimes the "code" was passed in instead of the ordinal, creating an incorrect mapping.
Furthermore, there are 2 GattDisconnectReason enums, one of which appears to be a superset of the other.
changes
@Deprecated
status
argument in each callback. Definitely could have made a mistake here as it's not always easy to tell.how tested
No changes to bluetooth behavior, so I didn't test it.