/**
* Converts the connection status given by the {@link android.bluetooth.BluetoothGattCallback#onConnectionStateChange(BluetoothGatt, int, int)} to error name.
* @param error the status number
* @return the error name as stated in the gatt_api.h file
*/
public static String parseConnectionError(final int error) {
switch (error) {
case BluetoothGatt.GATT_SUCCESS:
return "SUCCESS";
case 0x01:
return "GATT CONN L2C FAILURE";
case 0x08:
return "GATT CONN TIMEOUT";
case 0x13:
return "GATT CONN TERMINATE PEER USER";
case 0x16:
return "GATT CONN TERMINATE LOCAL HOST";
case 0x3E:
return "GATT CONN FAIL ESTABLISH";
case 0x22:
return "GATT CONN LMP TIMEOUT";
case 0x0100:
return "GATT CONN CANCEL ";
case 0x0085:
return "GATT ERROR"; // Device not reachable
default:
return "UNKNOWN (" + error + ")";
}
}
GattError.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:Android-DFU-App
作者:
评论列表
文章目录