DFU error numbers changed to distinguish them from TOO MANY CONNECTIONS

error (0x101). One bit has been added to ERROR_MASK.
This commit is contained in:
Aleksander Nowakowski 2014-10-01 16:52:28 +02:00
parent 740a18bda1
commit 7684e0ce7d
2 changed files with 7 additions and 5 deletions

View File

@ -223,7 +223,7 @@ public abstract class DfuBaseService extends IntentService {
/**
* If this bit is set than the progress value indicates an error. Use {@link GattError#parse(int)} to obtain error name.
*/
public static final int ERROR_MASK = 0x0100;
public static final int ERROR_MASK = 0x1100;
public static final int ERROR_DEVICE_DISCONNECTED = ERROR_MASK | 0x00;
public static final int ERROR_FILE_NOT_FOUND = ERROR_MASK | 0x01;
/** Thrown if service was unable to open the file ({@link IOException} has been thrown). */
@ -243,9 +243,9 @@ public abstract class DfuBaseService extends IntentService {
/** Thrown when the the service does not support given type or mime-type. */
public static final int ERROR_FILE_TYPE_UNSUPPORTED = ERROR_MASK | 0x09;
/** Flag set then the DFU target returned a DFU error. Look for DFU specification to get error codes. */
public static final int ERROR_REMOTE_MASK = 0x0200;
public static final int ERROR_REMOTE_MASK = 0x1200;
/** The flag set when one of {@link BluetoothGattCallback} methods was called with status other than {@link BluetoothGatt#GATT_SUCCESS}. */
public static final int ERROR_CONNECTION_MASK = 0x0400;
public static final int ERROR_CONNECTION_MASK = 0x1400;
/**
* The log events are only broadcasted when there is no nRF Logger installed. The broadcast contains 2 extras:

View File

@ -78,8 +78,10 @@ public class GattError {
return "GATT ENCRYPED NO MITM";
case 0x008e:
return "GATT NOT ENCRYPTED";
case 0x0101:
return "TOO MANY OPEN CONNECTIONS";
case 0x00FF:
return "DFU SERVICE DSCOVERY NOT STARTED";
return "DFU SERVICE DISCOVERY NOT STARTED";
case DfuBaseService.ERROR_DEVICE_DISCONNECTED:
return "DFU DEVICE DISCONNECTED";
case DfuBaseService.ERROR_FILE_ERROR:
@ -113,7 +115,7 @@ public class GattError {
return "REMOTE DFU OPERATION FAILED";
}
}
return String.format("UNKNOWN (0x%02X)", error & 0xFF);
return "UNKNOWN (" + error + ")";
}
}
}