@@ -42,22 +42,31 @@ public class GattError {
4242 public static final int GATT_ERROR = 0x0085 ; // Device not reachable
4343
4444 public static final int GATT_INVALID_HANDLE = 0x0001 ;
45+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_READ_NOT_PERMITTED
4546 public static final int GATT_READ_NOT_PERMIT = 0x0002 ;
47+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_WRITE_NOT_PERMITTED
4648 public static final int GATT_WRITE_NOT_PERMIT = 0x0003 ;
4749 public static final int GATT_INVALID_PDU = 0x0004 ;
50+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INSUFFICIENT_AUTHENTICATION
4851 public static final int GATT_INSUF_AUTHENTICATION = 0x0005 ;
52+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_REQUEST_NOT_SUPPORTED
4953 public static final int GATT_REQ_NOT_SUPPORTED = 0x0006 ;
54+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INVALID_OFFSET
5055 public static final int GATT_INVALID_OFFSET = 0x0007 ;
56+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INSUFFICIENT_AUTHORIZATION
5157 public static final int GATT_INSUF_AUTHORIZATION = 0x0008 ;
5258 public static final int GATT_PREPARE_Q_FULL = 0x0009 ;
5359 public static final int GATT_NOT_FOUND = 0x000a ;
5460 public static final int GATT_NOT_LONG = 0x000b ;
5561 public static final int GATT_INSUF_KEY_SIZE = 0x000c ;
62+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INVALID_ATTRIBUTE_LENGTH
5663 public static final int GATT_INVALID_ATTR_LEN = 0x000d ;
5764 public static final int GATT_ERR_UNLIKELY = 0x000e ;
65+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_INSUFFICIENT_ENCRYPTION
5866 public static final int GATT_INSUF_ENCRYPTION = 0x000f ;
5967 public static final int GATT_UNSUPPORT_GRP_TYPE = 0x0010 ;
6068 public static final int GATT_INSUF_RESOURCE = 0x0011 ;
69+ public static final int GATT_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED = 0x0029 ;
6170 public static final int GATT_CONTROLLER_BUSY = 0x003A ;
6271 public static final int GATT_UNACCEPT_CONN_INTERVAL = 0x003B ;
6372 public static final int GATT_ILLEGAL_PARAMETER = 0x0087 ;
@@ -74,7 +83,10 @@ public class GattError {
7483 public static final int GATT_SERVICE_STARTED = 0x008c ;
7584 public static final int GATT_ENCRYPTED_NO_MITM = 0x008d ;
7685 public static final int GATT_NOT_ENCRYPTED = 0x008e ;
86+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_CONNECTION_CONGESTED
7787 public static final int GATT_CONGESTED = 0x008f ;
88+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt#GATT_CONNECTION_TIMEOUT
89+ public static final int GATT_TIMEOUT = 0x0093 ;
7890 public static final int GATT_CCCD_CFG_ERROR = 0x00FD ;
7991 public static final int GATT_PROCEDURE_IN_PROGRESS = 0x00FE ;
8092 public static final int GATT_VALUE_OUT_OF_RANGE = 0x00FF ;
@@ -99,6 +111,8 @@ public static String parseConnectionError(final int error) {
99111 case GATT_CONN_LMP_TIMEOUT -> "GATT CONN LMP TIMEOUT" ;
100112 case GATT_CONN_CANCEL -> "GATT CONN CANCEL " ;
101113 case GATT_ERROR -> "GATT ERROR" ; // Device not reachable
114+ case GATT_TIMEOUT -> "GATT TIMEOUT" ; // Device not reachable, new Error added in Android 15
115+ case GATT_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED -> "GATT PAIRING WITH UNIT KEY NOT SUPPORTED" ;
102116 default -> "UNKNOWN (" + error + ")" ;
103117 };
104118 }
@@ -129,6 +143,7 @@ public static String parse(final int error) {
129143 case GATT_INSUF_ENCRYPTION -> "GATT INSUF ENCRYPTION" ;
130144 case GATT_UNSUPPORT_GRP_TYPE -> "GATT UNSUPPORT GRP TYPE" ;
131145 case GATT_INSUF_RESOURCE -> "GATT INSUF RESOURCE" ;
146+ case GATT_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED -> "GATT PAIRING WITH UNIT KEY NOT SUPPORTED" ;
132147 case GATT_CONN_LMP_TIMEOUT -> "GATT CONN LMP TIMEOUT" ;
133148 case GATT_CONTROLLER_BUSY -> "GATT CONTROLLER BUSY" ;
134149 case GATT_UNACCEPT_CONN_INTERVAL -> "GATT UNACCEPT CONN INTERVAL" ;
@@ -148,6 +163,7 @@ public static String parse(final int error) {
148163 case GATT_ENCRYPTED_NO_MITM -> "GATT ENCRYPTED NO MITM" ;
149164 case GATT_NOT_ENCRYPTED -> "GATT NOT ENCRYPTED" ;
150165 case GATT_CONGESTED -> "GATT CONGESTED" ;
166+ case GATT_TIMEOUT -> "GATT TIMEOUT" ;
151167 case GATT_CCCD_CFG_ERROR -> "GATT CCCD CFG ERROR" ;
152168 case GATT_PROCEDURE_IN_PROGRESS -> "GATT PROCEDURE IN PROGRESS" ;
153169 case GATT_VALUE_OUT_OF_RANGE -> "GATT VALUE OUT OF RANGE" ;
0 commit comments