Skip to content

Commit 04eeb9b

Browse files
committed
Add new state STATE_GOT_CHARACTERISTICS
+added new state fix #2
1 parent 0d95137 commit 04eeb9b

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/base/State.java

+3
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,7 @@ public class State {
4949

5050
/** unknown state*/
5151
public static final int STATE_UNKNOWN = 5;
52+
53+
/** got all characteristics*/
54+
public static final int STATE_GOT_CHARACTERISTICS = 6;
5255
}

lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/service/BluetoothLEService.java

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
181181
}
182182
}
183183
}
184+
setState(State.STATE_GOT_CHARACTERISTICS);
184185
}
185186
}
186187

sample/src/main/java/co/lujun/sample/Utils.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public static String transConnStateAsString(int state){
2222
result = "CONNECTED";
2323
} else if (state == State.STATE_DISCONNECTED){
2424
result = "DISCONNECTED";
25-
}else {
25+
}else if (state == State.STATE_GOT_CHARACTERISTICS){
26+
result = "CONNECTED, GOT ALL CHARACTERISTICS";
27+
}
28+
else{
2629
result = "UNKNOWN";
2730
}
2831
return result;

0 commit comments

Comments
 (0)