Skip to content

Commit

Permalink
More logs
Browse files Browse the repository at this point in the history
  • Loading branch information
philips77 committed Jul 28, 2020
1 parent 239e50f commit 92698bb
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,7 @@ protected void onHandleIntent(final Intent intent) {
if (mError > 0) { // error occurred
if ((mError & ERROR_CONNECTION_STATE_MASK) > 0) {
final int error = mError & ~ERROR_CONNECTION_STATE_MASK;
logi("Connection error after: " + (after - before) + " ms");
final boolean timeout = error == 133 && after > before + 25000; // timeout is 30 sec
if (timeout) {
loge("Device not reachable. Check if the device with address " + deviceAddress + " is in range, is advertising and is connectable");
Expand All @@ -1328,6 +1329,7 @@ protected void onHandleIntent(final Intent intent) {
// Connection usually fails due to a 133 error (device unreachable, or.. something else went wrong).
// Usually trying the same for the second time works. Let's try 2 times.
final int attempt = intent.getIntExtra(EXTRA_RECONNECTION_ATTEMPT, 0);
logi("Attempt: " + (attempt + 1));
if (attempt < 2) {
sendLogBroadcast(LOG_LEVEL_WARNING, "Retrying...");

Expand Down

0 comments on commit 92698bb

Please sign in to comment.