#129 fixed: improved characteristic validation
This commit is contained in:
parent
92fd8d647c
commit
31bf36350a
|
@ -60,8 +60,11 @@ import no.nordicsemi.android.dfu.internal.exception.UploadAbortedException;
|
|||
final BluetoothGattService dfuService = gatt.getService(BUTTONLESS_DFU_SERVICE_UUID);
|
||||
if (dfuService == null)
|
||||
return false;
|
||||
mButtonlessDfuCharacteristic = dfuService.getCharacteristic(BUTTONLESS_DFU_UUID);
|
||||
return mButtonlessDfuCharacteristic != null;
|
||||
final BluetoothGattCharacteristic characteristic = dfuService.getCharacteristic(BUTTONLESS_DFU_UUID);
|
||||
if (characteristic == null || characteristic.getDescriptor(CLIENT_CHARACTERISTIC_CONFIG) == null)
|
||||
return false;
|
||||
mButtonlessDfuCharacteristic = characteristic;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,8 +69,11 @@ import no.nordicsemi.android.dfu.internal.exception.UploadAbortedException;
|
|||
final BluetoothGattService dfuService = gatt.getService(BUTTONLESS_DFU_SERVICE_UUID);
|
||||
if (dfuService == null)
|
||||
return false;
|
||||
mButtonlessDfuCharacteristic = dfuService.getCharacteristic(BUTTONLESS_DFU_UUID);
|
||||
return mButtonlessDfuCharacteristic != null;
|
||||
final BluetoothGattCharacteristic characteristic = dfuService.getCharacteristic(BUTTONLESS_DFU_UUID);
|
||||
if (characteristic == null || characteristic.getDescriptor(CLIENT_CHARACTERISTIC_CONFIG) == null)
|
||||
return false;
|
||||
mButtonlessDfuCharacteristic = characteristic;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,8 +59,11 @@ import no.nordicsemi.android.dfu.internal.exception.UploadAbortedException;
|
|||
final BluetoothGattService dfuService = gatt.getService(EXPERIMENTAL_BUTTONLESS_DFU_SERVICE_UUID);
|
||||
if (dfuService == null)
|
||||
return false;
|
||||
mButtonlessDfuCharacteristic = dfuService.getCharacteristic(EXPERIMENTAL_BUTTONLESS_DFU_UUID);
|
||||
return mButtonlessDfuCharacteristic != null;
|
||||
final BluetoothGattCharacteristic characteristic = dfuService.getCharacteristic(EXPERIMENTAL_BUTTONLESS_DFU_UUID);
|
||||
if (characteristic == null || characteristic.getDescriptor(CLIENT_CHARACTERISTIC_CONFIG) == null)
|
||||
return false;
|
||||
mButtonlessDfuCharacteristic = characteristic;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,9 +58,10 @@ import no.nordicsemi.android.dfu.internal.exception.UploadAbortedException;
|
|||
final BluetoothGattService dfuService = gatt.getService(DFU_SERVICE_UUID);
|
||||
if (dfuService == null)
|
||||
return false;
|
||||
mControlPointCharacteristic = dfuService.getCharacteristic(DFU_CONTROL_POINT_UUID);
|
||||
if (mControlPointCharacteristic == null)
|
||||
final BluetoothGattCharacteristic characteristic = dfuService.getCharacteristic(DFU_CONTROL_POINT_UUID);
|
||||
if (characteristic == null || characteristic.getDescriptor(CLIENT_CHARACTERISTIC_CONFIG) == null)
|
||||
return false;
|
||||
mControlPointCharacteristic = characteristic;
|
||||
|
||||
mProgressInfo.setProgress(DfuBaseService.PROGRESS_STARTING);
|
||||
|
||||
|
|
|
@ -132,9 +132,12 @@ import no.nordicsemi.android.error.LegacyDfuError;
|
|||
final BluetoothGattService dfuService = gatt.getService(DFU_SERVICE_UUID);
|
||||
if (dfuService == null)
|
||||
return false;
|
||||
mControlPointCharacteristic = dfuService.getCharacteristic(DFU_CONTROL_POINT_UUID);
|
||||
final BluetoothGattCharacteristic characteristic = dfuService.getCharacteristic(DFU_CONTROL_POINT_UUID);
|
||||
if (characteristic == null || characteristic.getDescriptor(CLIENT_CHARACTERISTIC_CONFIG) == null)
|
||||
return false;
|
||||
mControlPointCharacteristic = characteristic;
|
||||
mPacketCharacteristic = dfuService.getCharacteristic(DFU_PACKET_UUID);
|
||||
return mControlPointCharacteristic != null && mPacketCharacteristic != null;
|
||||
return mPacketCharacteristic != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -148,9 +148,12 @@ import no.nordicsemi.android.error.SecureDfuError;
|
|||
final BluetoothGattService dfuService = gatt.getService(DFU_SERVICE_UUID);
|
||||
if (dfuService == null)
|
||||
return false;
|
||||
mControlPointCharacteristic = dfuService.getCharacteristic(DFU_CONTROL_POINT_UUID);
|
||||
final BluetoothGattCharacteristic characteristic = dfuService.getCharacteristic(DFU_CONTROL_POINT_UUID);
|
||||
if (characteristic == null || characteristic.getDescriptor(CLIENT_CHARACTERISTIC_CONFIG) == null)
|
||||
return false;
|
||||
mControlPointCharacteristic = characteristic;
|
||||
mPacketCharacteristic = dfuService.getCharacteristic(DFU_PACKET_UUID);
|
||||
return mControlPointCharacteristic != null && mPacketCharacteristic != null;
|
||||
return mPacketCharacteristic != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue