-
Notifications
You must be signed in to change notification settings - Fork 589
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
Added GATT status code to a BleDisconnectException #405
Conversation
/** | ||
* Set when the state is not available, for example when the adapter has been switched off. | ||
*/ | ||
public static final int UNKNOWN_STATE = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be status
? And maybe STATUS_UNAVAILABLE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right.
} | ||
|
||
public BleDisconnectedException(Throwable throwable, @NonNull String bluetoothDeviceAddress) { | ||
super(createMessage(bluetoothDeviceAddress), throwable); | ||
public BleDisconnectedException(Throwable throwable, @NonNull String bluetoothDeviceAddress, int state) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status
Plus this changes the public API :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, should be status. Do you think that we should keep exception constructors as a part of the public API? If so, I can create a new one and deprecate the old one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could deprecate the current constructors and add a LIBRARY_GROUP
annotation to the new one
} | ||
|
||
public BleDisconnectedException(@NonNull String bluetoothDeviceAddress) { | ||
super(createMessage(bluetoothDeviceAddress)); | ||
public BleDisconnectedException(@NonNull String bluetoothDeviceAddress, int state) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status, public api
} | ||
|
||
private static String createMessage(@Nullable String bluetoothDeviceAddress) { | ||
return "Disconnected from " + bluetoothDeviceAddress; | ||
private static String createMessage(@Nullable String bluetoothDeviceAddress, int state) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status, public api
Any news here? In our project it really helped us to tackle some requirements. |
6d3dfb9
to
3ae9ce3
Compare
@dariuszseweryn I applied the required changes. Could you have a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaik we're not into breaking the API yet
|
||
@Deprecated | ||
public BleDisconnectedException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it is probably deprecated long enough but it is still a breaking API change
a2e1368
to
6b4dbea
Compare
- Added GATT status to description mapping Fixes #282
6b4dbea
to
592dd19
Compare
|
||
public static BleDisconnectedException adapterDisabled(String macAddress) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be on the top level — not a nested class. Better sustainability I suppose.
Fixes #282