Skip to content

Commit 6295ffb

Browse files
authored
Merge pull request #634 from NordicSemiconductor/bugfix/timeouts
Adding missing `timeout` methods
2 parents 0f2ba0d + f02d0c4 commit 6295ffb

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

ble/src/main/java/no/nordicsemi/android/ble/ConditionalWaitRequest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import android.os.Handler;
44
import android.util.Log;
55

6+
import androidx.annotation.IntRange;
67
import androidx.annotation.NonNull;
78
import androidx.annotation.Nullable;
9+
810
import no.nordicsemi.android.ble.callback.AfterCallback;
911
import no.nordicsemi.android.ble.callback.BeforeCallback;
1012
import no.nordicsemi.android.ble.callback.FailCallback;
@@ -49,6 +51,13 @@ public ConditionalWaitRequest<T> setHandler(@Nullable final Handler handler) {
4951
return this;
5052
}
5153

54+
@NonNull
55+
@Override
56+
public ConditionalWaitRequest<T> timeout(@IntRange(from = 0) final long timeout) {
57+
super.timeout(timeout);
58+
return this;
59+
}
60+
5261
@Override
5362
@NonNull
5463
public ConditionalWaitRequest<T> done(@NonNull final SuccessCallback callback) {

ble/src/main/java/no/nordicsemi/android/ble/ReadRequest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
import android.os.Handler;
3030
import android.util.Log;
3131

32+
import androidx.annotation.IntRange;
3233
import androidx.annotation.NonNull;
3334
import androidx.annotation.Nullable;
35+
3436
import no.nordicsemi.android.ble.callback.AfterCallback;
3537
import no.nordicsemi.android.ble.callback.BeforeCallback;
3638
import no.nordicsemi.android.ble.callback.DataReceivedCallback;
@@ -86,6 +88,13 @@ public ReadRequest setHandler(@Nullable final Handler handler) {
8688
return this;
8789
}
8890

91+
@NonNull
92+
@Override
93+
public ReadRequest timeout(@IntRange(from = 0) final long timeout) {
94+
super.timeout(timeout);
95+
return this;
96+
}
97+
8998
@Override
9099
@NonNull
91100
public ReadRequest done(@NonNull final SuccessCallback callback) {

ble/src/main/java/no/nordicsemi/android/ble/WaitForReadRequest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import androidx.annotation.IntRange;
1010
import androidx.annotation.NonNull;
1111
import androidx.annotation.Nullable;
12+
1213
import no.nordicsemi.android.ble.callback.AfterCallback;
1314
import no.nordicsemi.android.ble.callback.BeforeCallback;
1415
import no.nordicsemi.android.ble.callback.DataSentCallback;
@@ -80,6 +81,13 @@ public WaitForReadRequest setHandler(@Nullable final Handler handler) {
8081
return this;
8182
}
8283

84+
@NonNull
85+
@Override
86+
public WaitForReadRequest timeout(@IntRange(from = 0) final long timeout) {
87+
super.timeout(timeout);
88+
return this;
89+
}
90+
8391
@Override
8492
@NonNull
8593
public WaitForReadRequest done(@NonNull final SuccessCallback callback) {

ble/src/main/java/no/nordicsemi/android/ble/WriteRequest.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
import android.os.Handler;
3030
import android.util.Log;
3131

32-
import java.util.Arrays;
33-
3432
import androidx.annotation.IntRange;
3533
import androidx.annotation.NonNull;
3634
import androidx.annotation.Nullable;
35+
36+
import java.util.Arrays;
37+
3738
import no.nordicsemi.android.ble.annotation.WriteType;
3839
import no.nordicsemi.android.ble.callback.AfterCallback;
3940
import no.nordicsemi.android.ble.callback.BeforeCallback;
@@ -111,6 +112,13 @@ public WriteRequest setHandler(@Nullable final Handler handler) {
111112
return this;
112113
}
113114

115+
@NonNull
116+
@Override
117+
public WriteRequest timeout(@IntRange(from = 0) final long timeout) {
118+
super.timeout(timeout);
119+
return this;
120+
}
121+
114122
@Override
115123
@NonNull
116124
public WriteRequest done(@NonNull final SuccessCallback callback) {

0 commit comments

Comments
 (0)