Skip to content

Commit bde8d0e

Browse files
committed
Don't report state when AutoConnect connection is not possible
1 parent 896e4b7 commit bde8d0e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/observability/src/main/java/no/nordicsemi/memfault/observability/bluetooth/MemfaultDiagnosticsService.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ class MemfaultDiagnosticsService {
261261
// is not supported (disconnect() method called), or the connection was cancelled
262262
// by the user.
263263
is ConnectionState.Disconnected -> {
264+
if (state.reason is ConnectionState.Disconnected.Reason.UnsupportedAddress) {
265+
// This error is thrown in AutoConnect connection when there is no
266+
// bonding. The library will transition to Direct connection automatically.
267+
// Don't report this state.
268+
return@onEach
269+
}
264270
_state.emit(state.toDeviceState(notSupported, bondingFailed))
265271
if (state.isUserInitiated /* (includes not supported) */ ||
266272
state.reason is ConnectionState.Disconnected.Reason.UnsupportedConfiguration) {

0 commit comments

Comments
 (0)