This repository was archived by the owner on Jul 4, 2024. It is now read-only.
Remove enum ambiguity from TransactionResult.responseStatus()#36
Open
droolingsheep wants to merge 1 commit into
Open
Remove enum ambiguity from TransactionResult.responseStatus()#36droolingsheep wants to merge 1 commit into
droolingsheep wants to merge 1 commit into
Conversation
Contributor
Author
|
Please double-check that I picked the correct enum (GattStatus vs GattDisconnectReason) for each callback's |
droolingsheep
commented
Sep 26, 2020
| * Created by iowens on 8/10/17. | ||
| */ | ||
|
|
||
| @Deprecated |
Contributor
Author
There was a problem hiding this comment.
We could also just delete this enum entirely in favor of the other one.
Contributor
There was a problem hiding this comment.
I would say yes with renaming the other one to GattFailureReason since they are not all ending in a gatt disconnect.
ionutlepi
suggested changes
Sep 29, 2020
| if(doesDescriptorAlreadyExist(serviceChar, descriptor)) { | ||
| TransactionResult.Builder builder = new TransactionResult.Builder().transactionName(getName()); | ||
| builder.responseStatus(GattDisconnectReason.getReasonForCode(GattDisconnectReason.GATT_CONN_NO_RESOURCES.getCode()).ordinal()); | ||
| builder.disconnectReason(GattDisconnectReason.GATT_CONN_NO_RESOURCES); |
Contributor
There was a problem hiding this comment.
I feel for these cases we should maybe have it as failureReason since this does not result in a disconnection
| * Created by iowens on 8/10/17. | ||
| */ | ||
|
|
||
| @Deprecated |
Contributor
There was a problem hiding this comment.
I would say yes with renaming the other one to GattFailureReason since they are not all ending in a gatt disconnect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
@Deprecatedstatusargument 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.